diff --git a/android/build.gradle b/android/build.gradle index 2bcef7af..ce6bda81 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -10,9 +10,13 @@ buildscript { allprojects { repositories { + mavenLocal() + maven { + // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm + url("$rootDir/../node_modules/react-native-electrode-bridge/android/electrode-reactnative-bridge") + } google() jcenter() - mavenLocal() } } diff --git a/android/lib/build.gradle b/android/lib/build.gradle index 24acef82..8c4da30b 100644 --- a/android/lib/build.gradle +++ b/android/lib/build.gradle @@ -33,7 +33,10 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0' - api('com.walmartlabs.ern:container-movies-reloaded:1.0.0') { changing = true } +// api('com.walmartlabs.ern:container-movies-reloaded:1.0.0') { changing = true } + api ('com.walmartlabs.ern:runner-ern-container:1.0.0') {changing=true} + implementation "com.facebook.react:react-native:+" // From node_modules + implementation project(":electrode-reactnative-bridge") testImplementation 'androidx.test:core:1.3.0' testImplementation 'androidx.test.ext:junit:1.1.2' testImplementation 'com.google.truth:truth:1.0.1' diff --git a/android/settings.gradle b/android/settings.gradle index d91182fb..14128d98 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1 +1,3 @@ include ':lib', ':moviesreloaded' +include ':electrode-reactnative-bridge' +project(':electrode-reactnative-bridge').projectDir = new File('../node_modules/react-native-electrode-bridge/android/electrode-reactnative-bridge') diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/Bridgeable.swift b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/Bridgeable.swift deleted file mode 100644 index 93ece07c..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/Bridgeable.swift +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import Foundation - -// @objc requires this protocol to be a class protocol -// mark public because ElectrodeBridgeMessage is public -@objc public protocol Bridgeable { - func toDictionary() -> NSDictionary -} diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeEvent.h b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeEvent.h deleted file mode 100644 index a1769705..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeEvent.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "ElectrodeBridgeMessage.h" -#import - -NS_ASSUME_NONNULL_BEGIN -@interface ElectrodeBridgeEvent : ElectrodeBridgeMessage - -+ (nullable instancetype)createEventWithData:(NSDictionary *)data; -- (instancetype)initWithName:(NSString *)name data:(id)data; -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeEvent.m b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeEvent.m deleted file mode 100644 index 7744608e..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeEvent.m +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "ElectrodeBridgeEvent.h" -#import "ElectrodeBridgeMessage.h" -#import "ElectrodeLogger.h" - -@implementation ElectrodeBridgeEvent -+ (nullable instancetype)createEventWithData:(NSDictionary *)data { - if ([ElectrodeBridgeMessage isValidFromData:data - withType:ElectrodeMessageTypeEvent]) { - return [[super alloc] initWithData:data]; - } - - ERNDebug(@"%@ : unable to create with data %@", - [ElectrodeBridgeEvent className], data); - return nil; -} - -- (instancetype)initWithName:(NSString *)name data:(id)data { - if (self = - [super initWithName:name type:ElectrodeMessageTypeEvent data:data]) { - return self; - } - ERNDebug(@"%@ : unable to create with data %@", - [ElectrodeBridgeEvent className], data); - return nil; -} - -+ (NSString *)className { - return NSStringFromClass(self.class); -} - -@end diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeFailureMessage.h b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeFailureMessage.h deleted file mode 100644 index c4e948fb..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeFailureMessage.h +++ /dev/null @@ -1,53 +0,0 @@ -// -// ElectrodeBridgeFailureMessage.h -// ElectrodeReactNativeBridge -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol ElectrodeFailureMessage - -@property(readonly, copy, nonatomic) NSString *code; -@property(readonly, copy, nonatomic) NSString *message; - -@optional -@property(readonly, copy, nonatomic, nullable) NSString *debugMessage; -@property(readonly, copy, nonatomic, nullable) NSException *exception; - -@end - -@interface ElectrodeBridgeFailureMessage : NSObject - -@property(readonly, copy, nonatomic) NSString *code; -@property(readonly, copy, nonatomic) NSString *message; -@property(readonly, copy, nonatomic, nullable) NSString *debugMessage; -@property(readonly, copy, nonatomic, nullable) NSException *exception; - -+ (instancetype)createFailureMessageWithCode:(NSString *)code - message:(NSString *)message; -+ (instancetype)createFailureMessageWithCode:(NSString *)code - message:(NSString *)message - exception:(nullable NSException *)exception; -+ (instancetype)createFailureMessageWithCode:(NSString *)code - message:(NSString *)message - debugMessage:(nullable NSString *)debugMessage; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeFailureMessage.m b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeFailureMessage.m deleted file mode 100644 index 0d12dabd..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeFailureMessage.m +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "ElectrodeBridgeFailureMessage.h" -#import - -@interface ElectrodeBridgeFailureMessage () -@property(copy, nonatomic) NSString *code; -@property(copy, nonatomic) NSString *message; -@property(copy, nonatomic, nullable) NSString *debugMessage; -@property(copy, nonatomic, nullable) NSException *exception; -@end - -@implementation ElectrodeBridgeFailureMessage - -+ (instancetype)createFailureMessageWithCode:(NSString *)code - message:(NSString *)message { - return [[ElectrodeBridgeFailureMessage alloc] initWithCode:code - message:message - exception:nil - debugMessage:nil]; -} - -+ (instancetype)createFailureMessageWithCode:(NSString *)code - message:(NSString *)message - exception:(nullable NSException *)exception { - return [[ElectrodeBridgeFailureMessage alloc] initWithCode:code - message:message - exception:exception - debugMessage:nil]; -} - -+ (instancetype)createFailureMessageWithCode:(NSString *)code - message:(NSString *)message - debugMessage:(nullable NSString *)debugMessage { - return [[ElectrodeBridgeFailureMessage alloc] initWithCode:code - message:message - exception:nil - debugMessage:debugMessage]; -} - -- (instancetype)initWithCode:(NSString *)code - message:(NSString *)message - exception:(nullable NSException *)exception - debugMessage:(nullable NSString *)debugMessage { - - if (self = [super init]) { - _code = code; - _message = message; - _exception = exception; - _debugMessage = (debugMessage == nil) ? exception.reason : nil; - return self; - } - - return nil; -} - -- (NSString *)description { - return [NSString - stringWithFormat: - @"%@ -> code: %@, message: %@, exception %@, debugMessage %@", - NSStringFromClass([self class]), self.code, self.message, - self.exception.name, self.debugMessage]; -} - -@end diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeHolder.h b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeHolder.h deleted file mode 100644 index 331221d4..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeHolder.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import -#import "ElectrodeBridgeEvent.h" -#import "ElectrodeBridgeRequest.h" - -#import "ElectrodeBridgeProtocols.h" - -@class ElectrodeBridgeTransceiver; -@protocol ElectrodeBridgeRequestHandler -, ElectrodeBridgeEventListener; - -NS_ASSUME_NONNULL_BEGIN - -/** - * Client facing class. - * Facade to ElectrodeBridgeTransceiver. - * Handles queuing every method calls until react native is ready. - */ - -@interface ElectrodeBridgeHolder : NSObject - -+ (void)sendEvent:(ElectrodeBridgeEvent *)event; - -+ (void)sendRequest:(ElectrodeBridgeRequest *)request - completionHandler:(ElectrodeBridgeResponseCompletionHandler)completion; - -+ (NSUUID *)registerRequestHandlerWithName:(NSString *)name - requestCompletionHandler: - (ElectrodeBridgeRequestCompletionHandler)completion; - -+ (nullable ElectrodeBridgeRequestCompletionHandler)unregisterRequestHandlerWithUUID: (NSUUID *)uuid; - - -+ (NSUUID *)addEventListenerWithName:(NSString *)name - eventListner:(ElectrodeBridgeEventListener)eventListner; - -+ (nullable ElectrodeBridgeEventListener)removeEventListener: (NSUUID *)UUID; - -+ (void)setBridge:(ElectrodeBridgeTransceiver *)bridge; -+ (void)addConstantsProvider:(id)constantsProvider; -@end -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeHolder.m b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeHolder.m deleted file mode 100644 index fd7d26fc..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeHolder.m +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "ElectrodeBridgeProtocols.h" -#import "ElectrodeBridgeHolder.h" -#import "ElectrodeBridgeTransceiver.h" -#import "ElectrodeLogger.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ElectrodeQueuedEventListener: NSObject -@property (nonatomic, strong) NSUUID *uuid; -@property (copy) ElectrodeBridgeEventListener listener; -- (instancetype) initWithUUID: (NSUUID *) uuid - listener: (ElectrodeBridgeEventListener) listener; -@end - -@implementation ElectrodeQueuedEventListener -- (instancetype) initWithUUID: (NSUUID *) uuid - listener: (ElectrodeBridgeEventListener) listener { - if (self = [super init]) { - _uuid = uuid; - _listener = listener; - } - - return self; -} -@end - -@interface ElectrodeQueuedRequestHandler: NSObject -@property (nonatomic, strong) NSUUID *uuid; -@property (copy) ElectrodeBridgeRequestCompletionHandler handler; -- (instancetype) initWithUUID: (NSUUID *) uuid - handler: (ElectrodeBridgeRequestCompletionHandler) handler; -@end - -@implementation ElectrodeQueuedRequestHandler -- (instancetype) initWithUUID: (NSUUID *) uuid - handler: (ElectrodeBridgeRequestCompletionHandler) handler { - if (self = [super init]) { - _uuid = uuid; - _handler = handler; - } - - return self; -} -@end -@implementation ElectrodeBridgeHolder -static ElectrodeBridgeTransceiver *electrodeNativeBridge; -static BOOL isReactNativeReady = NO; -static BOOL isTransceiverReady = NO; -static NSMutableDictionary *queuedRequestHandlerRegistration; -static NSMutableDictionary *queuedEventListenerRegistration; -static NSMutableDictionary *queuedRequests; -static NSMutableArray *queuedEvent; -static NSMutableArray> *queuedConstantsProvider; - -+ (void)initialize { - ERNDebug(@"in bridge holder initialization"); - queuedRequestHandlerRegistration = [[NSMutableDictionary alloc] init]; - queuedEventListenerRegistration = [[NSMutableDictionary alloc] init]; - queuedRequests = [[NSMutableDictionary alloc] init]; - queuedEvent = [[NSMutableArray alloc] init]; - queuedConstantsProvider = [[NSMutableArray alloc] init]; - [ElectrodeBridgeHolder registerReactReadyListenr]; - [ElectrodeBridgeHolder registerReactTransceiverReadyListner]; -} - -+ (void)registerReactReadyListenr { - [ElectrodeBridgeTransceiver - registerReactNativeReadyListener:^( - ElectrodeBridgeTransceiver *_Nonnull transceiver) { - isReactNativeReady = YES; - electrodeNativeBridge = transceiver; - [ElectrodeBridgeHolder registerQueuedEventListeners]; - [ElectrodeBridgeHolder registerQueuedRequestHandlers]; - [ElectrodeBridgeHolder sendQueuedEvents]; - [ElectrodeBridgeHolder sendQueuedRequests]; - [ElectrodeBridgeHolder addQueuedConstantsProvider]; - }]; -} - -+ (void)registerReactTransceiverReadyListner { - [ElectrodeBridgeTransceiver - registerReactTransceiverReadyListner:^( - ElectrodeBridgeTransceiver *_Nonnull transceiver) { - isTransceiverReady = YES; - electrodeNativeBridge = transceiver; - [ElectrodeBridgeHolder addQueuedConstantsProvider]; - }]; -} - -+ (void)addQueuedConstantsProvider { - for (id provider in queuedConstantsProvider) { - [ElectrodeBridgeHolder addConstantsProvider:provider]; - } -} - -+ (void)addConstantsProvider:(id)constantsProvider { - if (!isTransceiverReady) { - [queuedConstantsProvider addObject:constantsProvider]; - } else { - [electrodeNativeBridge addConstantsProvider:constantsProvider]; - } -} - -+ (void)sendEvent:(ElectrodeBridgeEvent *)event { - if (!isReactNativeReady) { - [queuedEvent addObject:event]; - } else { - [electrodeNativeBridge sendEvent:event]; - } -} - -+ (nullable ElectrodeBridgeEventListener)removeEventListener: (NSUUID *)UUID { - return [electrodeNativeBridge removeEventListnerWithUUID: UUID]; -} - -+ (void)sendRequest:(ElectrodeBridgeRequest *)request - completionHandler:(ElectrodeBridgeResponseCompletionHandler)completion { - if (!isReactNativeReady) { - [queuedRequests setObject:completion forKey:request]; - } else { - [electrodeNativeBridge sendRequest:request completionHandler:completion]; - } -} - -+ (NSUUID *)registerRequestHandlerWithName:(NSString *)name - requestCompletionHandler: -(ElectrodeBridgeRequestCompletionHandler)completion { - NSUUID *uuid = [NSUUID UUID]; - if (!isReactNativeReady) { - ElectrodeQueuedRequestHandler *handler = [[ElectrodeQueuedRequestHandler alloc] initWithUUID:uuid handler:completion]; - [queuedRequestHandlerRegistration setObject:handler forKey:name]; - ERNDebug(@"queuedRequestHandlerRegistration when react is not ready %@", - queuedRequestHandlerRegistration); - } else { - ERNDebug(@"BridgeHolderNew: registering request handler with name %@", - name); - [electrodeNativeBridge registerRequestCompletionHandlerWithName:name - uuid:uuid - completion:completion]; - } - return uuid; -} - -+ (nullable ElectrodeBridgeRequestCompletionHandler)unregisterRequestHandlerWithUUID: (NSUUID *)uuid { - return [electrodeNativeBridge unregisterRequestHandlerWithUUID:uuid]; -} - -+ (NSUUID *)addEventListenerWithName:(NSString *)name - eventListner:(ElectrodeBridgeEventListener)eventListner { - NSUUID *eventListenerUUID = [NSUUID UUID]; - if (!isReactNativeReady) { - ElectrodeQueuedEventListener *listener = [[ElectrodeQueuedEventListener alloc] initWithUUID:eventListenerUUID - listener:eventListner]; - [queuedEventListenerRegistration setObject:listener forKey:name]; - } else { - [electrodeNativeBridge registerEventListenerWithName:name uuid:eventListenerUUID listener:eventListner]; - } - - return eventListenerUUID; -} - -+ (BOOL)isReactNativeReady { - return isReactNativeReady; -} - -+ (void)registerQueuedRequestHandlers { - ERNDebug(@"registering Queued requesters"); - ERNDebug(@"queuedRequestHandlerRegistration %@", - queuedRequestHandlerRegistration); - - for (NSString *handlerName in queuedRequestHandlerRegistration) { - ERNDebug(@"Registering queued request handler %@", handlerName); - - ElectrodeQueuedRequestHandler *handleObj = queuedRequestHandlerRegistration[handlerName]; - NSUUID *uuid = [handleObj uuid]; - ElectrodeBridgeRequestCompletionHandler completion = [handleObj handler]; - [electrodeNativeBridge registerRequestCompletionHandlerWithName:handlerName - uuid:uuid - completion:completion]; - } - - [queuedRequestHandlerRegistration removeAllObjects]; -} - -+ (void)registerQueuedEventListeners { - for (NSString *eventListnerName in queuedEventListenerRegistration) { - ElectrodeQueuedEventListener *handleObj = queuedEventListenerRegistration[eventListnerName]; - NSUUID *uuid = [handleObj uuid]; - [electrodeNativeBridge registerEventListenerWithName:eventListnerName uuid:uuid listener:[handleObj listener]]; - } - - [queuedEventListenerRegistration removeAllObjects]; -} - -+ (void)sendQueuedRequests { - ERNDebug(@"Start sending queued request: %@", queuedRequests); - for (ElectrodeBridgeRequest *request in queuedRequests) { - ElectrodeBridgeResponseCompletionHandler completion = - queuedRequests[request]; - [ElectrodeBridgeHolder sendRequest:request completionHandler:completion]; - } - - [queuedRequests removeAllObjects]; -} - -+ (void)sendQueuedEvents { - for (ElectrodeBridgeEvent *event in queuedEvent) { - [ElectrodeBridgeHolder sendEvent:event]; - } - - [queuedEvent removeAllObjects]; -} - -+ (void)setBridge:(ElectrodeBridgeTransceiver *)bridge { - isReactNativeReady = YES; - electrodeNativeBridge = bridge; -} - -@end -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeMessage.h b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeMessage.h deleted file mode 100644 index c81073d2..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeMessage.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import -NS_ASSUME_NONNULL_BEGIN - -extern NSString *const kElectrodeBridgeMessageName; -extern NSString *const kElectrodeBridgeMessageId; -extern NSString *const kElectrodeBridgeMessageType; -extern NSString *const kElectrodeBridgeMessageData; - -extern NSString *const kElectrodeBridgeMessageRequest; -extern NSString *const kElectrodeBridgeMessageResponse; -extern NSString *const kElectordeBridgeMessageEvent; - -typedef NS_ENUM(NSUInteger, ElectrodeMessageType) { - ElectrodeMessageTypeRequest, - ElectrodeMessageTypeResponse, - ElectrodeMessageTypeEvent, - ElectrodeMessageTypeUnknown -}; - -@interface ElectrodeBridgeMessage : NSObject - -@property(nonatomic, copy, readonly) NSString *name; -@property(nonatomic, copy, readonly) NSString *messageId; -@property(nonatomic, assign, readonly) ElectrodeMessageType type; -// this could be NSDictionary, primitives, or NSArray -@property(nonatomic, strong, readonly, nullable) id data; - -+ (BOOL)isValidFromData:(NSDictionary *)data; -+ (BOOL)isValidFromData:(NSDictionary *)data - withType:(ElectrodeMessageType)type; -+ (NSString *)UUID; - -- (instancetype)initWithName:(NSString *)name - messageId:(NSString *)messageId - type:(ElectrodeMessageType)type - data:(id _Nullable)data; - -/* - * @param data could be NSDictionary, primitives, or NSArray - */ -- (instancetype)initWithName:(NSString *)name - type:(ElectrodeMessageType)type - data:(id _Nullable)data; -/* - * return an instance of bridge message from a NSDictionary representation of - * it. - * @param data NSDictionary representation of BridgeMessage. Has keys of - * 'id','name','type','data' - */ -- (nullable instancetype)initWithData:(NSDictionary *)data; -+ (ElectrodeMessageType)typeFromString:(NSString *)string; -+ (NSString *)convertEnumTypeToString: - (ElectrodeMessageType)electrodeMessageType; -- (NSDictionary *)toDictionary; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeMessage.m b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeMessage.m deleted file mode 100644 index ff4bb32c..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeMessage.m +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "ElectrodeBridgeMessage.h" -#import -#import "ElectrodeLogger.h" - -NS_ASSUME_NONNULL_BEGIN - -NSString *const kElectrodeBridgeMessageName = @"name"; -NSString *const kElectrodeBridgeMessageId = @"id"; -NSString *const kElectrodeBridgeMessageType = @"type"; -NSString *const kElectrodeBridgeMessageData = @"data"; - -NSString *const kElectrodeBridgeMessageRequest = @"req"; -NSString *const kElectrodeBridgeMessageResponse = @"rsp"; -NSString *const kElectordeBridgeMessageEvent = @"event"; -NSString *const kElectordeBridgeMessageUnknown = @"unknown"; - -@interface ElectrodeBridgeMessage () -@property(nonatomic, copy) NSString *name; -@property(nonatomic, copy) NSString *messageId; -@property(nonatomic, assign) ElectrodeMessageType type; -@property(nonatomic, strong, nullable) id data; -@end - -@implementation ElectrodeBridgeMessage - -+ (NSString *)UUID { - return [[[NSUUID alloc] init] UUIDString]; -} - -+ (BOOL)isValidFromData:(NSDictionary *)data { - return [data objectForKey:kElectrodeBridgeMessageName] && - [data objectForKey:kElectrodeBridgeMessageId] && - [data objectForKey:kElectrodeBridgeMessageType]; -} - -+ (BOOL)isValidFromData:(NSDictionary *)data - withType:(ElectrodeMessageType)type { - return [ElectrodeBridgeMessage isValidFromData:data] && - ([ElectrodeBridgeMessage - typeFromString:(NSString *)[data - objectForKey:kElectrodeBridgeMessageType]] == - type); -} - -- (instancetype)initWithName:(NSString *)name - messageId:(NSString *)messageId - type:(ElectrodeMessageType)type - data:(id _Nullable)data { - if (self = [super init]) { - _name = name; - _messageId = messageId; - _type = type; - _data = data; - } - - return self; -} - -- (instancetype)initWithName:(NSString *)name - type:(ElectrodeMessageType)type - data:(id _Nullable)data { - if (self = [super init]) { - _name = name; - _messageId = [ElectrodeBridgeMessage UUID]; - _type = type; - _data = data; - } - return self; -} - -- (nullable instancetype)initWithData:(NSDictionary *)data { - if ([ElectrodeBridgeMessage isValidFromData:data]) { - NSString *name = [data objectForKey:kElectrodeBridgeMessageName]; - NSString *messageId = [data objectForKey:kElectrodeBridgeMessageId]; - ElectrodeMessageType type = [ElectrodeBridgeMessage - typeFromString:(NSString *)[data - objectForKey:kElectrodeBridgeMessageType]]; - // BridgeMessage can be sent from either Native or React Native side. When - // it's from RN side, it can be - // NSDictionary, primitives, NSArray etc; when it's from Native side, it - // will be a complex object. - id bridgeMessageData = [data objectForKey:kElectrodeBridgeMessageData]; - return [self initWithName:name - messageId:messageId - type:type - data:bridgeMessageData]; - } - return nil; -} -- (NSDictionary *)toDictionary { - NSMutableDictionary *messageDict = [[NSMutableDictionary alloc] init]; - [messageDict setObject:self.name forKey:kElectrodeBridgeMessageName]; - [messageDict setObject:self.messageId forKey:kElectrodeBridgeMessageId]; - NSString *typeString = - [ElectrodeBridgeMessage convertEnumTypeToString:self.type]; - [messageDict setObject:typeString forKey:kElectrodeBridgeMessageType]; - id simpleObj = [self convertPayloadToSimpleFormat]; - - if (simpleObj) { - [messageDict setObject:simpleObj forKey:kElectrodeBridgeMessageData]; - } else { - ERNDebug(@"data is null, data won't be set in toDictionary"); - } - - return [messageDict copy]; -} - -- (id _Nullable)convertPayloadToSimpleFormat { - id simpleObj = nil; - if (self.data != nil) { - if ([self.data conformsToProtocol:@protocol(Bridgeable)]) { - simpleObj = [self.data toDictionary]; - } else if ([self.data isKindOfClass:[NSArray class]]) { - id element = [self.data firstObject]; - if (element) { // assume the array has the same type of object - if ([element conformsToProtocol:@protocol(Bridgeable)]) { - NSArray *convertedArray = [self convertToArrayOfBridgeable:self.data]; - simpleObj = convertedArray; - } - } else { - ERNDebug(@"ElectrodeBridgeMessage: empty array"); - } - } - } - if (simpleObj == nil) { - simpleObj = self.data; - } - return simpleObj; -} - -- (NSArray *)convertToArrayOfBridgeable: - (NSArray *)data { - NSMutableArray *res = [[NSMutableArray alloc] init]; - for (id element in data) { - if ([element conformsToProtocol:@protocol(Bridgeable)]) { - NSDictionary *serialized = [element toDictionary]; - [res addObject:serialized]; - } else { - ERNDebug(@"ElectrodeBridgeMessage: element does not conform to protocol " - @"in toDictionary"); - } - } - return [res copy]; -} - -- (NSString *)description { - return [NSString stringWithFormat:@"name:%@, id:%@, type:%lu, data:%@", - self.name, self.messageId, - (unsigned long)self.type, self.data]; -} - -+ (NSString *)convertEnumTypeToString: - (ElectrodeMessageType)electrodeMessageType { - NSString *result = nil; - switch (electrodeMessageType) { - case ElectrodeMessageTypeRequest: - result = kElectrodeBridgeMessageRequest; - break; - case ElectrodeMessageTypeResponse: - result = kElectrodeBridgeMessageResponse; - break; - case ElectrodeMessageTypeEvent: - result = kElectordeBridgeMessageEvent; - break; - case ElectrodeMessageTypeUnknown: - result = kElectordeBridgeMessageUnknown; - break; - default: - [NSException raise:NSGenericException format:@"Unexpected FormatType."]; - } - return result; -} - -+ (ElectrodeMessageType)typeFromString:(NSString *)string { - if ([string isEqualToString:kElectrodeBridgeMessageRequest]) { - return ElectrodeMessageTypeRequest; - } else if ([string isEqualToString:kElectrodeBridgeMessageResponse]) { - return ElectrodeMessageTypeResponse; - } else if ([string isEqualToString:kElectordeBridgeMessageEvent]) { - return ElectrodeMessageTypeEvent; - } else { - return ElectrodeMessageTypeUnknown; - } -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeProtocols.h b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeProtocols.h deleted file mode 100644 index 9b25a9cc..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeProtocols.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import -#import "ElectrodeBridgeFailureMessage.h" -#import "ElectrodeBridgeRequest.h" -#import "ElectrodeBridgeEvent.h" - -@class ElectrodeBridgeTransceiver; -NS_ASSUME_NONNULL_BEGIN -typedef void (^ElectrodeBridgeReactNativeReadyListner)( - ElectrodeBridgeTransceiver *transceiver); - -#pragma ElectrodeBridgeResponseListener protocol - -/** - - */ -typedef void (^ElectrodeBridgeResponseCompletionHandler)( - id _Nullable data, id _Nullable message); -/** - ElectrodeBridgeResponseCompletionHandler execute when a given request comes - through. The - completioners execute once the request has fully been handled. - */ -typedef void (^ElectrodeBridgeRequestCompletionHandler)( - id _Nullable data, ElectrodeBridgeResponseCompletionHandler block); -/* - * ElectrodeBridgeEventListener execute when an event is dispatched. - */ -typedef void (^ElectrodeBridgeEventListener)(id _Nullable eventPayload); - -@interface ElectrodeBridgeProtocols : NSObject - -@end - -@protocol ConstantsProvider -/** - * Returns constant values exposed to JavaScript. - * Its implementation is not required but is very useful to key pre-defined - * values that need to be propagated from JavaScript to NativeiOS in sync - * @return Dictionary containing a constant values - */ -- (NSDictionary *)constantsToExport; -@end - -//////////////////////////////////////////////// -#pragma ElectrodeNativeBridge protocol -/* - * Native client facing bridge API. Define all the actions a native client can - * perform over the bridge. - */ -@protocol ElectrodeNativeBridge - -/** - * Send a request from iOS native side to either native or React Native side - * depending on where the request handler is registered. - * @param request The ElectrodeBridgeRequest that contains request name, - * data, destination mode and timeout - * @param completion The response call back listener to issue success/failure of - * the request. - */ -- (void)sendRequest:(ElectrodeBridgeRequest *)request - completionHandler:(ElectrodeBridgeResponseCompletionHandler)completion; - -/** - * Register the request handler - * @param name name of the request - * @param uuid uuid of the request handler - * @param completion call back to be issued for a given request. - */ -- (void) registerRequestCompletionHandlerWithName:(NSString *)name - uuid: (NSUUID *) uuid - completion: (ElectrodeBridgeRequestCompletionHandler) completion; - -/** - * Unregister a request handler - * @param uuid returned when register a request handler - */ - -- (nullable ElectrodeBridgeRequestCompletionHandler)unregisterRequestHandlerWithUUID: (NSUUID *)uuid; - -/** - * Sends an event with payload to all the event listeners - * @param event The event to emit - */ -- (void)sendEvent:(ElectrodeBridgeEvent *)event; - -/** - * Add an event listener for the passed event - * @param name The event name this listener is interested in - * @param eventListener The event listener - * @param uuid of the event listener. - */ - -- (void) registerEventListenerWithName: (NSString *_Nonnull)name - uuid: (NSUUID * _Nonnull)uuid - listener: (ElectrodeBridgeEventListener _Nonnull)eventListener; - -/** - * Remove an event listener - * @param uuid returned when listner is added. - */ -- (nullable ElectrodeBridgeEventListener)removeEventListnerWithUUID: (NSUUID *) uuid; - -- (void)addConstantsProvider:(id)constantsProvider; - -@end - -//////////////////////////////////////////////// -#pragma ElectrodeReactBridge protocol - -/** - * React facing bridge API. React Native side calls to talk to bridge - */ -@protocol ElectrodeReactBridge -/** - * Invoked by React side to communicate the bridge - * @params bridgeMessage The NSDictionary representation of BridgeMessage - */ - -- (void)sendMessage:(NSDictionary *)bridgeMessage; - -@end - -NS_ASSUME_NONNULL_END - diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeProtocols.m b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeProtocols.m deleted file mode 100644 index e9f9d8cb..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeProtocols.m +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "ElectrodeBridgeProtocols.h" - -@implementation ElectrodeBridgeProtocols - -@end diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeRequest.h b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeRequest.h deleted file mode 100644 index 9bbc852e..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeRequest.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "ElectrodeBridgeMessage.h" -#import -@class ElectrodeBridgeMessage; -NS_ASSUME_NONNULL_BEGIN -extern const int kElectrodeBridgeRequestDefaultTimeOut; -extern const int kElectrodeBridgeRequestNoTimeOut; - -@interface ElectrodeBridgeRequest : ElectrodeBridgeMessage -/** - * return timeout of the request in ms. - */ -@property(nonatomic, assign, readonly) int timeoutMs; - -/** - * return if a request was initiated by JS. - */ -@property(nonatomic, assign, readonly) BOOL isJsInitiated; - -+ (nullable instancetype)createRequestWithData:(NSDictionary *)data; - -- (instancetype)initWithName:(NSString *)name data:(nullable id)data; - -@end -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeRequest.m b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeRequest.m deleted file mode 100644 index 0655a8eb..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeRequest.m +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "ElectrodeBridgeRequest.h" -#import "ElectrodeLogger.h" - -const int kElectrodeBridgeRequestDefaultTimeOut = 5000; -const int kElectrodeBridgeRequestNoTimeOut = -1; - -@interface ElectrodeBridgeRequest () - -@property(nonatomic, assign) int timeoutMs; -@property(nonatomic, assign) BOOL isJsInitiated; - -@end - -@implementation ElectrodeBridgeRequest - -+ (nullable instancetype)createRequestWithData:(NSDictionary *)data { - if ([super isValidFromData:data withType:ElectrodeMessageTypeRequest]) { - return [[self alloc] initWithData:data]; - } - - ERNDebug(@"cannot create class ElectrodeBridgeRequest with data"); - return nil; -} - -- (instancetype)initWithData:(NSDictionary *)data { - if (self = [super initWithData:data]) { - _timeoutMs = kElectrodeBridgeRequestNoTimeOut; - _isJsInitiated = YES; - } - return self; -} - -- (instancetype)initWithName:(NSString *)name data:(id)data { - if (self = [super initWithName:name - type:ElectrodeMessageTypeRequest - data:data]) { - _timeoutMs = kElectrodeBridgeRequestDefaultTimeOut; - _isJsInitiated = NO; - } - return self; -} - -- (NSString *)description { - return [NSString stringWithFormat:@"%@, timeOut:%d, isJsInitiated:%d", - [super description], self.timeoutMs, - self.isJsInitiated]; -} - -- (id)copyWithZone:(nullable NSZone *)zone { - return self; -} - -@end diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeResponse.h b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeResponse.h deleted file mode 100644 index ece711d9..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeResponse.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "ElectrodeBridgeFailureMessage.h" -#import "ElectrodeBridgeRequest.h" - -NS_ASSUME_NONNULL_BEGIN - -extern NSString *const kElectrodeBridgeResponseError; -extern NSString *const kElectrodeBridgeResponseErrorCode; -extern NSString *const kElectrodeBridgeResponseErrorMessage; -extern NSString *const kElectrodeBridgeResponseUnknownErrorCode; - -@interface ElectrodeBridgeResponse : ElectrodeBridgeMessage - -@property(readonly, nonatomic, strong, nullable) id - failureMessage; - -+ (nullable instancetype)createResponseWithData:(NSDictionary *)data; -+ (nullable instancetype) -createResponseForRequest:(ElectrodeBridgeRequest *)request - withResponseData:(nullable NSDictionary *)data - withFailureMessage:(nullable id)failureMessage; -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeResponse.m b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeResponse.m deleted file mode 100644 index 1f04b6ed..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeResponse.m +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "ElectrodeBridgeResponse.h" -#import "ElectrodeBridgeFailureMessage.h" - -NSString *const kElectrodeBridgeResponseError = @"error"; -NSString *const kElectrodeBridgeResponseErrorCode = @"code"; -NSString *const kElectrodeBridgeResponseErrorMessage = @"message"; -NSString *const kElectrodeBridgeResponseUnknownErrorCode = @"EUNKNOWN"; - -@interface ElectrodeBridgeResponse () - -@property(nonatomic, strong, nullable) id - failureMessage; - -@end - -@implementation ElectrodeBridgeResponse - -+ (nullable instancetype)createResponseWithData:(NSDictionary *)data { - if ([super isValidFromData:data withType:ElectrodeMessageTypeResponse]) { - return [[ElectrodeBridgeResponse alloc] initWithData:data]; - } - - return nil; -} - -+ (nullable instancetype) -createResponseForRequest:(ElectrodeBridgeRequest *)request - withResponseData:(nullable id)data - withFailureMessage:(nullable id)failureMessage { - return - [[ElectrodeBridgeResponse alloc] initWithName:request.name - messageId:request.messageId - type:ElectrodeMessageTypeResponse - data:data - failureMessage:failureMessage]; -} - -- (nullable instancetype)initWithData:(NSDictionary *)data { - if (self = [super initWithData:data]) { - NSDictionary *error = [data objectForKey:kElectrodeBridgeResponseError]; - if (error != nil && - [error isKindOfClass:[NSDictionary class]]) { // check the - // arguemntsEx.toBundle - // thingy - NSString *code = - (NSString *)[error objectForKey:kElectrodeBridgeResponseErrorCode]; - NSString *message = - (NSString *)[error objectForKey:kElectrodeBridgeResponseErrorMessage]; - _failureMessage = [ElectrodeBridgeFailureMessage - createFailureMessageWithCode: - (code != nil ? code : kElectrodeBridgeResponseUnknownErrorCode) - message:(message != nil ? message - : @"unknown error")]; - } - } - - return self; -} - -- (nullable instancetype)initWithName:(NSString *)name - messageId:(NSString *)messageId - type:(ElectrodeMessageType)type - data:(id)data - failureMessage: - (id)failureMessage { - if (self = - [super initWithName:name messageId:messageId type:type data:data]) { - _failureMessage = failureMessage; - } - - return self; -} - -- (NSDictionary *)toDictionary { - if (_failureMessage) { - NSMutableDictionary *messageDict = - [[NSMutableDictionary alloc] initWithDictionary:[super toDictionary]]; - NSMutableDictionary *errorDict = [[NSMutableDictionary alloc] init]; - [errorDict setObject:_failureMessage.message - forKey:kElectrodeBridgeResponseErrorMessage]; - [errorDict setObject:_failureMessage.code - forKey:kElectrodeBridgeResponseErrorCode]; - [messageDict setObject:errorDict forKey:kElectrodeBridgeResponseError]; - return messageDict; - } - return [super toDictionary]; -} - -- (NSString *)description { - return [NSString stringWithFormat:@"%@, failureMessage:%@", - [super description], self.failureMessage]; -} - -@end diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeTransaction.h b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeTransaction.h deleted file mode 100644 index b750cc4d..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeTransaction.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import -#import "ElectrodeBridgeProtocols.h" -#import "ElectrodeBridgeRequest.h" -#import "ElectrodeBridgeResponse.h" -NS_ASSUME_NONNULL_BEGIN -@interface ElectrodeBridgeTransaction : NSObject - -@property(nonatomic, readonly, strong) ElectrodeBridgeRequest *request; -@property(nonatomic, readonly, strong, nullable) ElectrodeBridgeResponseCompletionHandler completion; -// Note: response can be set -@property(nonatomic, readwrite, strong, nullable) - ElectrodeBridgeResponse *response; - -- (instancetype)initWithRequest:(ElectrodeBridgeRequest *)request - completionHandler:(ElectrodeBridgeResponseCompletionHandler _Nullable)completion; -- (NSString *)transactionId; -- (BOOL)isJsInitiated; - -@end -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeTransaction.m b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeTransaction.m deleted file mode 100644 index 237e2068..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeTransaction.m +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "ElectrodeBridgeTransaction.h" -#import "ElectrodeBridgeMessage.h" -NS_ASSUME_NONNULL_BEGIN -@interface ElectrodeBridgeTransaction () - -@property(nonatomic, strong, nonnull) ElectrodeBridgeRequest *request; -@property(nonatomic, strong, nullable) - ElectrodeBridgeResponseCompletionHandler completion; - -@end - -@implementation ElectrodeBridgeTransaction - -- (nonnull instancetype)initWithRequest:(ElectrodeBridgeRequest *)request - completionHandler: - (ElectrodeBridgeResponseCompletionHandler _Nullable) - completion; -{ - if (request.type != ElectrodeMessageTypeRequest) { - [NSException raise:@"Invalid type" - format:@"BridgeTransaction constrictor expects a request type, " - @"did you accidentally pass in a different type"]; - } - - if (self = [super init]) { - _request = request; - _completion = completion; - } - - return self; -} - -- (nonnull NSString *)transactionId { - return self.request.messageId; -} -- (BOOL)isJsInitiated { - return self.request.isJsInitiated; -} - -@end -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeTransceiver.h b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeTransceiver.h deleted file mode 100644 index f2e5fb4a..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeTransceiver.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import - -#if __has_include() -#import -#elif __has_include("RCTBridgeModule.h") -#import "RCTBridgeModule.h" -#else -#import "React/RCTBridgeModule.h" // Required when used as a Pod in a Swift project -#endif - -#if __has_include() -#import -#elif __has_include("RCTEventEmitter.h") -#import "RCTEventEmitter.h" -#else -#import "React/RCTEventEmitter.h" // Required when used as a Pod in a Swift project -#endif - -#import "ElectrodeBridgeProtocols.h" -/** - * A class that is responsible for transmitting messages between native side and - * react native side. - */ -NS_ASSUME_NONNULL_BEGIN -@interface ElectrodeBridgeTransceiver : RCTEventEmitter - -@property(nonatomic, copy, readonly, nonnull) NSString *name; -+ (instancetype)sharedInstance; -+ (void)registerReactNativeReadyListener:(ElectrodeBridgeReactNativeReadyListner _Nonnull)reactNativeReadyListner; -+ (void)registerReactTransceiverReadyListner:(ElectrodeBridgeReactNativeReadyListner _Nonnull)reactNativeReadyListner; -- (void)onReactNativeInitialized; -- (void)onTransceiverModuleInitialized; -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeTransceiver.m b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeTransceiver.m deleted file mode 100644 index 981f1a98..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeTransceiver.m +++ /dev/null @@ -1,442 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "ElectrodeBridgeTransceiver.h" -#import "ElectrodeBridgeTransceiver_Internal.h" -#import "ElectrodeEventDispatcher.h" -#import "ElectrodeRequestDispatcher.h" -#import "ElectrodeBridgeTransaction.h" -#import "ElectrodeEventRegistrar.h" -#import "ElectrodeRequestRegistrar.h" -#import "ElectrodeLogger.h" - -#if __has_include() -#import -#elif __has_include("RCTLog.h") -#import "RCTLog.h" -#else -#import "React/RCTLog.h" // Required when used as a Pod in a Swift project -#endif - -#if __has_include() -#import -#elif __has_include("RCTBridge.h") -#import "RCTBridge.h" -#else -#import "React/RCTBridge.h" // Required when used as a Pod in a Swift project -#endif - -#import "ElectrodeBridgeMessage.h" -#import "ElectrodeBridgeEvent.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ElectrodeBridgeTransceiver () - -@property(nonatomic, copy) NSString *name; -@property(nonatomic, strong) ElectrodeEventDispatcher *eventDispatcher; -@property(nonatomic, strong) ElectrodeRequestDispatcher *requestDispatcher; -@property(nonatomic, copy) NSMutableDictionary *pendingTransaction; -@property(nonatomic, assign) dispatch_queue_t syncQueue; // this is used to make sure access to - // pendingTransaction is thread safe. - -@end - -static dispatch_once_t onceToken; -static ElectrodeRequestRegistrar *requestRegistrar; -static ElectrodeEventRegistrar *eventRegistrar; -static ElectrodeRequestDispatcher *requestDispatcher; -static ElectrodeEventDispatcher *eventDispatcher; -static NSMutableDictionary *pendingTransaction; -static NSMutableArray> *constantsProviders; - -@implementation ElectrodeBridgeTransceiver - -+ (instancetype)sharedInstance { - return sharedInstance; -} - -- (instancetype)init { - if (self = [super init]) { - dispatch_once(&onceToken, ^{ - requestRegistrar = [[ElectrodeRequestRegistrar alloc] init]; - eventRegistrar = [[ElectrodeEventRegistrar alloc] init]; - requestDispatcher = [[ElectrodeRequestDispatcher alloc] - initWithRequestRegistrar:requestRegistrar]; - eventDispatcher = [[ElectrodeEventDispatcher alloc] - initWithEventRegistrar:eventRegistrar]; - pendingTransaction = [[NSMutableDictionary alloc] init]; - constantsProviders = [[NSMutableArray alloc] init]; - }); - - _requestDispatcher = requestDispatcher; - _eventDispatcher = eventDispatcher; - _pendingTransaction = pendingTransaction; - } - return self; -} -RCT_EXPORT_MODULE(ElectrodeBridge); -+ (NSArray *)electrodeModules { - return @[ [[ElectrodeBridgeTransceiver alloc] init] ]; -} - -- (NSArray *)supportedEvents { - return @[ @"electrode.bridge.message" ]; -} - -#pragma ConstantsProvider implementation - -- (NSDictionary *)constantsToExport { - NSMutableDictionary *constants = [NSMutableDictionary new]; - if (constantsProviders != nil && [constantsProviders count] > 0) { - for (id constant in constantsProviders) { - [constants addEntriesFromDictionary:[constant constantsToExport]]; - } - return constants; - } - ERNDebug(@"Constants provider is empty %@", constantsProviders); - return nil; -} - -- (void)addConstantsProvider:(id)constantsProvider { - @synchronized(self) { - [constantsProviders addObject:constantsProvider]; - } -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#pragma ElectrodeNativeBridge implementation -- (void)sendRequest:(ElectrodeBridgeRequest *)request - completionHandler:(ElectrodeBridgeResponseCompletionHandler)completion { - [self handleRequest:request completionHandler:completion]; -} - -- (void) registerRequestCompletionHandlerWithName:(NSString *)name - uuid: (NSUUID *) uuid - completion: (ElectrodeBridgeRequestCompletionHandler) completion { - [self.requestDispatcher.requestRegistrar registerRequestCompletionHandlerWithName:name - uuid:uuid completion:completion]; -} - - -- (nullable ElectrodeBridgeRequestCompletionHandler) unregisterRequestHandlerWithUUID:(NSUUID *)uuid { - return [requestRegistrar unregisterRequestHandler:uuid]; -} - -- (void)resetRegistrar { - [self.requestDispatcher.requestRegistrar reset]; -} - -- (void)sendEvent:(ElectrodeBridgeEvent *)event { - ERNDebug(@"ElectrodeBridgeTransceiver: emit event named: %@, id: %@", - event.name, event.messageId); - [self notifyNativeEventListenerWithEvent:event]; - [self notifyReactNativeEventListenerWithEvent:event]; -} - -- (void) registerEventListenerWithName: (NSString *_Nonnull)name - uuid: (NSUUID * _Nonnull)uuid - listener: (ElectrodeBridgeEventListener _Nonnull)eventListener { - ERNDebug(@"%@, Adding eventListener %@ for event %@", - NSStringFromClass([self class]), eventListener, name); - [self.eventDispatcher.eventRegistrar registerEventListener:eventListener - name:name uuid:uuid]; -} -- (nullable ElectrodeBridgeEventListener)removeEventListnerWithUUID: (NSUUID *) uuid { - ERNDebug(@"Removing event listener with NNUUID with string %@", uuid.UUIDString); - return [eventRegistrar unregisterEventListener:uuid]; -} -#pragma ElectrodeReactBridge - -RCT_EXPORT_METHOD(sendMessage : (NSDictionary *)bridgeMessage) { - ERNDebug(@"Received message from JS(data=%@)", bridgeMessage); - NSString *typeString = - (NSString *)[bridgeMessage objectForKey:kElectrodeBridgeMessageType]; - ElectrodeMessageType type = - [ElectrodeBridgeMessage typeFromString:typeString]; - switch (type) { - case ElectrodeMessageTypeRequest: { - ElectrodeBridgeRequest *request = - [ElectrodeBridgeRequest createRequestWithData:bridgeMessage]; - [self handleRequest:request completionHandler:nil]; - break; - } - - case ElectrodeMessageTypeResponse: { - ElectrodeBridgeResponse *response = - [ElectrodeBridgeResponse createResponseWithData:bridgeMessage]; - if (response != nil) { - [self handleResponse:response]; - } else { - [NSException raise:@"invalue resonse" - format:@"cannot construct a response from data"]; - } - break; - } - case ElectrodeMessageTypeEvent: { - ElectrodeBridgeEvent *event = - [ElectrodeBridgeEvent createEventWithData:bridgeMessage]; - if (event != nil) { - [self notifyNativeEventListenerWithEvent:event]; - } else { - [NSException raise:@"invalue event" - format:@"cannot construct an event from data"]; - } - break; - } - case ElectrodeMessageTypeUnknown: - default: - [NSException raise:@"invalue message" - format:@"cannot construct any message from data"]; - break; - } -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#pragma private methods - -- (void)emitMessage:(ElectrodeBridgeMessage *_Nonnull)bridgeMessage { - ERNDebug(@"Sending bridgeMessage(%@) to JS", bridgeMessage); - [self sendEventWithName:@"electrode.bridge.message" - body:[bridgeMessage toDictionary]]; -} - -- (void)notifyReactNativeEventListenerWithEvent:(ElectrodeBridgeEvent *)event { - [self emitMessage:event]; -} - -- (void)notifyNativeEventListenerWithEvent:(ElectrodeBridgeEvent *)event { - [self.eventDispatcher dispatchEvent:event]; -} - -- (void)handleRequest:(ElectrodeBridgeRequest *)request - completionHandler: - (ElectrodeBridgeResponseCompletionHandler _Nullable)completion { - [self logRequest:request]; - - if (completion == nil && !request.isJsInitiated) { - [NSException - raise:@"invalid operation" - format:@"A response lister is required for a native initiated request"]; - } - - ElectrodeBridgeTransaction *transaction = - [self createTransactionWithRequest:request completionHandler:completion]; - if ([self.requestDispatcher canHandlerRequestWithName:request.name]) { - [self dispatchRequestToNativeHandlerForTransaction:transaction]; - } else if (!request.isJsInitiated) { // GOTCHA: Make sure not send a request - // back to JS if it's initiated on JS - // side - [self dispatchRequestToReactHandlerForTransaction:transaction]; - } else { - ERNDebug(@"No handler available to handle request(%@)", request); - id failureMessage = [ElectrodeBridgeFailureMessage - createFailureMessageWithCode:@"ENOHANDLER" - message:@"No registered request handler found"]; - ElectrodeBridgeResponse *response = - [ElectrodeBridgeResponse createResponseForRequest:request - withResponseData:nil - withFailureMessage:failureMessage]; - [self handleResponse:response]; - } -} - -- (ElectrodeBridgeTransaction *) -createTransactionWithRequest:(ElectrodeBridgeRequest *)request - completionHandler: - (ElectrodeBridgeResponseCompletionHandler)completion { - ElectrodeBridgeTransaction *transaction = - [[ElectrodeBridgeTransaction alloc] initWithRequest:request - completionHandler:completion]; - - @synchronized(self) { - [self.pendingTransaction setObject:transaction forKey:request.messageId]; - if ([request timeoutMs] != kElectrodeBridgeRequestNoTimeOut) { - [self startTimeOutCheckForTransaction:transaction]; - } - } - - return transaction; -} - -- (void)startTimeOutCheckForTransaction: - (ElectrodeBridgeTransaction *)transaction { - // Add the timeout handler - __weak ElectrodeBridgeTransceiver *weakSelf = self; - dispatch_after( - dispatch_time(DISPATCH_TIME_NOW, - (int64_t)(transaction.request.timeoutMs * NSEC_PER_MSEC)), - dispatch_get_main_queue(), ^{ - ElectrodeBridgeResponseCompletionHandler completionBlock = - transaction.completion; - if (completionBlock) { - id failureMessage = - [ElectrodeBridgeFailureMessage - createFailureMessageWithCode:@"TIMEOUT" - message:@"transaction timed out for " - @"request"]; - ElectrodeBridgeResponse *response = [ElectrodeBridgeResponse - createResponseForRequest:transaction.request - withResponseData:nil - withFailureMessage:failureMessage]; - [weakSelf handleResponse:response]; - } else { - ERNDebug( - @"Empty failure block. Time out may not be handled property"); - } - }); -} - -- (void)dispatchRequestToNativeHandlerForTransaction: - (ElectrodeBridgeTransaction *)transaction { - ERNDebug(@"Sending request(%@) to native handler", transaction.request); - ElectrodeBridgeRequest *request = transaction.request; - __weak ElectrodeBridgeTransceiver *weakSelf = self; - - [self.requestDispatcher - dispatchRequest:request - completionHandler:^( - id _Nullable data, - id _Nullable failureMessage) { - if (failureMessage != nil) { - ElectrodeBridgeResponse *response = - [ElectrodeBridgeResponse createResponseForRequest:request - withResponseData:nil - withFailureMessage:failureMessage]; - [weakSelf handleResponse:response]; - } else { - ElectrodeBridgeResponse *response = - [ElectrodeBridgeResponse createResponseForRequest:request - withResponseData:data - withFailureMessage:nil]; - [weakSelf handleResponse:response]; - } - }]; -} - -- (void)dispatchRequestToReactHandlerForTransaction: - (ElectrodeBridgeTransaction *)transaction { - ERNDebug(@"Sending request(%@) over to JS handler because there is no local " - @"request handler available", - transaction.request); - [self emitMessage:transaction.request]; -} - -- (void)handleResponse:(ElectrodeBridgeResponse *)response { - ERNDebug(@"hanlding bridge response: %@", response); - ElectrodeBridgeTransaction *transaction; - @synchronized(self) { - transaction = (ElectrodeBridgeTransaction *)[self.pendingTransaction - objectForKey:response.messageId]; - } - if (transaction != nil) { - transaction.response = response; - [self completeTransaction:transaction]; - } else { - ERNDebug(@"Response(%@) will be ignored because the transcation for this " - @"request has been removed from the queue. Perhaps it's already " - @"timed-out or completed.", - response); - } -} - -- (void)completeTransaction:(ElectrodeBridgeTransaction *)transaction { - if (transaction.response == nil) { - [NSException raise:@"invalid transaction" - format:@"Cannot complete transaction, a transaction can only " - @"be completed with a valid response"]; - } - ERNDebug(@"completing transaction(id=%@", transaction.transactionId); - - [self.pendingTransaction removeObjectForKey:transaction.transactionId]; - - ElectrodeBridgeResponse *response = transaction.response; - [self logResponse:response]; - - if (transaction.isJsInitiated) { - ERNDebug(@"Completing transaction by emitting event back to JS since the " - @"request is initiated from JS side"); - [self emitMessage:response]; - } else { - if (transaction.completion == nil) { - [NSException raise:@"invalid transaction" - format:@"Should never reach here. A response listener should " - @"always be set for a local transaction"]; - } else { - if (response.failureMessage != nil) { - - ERNDebug(@"Completing transaction by issuing a failure call back to " - @"local response listener"); - dispatch_async(dispatch_get_main_queue(), ^{ - transaction.completion(nil, response.failureMessage); - }); - } else { - ERNDebug(@"Completing transaction by issuing a success call back to " - @"local response listener"); - dispatch_async(dispatch_get_main_queue(), ^{ - transaction.completion(response.data, nil); - }); - } - } - } -} - -- (void)logRequest:(ElectrodeBridgeRequest *)request { - ERNDebug(@"--> --> --> --> --> Request(%@)", request); -} - -- (void)logResponse:(ElectrodeBridgeResponse *)response { - ERNDebug(@"<-- <-- <-- <-- <-- Response(%@)", response); -} - -+ (void)registerReactNativeReadyListener: - (ElectrodeBridgeReactNativeReadyListner)listner { - if (isReactNativeReady) { - if (listner) { - listner(sharedInstance); - } - } - - reactNativeReadyListener = [listner copy]; -} - -- (void)onReactNativeInitialized { - isReactNativeReady = YES; - sharedInstance = self; - if (reactNativeReadyListener) { - reactNativeReadyListener(self); - } -} -+ (void)registerReactTransceiverReadyListner: - (ElectrodeBridgeReactNativeReadyListner)listener { - if (isTransceiverReady) { - if (listener) { - listener(sharedInstance); - } - } - reactNativeTransceiver = listener; -} - -- (void)onTransceiverModuleInitialized { - isTransceiverReady = YES; - sharedInstance = self; - if (reactNativeTransceiver) { - reactNativeTransceiver(self); - } -} - -@end -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeTransceiver_Internal.h b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeTransceiver_Internal.h deleted file mode 100644 index 083079ac..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeBridgeTransceiver_Internal.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "ElectrodeBridgeTransceiver.h" -NS_ASSUME_NONNULL_BEGIN -static ElectrodeBridgeReactNativeReadyListner reactNativeReadyListener = nil; -static ElectrodeBridgeReactNativeReadyListner reactNativeTransceiver = nil; -static BOOL isReactNativeReady = NO; -static BOOL isTransceiverReady = NO; -static ElectrodeBridgeTransceiver *sharedInstance; - -@interface ElectrodeBridgeTransceiver () -- (void)emitMessage:(ElectrodeBridgeMessage *_Nonnull)bridgeMessage; -- (void)resetRegistrar; -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeEventDispatcher.h b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeEventDispatcher.h deleted file mode 100644 index 6290e04f..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeEventDispatcher.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import -#import "ElectrodeEventRegistrar.h" -#import "ElectrodeBridgeEvent.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ElectrodeEventDispatcher : NSObject - -@property(nonatomic, strong, readonly) ElectrodeEventRegistrar *eventRegistrar; - -- (instancetype)initWithEventRegistrar:(ElectrodeEventRegistrar *)eventRegistrar; -- (void)dispatchEvent:(ElectrodeBridgeEvent *)bridgeEvent; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeEventDispatcher.m b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeEventDispatcher.m deleted file mode 100644 index b9800bb4..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeEventDispatcher.m +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "ElectrodeEventDispatcher.h" -#import "ElectrodeBridgeProtocols.h" -#import "ElectrodeLogger.h" - -@interface ElectrodeEventRegistrar () - -@property(nonatomic, strong) ElectrodeEventRegistrar *eventRegistrar; - -@end - -@implementation ElectrodeEventDispatcher - -- (instancetype)initWithEventRegistrar: - (ElectrodeEventRegistrar *)eventRegistrar { - if (self = [super init]) { - _eventRegistrar = eventRegistrar; - } - - return self; -} - -- (void)dispatchEvent:(ElectrodeBridgeEvent *)bridgeEvent { - NSArray *eventListeners = - [self.eventRegistrar getEventListnersForName:bridgeEvent.name]; - - for (ElectrodeBridgeEventListener eventListener in eventListeners) { - ERNDebug(@"ElectrodeEventDispatcher is dispatching events %@, id(%@) to " - @"listener %@", - bridgeEvent.name, bridgeEvent.messageId, eventListener); - dispatch_async(dispatch_get_main_queue(), ^{ - if (eventListener) { - eventListener(bridgeEvent.data); - } - }); - } -} - -@end diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeEventRegistrar.h b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeEventRegistrar.h deleted file mode 100644 index 07c9c466..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeEventRegistrar.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import -#import "ElectrodeBridgeProtocols.h" - -@interface ElectrodeEventRegistrar : NSObject - -/** - Add a specific event listener that will respond to a given event name. - - @param name The name of the event in reverse url format. - @param eventListener The event listener that will respond to a given event. - @param uuid The uuid of the listener - */ -- (void) registerEventListener:(ElectrodeBridgeEventListener _Nonnull)eventListener - name: (NSString *_Nonnull)name - uuid: (NSUUID * _Nonnull)uuid; - -/** - Remove an event listener by a given UUID. It is possible to have multiple event - listeners for a given name. They are grouped by the name and separated by UUID. - - @param eventListenerUUID The UUID of the event listener. - */ -- (nullable ElectrodeBridgeEventListener)unregisterEventListener:(NSUUID *_Nonnull)eventListenerUUID; - -/** - Grabs all of the event listeners of a given name. - - @param name The name that the event listeners will respond to. - @return An array of all of the event listeners, will return nil if none are - found. - */ -- (NSArray *_Nullable)getEventListnersForName: - (NSString *_Nonnull)name; - -@end diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeEventRegistrar.m b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeEventRegistrar.m deleted file mode 100644 index 755c5f2b..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeEventRegistrar.m +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "ElectrodeEventRegistrar.h" - -@interface ElectrodeEventRegistrar () - -@property(nonatomic, strong) NSMutableDictionary *eventListenerByUUID; -@property(nonatomic, strong) NSMutableDictionary *eventListenersByEventName; - -@end - -@implementation ElectrodeEventRegistrar -- (void) registerEventListener:(ElectrodeBridgeEventListener _Nonnull)eventListener - name: (NSString *_Nonnull)name - uuid: (NSUUID * _Nonnull)uuid { - @synchronized(self) { - if ([self.eventListenersByEventName objectForKey:name]) { - NSMutableArray *eventListenerArray = - [self.eventListenersByEventName objectForKey:name]; - [eventListenerArray addObject:eventListener]; - [self.eventListenersByEventName setValue:eventListenerArray forKey:name]; - } else { - NSMutableArray *eventListenerArray = [[NSMutableArray alloc] init]; - [eventListenerArray addObject:eventListener]; - [self.eventListenersByEventName setObject:eventListenerArray forKey:name]; - } - - [self.eventListenerByUUID setObject:eventListener forKey:uuid]; - } -} - -- (nullable ElectrodeBridgeEventListener) unregisterEventListener:(NSUUID *_Nonnull)eventListenerUUID { - ElectrodeBridgeEventListener eventListener; - @synchronized(self) { - eventListener = - [self.eventListenerByUUID objectForKey:eventListenerUUID]; - [self.eventListenerByUUID removeObjectForKey:eventListenerUUID]; - - if (eventListener) { - NSArray *keys = [self.eventListenersByEventName allKeys]; - for (NSString *key in keys) { - NSMutableArray *eventListeners = - [self.eventListenersByEventName objectForKey:key]; - if ([eventListeners containsObject:eventListener]) { - [eventListeners removeObject:eventListener]; - } - [self.eventListenersByEventName setObject:eventListeners forKey:key]; - } - } - } - return eventListener; -} - -- (NSArray *_Nullable)getEventListnersForName: - (NSString *_Nonnull)name { - @synchronized(self) { - NSArray *eventListeners = nil; - - if ([self.eventListenersByEventName objectForKey:name]) { - id tempListeners = [self.eventListenersByEventName objectForKey:name]; - if ([tempListeners isKindOfClass:[NSArray class]]) { - eventListeners = (NSArray *)[NSArray - arrayWithArray:tempListeners]; - } - } - return eventListeners; - } -} - -- (NSMutableDictionary *)eventListenersByEventName { - // Lazy instantiation - if (!_eventListenersByEventName) { - _eventListenersByEventName = [[NSMutableDictionary alloc] init]; - } - - return _eventListenersByEventName; -} - -- (NSMutableDictionary *)eventListenerByUUID { - // Lazy instantiation - if (!_eventListenerByUUID) { - _eventListenerByUUID = [[NSMutableDictionary alloc] init]; - } - - return _eventListenerByUUID; -} - -@end diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeLogger.h b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeLogger.h deleted file mode 100644 index 060c2f2b..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeLogger.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import -NS_ASSUME_NONNULL_BEGIN -typedef NS_ENUM(NSInteger, ElectrodeLogLevel) { - ElectrodeLogLevelNone = 1 << 0, - ElectrodeLogLevelError = 1 << 1, - ElectrodeLogLevelInfo = 1 << 2, - ElectrodeLogLevelDebug = 1 << 3, - ElectrodeLogLevelVerbose = 1 << 4 -}; - -@interface ElectrodeLoggerObjc : NSObject -+ (void)loglevel:(ElectrodeLogLevel)level format:(NSString *)format, ...; -@end - -#define ERNLog(lvl, frmt, ...) \ - [ElectrodeLoggerObjc loglevel:lvl format:frmt, ##__VA_ARGS__] - -#define ERNDebug(frmt, ...) ERNLog(ElectrodeLogLevelDebug, frmt, ##__VA_ARGS__) - -@protocol ElectrodeLogger - -@property(nonatomic, assign) ElectrodeLogLevel logLevel; -+ (instancetype)sharedInstance; -- (void)log:(ElectrodeLogLevel)level message:(NSString *)message; -- (void)debug:(NSString *)message; - -@end - -/* - * ElectrodeConsoleLogger sets the log level for ERN framework - * an example usage could be like below - * ElectrodeConsoleLogger.sharedInstance.logLevel = ElectrodeLogLevelDebug - */ -@interface ElectrodeConsoleLogger : NSObject - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeLogger.m b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeLogger.m deleted file mode 100644 index 24ce8b4b..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeLogger.m +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#import "ElectrodeLogger.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ElectrodeConsoleLogger () -@end - -@implementation ElectrodeConsoleLogger -@synthesize logLevel = _logLevel; -- (instancetype)init { - if (self = [super init]) { - _logLevel = ElectrodeLogLevelNone; - } - - return self; -} -+ (instancetype)sharedInstance { - static dispatch_once_t onceToken; - static ElectrodeConsoleLogger *sharedInstance; - dispatch_once(&onceToken, ^{ - sharedInstance = [[ElectrodeConsoleLogger alloc] init]; - }); - - return sharedInstance; -} -- (void)log:(ElectrodeLogLevel)level message:(NSString *)message { - if (self.logLevel >= level) { - switch (level) { - case ElectrodeLogLevelNone: - // log nothing - break; - case ElectrodeLogLevelError: - NSLog(@"[ERN Error] %@", message); - break; - case ElectrodeLogLevelInfo: - NSLog(@"[ERN Info] %@", message); - break; - case ElectrodeLogLevelDebug: - NSLog(@"[ERN Debug] %@", message); - break; - case ElectrodeLogLevelVerbose: - NSLog(@"[ERN Verbose] %@", message); - break; - default: - break; - } - } -} - -- (void)debug:(NSString *)message { - [self log:ElectrodeLogLevelDebug message:message]; -} -@end - -@implementation ElectrodeLoggerObjc - -+ (void)loglevel:(ElectrodeLogLevel)level format:(NSString *)format, ... { - va_list argp; - va_start(argp, format); - NSString *message = [[NSString alloc] initWithFormat:format arguments:argp]; - va_end(argp); - - [[ElectrodeConsoleLogger sharedInstance] log:level message:message]; -} - -@end -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeObject.swift b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeObject.swift deleted file mode 100644 index 9518b60d..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeObject.swift +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import UIKit - -open class ElectrodeObject: NSObject { - public required init(dictionary _: [AnyHashable: Any]) { - super.init() - } - - public override init() { - super.init() - } -} diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeReactNativeBridge.h b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeReactNativeBridge.h deleted file mode 100644 index e1e75a14..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeReactNativeBridge.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import - -//! Project version number for ElectrodeReactNativeBridge. -FOUNDATION_EXPORT double ElectrodeReactNativeBridgeVersionNumber; - -//! Project version string for ElectrodeReactNativeBridge. -FOUNDATION_EXPORT const unsigned char ElectrodeReactNativeBridgeVersionString[]; - -// In this header, you should import all the public headers of your framework -// using statements like #import - -#import -#import -#import -#import -#import diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeRequestDispatcher.h b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeRequestDispatcher.h deleted file mode 100644 index a4471af8..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeRequestDispatcher.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import -#import "ElectrodeRequestRegistrar.h" -#import "ElectrodeBridgeRequest.h" -#import "ElectrodeBridgeProtocols.h" - -NS_ASSUME_NONNULL_BEGIN -@interface ElectrodeRequestDispatcher : NSObject - -@property(nonatomic, strong, readonly) ElectrodeRequestRegistrar *requestRegistrar; - -- (instancetype)initWithRequestRegistrar:(ElectrodeRequestRegistrar *)requestRegistrar; -- (void)dispatchRequest:(ElectrodeBridgeRequest *)bridgeRequest - completionHandler:(ElectrodeBridgeResponseCompletionHandler)completion; -- (BOOL)canHandlerRequestWithName:(NSString *)name; -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeRequestDispatcher.m b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeRequestDispatcher.m deleted file mode 100644 index 2c6d1627..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeRequestDispatcher.m +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "ElectrodeRequestDispatcher.h" -#import "ElectrodeBridgeFailureMessage.h" -#import "ElectrodeLogger.h" - -NS_ASSUME_NONNULL_BEGIN -@interface ElectrodeRequestRegistrar () -@property(nonatomic, strong) ElectrodeRequestRegistrar *requestRegistrar; - -@end - -@implementation ElectrodeRequestDispatcher -- (instancetype)initWithRequestRegistrar: - (ElectrodeRequestRegistrar *)requestRegistrar { - if (self = [super init]) { - _requestRegistrar = [[ElectrodeRequestRegistrar alloc] init]; - } - return self; -} - -- (void)dispatchRequest:(ElectrodeBridgeRequest *)bridgeRequest - completionHandler:(ElectrodeBridgeResponseCompletionHandler)completion - -{ - NSString *requestId = bridgeRequest.messageId; - NSString *requestName = bridgeRequest.name; - - ERNDebug(@"ElectrodeRequestDispatcher dispatching request(id=%@) locally", - requestId); - - ElectrodeBridgeRequestCompletionHandler requestCompletionHandler = - [self.requestRegistrar getRequestHandler:requestName]; - if (requestCompletionHandler == nil) { - NSString *errorMessage = [NSString - stringWithFormat:@"No registered request handler for request name %@", - requestName]; - id failureMessage = [ElectrodeBridgeFailureMessage - createFailureMessageWithCode:@"ENOHANDLER" - message:errorMessage]; - if (completion) { - completion(nil, failureMessage); - } - return; - } - - dispatch_async(dispatch_get_main_queue(), ^{ - requestCompletionHandler(bridgeRequest.data, completion); - }); -} -- (BOOL)canHandlerRequestWithName:(NSString *)name { - return ([self.requestRegistrar getRequestHandler:name] != nil); -} -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeRequestHandlerProcessor.swift b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeRequestHandlerProcessor.swift deleted file mode 100644 index 180f1035..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeRequestHandlerProcessor.swift +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import UIKit - -public class ElectrodeRequestHandlerProcessor: NSObject, Processor { - let tag: String - let requestName: String - let reqClass: TReq.Type - let reqItemType: Any.Type? - let respClass: TResp.Type - let requestCompletionHandler: ElectrodeBridgeRequestCompletionHandler - - public init(requestName: String, - reqClass: TReq.Type, - reqItemType: Any.Type? = nil, - respClass: TResp.Type, - requestCompletionHandler: @escaping ElectrodeBridgeRequestCompletionHandler) { - tag = String(describing: type(of: self)) - self.requestName = requestName - self.reqClass = reqClass - self.reqItemType = reqItemType - self.respClass = respClass - self.requestCompletionHandler = requestCompletionHandler - super.init() - } - - public func execute() -> UUID? { - let uuid = ElectrodeBridgeHolder.registerRequestHandler(withName: requestName) { (data: Any?, responseCompletion: @escaping ElectrodeBridgeResponseCompletionHandler) in - let request: Any? - if self.reqClass == None.self { - request = nil - } else { - if let nonnilData = data { - request = try? ElectrodeUtilities.generateObject(data: nonnilData, classType: self.reqClass, itemType: self.reqItemType) - } else { - request = nil - } - } - //this is passed back to Native side. - self.requestCompletionHandler(request, responseCompletion) - } - return uuid - } -} diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeRequestProcessor.swift b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeRequestProcessor.swift deleted file mode 100644 index f01fabaa..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeRequestProcessor.swift +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import UIKit - -typealias ElectrodeRequestProcessorSuccessClosure = (Any?) -> Void -typealias ElectrodeRequestProcessorFailureClosure = (ElectrodeFailureMessage) -> Void - -public class ElectrodeRequestProcessor: NSObject { - private let tag: String - private let requestName: String - private let requestPayload: Any? - private let responseClass: TResp.Type - private let responseItemType: Any.Type? - private let responseCompletionHandler: ElectrodeBridgeResponseCompletionHandler - - public init(requestName: String, - requestPayload: Any?, - respClass: TResp.Type, - responseItemType: Any.Type?, - responseCompletionHandler: @escaping ElectrodeBridgeResponseCompletionHandler) { - tag = String(describing: type(of: self)) - self.requestName = requestName - self.requestPayload = requestPayload - responseClass = respClass - self.responseItemType = responseItemType - self.responseCompletionHandler = responseCompletionHandler - super.init() - } - - public func execute() -> UUID? { - ElectrodeConsoleLogger.sharedInstance().debug("RequestProcessor started processing request (\(requestName)) with payload (\(String(describing: requestPayload)))") - let bridgeMessageData = ElectrodeUtilities.convertObjectToBridgeMessageData(object: requestPayload) - - let validRequest = ElectrodeBridgeRequest(name: requestName, data: bridgeMessageData) - - ElectrodeBridgeHolder.send(validRequest) { (responseData: Any?, failureMessage: ElectrodeFailureMessage?) in - if let failureMessage = failureMessage { - self.responseCompletionHandler(nil, failureMessage) - } else { - let processedResp: Any? - if self.responseClass != None.self { - processedResp = self.processSuccessResponse(responseData: responseData) - } else { - processedResp = nil - } - self.responseCompletionHandler(processedResp, nil) - } - } - return nil - } - - private func processSuccessResponse(responseData: Any?) -> Any? { - guard let anyData = responseData else { - return nil - } - - let generatedRes: Any? - do { - generatedRes = try NSObject.generateObject(data: anyData, classType: responseClass, itemType: responseItemType) - - } catch { - assertionFailure("Failed to convert responseData to valid obj") - generatedRes = nil - } - - return generatedRes - } -} diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeRequestRegistrar.h b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeRequestRegistrar.h deleted file mode 100644 index 75663791..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeRequestRegistrar.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import -#import "ElectrodeBridgeProtocols.h" - -NS_ASSUME_NONNULL_BEGIN -@interface ElectrodeRequestRegistrar : NSObject - -/** - Register a request handler with a given name. An error is returned if a handler - already exists for the given name. Only one request is allowed per name. - - @param name The name of the event in reverse url format. - @param completion The request handler that will parse and process a request. - */ -- (void) registerRequestCompletionHandlerWithName:(NSString *)name - uuid: (NSUUID *) uuid - completion: (ElectrodeBridgeRequestCompletionHandler) completion; - -/** - * Unregisters a request handler - * - * @param uuid - The UUID that was obtained through initial - * registerRequestHandler - * call - */ -- (nullable ElectrodeBridgeRequestCompletionHandler)unregisterRequestHandler:(NSUUID *)uuid; - -/** - Grabs a given request handler for a request name. - - @param name The name of the request, in reverse url format. - @return Returns a request handler for a specific name. - */ -- (nullable ElectrodeBridgeRequestCompletionHandler)getRequestHandler: - (NSString *)name; -- (void)reset; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeRequestRegistrar.m b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeRequestRegistrar.m deleted file mode 100644 index 7b18242a..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeRequestRegistrar.m +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "ElectrodeRequestRegistrar.h" -#import "ElectrodeLogger.h" -NS_ASSUME_NONNULL_BEGIN -@interface ElectrodeRequestRegistrar () - -@property(nonatomic, strong) NSMutableDictionary *requestNameByUUID; -@property(nonatomic, strong) NSMutableDictionary *requestHandlerByRequestName; - -@end - -@implementation ElectrodeRequestRegistrar - -- (void) registerRequestCompletionHandlerWithName:(NSString *)name - uuid: (NSUUID *) uuid - completion: (ElectrodeBridgeRequestCompletionHandler) completion { - @synchronized(self) { - ERNDebug(@"***Logging registering requestHandler with Name %@", name); - [self.requestHandlerByRequestName setObject:completion forKey:name]; - [self.requestNameByUUID setObject:name forKey:uuid]; - ERNDebug(@"***Logging registered requestHandlerDictionary:%@", - self.requestHandlerByRequestName); - } -} - -- (nullable ElectrodeBridgeRequestCompletionHandler)unregisterRequestHandler:(NSUUID *)uuid { - ElectrodeBridgeRequestCompletionHandler handler; - @synchronized(self) { - NSString *requestName = [self.requestNameByUUID objectForKey:uuid]; - - if (requestName) { - [self.requestNameByUUID removeObjectForKey:uuid]; - handler = [self.requestHandlerByRequestName objectForKey:requestName]; - [self.requestHandlerByRequestName removeObjectForKey:requestName]; - } - } - return handler; -} - -- (nullable ElectrodeBridgeRequestCompletionHandler)getRequestHandler: - (NSString *)name; -{ - ERNDebug(@"***Logging getting request handler requestHandlerDictionary:%@", - self.requestHandlerByRequestName); - ERNDebug(@"%@", self); - - @synchronized(self) { - return [self.requestHandlerByRequestName objectForKey:name]; - } -} - -- (void)reset { - self.requestNameByUUID = [[NSMutableDictionary alloc] init]; - self.requestHandlerByRequestName = [[NSMutableDictionary alloc] init]; -} -//////////////////////////////////////////////////////////////////////////////// -#pragma mark - Lazy Loading - -- (NSMutableDictionary *)requestNameByUUID { - // Lazy instatiation - if (!_requestNameByUUID) { - _requestNameByUUID = [[NSMutableDictionary alloc] init]; - } - - return _requestNameByUUID; -} - -- (NSMutableDictionary *)requestHandlerByRequestName { - // Lazy instatiation - if (!_requestHandlerByRequestName) { - _requestHandlerByRequestName = [[NSMutableDictionary alloc] init]; - } - - return _requestHandlerByRequestName; -} - -@end -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeUtilities.swift b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeUtilities.swift deleted file mode 100644 index aa5f1383..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/ElectrodeUtilities.swift +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import UIKit - -let kElectrodeBridgeRequestTimeoutTime = 10 - -let objectiveCPrimitives = [ - String.self, - String?.self, - Double.self, - Float.self, - Bool.self, - Int.self, - Int?.self, - Int8.self, - Int16.self, - Int32.self, - Int64.self, -] as [Any.Type] - -enum Property { - case Class(AnyClass) - case Struct -} - -public enum GenerateObjectError: Error { - case arrayTypeMissmatch - case emptyArrayItemType - case unsupportedType - case unBridgeable - case deserializationError -} - -extension NSObject { - - // Returns the property type - func getTypeOfProperty(_ name: String) -> Property? { - - var type: Mirror = Mirror(reflecting: self) - - for child in type.children { - if child.label! == name { - #if swift(>=4.0) - let res = Swift.type(of: child.value) - #else - let res = type(of: child.value) - #endif - let tmp = ElectrodeUtilities.isObjectiveCPrimitives(type: res) - return (!tmp) ? .Class(res) : .Struct - } - } - while let parent = type.superclassMirror { - for child in parent.children { - if child.label! == name { - #if swift(>=4.0) - let res = Swift.type(of: child.value) - #else - let res = type(of: child.value) - #endif - let tmp = ElectrodeUtilities.isObjectiveCPrimitives(type: res) - return (tmp) ? .Class(res) : .Struct - } - } - type = parent - } - return nil - } - - func toNSDictionary() -> NSDictionary { - let type: Mirror = Mirror(reflecting: self) - var res = [AnyHashable: Any]() - for case let (label, value) in type.children { - res[label!] = value - } - return res as NSDictionary - } - - static func generateObjectFromDict(data: [AnyHashable: Any], passedClass: AnyClass) throws -> AnyObject { - let stringForClass = String(reflecting: passedClass) - guard let obj = NSClassFromString(stringForClass) as? ElectrodeObject.Type else { - assertionFailure("Cannot proceed to convert dictionary to object type \(passedClass)") - return NSObject() - } - - let res = obj.init(dictionary: data) - return res - } - - public static func generateObject(data: Any, classType: Any.Type, itemType: Any.Type? = nil) throws -> Any { - var res: Any - // check to see if the type already matches. so no need to serialize or deserialize - if type(of: data) == classType && !(data is Array) { - return data - } - - if ElectrodeUtilities.isObjectiveCPrimitives(type: classType) { - res = data - } else if data is NSDictionary { - if let convertableData = data as? [AnyHashable: AnyObject] { - let obj = try NSObject.generateObjectFromDict(data: convertableData, passedClass: classType as! AnyClass) - res = obj - } else { - assertionFailure("failed here") - return NSString() - } - } else if data is Array { - if let arrayData = data as? Array { - var tmpRes = Array() - guard let validItemType = itemType else { throw GenerateObjectError.emptyArrayItemType } - for item in arrayData { - var obj: AnyObject - if ElectrodeUtilities.isObjectiveCPrimitives(type: validItemType) { - obj = item as AnyObject - } else { - obj = try NSObject.generateObject(data: item as AnyObject, classType: validItemType) as AnyObject - } - tmpRes.append(obj) - } - res = tmpRes as AnyObject - } else { - throw GenerateObjectError.unsupportedType - } - } else { - throw GenerateObjectError.unsupportedType - } - return res - } -} - -@objc class ElectrodeUtilities: NSObject { - - static func isObjectiveCPrimitives(type: Any.Type) -> Bool { - return (objectiveCPrimitives.contains(where: { (aClass) -> Bool in - aClass == type - })) - } - - static func convertObjectToBridgeMessageData(object: Any?) -> Any? { - - if let objectArray = object as? NSArray { - let converted = ElectrodeUtilities.convertArrayToDictionary(object: objectArray) - return converted - } - - let convertedData = ElectrodeUtilities.convertSingleItemToBridgeReadyData(object: object) - return convertedData - } - - private static func convertArrayToDictionary(object: NSArray) -> Array { - var res = [Any?]() - for item in object { - if let itemArray = item as? NSArray { - let convertedArray = ElectrodeUtilities.convertArrayToDictionary(object: itemArray) - res.append(convertedArray) - } else { - let convertedItem = ElectrodeUtilities.convertSingleItemToBridgeReadyData(object: item) - res.append(convertedItem) - } - } - return res - } - - private static func convertSingleItemToBridgeReadyData(object: Any?) -> Any? { - let bridgeMessageReadyDictionary: Any? - guard let validObject = object else { - bridgeMessageReadyDictionary = nil - return bridgeMessageReadyDictionary - } - #if swift(>=4.0) - let type = Swift.type(of: validObject) - #else - let type = type(of: validObject) - #endif - if ElectrodeUtilities.isObjectiveCPrimitives(type: type) { - return validObject - } - - if let bridgeableObject = validObject as? Bridgeable { - bridgeMessageReadyDictionary = bridgeableObject.toDictionary() - return bridgeMessageReadyDictionary - } - - return nil - } -} diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/EventListenerProcessor.swift b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/EventListenerProcessor.swift deleted file mode 100644 index be4b515b..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/EventListenerProcessor.swift +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import UIKit - -public class EventListenerProcessor: NSObject, Processor { - private let tag: String - private let eventName: String - private let eventPayloadClass: T.Type - private let appEventListener: ElectrodeBridgeEventListener - private let logger = ElectrodeConsoleLogger.sharedInstance() - - public init(eventName: String, eventPayloadClass: T.Type, eventListener: @escaping ElectrodeBridgeEventListener) { - tag = String(describing: type(of: self)) - self.eventName = eventName - self.eventPayloadClass = eventPayloadClass - appEventListener = eventListener - super.init() - } - - public func execute() -> UUID? { - let uuid = ElectrodeBridgeHolder.addEventListener(withName: eventName, eventListner: { (eventPayload: Any?) in - self.logger.debug("Processing final result for the event with payload bundle (\(String(describing: eventPayload)))") - let result = try? NSObject.generateObject(data: eventPayload as AnyObject, classType: self.eventPayloadClass) - self.appEventListener(result) - }) - return uuid - } -} diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/EventProcessor.swift b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/EventProcessor.swift deleted file mode 100644 index d5888bce..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/EventProcessor.swift +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import UIKit - -public class EventProcessor: NSObject, Processor { - private let tag: String - private let eventPayload: T? - private let eventName: String - private let logger = ElectrodeConsoleLogger.sharedInstance() - - public init(eventName: String, eventPayload: T?) { - tag = String(describing: type(of: self)) - self.eventName = eventName - self.eventPayload = eventPayload - super.init() - } - - public func execute() -> UUID? { - logger.debug("\(tag) EventProcessor is emitting event (\(eventName)) with payload (\(String(describing: eventPayload)))") - let event = ElectrodeBridgeEvent(name: eventName, type: .event, data: eventPayload) - ElectrodeBridgeHolder.send(event) - return nil - } -} diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/Info.plist b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/Info.plist deleted file mode 100644 index 239bb348..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/Info.plist +++ /dev/null @@ -1,29 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - NSPrincipalClass - - - diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/None.swift b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/None.swift deleted file mode 100644 index 7cf0e863..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/None.swift +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import UIKit - -public class None: NSObject, Bridgeable { - public func toDictionary() -> NSDictionary { - return NSDictionary() - } - - public init(emptyData _: Data?) { - } -} diff --git a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/Processor.swift b/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/Processor.swift deleted file mode 100644 index cb56de3e..00000000 --- a/ios/ElectrodeApiImpl/ElectrodeReactNativeBridge/Processor.swift +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2017 WalmartLabs - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import Foundation - -@objc public protocol Processor { - func execute() -> UUID? -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ART.xcodeproj/project.pbxproj b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ART.xcodeproj/project.pbxproj deleted file mode 100644 index 2aec17b1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ART.xcodeproj/project.pbxproj +++ /dev/null @@ -1,514 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 0CF68B051AF0549300FF9E5C /* ARTGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68ADE1AF0549300FF9E5C /* ARTGroup.m */; }; - 0CF68B061AF0549300FF9E5C /* ARTNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE01AF0549300FF9E5C /* ARTNode.m */; }; - 0CF68B071AF0549300FF9E5C /* ARTRenderable.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE21AF0549300FF9E5C /* ARTRenderable.m */; }; - 0CF68B081AF0549300FF9E5C /* ARTShape.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE41AF0549300FF9E5C /* ARTShape.m */; }; - 0CF68B091AF0549300FF9E5C /* ARTSurfaceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE61AF0549300FF9E5C /* ARTSurfaceView.m */; }; - 0CF68B0A1AF0549300FF9E5C /* ARTText.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE81AF0549300FF9E5C /* ARTText.m */; }; - 0CF68B0B1AF0549300FF9E5C /* ARTBrush.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AEC1AF0549300FF9E5C /* ARTBrush.m */; }; - 0CF68B0C1AF0549300FF9E5C /* ARTLinearGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AEE1AF0549300FF9E5C /* ARTLinearGradient.m */; }; - 0CF68B0D1AF0549300FF9E5C /* ARTPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF01AF0549300FF9E5C /* ARTPattern.m */; }; - 0CF68B0E1AF0549300FF9E5C /* ARTRadialGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF21AF0549300FF9E5C /* ARTRadialGradient.m */; }; - 0CF68B0F1AF0549300FF9E5C /* ARTSolidColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF41AF0549300FF9E5C /* ARTSolidColor.m */; }; - 0CF68B101AF0549300FF9E5C /* RCTConvert+ART.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF71AF0549300FF9E5C /* RCTConvert+ART.m */; }; - 0CF68B111AF0549300FF9E5C /* ARTGroupManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFA1AF0549300FF9E5C /* ARTGroupManager.m */; }; - 0CF68B121AF0549300FF9E5C /* ARTNodeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFC1AF0549300FF9E5C /* ARTNodeManager.m */; }; - 0CF68B131AF0549300FF9E5C /* ARTRenderableManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFE1AF0549300FF9E5C /* ARTRenderableManager.m */; }; - 0CF68B141AF0549300FF9E5C /* ARTShapeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B001AF0549300FF9E5C /* ARTShapeManager.m */; }; - 0CF68B151AF0549300FF9E5C /* ARTSurfaceViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B021AF0549300FF9E5C /* ARTSurfaceViewManager.m */; }; - 0CF68B161AF0549300FF9E5C /* ARTTextManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B041AF0549300FF9E5C /* ARTTextManager.m */; }; - 325CF7AD1E5F2ABA00AC9606 /* ARTBrush.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AEC1AF0549300FF9E5C /* ARTBrush.m */; }; - 325CF7AE1E5F2ABA00AC9606 /* ARTLinearGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AEE1AF0549300FF9E5C /* ARTLinearGradient.m */; }; - 325CF7AF1E5F2ABA00AC9606 /* ARTPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF01AF0549300FF9E5C /* ARTPattern.m */; }; - 325CF7B01E5F2ABA00AC9606 /* ARTRadialGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF21AF0549300FF9E5C /* ARTRadialGradient.m */; }; - 325CF7B11E5F2ABA00AC9606 /* ARTSolidColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF41AF0549300FF9E5C /* ARTSolidColor.m */; }; - 325CF7B21E5F2ABA00AC9606 /* ARTGroupManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFA1AF0549300FF9E5C /* ARTGroupManager.m */; }; - 325CF7B31E5F2ABA00AC9606 /* ARTNodeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFC1AF0549300FF9E5C /* ARTNodeManager.m */; }; - 325CF7B41E5F2ABA00AC9606 /* ARTRenderableManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFE1AF0549300FF9E5C /* ARTRenderableManager.m */; }; - 325CF7B51E5F2ABA00AC9606 /* ARTShapeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B001AF0549300FF9E5C /* ARTShapeManager.m */; }; - 325CF7B61E5F2ABA00AC9606 /* ARTSurfaceViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B021AF0549300FF9E5C /* ARTSurfaceViewManager.m */; }; - 325CF7B71E5F2ABA00AC9606 /* ARTTextManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B041AF0549300FF9E5C /* ARTTextManager.m */; }; - 325CF7B81E5F2ABA00AC9606 /* ARTGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68ADE1AF0549300FF9E5C /* ARTGroup.m */; }; - 325CF7B91E5F2ABA00AC9606 /* ARTNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE01AF0549300FF9E5C /* ARTNode.m */; }; - 325CF7BA1E5F2ABA00AC9606 /* ARTRenderable.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE21AF0549300FF9E5C /* ARTRenderable.m */; }; - 325CF7BB1E5F2ABA00AC9606 /* ARTShape.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE41AF0549300FF9E5C /* ARTShape.m */; }; - 325CF7BC1E5F2ABA00AC9606 /* ARTSurfaceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE61AF0549300FF9E5C /* ARTSurfaceView.m */; }; - 325CF7BD1E5F2ABA00AC9606 /* ARTText.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE81AF0549300FF9E5C /* ARTText.m */; }; - 325CF7BE1E5F2ABA00AC9606 /* RCTConvert+ART.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF71AF0549300FF9E5C /* RCTConvert+ART.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 0CF68ABF1AF0540F00FF9E5C /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 323A12851E5F266B004975B8 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 0CF68AC11AF0540F00FF9E5C /* libART.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libART.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 0CF68ADB1AF0549300FF9E5C /* ARTCGFloatArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTCGFloatArray.h; sourceTree = ""; }; - 0CF68ADC1AF0549300FF9E5C /* ARTContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTContainer.h; sourceTree = ""; }; - 0CF68ADD1AF0549300FF9E5C /* ARTGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTGroup.h; sourceTree = ""; }; - 0CF68ADE1AF0549300FF9E5C /* ARTGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTGroup.m; sourceTree = ""; }; - 0CF68ADF1AF0549300FF9E5C /* ARTNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTNode.h; sourceTree = ""; }; - 0CF68AE01AF0549300FF9E5C /* ARTNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTNode.m; sourceTree = ""; }; - 0CF68AE11AF0549300FF9E5C /* ARTRenderable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTRenderable.h; sourceTree = ""; }; - 0CF68AE21AF0549300FF9E5C /* ARTRenderable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTRenderable.m; sourceTree = ""; }; - 0CF68AE31AF0549300FF9E5C /* ARTShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTShape.h; sourceTree = ""; }; - 0CF68AE41AF0549300FF9E5C /* ARTShape.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTShape.m; sourceTree = ""; }; - 0CF68AE51AF0549300FF9E5C /* ARTSurfaceView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTSurfaceView.h; sourceTree = ""; }; - 0CF68AE61AF0549300FF9E5C /* ARTSurfaceView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTSurfaceView.m; sourceTree = ""; }; - 0CF68AE71AF0549300FF9E5C /* ARTText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTText.h; sourceTree = ""; }; - 0CF68AE81AF0549300FF9E5C /* ARTText.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTText.m; sourceTree = ""; }; - 0CF68AE91AF0549300FF9E5C /* ARTTextFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTTextFrame.h; sourceTree = ""; }; - 0CF68AEB1AF0549300FF9E5C /* ARTBrush.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTBrush.h; sourceTree = ""; }; - 0CF68AEC1AF0549300FF9E5C /* ARTBrush.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTBrush.m; sourceTree = ""; }; - 0CF68AED1AF0549300FF9E5C /* ARTLinearGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTLinearGradient.h; sourceTree = ""; }; - 0CF68AEE1AF0549300FF9E5C /* ARTLinearGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTLinearGradient.m; sourceTree = ""; }; - 0CF68AEF1AF0549300FF9E5C /* ARTPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTPattern.h; sourceTree = ""; }; - 0CF68AF01AF0549300FF9E5C /* ARTPattern.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTPattern.m; sourceTree = ""; }; - 0CF68AF11AF0549300FF9E5C /* ARTRadialGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTRadialGradient.h; sourceTree = ""; }; - 0CF68AF21AF0549300FF9E5C /* ARTRadialGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTRadialGradient.m; sourceTree = ""; }; - 0CF68AF31AF0549300FF9E5C /* ARTSolidColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTSolidColor.h; sourceTree = ""; }; - 0CF68AF41AF0549300FF9E5C /* ARTSolidColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTSolidColor.m; sourceTree = ""; }; - 0CF68AF61AF0549300FF9E5C /* RCTConvert+ART.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RCTConvert+ART.h"; sourceTree = ""; }; - 0CF68AF71AF0549300FF9E5C /* RCTConvert+ART.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RCTConvert+ART.m"; sourceTree = ""; }; - 0CF68AF91AF0549300FF9E5C /* ARTGroupManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTGroupManager.h; sourceTree = ""; }; - 0CF68AFA1AF0549300FF9E5C /* ARTGroupManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTGroupManager.m; sourceTree = ""; }; - 0CF68AFB1AF0549300FF9E5C /* ARTNodeManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTNodeManager.h; sourceTree = ""; }; - 0CF68AFC1AF0549300FF9E5C /* ARTNodeManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTNodeManager.m; sourceTree = ""; }; - 0CF68AFD1AF0549300FF9E5C /* ARTRenderableManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTRenderableManager.h; sourceTree = ""; }; - 0CF68AFE1AF0549300FF9E5C /* ARTRenderableManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTRenderableManager.m; sourceTree = ""; }; - 0CF68AFF1AF0549300FF9E5C /* ARTShapeManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTShapeManager.h; sourceTree = ""; }; - 0CF68B001AF0549300FF9E5C /* ARTShapeManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTShapeManager.m; sourceTree = ""; }; - 0CF68B011AF0549300FF9E5C /* ARTSurfaceViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTSurfaceViewManager.h; sourceTree = ""; }; - 0CF68B021AF0549300FF9E5C /* ARTSurfaceViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTSurfaceViewManager.m; sourceTree = ""; }; - 0CF68B031AF0549300FF9E5C /* ARTTextManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTTextManager.h; sourceTree = ""; }; - 0CF68B041AF0549300FF9E5C /* ARTTextManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTTextManager.m; sourceTree = ""; }; - 323A12871E5F266B004975B8 /* libART-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libART-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 0CF68ABE1AF0540F00FF9E5C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 323A12841E5F266B004975B8 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 0CF68AB81AF0540F00FF9E5C = { - isa = PBXGroup; - children = ( - 0CF68AEA1AF0549300FF9E5C /* Brushes */, - 0CF68AF81AF0549300FF9E5C /* ViewManagers */, - 0CF68ADB1AF0549300FF9E5C /* ARTCGFloatArray.h */, - 0CF68ADC1AF0549300FF9E5C /* ARTContainer.h */, - 0CF68ADD1AF0549300FF9E5C /* ARTGroup.h */, - 0CF68ADE1AF0549300FF9E5C /* ARTGroup.m */, - 0CF68ADF1AF0549300FF9E5C /* ARTNode.h */, - 0CF68AE01AF0549300FF9E5C /* ARTNode.m */, - 0CF68AE11AF0549300FF9E5C /* ARTRenderable.h */, - 0CF68AE21AF0549300FF9E5C /* ARTRenderable.m */, - 0CF68AE31AF0549300FF9E5C /* ARTShape.h */, - 0CF68AE41AF0549300FF9E5C /* ARTShape.m */, - 0CF68AE51AF0549300FF9E5C /* ARTSurfaceView.h */, - 0CF68AE61AF0549300FF9E5C /* ARTSurfaceView.m */, - 0CF68AE71AF0549300FF9E5C /* ARTText.h */, - 0CF68AE81AF0549300FF9E5C /* ARTText.m */, - 0CF68AE91AF0549300FF9E5C /* ARTTextFrame.h */, - 0CF68AF61AF0549300FF9E5C /* RCTConvert+ART.h */, - 0CF68AF71AF0549300FF9E5C /* RCTConvert+ART.m */, - 0CF68AC21AF0540F00FF9E5C /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 0CF68AC21AF0540F00FF9E5C /* Products */ = { - isa = PBXGroup; - children = ( - 0CF68AC11AF0540F00FF9E5C /* libART.a */, - 323A12871E5F266B004975B8 /* libART-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 0CF68AEA1AF0549300FF9E5C /* Brushes */ = { - isa = PBXGroup; - children = ( - 0CF68AEB1AF0549300FF9E5C /* ARTBrush.h */, - 0CF68AEC1AF0549300FF9E5C /* ARTBrush.m */, - 0CF68AED1AF0549300FF9E5C /* ARTLinearGradient.h */, - 0CF68AEE1AF0549300FF9E5C /* ARTLinearGradient.m */, - 0CF68AEF1AF0549300FF9E5C /* ARTPattern.h */, - 0CF68AF01AF0549300FF9E5C /* ARTPattern.m */, - 0CF68AF11AF0549300FF9E5C /* ARTRadialGradient.h */, - 0CF68AF21AF0549300FF9E5C /* ARTRadialGradient.m */, - 0CF68AF31AF0549300FF9E5C /* ARTSolidColor.h */, - 0CF68AF41AF0549300FF9E5C /* ARTSolidColor.m */, - ); - path = Brushes; - sourceTree = ""; - }; - 0CF68AF81AF0549300FF9E5C /* ViewManagers */ = { - isa = PBXGroup; - children = ( - 0CF68AF91AF0549300FF9E5C /* ARTGroupManager.h */, - 0CF68AFA1AF0549300FF9E5C /* ARTGroupManager.m */, - 0CF68AFB1AF0549300FF9E5C /* ARTNodeManager.h */, - 0CF68AFC1AF0549300FF9E5C /* ARTNodeManager.m */, - 0CF68AFD1AF0549300FF9E5C /* ARTRenderableManager.h */, - 0CF68AFE1AF0549300FF9E5C /* ARTRenderableManager.m */, - 0CF68AFF1AF0549300FF9E5C /* ARTShapeManager.h */, - 0CF68B001AF0549300FF9E5C /* ARTShapeManager.m */, - 0CF68B011AF0549300FF9E5C /* ARTSurfaceViewManager.h */, - 0CF68B021AF0549300FF9E5C /* ARTSurfaceViewManager.m */, - 0CF68B031AF0549300FF9E5C /* ARTTextManager.h */, - 0CF68B041AF0549300FF9E5C /* ARTTextManager.m */, - ); - path = ViewManagers; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 0CF68AC01AF0540F00FF9E5C /* ART */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0CF68AD51AF0540F00FF9E5C /* Build configuration list for PBXNativeTarget "ART" */; - buildPhases = ( - 0CF68ABD1AF0540F00FF9E5C /* Sources */, - 0CF68ABE1AF0540F00FF9E5C /* Frameworks */, - 0CF68ABF1AF0540F00FF9E5C /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = ART; - productName = ART; - productReference = 0CF68AC11AF0540F00FF9E5C /* libART.a */; - productType = "com.apple.product-type.library.static"; - }; - 323A12861E5F266B004975B8 /* ART-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 323A128D1E5F266B004975B8 /* Build configuration list for PBXNativeTarget "ART-tvOS" */; - buildPhases = ( - 323A12831E5F266B004975B8 /* Sources */, - 323A12841E5F266B004975B8 /* Frameworks */, - 323A12851E5F266B004975B8 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "ART-tvOS"; - productName = "ART-tvOS"; - productReference = 323A12871E5F266B004975B8 /* libART-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 0CF68AB91AF0540F00FF9E5C /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - TargetAttributes = { - 0CF68AC01AF0540F00FF9E5C = { - CreatedOnToolsVersion = 6.2; - }; - 323A12861E5F266B004975B8 = { - CreatedOnToolsVersion = 6.2; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 0CF68ABC1AF0540F00FF9E5C /* Build configuration list for PBXProject "ART" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 0CF68AB81AF0540F00FF9E5C; - productRefGroup = 0CF68AC21AF0540F00FF9E5C /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 0CF68AC01AF0540F00FF9E5C /* ART */, - 323A12861E5F266B004975B8 /* ART-tvOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 0CF68ABD1AF0540F00FF9E5C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0CF68B161AF0549300FF9E5C /* ARTTextManager.m in Sources */, - 0CF68B111AF0549300FF9E5C /* ARTGroupManager.m in Sources */, - 0CF68B0D1AF0549300FF9E5C /* ARTPattern.m in Sources */, - 0CF68B0A1AF0549300FF9E5C /* ARTText.m in Sources */, - 0CF68B121AF0549300FF9E5C /* ARTNodeManager.m in Sources */, - 0CF68B051AF0549300FF9E5C /* ARTGroup.m in Sources */, - 0CF68B131AF0549300FF9E5C /* ARTRenderableManager.m in Sources */, - 0CF68B091AF0549300FF9E5C /* ARTSurfaceView.m in Sources */, - 0CF68B0E1AF0549300FF9E5C /* ARTRadialGradient.m in Sources */, - 0CF68B151AF0549300FF9E5C /* ARTSurfaceViewManager.m in Sources */, - 0CF68B081AF0549300FF9E5C /* ARTShape.m in Sources */, - 0CF68B071AF0549300FF9E5C /* ARTRenderable.m in Sources */, - 0CF68B101AF0549300FF9E5C /* RCTConvert+ART.m in Sources */, - 0CF68B061AF0549300FF9E5C /* ARTNode.m in Sources */, - 0CF68B0F1AF0549300FF9E5C /* ARTSolidColor.m in Sources */, - 0CF68B0C1AF0549300FF9E5C /* ARTLinearGradient.m in Sources */, - 0CF68B0B1AF0549300FF9E5C /* ARTBrush.m in Sources */, - 0CF68B141AF0549300FF9E5C /* ARTShapeManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 323A12831E5F266B004975B8 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 325CF7B71E5F2ABA00AC9606 /* ARTTextManager.m in Sources */, - 325CF7B21E5F2ABA00AC9606 /* ARTGroupManager.m in Sources */, - 325CF7AF1E5F2ABA00AC9606 /* ARTPattern.m in Sources */, - 325CF7BD1E5F2ABA00AC9606 /* ARTText.m in Sources */, - 325CF7B31E5F2ABA00AC9606 /* ARTNodeManager.m in Sources */, - 325CF7B81E5F2ABA00AC9606 /* ARTGroup.m in Sources */, - 325CF7B41E5F2ABA00AC9606 /* ARTRenderableManager.m in Sources */, - 325CF7BC1E5F2ABA00AC9606 /* ARTSurfaceView.m in Sources */, - 325CF7B01E5F2ABA00AC9606 /* ARTRadialGradient.m in Sources */, - 325CF7B61E5F2ABA00AC9606 /* ARTSurfaceViewManager.m in Sources */, - 325CF7BB1E5F2ABA00AC9606 /* ARTShape.m in Sources */, - 325CF7BA1E5F2ABA00AC9606 /* ARTRenderable.m in Sources */, - 325CF7BE1E5F2ABA00AC9606 /* RCTConvert+ART.m in Sources */, - 325CF7B91E5F2ABA00AC9606 /* ARTNode.m in Sources */, - 325CF7B11E5F2ABA00AC9606 /* ARTSolidColor.m in Sources */, - 325CF7AE1E5F2ABA00AC9606 /* ARTLinearGradient.m in Sources */, - 325CF7AD1E5F2ABA00AC9606 /* ARTBrush.m in Sources */, - 325CF7B51E5F2ABA00AC9606 /* ARTShapeManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 0CF68AD31AF0540F00FF9E5C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 0CF68AD41AF0540F00FF9E5C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 0CF68AD61AF0540F00FF9E5C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 0CF68AD71AF0540F00FF9E5C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - 323A128E1E5F266B004975B8 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 323A128F1E5F266B004975B8 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 0CF68ABC1AF0540F00FF9E5C /* Build configuration list for PBXProject "ART" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0CF68AD31AF0540F00FF9E5C /* Debug */, - 0CF68AD41AF0540F00FF9E5C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 0CF68AD51AF0540F00FF9E5C /* Build configuration list for PBXNativeTarget "ART" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0CF68AD61AF0540F00FF9E5C /* Debug */, - 0CF68AD71AF0540F00FF9E5C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 323A128D1E5F266B004975B8 /* Build configuration list for PBXNativeTarget "ART-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 323A128E1E5F266B004975B8 /* Debug */, - 323A128F1E5F266B004975B8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 0CF68AB91AF0540F00FF9E5C /* Project object */; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTCGFloatArray.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTCGFloatArray.h deleted file mode 100644 index b26bcb1b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTCGFloatArray.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// A little helper to make sure we have the right memory allocation ready for use. -// We assume that we will only this in one place so no reference counting is necessary. -// Needs to be freed when deallocated. - -// This is fragile since this relies on these values not getting reused. Consider -// wrapping these in an Obj-C class or some ARC hackery to get refcounting. - -typedef struct { - size_t count; - CGFloat *array; -} ARTCGFloatArray; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTContainer.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTContainer.h deleted file mode 100644 index 5439d9fb..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTContainer.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@protocol ARTContainer - -// This is used as a hook for child to mark it's parent as dirty. -// This bubbles up to the root which gets marked as dirty. -- (void)invalidate; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTGroup.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTGroup.h deleted file mode 100644 index 31edddde..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTGroup.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "ARTContainer.h" -#import "ARTNode.h" - -@interface ARTGroup : ARTNode - -@property (nonatomic, assign) CGRect clipping; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTGroup.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTGroup.m deleted file mode 100644 index 56699114..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTGroup.m +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTGroup.h" - -@implementation ARTGroup - -- (void)renderLayerTo:(CGContextRef)context -{ - - if (!CGRectIsEmpty(self.clipping)) { - CGContextClipToRect(context, self.clipping); - } - - for (ARTNode *node in self.subviews) { - [node renderTo:context]; - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTNode.h deleted file mode 100644 index 9f381115..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTNode.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -/** - * ART nodes are implemented as empty UIViews but this is just an implementation detail to fit - * into the existing view management. They should also be shadow views and painted on a background - * thread. - */ - -@interface ARTNode : UIView - -@property (nonatomic, assign) CGFloat opacity; - -- (void)invalidate; -- (void)renderTo:(CGContextRef)context; - -/** - * renderTo will take opacity into account and draw renderLayerTo off-screen if there is opacity - * specified, then composite that onto the context. renderLayerTo always draws at opacity=1. - * @abstract - */ -- (void)renderLayerTo:(CGContextRef)context; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTNode.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTNode.m deleted file mode 100644 index ae1a152a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTNode.m +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTNode.h" - -#import "ARTContainer.h" - -@implementation ARTNode - -- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex -{ - [super insertReactSubview:subview atIndex:atIndex]; - [self insertSubview:subview atIndex:atIndex]; - [self invalidate]; -} - -- (void)removeReactSubview:(UIView *)subview -{ - [super removeReactSubview:subview]; - [self invalidate]; -} - -- (void)didUpdateReactSubviews -{ - // Do nothing, as subviews are inserted by insertReactSubview: -} - -- (void)setOpacity:(CGFloat)opacity -{ - [self invalidate]; - _opacity = opacity; -} - -- (void)setTransform:(CGAffineTransform)transform -{ - [self invalidate]; - super.transform = transform; -} - -- (void)invalidate -{ - id container = (id)self.superview; - [container invalidate]; -} - -- (void)renderTo:(CGContextRef)context -{ - if (self.opacity <= 0) { - // Nothing to paint - return; - } - if (self.opacity >= 1) { - // Just paint at full opacity - CGContextSaveGState(context); - CGContextConcatCTM(context, self.transform); - CGContextSetAlpha(context, 1); - [self renderLayerTo:context]; - CGContextRestoreGState(context); - return; - } - // This needs to be painted on a layer before being composited. - CGContextSaveGState(context); - CGContextConcatCTM(context, self.transform); - CGContextSetAlpha(context, self.opacity); - CGContextBeginTransparencyLayer(context, NULL); - [self renderLayerTo:context]; - CGContextEndTransparencyLayer(context); - CGContextRestoreGState(context); -} - -- (void)renderLayerTo:(CGContextRef)context -{ - // abstract -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTRenderable.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTRenderable.h deleted file mode 100644 index 077d47ec..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTRenderable.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "ARTBrush.h" -#import "ARTCGFloatArray.h" -#import "ARTNode.h" - -@interface ARTRenderable : ARTNode - -@property (nonatomic, strong) ARTBrush *fill; -@property (nonatomic, assign) CGColorRef stroke; -@property (nonatomic, assign) CGFloat strokeWidth; -@property (nonatomic, assign) CGLineCap strokeCap; -@property (nonatomic, assign) CGLineJoin strokeJoin; -@property (nonatomic, assign) ARTCGFloatArray strokeDash; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTRenderable.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTRenderable.m deleted file mode 100644 index 88349f82..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTRenderable.m +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTRenderable.h" - -@implementation ARTRenderable - -- (void)setFill:(ARTBrush *)fill -{ - [self invalidate]; - _fill = fill; -} - -- (void)setStroke:(CGColorRef)stroke -{ - if (stroke == _stroke) { - return; - } - [self invalidate]; - CGColorRelease(_stroke); - _stroke = CGColorRetain(stroke); -} - -- (void)setStrokeWidth:(CGFloat)strokeWidth -{ - [self invalidate]; - _strokeWidth = strokeWidth; -} - -- (void)setStrokeCap:(CGLineCap)strokeCap -{ - [self invalidate]; - _strokeCap = strokeCap; -} - -- (void)setStrokeJoin:(CGLineJoin)strokeJoin -{ - [self invalidate]; - _strokeJoin = strokeJoin; -} - -- (void)setStrokeDash:(ARTCGFloatArray)strokeDash -{ - if (strokeDash.array == _strokeDash.array) { - return; - } - if (_strokeDash.array) { - free(_strokeDash.array); - } - [self invalidate]; - _strokeDash = strokeDash; -} - -- (void)dealloc -{ - CGColorRelease(_stroke); - if (_strokeDash.array) { - free(_strokeDash.array); - } -} - -- (void)renderTo:(CGContextRef)context -{ - if (self.opacity <= 0 || self.opacity >= 1 || (self.fill && self.stroke)) { - // If we have both fill and stroke, we will need to paint this using normal compositing - [super renderTo: context]; - return; - } - // This is a terminal with only one painting. Therefore we don't need to paint this - // off-screen. We can just composite it straight onto the buffer. - CGContextSaveGState(context); - CGContextConcatCTM(context, self.transform); - CGContextSetAlpha(context, self.opacity); - [self renderLayerTo:context]; - CGContextRestoreGState(context); -} - -- (void)renderLayerTo:(CGContextRef)context -{ - // abstract -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTSerializablePath.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTSerializablePath.js deleted file mode 100644 index aafb74c4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTSerializablePath.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -// TODO: Move this into an ART mode called "serialized" or something - -const Class = require('art/core/class.js'); -const Path = require('art/core/path.js'); - -const MOVE_TO = 0; -const CLOSE = 1; -const LINE_TO = 2; -const CURVE_TO = 3; -const ARC = 4; - -const SerializablePath = Class(Path, { - initialize: function(path) { - this.reset(); - if (path instanceof SerializablePath) { - this.path = path.path.slice(0); - } else if (path) { - if (path.applyToPath) { - path.applyToPath(this); - } else { - this.push(path); - } - } - }, - - onReset: function() { - this.path = []; - }, - - onMove: function(sx, sy, x, y) { - this.path.push(MOVE_TO, x, y); - }, - - onLine: function(sx, sy, x, y) { - this.path.push(LINE_TO, x, y); - }, - - onBezierCurve: function(sx, sy, p1x, p1y, p2x, p2y, x, y) { - this.path.push(CURVE_TO, p1x, p1y, p2x, p2y, x, y); - }, - - _arcToBezier: Path.prototype.onArc, - - onArc: function(sx, sy, ex, ey, cx, cy, rx, ry, sa, ea, ccw, rotation) { - if (rx !== ry || rotation) { - return this._arcToBezier( - sx, - sy, - ex, - ey, - cx, - cy, - rx, - ry, - sa, - ea, - ccw, - rotation, - ); - } - this.path.push(ARC, cx, cy, rx, sa, ea, ccw ? 0 : 1); - }, - - onClose: function() { - this.path.push(CLOSE); - }, - - toJSON: function() { - return this.path; - }, -}); - -module.exports = SerializablePath; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTShape.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTShape.h deleted file mode 100644 index 1a1fd429..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTShape.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "ARTRenderable.h" - -@interface ARTShape : ARTRenderable - -@property (nonatomic, assign) CGPathRef d; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTShape.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTShape.m deleted file mode 100644 index 8a1a7d69..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTShape.m +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTShape.h" - -@implementation ARTShape - -- (void)setD:(CGPathRef)d -{ - if (d == _d) { - return; - } - [self invalidate]; - CGPathRelease(_d); - _d = CGPathRetain(d); -} - -- (void)dealloc -{ - CGPathRelease(_d); -} - -- (void)renderLayerTo:(CGContextRef)context -{ - if ((!self.fill && !self.stroke) || !self.d) { - return; - } - - CGPathDrawingMode mode = kCGPathStroke; - if (self.fill) { - if ([self.fill applyFillColor:context]) { - mode = kCGPathFill; - } else { - CGContextSaveGState(context); - CGContextAddPath(context, self.d); - CGContextClip(context); - [self.fill paint:context]; - CGContextRestoreGState(context); - if (!self.stroke) { - return; - } - } - } - if (self.stroke) { - CGContextSetStrokeColorWithColor(context, self.stroke); - CGContextSetLineWidth(context, self.strokeWidth); - CGContextSetLineCap(context, self.strokeCap); - CGContextSetLineJoin(context, self.strokeJoin); - ARTCGFloatArray dash = self.strokeDash; - if (dash.count) { - CGContextSetLineDash(context, 0, dash.array, dash.count); - } - if (mode == kCGPathFill) { - mode = kCGPathFillStroke; - } - } - - CGContextAddPath(context, self.d); - CGContextDrawPath(context, mode); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTSurfaceView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTSurfaceView.h deleted file mode 100644 index 34016b9e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTSurfaceView.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "ARTContainer.h" - -@interface ARTSurfaceView : UIView - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTSurfaceView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTSurfaceView.m deleted file mode 100644 index 7e033690..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTSurfaceView.m +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTSurfaceView.h" - -#import - -#import "ARTNode.h" - -@implementation ARTSurfaceView - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - self.opaque = NO; - } - - return self; -} - -- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex -{ - [super insertReactSubview:subview atIndex:atIndex]; - [self insertSubview:subview atIndex:atIndex]; - [self invalidate]; -} - -- (void)removeReactSubview:(UIView *)subview -{ - [super removeReactSubview:subview]; - [self invalidate]; -} - -- (void)didUpdateReactSubviews -{ - // Do nothing, as subviews are inserted by insertReactSubview: -} - -- (void)invalidate -{ - [self setNeedsDisplay]; -} - -- (void)drawRect:(CGRect)rect -{ - CGContextRef context = UIGraphicsGetCurrentContext(); - for (ARTNode *node in self.subviews) { - [node renderTo:context]; - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTText.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTText.h deleted file mode 100644 index 1431fc5e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTText.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "ARTRenderable.h" -#import "ARTTextFrame.h" - -@interface ARTText : ARTRenderable - -@property (nonatomic, assign) CTTextAlignment alignment; -@property (nonatomic, assign) ARTTextFrame textFrame; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTText.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTText.m deleted file mode 100644 index 5bcebdf5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTText.m +++ /dev/null @@ -1,125 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTText.h" - -#import - -@implementation ARTText - -- (void)setAlignment:(CTTextAlignment)alignment -{ - [self invalidate]; - _alignment = alignment; -} - -static void ARTFreeTextFrame(ARTTextFrame frame) -{ - if (frame.count) { - // We must release each line before freeing up this struct - for (int i = 0; i < frame.count; i++) { - CFRelease(frame.lines[i]); - } - free(frame.lines); - free(frame.widths); - } -} - -- (void)setTextFrame:(ARTTextFrame)frame -{ - if (frame.lines != _textFrame.lines) { - ARTFreeTextFrame(_textFrame); - } - [self invalidate]; - _textFrame = frame; -} - -- (void)dealloc -{ - ARTFreeTextFrame(_textFrame); -} - -- (void)renderLayerTo:(CGContextRef)context -{ - ARTTextFrame frame = self.textFrame; - - if ((!self.fill && !self.stroke) || !frame.count) { - return; - } - - // to-do: draw along a path - - CGTextDrawingMode mode = kCGTextStroke; - if (self.fill) { - if ([self.fill applyFillColor:context]) { - mode = kCGTextFill; - } else { - - for (int i = 0; i < frame.count; i++) { - CGContextSaveGState(context); - // Inverse the coordinate space since CoreText assumes a bottom-up coordinate space - CGContextScaleCTM(context, 1.0, -1.0); - CGContextSetTextDrawingMode(context, kCGTextClip); - [self renderLineTo:context atIndex:i]; - // Inverse the coordinate space back to the original before filling - CGContextScaleCTM(context, 1.0, -1.0); - [self.fill paint:context]; - // Restore the state so that the next line can be clipped separately - CGContextRestoreGState(context); - } - - if (!self.stroke) { - return; - } - } - } - if (self.stroke) { - CGContextSetStrokeColorWithColor(context, self.stroke); - CGContextSetLineWidth(context, self.strokeWidth); - CGContextSetLineCap(context, self.strokeCap); - CGContextSetLineJoin(context, self.strokeJoin); - ARTCGFloatArray dash = self.strokeDash; - if (dash.count) { - CGContextSetLineDash(context, 0, dash.array, dash.count); - } - if (mode == kCGTextFill) { - mode = kCGTextFillStroke; - } - } - - CGContextSetTextDrawingMode(context, mode); - - // Inverse the coordinate space since CoreText assumes a bottom-up coordinate space - CGContextScaleCTM(context, 1.0, -1.0); - for (int i = 0; i < frame.count; i++) { - [self renderLineTo:context atIndex:i]; - } -} - -- (void)renderLineTo:(CGContextRef)context atIndex:(int)index -{ - ARTTextFrame frame = self.textFrame; - CGFloat shift; - switch (self.alignment) { - case kCTTextAlignmentRight: - shift = frame.widths[index]; - break; - case kCTTextAlignmentCenter: - shift = (frame.widths[index] / 2); - break; - default: - shift = 0; - break; - } - // We should consider snapping this shift to device pixels to improve rendering quality - // when a line has subpixel width. - CGContextSetTextPosition(context, -shift, -frame.baseLine - frame.lineHeight * index); - CTLineRef line = frame.lines[index]; - CTLineDraw(line, context); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTTextFrame.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTTextFrame.h deleted file mode 100644 index 00e61ce2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ARTTextFrame.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -// A little helper to make sure we have a set of lines including width ready for use. -// We assume that we will only this in one place so no reference counting is necessary. -// Needs to be freed when deallocated. - -// This is fragile since this relies on these values not getting reused. Consider -// wrapping these in an Obj-C class or some ARC hackery to get refcounting. - -typedef struct { - size_t count; - CGFloat baseLine; // Distance from the origin to the base line of the first line - CGFloat lineHeight; // Distance between lines - CTLineRef *lines; - CGFloat *widths; // Width of each line -} ARTTextFrame; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTBrush.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTBrush.h deleted file mode 100644 index f6e39e86..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTBrush.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -@interface ARTBrush : NSObject - -/* @abstract */ -- (instancetype)initWithArray:(NSArray *)data NS_DESIGNATED_INITIALIZER; - -/** - * For certain brushes we can fast path a combined fill and stroke. - * For those brushes we override applyFillColor which sets the fill - * color to be used by those batch paints. Those return YES. - * We can't batch gradient painting in CoreGraphics, so those will - * return NO and paint gets called instead. - * @abstract - */ -- (BOOL)applyFillColor:(CGContextRef)context; - -/** - * paint fills the context with a brush. The context is assumed to - * be clipped. - * @abstract - */ -- (void)paint:(CGContextRef)context; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTBrush.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTBrush.m deleted file mode 100644 index 969ad5d7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTBrush.m +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTBrush.h" - -#import - -@implementation ARTBrush - -- (instancetype)initWithArray:(NSArray *)data -{ - return [super init]; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (BOOL)applyFillColor:(CGContextRef)context -{ - return NO; -} - -- (void)paint:(CGContextRef)context -{ - // abstract -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTLinearGradient.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTLinearGradient.h deleted file mode 100644 index d289b192..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTLinearGradient.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTBrush.h" - -@interface ARTLinearGradient : ARTBrush - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTLinearGradient.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTLinearGradient.m deleted file mode 100644 index 20bd1af6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTLinearGradient.m +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTLinearGradient.h" - -#import - -#import "RCTConvert+ART.h" - -@implementation ARTLinearGradient -{ - CGGradientRef _gradient; - CGPoint _startPoint; - CGPoint _endPoint; -} - -- (instancetype)initWithArray:(NSArray *)array -{ - if ((self = [super initWithArray:array])) { - if (array.count < 5) { - RCTLogError(@"-[%@ %@] expects 5 elements, received %@", - self.class, NSStringFromSelector(_cmd), array); - return nil; - } - _startPoint = [RCTConvert CGPoint:array offset:1]; - _endPoint = [RCTConvert CGPoint:array offset:3]; - _gradient = CGGradientRetain([RCTConvert CGGradient:array offset:5]); - } - return self; -} - -- (void)dealloc -{ - CGGradientRelease(_gradient); -} - -- (void)paint:(CGContextRef)context -{ - CGGradientDrawingOptions extendOptions = - kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation; - CGContextDrawLinearGradient(context, _gradient, _startPoint, _endPoint, extendOptions); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTPattern.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTPattern.h deleted file mode 100644 index 11fa9354..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTPattern.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTBrush.h" - -@interface ARTPattern : ARTBrush - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTPattern.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTPattern.m deleted file mode 100644 index 70e0bd25..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTPattern.m +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTPattern.h" - -#import - -#import "RCTConvert+ART.h" - -@implementation ARTPattern -{ - CGImageRef _image; - CGRect _rect; -} - -- (instancetype)initWithArray:(NSArray *)array -{ - if ((self = [super initWithArray:array])) { - if (array.count < 6) { - RCTLogError(@"-[%@ %@] expects 6 elements, received %@", - self.class, NSStringFromSelector(_cmd), array); - return nil; - } - _image = CGImageRetain([RCTConvert CGImage:array[1]]); - _rect = [RCTConvert CGRect:array offset:2]; - } - return self; -} - -- (void)dealloc -{ - CGImageRelease(_image); -} - -// Note: This could use applyFillColor with a pattern. This could be more efficient but -// to do that, we need to calculate our own user space CTM. - -- (void)paint:(CGContextRef)context -{ - CGContextDrawTiledImage(context, _rect, _image); -} - - - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTRadialGradient.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTRadialGradient.h deleted file mode 100644 index 98bec026..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTRadialGradient.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTBrush.h" - -@interface ARTRadialGradient : ARTBrush - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTRadialGradient.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTRadialGradient.m deleted file mode 100644 index c36f6ce5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTRadialGradient.m +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTRadialGradient.h" - -#import - -#import "RCTConvert+ART.h" - -@implementation ARTRadialGradient -{ - CGGradientRef _gradient; - CGPoint _focusPoint; - CGPoint _centerPoint; - CGFloat _radius; - CGFloat _radiusRatio; -} - -- (instancetype)initWithArray:(NSArray *)array -{ - if ((self = [super initWithArray:array])) { - if (array.count < 7) { - RCTLogError(@"-[%@ %@] expects 7 elements, received %@", - self.class, NSStringFromSelector(_cmd), array); - return nil; - } - _radius = [RCTConvert CGFloat:array[3]]; - _radiusRatio = [RCTConvert CGFloat:array[4]] / _radius; - _focusPoint.x = [RCTConvert CGFloat:array[1]]; - _focusPoint.y = [RCTConvert CGFloat:array[2]] / _radiusRatio; - _centerPoint.x = [RCTConvert CGFloat:array[5]]; - _centerPoint.y = [RCTConvert CGFloat:array[6]] / _radiusRatio; - _gradient = CGGradientRetain([RCTConvert CGGradient:array offset:7]); - } - return self; -} - -- (void)dealloc -{ - CGGradientRelease(_gradient); -} - -- (void)paint:(CGContextRef)context -{ - CGAffineTransform transform = CGAffineTransformMakeScale(1, _radiusRatio); - CGContextConcatCTM(context, transform); - CGGradientDrawingOptions extendOptions = kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation; - CGContextDrawRadialGradient(context, _gradient, _focusPoint, 0, _centerPoint, _radius, extendOptions); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTSolidColor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTSolidColor.h deleted file mode 100644 index 9880cfd6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTSolidColor.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTBrush.h" - -@interface ARTSolidColor : ARTBrush - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTSolidColor.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTSolidColor.m deleted file mode 100644 index 2ef02d43..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/Brushes/ARTSolidColor.m +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTSolidColor.h" - -#import - -#import "RCTConvert+ART.h" - -@implementation ARTSolidColor -{ - CGColorRef _color; -} - -- (instancetype)initWithArray:(NSArray *)array -{ - if ((self = [super initWithArray:array])) { - _color = CGColorRetain([RCTConvert CGColor:array offset:1]); - } - return self; -} - -- (void)dealloc -{ - CGColorRelease(_color); -} - -- (BOOL)applyFillColor:(CGContextRef)context -{ - CGContextSetFillColorWithColor(context, _color); - return YES; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/RCTConvert+ART.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/RCTConvert+ART.h deleted file mode 100644 index 5fe3b4ed..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/RCTConvert+ART.h +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#import "ARTBrush.h" -#import "ARTCGFloatArray.h" -#import "ARTTextFrame.h" - -@interface RCTConvert (ART) - -+ (CGPathRef)CGPath:(id)json CF_RETURNS_NOT_RETAINED; -+ (CTTextAlignment)CTTextAlignment:(id)json; -+ (ARTTextFrame)ARTTextFrame:(id)json; -+ (ARTCGFloatArray)ARTCGFloatArray:(id)json; -+ (ARTBrush *)ARTBrush:(id)json; - -+ (CGPoint)CGPoint:(id)json offset:(NSUInteger)offset; -+ (CGRect)CGRect:(id)json offset:(NSUInteger)offset; -+ (CGColorRef)CGColor:(id)json offset:(NSUInteger)offset CF_RETURNS_NOT_RETAINED; -+ (CGGradientRef)CGGradient:(id)json offset:(NSUInteger)offset CF_RETURNS_NOT_RETAINED; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/RCTConvert+ART.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/RCTConvert+ART.m deleted file mode 100644 index 3312e319..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/RCTConvert+ART.m +++ /dev/null @@ -1,222 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTConvert+ART.h" - -#import -#import - -#import "ARTLinearGradient.h" -#import "ARTPattern.h" -#import "ARTRadialGradient.h" -#import "ARTSolidColor.h" - -@implementation RCTConvert (ART) - -+ (CGPathRef)CGPath:(id)json -{ - NSArray *arr = [self NSNumberArray:json]; - - NSUInteger count = [arr count]; - -#define NEXT_VALUE [self double:arr[i++]] - - CGMutablePathRef path = CGPathCreateMutable(); - CGPathMoveToPoint(path, NULL, 0, 0); - - @try { - NSUInteger i = 0; - while (i < count) { - NSUInteger type = [arr[i++] unsignedIntegerValue]; - switch (type) { - case 0: - CGPathMoveToPoint(path, NULL, NEXT_VALUE, NEXT_VALUE); - break; - case 1: - CGPathCloseSubpath(path); - break; - case 2: - CGPathAddLineToPoint(path, NULL, NEXT_VALUE, NEXT_VALUE); - break; - case 3: - CGPathAddCurveToPoint(path, NULL, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE); - break; - case 4: - CGPathAddArc(path, NULL, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE == 0); - break; - default: - RCTLogError(@"Invalid CGPath type %llu at element %llu of %@", (unsigned long long)type, (unsigned long long)i, arr); - CGPathRelease(path); - return NULL; - } - } - } - @catch (NSException *exception) { - RCTLogError(@"Invalid CGPath format: %@", arr); - CGPathRelease(path); - return NULL; - } - - return (CGPathRef)CFAutorelease(path); -} - -RCT_ENUM_CONVERTER(CTTextAlignment, (@{ - @"auto": @(kCTTextAlignmentNatural), - @"left": @(kCTTextAlignmentLeft), - @"center": @(kCTTextAlignmentCenter), - @"right": @(kCTTextAlignmentRight), - @"justify": @(kCTTextAlignmentJustified), -}), kCTTextAlignmentNatural, integerValue) - -// This takes a tuple of text lines and a font to generate a CTLine for each text line. -// This prepares everything for rendering a frame of text in ARTText. -+ (ARTTextFrame)ARTTextFrame:(id)json -{ - NSDictionary *dict = [self NSDictionary:json]; - ARTTextFrame frame; - frame.count = 0; - - NSArray *lines = [self NSArray:dict[@"lines"]]; - NSUInteger lineCount = [lines count]; - if (lineCount == 0) { - return frame; - } - - CTFontRef font = (__bridge CTFontRef)[self UIFont:dict[@"font"]]; - if (!font) { - return frame; - } - - // Create a dictionary for this font - CFDictionaryRef attributes = (__bridge CFDictionaryRef)@{ - (NSString *)kCTFontAttributeName:(__bridge id)font, - (NSString *)kCTForegroundColorFromContextAttributeName: @YES - }; - - // Set up text frame with font metrics - CGFloat size = CTFontGetSize(font); - frame.count = lineCount; - frame.baseLine = size; // estimate base line - frame.lineHeight = size * 1.1; // Base on ART canvas line height estimate - frame.lines = malloc(sizeof(CTLineRef) * lineCount); - frame.widths = malloc(sizeof(CGFloat) * lineCount); - - [lines enumerateObjectsUsingBlock:^(NSString *text, NSUInteger i, BOOL *stop) { - - CFStringRef string = (__bridge CFStringRef)text; - CFAttributedStringRef attrString = CFAttributedStringCreate(kCFAllocatorDefault, string, attributes); - CTLineRef line = CTLineCreateWithAttributedString(attrString); - CFRelease(attrString); - - frame.lines[i] = line; - frame.widths[i] = CTLineGetTypographicBounds(line, NULL, NULL, NULL); - }]; - - return frame; -} - -+ (ARTCGFloatArray)ARTCGFloatArray:(id)json -{ - NSArray *arr = [self NSNumberArray:json]; - NSUInteger count = arr.count; - - ARTCGFloatArray array; - array.count = count; - array.array = NULL; - - if (count) { - // Ideally, these arrays should already use the same memory layout. - // In that case we shouldn't need this new malloc. - array.array = malloc(sizeof(CGFloat) * count); - for (NSUInteger i = 0; i < count; i++) { - array.array[i] = [arr[i] doubleValue]; - } - } - - return array; -} - -+ (ARTBrush *)ARTBrush:(id)json -{ - NSArray *arr = [self NSArray:json]; - NSUInteger type = [self NSUInteger:arr.firstObject]; - switch (type) { - case 0: // solid color - // These are probably expensive allocations since it's often the same value. - // We should memoize colors but look ups may be just as expensive. - return [[ARTSolidColor alloc] initWithArray:arr]; - case 1: // linear gradient - return [[ARTLinearGradient alloc] initWithArray:arr]; - case 2: // radial gradient - return [[ARTRadialGradient alloc] initWithArray:arr]; - case 3: // pattern - return [[ARTPattern alloc] initWithArray:arr]; - default: - RCTLogError(@"Unknown brush type: %llu", (unsigned long long)type); - return nil; - } -} - -+ (CGPoint)CGPoint:(id)json offset:(NSUInteger)offset -{ - NSArray *arr = [self NSArray:json]; - if (arr.count < offset + 2) { - RCTLogError(@"Too few elements in array (expected at least %llu): %@", (unsigned long long)(2 + offset), arr); - return CGPointZero; - } - return (CGPoint){ - [self CGFloat:arr[offset]], - [self CGFloat:arr[offset + 1]], - }; -} - -+ (CGRect)CGRect:(id)json offset:(NSUInteger)offset -{ - NSArray *arr = [self NSArray:json]; - if (arr.count < offset + 4) { - RCTLogError(@"Too few elements in array (expected at least %llu): %@", (unsigned long long)(4 + offset), arr); - return CGRectZero; - } - return (CGRect){ - {[self CGFloat:arr[offset]], [self CGFloat:arr[offset + 1]]}, - {[self CGFloat:arr[offset + 2]], [self CGFloat:arr[offset + 3]]}, - }; -} - -+ (CGColorRef)CGColor:(id)json offset:(NSUInteger)offset -{ - NSArray *arr = [self NSArray:json]; - if (arr.count < offset + 4) { - RCTLogError(@"Too few elements in array (expected at least %llu): %@", (unsigned long long)(4 + offset), arr); - return NULL; - } - return [self CGColor:[arr subarrayWithRange:(NSRange){offset, 4}]]; -} - -+ (CGGradientRef)CGGradient:(id)json offset:(NSUInteger)offset -{ - NSArray *arr = [self NSArray:json]; - if (arr.count < offset) { - RCTLogError(@"Too few elements in array (expected at least %llu): %@", (unsigned long long)offset, arr); - return NULL; - } - arr = [arr subarrayWithRange:(NSRange){offset, arr.count - offset}]; - ARTCGFloatArray colorsAndOffsets = [self ARTCGFloatArray:arr]; - size_t stops = colorsAndOffsets.count / 5; - CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB(); - CGGradientRef gradient = CGGradientCreateWithColorComponents( - rgb, - colorsAndOffsets.array, - colorsAndOffsets.array + stops * 4, - stops - ); - CGColorSpaceRelease(rgb); - free(colorsAndOffsets.array); - return (CGGradientRef)CFAutorelease(gradient); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ReactNativeART.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ReactNativeART.js deleted file mode 100644 index 1ac9a5e1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ReactNativeART.js +++ /dev/null @@ -1,612 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const Color = require('art/core/color'); -const Path = require('ARTSerializablePath'); -const Transform = require('art/core/transform'); - -const React = require('React'); -const PropTypes = require('prop-types'); -const ReactNativeViewAttributes = require('ReactNativeViewAttributes'); - -const createReactNativeComponentClass = require('createReactNativeComponentClass'); -const merge = require('merge'); -const invariant = require('invariant'); - -// Diff Helpers - -function arrayDiffer(a, b) { - if (a == null || b == null) { - return true; - } - if (a.length !== b.length) { - return true; - } - for (let i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return true; - } - } - return false; -} - -function fontAndLinesDiffer(a, b) { - if (a === b) { - return false; - } - if (a.font !== b.font) { - if (a.font === null) { - return true; - } - if (b.font === null) { - return true; - } - - if ( - a.font.fontFamily !== b.font.fontFamily || - a.font.fontSize !== b.font.fontSize || - a.font.fontWeight !== b.font.fontWeight || - a.font.fontStyle !== b.font.fontStyle - ) { - return true; - } - } - return arrayDiffer(a.lines, b.lines); -} - -// Native Attributes - -const SurfaceViewAttributes = merge(ReactNativeViewAttributes.UIView, { - // This should contain pixel information such as width, height and - // resolution to know what kind of buffer needs to be allocated. - // Currently we rely on UIViews and style to figure that out. -}); - -const NodeAttributes = { - transform: {diff: arrayDiffer}, - opacity: true, -}; - -const GroupAttributes = merge(NodeAttributes, { - clipping: {diff: arrayDiffer}, -}); - -const RenderableAttributes = merge(NodeAttributes, { - fill: {diff: arrayDiffer}, - stroke: {diff: arrayDiffer}, - strokeWidth: true, - strokeCap: true, - strokeJoin: true, - strokeDash: {diff: arrayDiffer}, -}); - -const ShapeAttributes = merge(RenderableAttributes, { - d: {diff: arrayDiffer}, -}); - -const TextAttributes = merge(RenderableAttributes, { - alignment: true, - frame: {diff: fontAndLinesDiffer}, - path: {diff: arrayDiffer}, -}); - -// Native Components - -const NativeSurfaceView = createReactNativeComponentClass( - 'ARTSurfaceView', - () => ({ - validAttributes: SurfaceViewAttributes, - uiViewClassName: 'ARTSurfaceView', - }), -); - -const NativeGroup = createReactNativeComponentClass('ARTGroup', () => ({ - validAttributes: GroupAttributes, - uiViewClassName: 'ARTGroup', -})); - -const NativeShape = createReactNativeComponentClass('ARTShape', () => ({ - validAttributes: ShapeAttributes, - uiViewClassName: 'ARTShape', -})); - -const NativeText = createReactNativeComponentClass('ARTText', () => ({ - validAttributes: TextAttributes, - uiViewClassName: 'ARTText', -})); - -// Utilities - -function childrenAsString(children) { - if (!children) { - return ''; - } - if (typeof children === 'string') { - return children; - } - if (children.length) { - return children.join('\n'); - } - return ''; -} - -// Surface - Root node of all ART - -class Surface extends React.Component { - static childContextTypes = { - isInSurface: PropTypes.bool, - }; - - getChildContext() { - return {isInSurface: true}; - } - - render() { - const height = extractNumber(this.props.height, 0); - const width = extractNumber(this.props.width, 0); - - return ( - - {this.props.children} - - ); - } -} - -// Node Props - -// TODO: The desktop version of ART has title and cursor. We should have -// accessibility support here too even though hovering doesn't work. - -function extractNumber(value, defaultValue) { - if (value == null) { - return defaultValue; - } - return +value; -} - -const pooledTransform = new Transform(); - -function extractTransform(props) { - const scaleX = - props.scaleX != null ? props.scaleX : props.scale != null ? props.scale : 1; - const scaleY = - props.scaleY != null ? props.scaleY : props.scale != null ? props.scale : 1; - - pooledTransform - .transformTo(1, 0, 0, 1, 0, 0) - .move(props.x || 0, props.y || 0) - .rotate(props.rotation || 0, props.originX, props.originY) - .scale(scaleX, scaleY, props.originX, props.originY); - - if (props.transform != null) { - pooledTransform.transform(props.transform); - } - - return [ - pooledTransform.xx, - pooledTransform.yx, - pooledTransform.xy, - pooledTransform.yy, - pooledTransform.x, - pooledTransform.y, - ]; -} - -function extractOpacity(props) { - // TODO: visible === false should also have no hit detection - if (props.visible === false) { - return 0; - } - if (props.opacity == null) { - return 1; - } - return +props.opacity; -} - -// Groups - -// Note: ART has a notion of width and height on Group but AFAIK it's a noop in -// ReactART. - -class Group extends React.Component { - static contextTypes = { - isInSurface: PropTypes.bool.isRequired, - }; - - render() { - const props = this.props; - invariant( - this.context.isInSurface, - 'ART: must be a child of a ', - ); - return ( - - {this.props.children} - - ); - } -} - -class ClippingRectangle extends React.Component { - render() { - const props = this.props; - const x = extractNumber(props.x, 0); - const y = extractNumber(props.y, 0); - const w = extractNumber(props.width, 0); - const h = extractNumber(props.height, 0); - const clipping = [x, y, w, h]; - // The current clipping API requires x and y to be ignored in the transform - const propsExcludingXAndY = merge(props); - delete propsExcludingXAndY.x; - delete propsExcludingXAndY.y; - return ( - - {this.props.children} - - ); - } -} - -// Renderables - -const SOLID_COLOR = 0; -const LINEAR_GRADIENT = 1; -const RADIAL_GRADIENT = 2; -const PATTERN = 3; - -function insertColorIntoArray(color, targetArray, atIndex) { - const c = new Color(color); - targetArray[atIndex + 0] = c.red / 255; - targetArray[atIndex + 1] = c.green / 255; - targetArray[atIndex + 2] = c.blue / 255; - targetArray[atIndex + 3] = c.alpha; -} - -function insertColorsIntoArray(stops, targetArray, atIndex) { - let i = 0; - if ('length' in stops) { - while (i < stops.length) { - insertColorIntoArray(stops[i], targetArray, atIndex + i * 4); - i++; - } - } else { - for (const offset in stops) { - insertColorIntoArray(stops[offset], targetArray, atIndex + i * 4); - i++; - } - } - return atIndex + i * 4; -} - -function insertOffsetsIntoArray(stops, targetArray, atIndex, multi, reverse) { - let offsetNumber; - let i = 0; - if ('length' in stops) { - while (i < stops.length) { - offsetNumber = (i / (stops.length - 1)) * multi; - targetArray[atIndex + i] = reverse ? 1 - offsetNumber : offsetNumber; - i++; - } - } else { - for (const offsetString in stops) { - offsetNumber = +offsetString * multi; - targetArray[atIndex + i] = reverse ? 1 - offsetNumber : offsetNumber; - i++; - } - } - return atIndex + i; -} - -function insertColorStopsIntoArray(stops, targetArray, atIndex) { - const lastIndex = insertColorsIntoArray(stops, targetArray, atIndex); - insertOffsetsIntoArray(stops, targetArray, lastIndex, 1, false); -} - -function insertDoubleColorStopsIntoArray(stops, targetArray, atIndex) { - let lastIndex = insertColorsIntoArray(stops, targetArray, atIndex); - lastIndex = insertColorsIntoArray(stops, targetArray, lastIndex); - lastIndex = insertOffsetsIntoArray(stops, targetArray, lastIndex, 0.5, false); - insertOffsetsIntoArray(stops, targetArray, lastIndex, 0.5, true); -} - -function applyBoundingBoxToBrushData(brushData, props) { - const type = brushData[0]; - const width = +props.width; - const height = +props.height; - if (type === LINEAR_GRADIENT) { - brushData[1] *= width; - brushData[2] *= height; - brushData[3] *= width; - brushData[4] *= height; - } else if (type === RADIAL_GRADIENT) { - brushData[1] *= width; - brushData[2] *= height; - brushData[3] *= width; - brushData[4] *= height; - brushData[5] *= width; - brushData[6] *= height; - } else if (type === PATTERN) { - // todo - } -} - -function extractBrush(colorOrBrush, props) { - if (colorOrBrush == null) { - return null; - } - if (colorOrBrush._brush) { - if (colorOrBrush._bb) { - // The legacy API for Gradients allow for the bounding box to be used - // as a convenience for specifying gradient positions. This should be - // deprecated. It's not properly implemented in canvas mode. ReactART - // doesn't handle update to the bounding box correctly. That's why we - // mutate this so that if it's reused, we reuse the same resolved box. - applyBoundingBoxToBrushData(colorOrBrush._brush, props); - colorOrBrush._bb = false; - } - return colorOrBrush._brush; - } - const c = new Color(colorOrBrush); - return [SOLID_COLOR, c.red / 255, c.green / 255, c.blue / 255, c.alpha]; -} - -function extractColor(color) { - if (color == null) { - return null; - } - const c = new Color(color); - return [c.red / 255, c.green / 255, c.blue / 255, c.alpha]; -} - -function extractStrokeCap(strokeCap) { - switch (strokeCap) { - case 'butt': - return 0; - case 'square': - return 2; - default: - return 1; // round - } -} - -function extractStrokeJoin(strokeJoin) { - switch (strokeJoin) { - case 'miter': - return 0; - case 'bevel': - return 2; - default: - return 1; // round - } -} - -// Shape - -// Note: ART has a notion of width and height on Shape but AFAIK it's a noop in -// ReactART. - -export type ShapeProps = {| - fill?: mixed, - stroke?: mixed, - strokeCap?: mixed, - strokeDash?: mixed, - strokeJoin?: mixed, - strokeWidth?: mixed, - x?: number, - y?: number, - opacity?: mixed, -|}; - -class Shape extends React.Component { - render() { - const props = this.props; - const path = props.d || childrenAsString(props.children); - const d = (path instanceof Path ? path : new Path(path)).toJSON(); - return ( - - ); - } -} - -// Text - -const cachedFontObjectsFromString = {}; - -const fontFamilyPrefix = /^[\s"']*/; -const fontFamilySuffix = /[\s"']*$/; - -function extractSingleFontFamily(fontFamilyString) { - // ART on the web allows for multiple font-families to be specified. - // For compatibility, we extract the first font-family, hoping - // we'll get a match. - return fontFamilyString - .split(',')[0] - .replace(fontFamilyPrefix, '') - .replace(fontFamilySuffix, ''); -} - -function parseFontString(font) { - if (cachedFontObjectsFromString.hasOwnProperty(font)) { - return cachedFontObjectsFromString[font]; - } - const regexp = /^\s*((?:(?:normal|bold|italic)\s+)*)(?:(\d+(?:\.\d+)?)[ptexm\%]*(?:\s*\/.*?)?\s+)?\s*\"?([^\"]*)/i; - const match = regexp.exec(font); - if (!match) { - return null; - } - const fontFamily = extractSingleFontFamily(match[3]); - const fontSize = +match[2] || 12; - const isBold = /bold/.exec(match[1]); - const isItalic = /italic/.exec(match[1]); - cachedFontObjectsFromString[font] = { - fontFamily: fontFamily, - fontSize: fontSize, - fontWeight: isBold ? 'bold' : 'normal', - fontStyle: isItalic ? 'italic' : 'normal', - }; - return cachedFontObjectsFromString[font]; -} - -function extractFont(font) { - if (font == null) { - return null; - } - if (typeof font === 'string') { - return parseFontString(font); - } - const fontFamily = extractSingleFontFamily(font.fontFamily); - const fontSize = +font.fontSize || 12; - const fontWeight = - font.fontWeight != null ? font.fontWeight.toString() : '400'; - return { - // Normalize - fontFamily: fontFamily, - fontSize: fontSize, - fontWeight: fontWeight, - fontStyle: font.fontStyle, - }; -} - -const newLine = /\n/g; -function extractFontAndLines(font, text) { - return {font: extractFont(font), lines: text.split(newLine)}; -} - -function extractAlignment(alignment) { - switch (alignment) { - case 'right': - return 1; - case 'center': - return 2; - default: - return 0; - } -} - -class Text extends React.Component { - render() { - const props = this.props; - const path = props.path; - const textPath = path - ? (path instanceof Path ? path : new Path(path)).toJSON() - : null; - const textFrame = extractFontAndLines( - props.font, - childrenAsString(props.children), - ); - return ( - - ); - } -} - -// Declarative fill type objects - API design not finalized - -function LinearGradient(stops, x1, y1, x2, y2) { - const type = LINEAR_GRADIENT; - - if (arguments.length < 5) { - const angle = ((x1 == null ? 270 : x1) * Math.PI) / 180; - - let x = Math.cos(angle); - let y = -Math.sin(angle); - const l = (Math.abs(x) + Math.abs(y)) / 2; - - x *= l; - y *= l; - - x1 = 0.5 - x; - x2 = 0.5 + x; - y1 = 0.5 - y; - y2 = 0.5 + y; - this._bb = true; - } else { - this._bb = false; - } - - const brushData = [type, +x1, +y1, +x2, +y2]; - insertColorStopsIntoArray(stops, brushData, 5); - this._brush = brushData; -} - -function RadialGradient(stops, fx, fy, rx, ry, cx, cy) { - if (ry == null) { - ry = rx; - } - if (cx == null) { - cx = fx; - } - if (cy == null) { - cy = fy; - } - if (fx == null) { - // As a convenience we allow the whole radial gradient to cover the - // bounding box. We should consider dropping this API. - fx = fy = rx = ry = cx = cy = 0.5; - this._bb = true; - } else { - this._bb = false; - } - // The ART API expects the radial gradient to be repeated at the edges. - // To simulate this we render the gradient twice as large and add double - // color stops. Ideally this API would become more restrictive so that this - // extra work isn't needed. - const brushData = [RADIAL_GRADIENT, +fx, +fy, +rx * 2, +ry * 2, +cx, +cy]; - insertDoubleColorStopsIntoArray(stops, brushData, 7); - this._brush = brushData; -} - -function Pattern(url, width, height, left, top) { - this._brush = [PATTERN, url, +left || 0, +top || 0, +width, +height]; -} - -const ReactART = { - LinearGradient: LinearGradient, - RadialGradient: RadialGradient, - Pattern: Pattern, - Transform: Transform, - Path: Path, - Surface: Surface, - Group: Group, - ClippingRectangle: ClippingRectangle, - Shape: Shape, - Text: Text, -}; - -module.exports = ReactART; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTGroupManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTGroupManager.h deleted file mode 100644 index f518cf0e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTGroupManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTNodeManager.h" - -@interface ARTGroupManager : ARTNodeManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTGroupManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTGroupManager.m deleted file mode 100644 index 9fb45d71..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTGroupManager.m +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTGroupManager.h" - -#import "ARTGroup.h" -#import "RCTConvert+ART.h" - -@implementation ARTGroupManager - -RCT_EXPORT_MODULE() - -- (ARTNode *)node -{ - return [ARTGroup new]; -} - -RCT_EXPORT_VIEW_PROPERTY(clipping, CGRect) - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTNodeManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTNodeManager.h deleted file mode 100644 index 84ef8fb0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTNodeManager.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@class ARTNode; - -@interface ARTNodeManager : RCTViewManager - -- (ARTNode *)node; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTNodeManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTNodeManager.m deleted file mode 100644 index 62680975..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTNodeManager.m +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTNodeManager.h" - -#import "ARTNode.h" - -@implementation ARTNodeManager - -RCT_EXPORT_MODULE() - -- (ARTNode *)node -{ - return [ARTNode new]; -} - -- (UIView *)view -{ - return [self node]; -} - -- (RCTShadowView *)shadowView -{ - return nil; -} - -RCT_EXPORT_VIEW_PROPERTY(opacity, CGFloat) -RCT_EXPORT_VIEW_PROPERTY(transform, CGAffineTransform) - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTRenderableManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTRenderableManager.h deleted file mode 100644 index 781ed32f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTRenderableManager.h +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTNodeManager.h" -#import "ARTRenderable.h" - -@interface ARTRenderableManager : ARTNodeManager - -- (ARTRenderable *)node; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTRenderableManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTRenderableManager.m deleted file mode 100644 index ad026496..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTRenderableManager.m +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTRenderableManager.h" - -#import "RCTConvert+ART.h" - -@implementation ARTRenderableManager - -RCT_EXPORT_MODULE() - -- (ARTRenderable *)node -{ - return [ARTRenderable new]; -} - -RCT_EXPORT_VIEW_PROPERTY(strokeWidth, CGFloat) -RCT_EXPORT_VIEW_PROPERTY(strokeCap, CGLineCap) -RCT_EXPORT_VIEW_PROPERTY(strokeJoin, CGLineJoin) -RCT_EXPORT_VIEW_PROPERTY(fill, ARTBrush) -RCT_EXPORT_VIEW_PROPERTY(stroke, CGColor) -RCT_EXPORT_VIEW_PROPERTY(strokeDash, ARTCGFloatArray) - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTShapeManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTShapeManager.h deleted file mode 100644 index cc514b15..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTShapeManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTRenderableManager.h" - -@interface ARTShapeManager : ARTRenderableManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTShapeManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTShapeManager.m deleted file mode 100644 index cb056e5d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTShapeManager.m +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTShapeManager.h" - -#import "ARTShape.h" -#import "RCTConvert+ART.h" - -@implementation ARTShapeManager - -RCT_EXPORT_MODULE() - -- (ARTRenderable *)node -{ - return [ARTShape new]; -} - -RCT_EXPORT_VIEW_PROPERTY(d, CGPath) - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTSurfaceViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTSurfaceViewManager.h deleted file mode 100644 index 36d5949a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTSurfaceViewManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface ARTSurfaceViewManager : RCTViewManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTSurfaceViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTSurfaceViewManager.m deleted file mode 100644 index 1a038979..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTSurfaceViewManager.m +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTSurfaceViewManager.h" - -#import "ARTSurfaceView.h" - -@implementation ARTSurfaceViewManager - -RCT_EXPORT_MODULE() - -- (UIView *)view -{ - return [ARTSurfaceView new]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTTextManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTTextManager.h deleted file mode 100644 index 343e669a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTTextManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTRenderableManager.h" - -@interface ARTTextManager : ARTRenderableManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTTextManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTTextManager.m deleted file mode 100644 index 35c53811..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ART/ViewManagers/ARTTextManager.m +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTTextManager.h" - -#import "ARTText.h" -#import "RCTConvert+ART.h" - -@implementation ARTTextManager - -RCT_EXPORT_MODULE() - -- (ARTRenderable *)node -{ - return [ARTText new]; -} - -RCT_EXPORT_VIEW_PROPERTY(alignment, CTTextAlignment) -RCT_REMAP_VIEW_PROPERTY(frame, textFrame, ARTTextFrame) - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ActionSheetIOS/ActionSheetIOS.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/ActionSheetIOS/ActionSheetIOS.js deleted file mode 100644 index 129de677..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ActionSheetIOS/ActionSheetIOS.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ -'use strict'; - -const RCTActionSheetManager = require('NativeModules').ActionSheetManager; - -const invariant = require('invariant'); -const processColor = require('processColor'); - -/** - * Display action sheets and share sheets on iOS. - * - * See http://facebook.github.io/react-native/docs/actionsheetios.html - */ -const ActionSheetIOS = { - /** - * Display an iOS action sheet. - * - * The `options` object must contain one or more of: - * - * - `options` (array of strings) - a list of button titles (required) - * - `cancelButtonIndex` (int) - index of cancel button in `options` - * - `destructiveButtonIndex` (int or array of ints) - index or indices of destructive buttons in `options` - * - `title` (string) - a title to show above the action sheet - * - `message` (string) - a message to show below the title - * - * The 'callback' function takes one parameter, the zero-based index - * of the selected item. - * - * See http://facebook.github.io/react-native/docs/actionsheetios.html#showactionsheetwithoptions - */ - showActionSheetWithOptions( - options: {| - +title?: ?string, - +message?: ?string, - +options: Array, - +destructiveButtonIndex?: ?number, - +cancelButtonIndex?: ?number, - +anchor?: ?number, - +tintColor?: number | string, - |}, - callback: (buttonIndex: number) => void, - ) { - invariant( - typeof options === 'object' && options !== null, - 'Options must be a valid object', - ); - invariant(typeof callback === 'function', 'Must provide a valid callback'); - - RCTActionSheetManager.showActionSheetWithOptions( - {...options, tintColor: processColor(options.tintColor)}, - callback, - ); - }, - - /** - * Display the iOS share sheet. The `options` object should contain - * one or both of `message` and `url` and can additionally have - * a `subject` or `excludedActivityTypes`: - * - * - `url` (string) - a URL to share - * - `message` (string) - a message to share - * - `subject` (string) - a subject for the message - * - `excludedActivityTypes` (array) - the activities to exclude from - * the ActionSheet - * - `tintColor` (color) - tint color of the buttons - * - * The 'failureCallback' function takes one parameter, an error object. - * The only property defined on this object is an optional `stack` property - * of type `string`. - * - * The 'successCallback' function takes two parameters: - * - * - a boolean value signifying success or failure - * - a string that, in the case of success, indicates the method of sharing - * - * See http://facebook.github.io/react-native/docs/actionsheetios.html#showshareactionsheetwithoptions - */ - showShareActionSheetWithOptions( - options: Object, - failureCallback: Function, - successCallback: Function, - ) { - invariant( - typeof options === 'object' && options !== null, - 'Options must be a valid object', - ); - invariant( - typeof failureCallback === 'function', - 'Must provide a valid failureCallback', - ); - invariant( - typeof successCallback === 'function', - 'Must provide a valid successCallback', - ); - RCTActionSheetManager.showShareActionSheetWithOptions( - {...options, tintColor: processColor(options.tintColor)}, - failureCallback, - successCallback, - ); - }, -}; - -module.exports = ActionSheetIOS; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ActionSheetIOS/RCTActionSheet.xcodeproj/project.pbxproj b/ios/ElectrodeApiImpl/Libraries/ReactNative/ActionSheetIOS/RCTActionSheet.xcodeproj/project.pbxproj deleted file mode 100644 index c71f89bd..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ActionSheetIOS/RCTActionSheet.xcodeproj/project.pbxproj +++ /dev/null @@ -1,258 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 14C644C41AB0DFC900DE3C65 /* RCTActionSheetManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C644C21AB0DFC900DE3C65 /* RCTActionSheetManager.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libRCTActionSheet.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTActionSheet.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 14C644C11AB0DFC900DE3C65 /* RCTActionSheetManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTActionSheetManager.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 14C644C21AB0DFC900DE3C65 /* RCTActionSheetManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTActionSheetManager.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 134814211AA4EA7D00B7C361 /* Products */ = { - isa = PBXGroup; - children = ( - 134814201AA4EA6300B7C361 /* libRCTActionSheet.a */, - ); - name = Products; - sourceTree = ""; - }; - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - 14C644C11AB0DFC900DE3C65 /* RCTActionSheetManager.h */, - 14C644C21AB0DFC900DE3C65 /* RCTActionSheetManager.m */, - 134814211AA4EA7D00B7C361 /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 58B511DA1A9E6C8500147676 /* RCTActionSheet */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTActionSheet" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTActionSheet; - productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libRCTActionSheet.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTActionSheet" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511D21A9E6C8500147676; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B511DA1A9E6C8500147676 /* RCTActionSheet */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 14C644C41AB0DFC900DE3C65 /* RCTActionSheetManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTActionSheet; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTActionSheet; - RUN_CLANG_STATIC_ANALYZER = NO; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTActionSheet" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTActionSheet" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ActionSheetIOS/RCTActionSheetManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ActionSheetIOS/RCTActionSheetManager.h deleted file mode 100644 index 53184041..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ActionSheetIOS/RCTActionSheetManager.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTActionSheetManager : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ActionSheetIOS/RCTActionSheetManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ActionSheetIOS/RCTActionSheetManager.m deleted file mode 100644 index 9eca1181..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ActionSheetIOS/RCTActionSheetManager.m +++ /dev/null @@ -1,180 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTActionSheetManager.h" - -#import -#import -#import -#import -#import - -@interface RCTActionSheetManager () -@end - -@implementation RCTActionSheetManager -{ - // Use NSMapTable, as UIAlertViews do not implement - // which is required for NSDictionary keys - NSMapTable *_callbacks; -} - -RCT_EXPORT_MODULE() - -@synthesize bridge = _bridge; - -- (dispatch_queue_t)methodQueue -{ - return dispatch_get_main_queue(); -} - -- (void)presentViewController:(UIViewController *)alertController - onParentViewController:(UIViewController *)parentViewController - anchorViewTag:(NSNumber *)anchorViewTag -{ - alertController.modalPresentationStyle = UIModalPresentationPopover; - UIView *sourceView = parentViewController.view; - - if (anchorViewTag) { - sourceView = [self.bridge.uiManager viewForReactTag:anchorViewTag]; - } else { - alertController.popoverPresentationController.permittedArrowDirections = 0; - } - alertController.popoverPresentationController.sourceView = sourceView; - alertController.popoverPresentationController.sourceRect = sourceView.bounds; - [parentViewController presentViewController:alertController animated:YES completion:nil]; -} - -RCT_EXPORT_METHOD(showActionSheetWithOptions:(NSDictionary *)options - callback:(RCTResponseSenderBlock)callback) -{ - if (RCTRunningInAppExtension()) { - RCTLogError(@"Unable to show action sheet from app extension"); - return; - } - - if (!_callbacks) { - _callbacks = [NSMapTable strongToStrongObjectsMapTable]; - } - - NSString *title = [RCTConvert NSString:options[@"title"]]; - NSString *message = [RCTConvert NSString:options[@"message"]]; - NSArray *buttons = [RCTConvert NSStringArray:options[@"options"]]; - NSInteger cancelButtonIndex = options[@"cancelButtonIndex"] ? [RCTConvert NSInteger:options[@"cancelButtonIndex"]] : -1; - NSArray *destructiveButtonIndices; - if ([options[@"destructiveButtonIndex"] isKindOfClass:[NSArray class]]) { - destructiveButtonIndices = [RCTConvert NSArray:options[@"destructiveButtonIndex"]]; - } else { - NSNumber *destructiveButtonIndex = options[@"destructiveButtonIndex"] ? [RCTConvert NSNumber:options[@"destructiveButtonIndex"]] : @-1; - destructiveButtonIndices = @[destructiveButtonIndex]; - } - - UIViewController *controller = RCTPresentedViewController(); - - if (controller == nil) { - RCTLogError(@"Tried to display action sheet but there is no application window. options: %@", options); - return; - } - - /* - * The `anchor` option takes a view to set as the anchor for the share - * popup to point to, on iPads running iOS 8. If it is not passed, it - * defaults to centering the share popup on screen without any arrows. - */ - NSNumber *anchorViewTag = [RCTConvert NSNumber:options[@"anchor"]]; - - UIAlertController *alertController = - [UIAlertController alertControllerWithTitle:title - message:message - preferredStyle:UIAlertControllerStyleActionSheet]; - - NSInteger index = 0; - for (NSString *option in buttons) { - UIAlertActionStyle style = UIAlertActionStyleDefault; - if ([destructiveButtonIndices containsObject:@(index)]) { - style = UIAlertActionStyleDestructive; - } else if (index == cancelButtonIndex) { - style = UIAlertActionStyleCancel; - } - - NSInteger localIndex = index; - [alertController addAction:[UIAlertAction actionWithTitle:option - style:style - handler:^(__unused UIAlertAction *action){ - callback(@[@(localIndex)]); - }]]; - - index++; - } - - alertController.view.tintColor = [RCTConvert UIColor:options[@"tintColor"]]; - [self presentViewController:alertController onParentViewController:controller anchorViewTag:anchorViewTag]; -} - -RCT_EXPORT_METHOD(showShareActionSheetWithOptions:(NSDictionary *)options - failureCallback:(RCTResponseErrorBlock)failureCallback - successCallback:(RCTResponseSenderBlock)successCallback) -{ - if (RCTRunningInAppExtension()) { - RCTLogError(@"Unable to show action sheet from app extension"); - return; - } - - NSMutableArray *items = [NSMutableArray array]; - NSString *message = [RCTConvert NSString:options[@"message"]]; - if (message) { - [items addObject:message]; - } - NSURL *URL = [RCTConvert NSURL:options[@"url"]]; - if (URL) { - if ([URL.scheme.lowercaseString isEqualToString:@"data"]) { - NSError *error; - NSData *data = [NSData dataWithContentsOfURL:URL - options:(NSDataReadingOptions)0 - error:&error]; - if (!data) { - failureCallback(error); - return; - } - [items addObject:data]; - } else { - [items addObject:URL]; - } - } - if (items.count == 0) { - RCTLogError(@"No `url` or `message` to share"); - return; - } - - UIActivityViewController *shareController = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil]; - - NSString *subject = [RCTConvert NSString:options[@"subject"]]; - if (subject) { - [shareController setValue:subject forKey:@"subject"]; - } - - NSArray *excludedActivityTypes = [RCTConvert NSStringArray:options[@"excludedActivityTypes"]]; - if (excludedActivityTypes) { - shareController.excludedActivityTypes = excludedActivityTypes; - } - - UIViewController *controller = RCTPresentedViewController(); - shareController.completionWithItemsHandler = ^(NSString *activityType, BOOL completed, __unused NSArray *returnedItems, NSError *activityError) { - if (activityError) { - failureCallback(activityError); - } else { - successCallback(@[@(completed), RCTNullIfNil(activityType)]); - } - }; - - NSNumber *anchorViewTag = [RCTConvert NSNumber:options[@"anchor"]]; - shareController.view.tintColor = [RCTConvert UIColor:options[@"tintColor"]]; - - [self presentViewController:shareController onParentViewController:controller anchorViewTag:anchorViewTag]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/CameraRoll.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/CameraRoll.js deleted file mode 100644 index 68a06805..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/CameraRoll.js +++ /dev/null @@ -1,249 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ -'use strict'; - -const PropTypes = require('prop-types'); -const {checkPropTypes} = PropTypes; -const RCTCameraRollManager = require('NativeModules').CameraRollManager; - -const deprecatedCreateStrictShapeTypeChecker = require('deprecatedCreateStrictShapeTypeChecker'); -const invariant = require('invariant'); - -const GROUP_TYPES_OPTIONS = { - Album: 'Album', - All: 'All', - Event: 'Event', - Faces: 'Faces', - Library: 'Library', - PhotoStream: 'PhotoStream', - SavedPhotos: 'SavedPhotos', // default -}; - -const ASSET_TYPE_OPTIONS = { - All: 'All', - Videos: 'Videos', - Photos: 'Photos', -}; - -export type GroupTypes = $Keys; - -export type GetPhotosParams = { - first: number, - after?: string, - groupTypes?: GroupTypes, - groupName?: string, - assetType?: $Keys, - mimeTypes?: Array, -}; - -/** - * Shape of the param arg for the `getPhotos` function. - */ -const getPhotosParamChecker = deprecatedCreateStrictShapeTypeChecker({ - /** - * The number of photos wanted in reverse order of the photo application - * (i.e. most recent first for SavedPhotos). - */ - first: PropTypes.number.isRequired, - - /** - * A cursor that matches `page_info { end_cursor }` returned from a previous - * call to `getPhotos` - */ - after: PropTypes.string, - - /** - * Specifies which group types to filter the results to. - */ - groupTypes: PropTypes.oneOf(Object.keys(GROUP_TYPES_OPTIONS)), - - /** - * Specifies filter on group names, like 'Recent Photos' or custom album - * titles. - */ - groupName: PropTypes.string, - - /** - * Specifies filter on asset type - */ - assetType: PropTypes.oneOf(Object.keys(ASSET_TYPE_OPTIONS)), - - /** - * Filter by mimetype (e.g. image/jpeg). - */ - mimeTypes: PropTypes.arrayOf(PropTypes.string), -}); - -export type PhotoIdentifier = { - node: { - type: string, - group_name: string, - image: { - filename: string, - uri: string, - height: number, - width: number, - isStored?: boolean, - playableDuration: number, - }, - timestamp: number, - location?: { - latitude?: number, - longitude?: number, - altitude?: number, - heading?: number, - speed?: number, - }, - }, -}; - -export type PhotoIdentifiersPage = { - edges: Array, - page_info: { - has_next_page: boolean, - start_cursor?: string, - end_cursor?: string, - }, -}; - -/** - * Shape of the return value of the `getPhotos` function. - */ -const getPhotosReturnChecker = deprecatedCreateStrictShapeTypeChecker({ - edges: PropTypes.arrayOf( - /* $FlowFixMe(>=0.66.0 site=react_native_fb) This comment suppresses an - * error found when Flow v0.66 was deployed. To see the error delete this - * comment and run Flow. */ - deprecatedCreateStrictShapeTypeChecker({ - node: deprecatedCreateStrictShapeTypeChecker({ - type: PropTypes.string.isRequired, - group_name: PropTypes.string.isRequired, - image: deprecatedCreateStrictShapeTypeChecker({ - uri: PropTypes.string.isRequired, - height: PropTypes.number.isRequired, - width: PropTypes.number.isRequired, - isStored: PropTypes.bool, - playableDuration: PropTypes.number.isRequired, - }).isRequired, - timestamp: PropTypes.number.isRequired, - location: deprecatedCreateStrictShapeTypeChecker({ - latitude: PropTypes.number, - longitude: PropTypes.number, - altitude: PropTypes.number, - heading: PropTypes.number, - speed: PropTypes.number, - }), - }).isRequired, - }), - ).isRequired, - page_info: deprecatedCreateStrictShapeTypeChecker({ - has_next_page: PropTypes.bool.isRequired, - start_cursor: PropTypes.string, - end_cursor: PropTypes.string, - }).isRequired, -}); - -/** - * `CameraRoll` provides access to the local camera roll or photo library. - * - * See https://facebook.github.io/react-native/docs/cameraroll.html - */ -class CameraRoll { - static GroupTypesOptions = GROUP_TYPES_OPTIONS; - static AssetTypeOptions = ASSET_TYPE_OPTIONS; - - /** - * `CameraRoll.saveImageWithTag()` is deprecated. Use `CameraRoll.saveToCameraRoll()` instead. - */ - static saveImageWithTag(tag: string): Promise { - console.warn( - '`CameraRoll.saveImageWithTag()` is deprecated. Use `CameraRoll.saveToCameraRoll()` instead.', - ); - return this.saveToCameraRoll(tag, 'photo'); - } - - static deletePhotos(photos: Array) { - return RCTCameraRollManager.deletePhotos(photos); - } - - /** - * Saves the photo or video to the camera roll or photo library. - * - * See https://facebook.github.io/react-native/docs/cameraroll.html#savetocameraroll - */ - static saveToCameraRoll( - tag: string, - type?: 'photo' | 'video', - ): Promise { - invariant( - typeof tag === 'string', - 'CameraRoll.saveToCameraRoll must be a valid string.', - ); - - invariant( - type === 'photo' || type === 'video' || type === undefined, - `The second argument to saveToCameraRoll must be 'photo' or 'video'. You passed ${type || - 'unknown'}`, - ); - - let mediaType = 'photo'; - if (type) { - mediaType = type; - } else if (['mov', 'mp4'].indexOf(tag.split('.').slice(-1)[0]) >= 0) { - mediaType = 'video'; - } - - return RCTCameraRollManager.saveToCameraRoll(tag, mediaType); - } - - /** - * Returns a Promise with photo identifier objects from the local camera - * roll of the device matching shape defined by `getPhotosReturnChecker`. - * - * See https://facebook.github.io/react-native/docs/cameraroll.html#getphotos - */ - static getPhotos(params: GetPhotosParams): Promise { - if (__DEV__) { - checkPropTypes( - {params: getPhotosParamChecker}, - {params}, - 'params', - 'CameraRoll.getPhotos', - ); - } - if (arguments.length > 1) { - console.warn( - 'CameraRoll.getPhotos(tag, success, error) is deprecated. Use the returned Promise instead', - ); - let successCallback = arguments[1]; - if (__DEV__) { - const callback = arguments[1]; - successCallback = response => { - checkPropTypes( - {response: getPhotosReturnChecker}, - {response}, - 'response', - 'CameraRoll.getPhotos callback', - ); - callback(response); - }; - } - const errorCallback = arguments[2] || (() => {}); - RCTCameraRollManager.getPhotos(params).then( - successCallback, - errorCallback, - ); - } - // TODO: Add the __DEV__ check back in to verify the Promise result - return RCTCameraRollManager.getPhotos(params); - } -} - -module.exports = CameraRoll; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/ImagePickerIOS.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/ImagePickerIOS.js deleted file mode 100644 index 9c783339..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/ImagePickerIOS.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const RCTImagePicker = require('NativeModules').ImagePickerIOS; - -const ImagePickerIOS = { - canRecordVideos: function(callback: Function) { - return RCTImagePicker.canRecordVideos(callback); - }, - canUseCamera: function(callback: Function) { - return RCTImagePicker.canUseCamera(callback); - }, - openCameraDialog: function( - config: Object, - successCallback: Function, - cancelCallback: Function, - ) { - config = { - videoMode: false, - ...config, - }; - return RCTImagePicker.openCameraDialog( - config, - successCallback, - cancelCallback, - ); - }, - openSelectDialog: function( - config: Object, - successCallback: Function, - cancelCallback: Function, - ) { - config = { - showImages: true, - showVideos: false, - ...config, - }; - return RCTImagePicker.openSelectDialog( - config, - successCallback, - cancelCallback, - ); - }, -}; - -module.exports = ImagePickerIOS; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTAssetsLibraryRequestHandler.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTAssetsLibraryRequestHandler.h deleted file mode 100644 index 7a0f0635..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTAssetsLibraryRequestHandler.h +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -@class PHPhotoLibrary; - -@interface RCTAssetsLibraryRequestHandler : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTAssetsLibraryRequestHandler.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTAssetsLibraryRequestHandler.m deleted file mode 100644 index cdc6cb9f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTAssetsLibraryRequestHandler.m +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAssetsLibraryRequestHandler.h" - -#import -#import -#import - -#import -#import - -#import -#import - -@implementation RCTAssetsLibraryRequestHandler - -RCT_EXPORT_MODULE() - -#pragma mark - RCTURLRequestHandler - -- (BOOL)canHandleRequest:(NSURLRequest *)request -{ - if (![PHAsset class]) { - return NO; - } - - return [request.URL.scheme caseInsensitiveCompare:@"assets-library"] == NSOrderedSame - || [request.URL.scheme caseInsensitiveCompare:@"ph"] == NSOrderedSame; -} - -- (id)sendRequest:(NSURLRequest *)request - withDelegate:(id)delegate -{ - __block atomic_bool cancelled = ATOMIC_VAR_INIT(NO); - void (^cancellationBlock)(void) = ^{ - atomic_store(&cancelled, YES); - }; - - if (!request.URL) { - NSString *const msg = [NSString stringWithFormat:@"Cannot send request without URL"]; - [delegate URLRequest:cancellationBlock didCompleteWithError:RCTErrorWithMessage(msg)]; - return cancellationBlock; - } - - PHFetchResult *fetchResult; - - if ([request.URL.scheme caseInsensitiveCompare:@"ph"] == NSOrderedSame) { - // Fetch assets using PHAsset localIdentifier (recommended) - NSString *const localIdentifier = [request.URL.absoluteString substringFromIndex:@"ph://".length]; - fetchResult = [PHAsset fetchAssetsWithLocalIdentifiers:@[localIdentifier] options:nil]; - } else if ([request.URL.scheme caseInsensitiveCompare:@"assets-library"] == NSOrderedSame) { - // This is the older, deprecated way of fetching assets from assets-library - // using the "assets-library://" protocol - fetchResult = [PHAsset fetchAssetsWithALAssetURLs:@[request.URL] options:nil]; - } else { - NSString *const msg = [NSString stringWithFormat:@"Cannot send request with unknown protocol: %@", request.URL]; - [delegate URLRequest:cancellationBlock didCompleteWithError:RCTErrorWithMessage(msg)]; - return cancellationBlock; - } - - if (![fetchResult firstObject]) { - NSString *errorMessage = [NSString stringWithFormat:@"Failed to load asset" - " at URL %@ with no error message.", request.URL]; - NSError *error = RCTErrorWithMessage(errorMessage); - [delegate URLRequest:cancellationBlock didCompleteWithError:error]; - return cancellationBlock; - } - - if (atomic_load(&cancelled)) { - return cancellationBlock; - } - - PHAsset *const _Nonnull asset = [fetchResult firstObject]; - - // By default, allow downloading images from iCloud - PHImageRequestOptions *const requestOptions = [PHImageRequestOptions new]; - requestOptions.networkAccessAllowed = YES; - - [[PHImageManager defaultManager] requestImageDataForAsset:asset - options:requestOptions - resultHandler:^(NSData * _Nullable imageData, - NSString * _Nullable dataUTI, - UIImageOrientation orientation, - NSDictionary * _Nullable info) { - NSError *const error = [info objectForKey:PHImageErrorKey]; - if (error) { - [delegate URLRequest:cancellationBlock didCompleteWithError:error]; - return; - } - - NSInteger const length = [imageData length]; - CFStringRef const dataUTIStringRef = (__bridge CFStringRef _Nonnull)(dataUTI); - CFStringRef const mimeType = UTTypeCopyPreferredTagWithClass(dataUTIStringRef, kUTTagClassMIMEType); - - NSURLResponse *const response = [[NSURLResponse alloc] initWithURL:request.URL - MIMEType:(__bridge NSString *)(mimeType) - expectedContentLength:length - textEncodingName:nil]; - CFRelease(mimeType); - - [delegate URLRequest:cancellationBlock didReceiveResponse:response]; - - [delegate URLRequest:cancellationBlock didReceiveData:imageData]; - [delegate URLRequest:cancellationBlock didCompleteWithError:nil]; - }]; - - return cancellationBlock; -} - -- (void)cancelRequest:(id)requestToken -{ - ((void (^)(void))requestToken)(); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTCameraRoll.xcodeproj/project.pbxproj b/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTCameraRoll.xcodeproj/project.pbxproj deleted file mode 100644 index 618dbab4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTCameraRoll.xcodeproj/project.pbxproj +++ /dev/null @@ -1,302 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 137620351B31C53500677FF0 /* RCTImagePickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 137620341B31C53500677FF0 /* RCTImagePickerManager.m */; }; - 143879351AAD238D00F088A5 /* RCTCameraRollManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 143879341AAD238D00F088A5 /* RCTCameraRollManager.m */; }; - 8312EAEE1B85EB7C001867A2 /* RCTAssetsLibraryRequestHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 8312EAED1B85EB7C001867A2 /* RCTAssetsLibraryRequestHandler.m */; }; - 8312EAF11B85F071001867A2 /* RCTPhotoLibraryImageLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 8312EAF01B85F071001867A2 /* RCTPhotoLibraryImageLoader.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 58B5115B1A9E6B3D00147676 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 137620331B31C53500677FF0 /* RCTImagePickerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTImagePickerManager.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 137620341B31C53500677FF0 /* RCTImagePickerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImagePickerManager.m; sourceTree = ""; }; - 143879331AAD238D00F088A5 /* RCTCameraRollManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTCameraRollManager.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 143879341AAD238D00F088A5 /* RCTCameraRollManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTCameraRollManager.m; sourceTree = ""; }; - 58B5115D1A9E6B3D00147676 /* libRCTCameraRoll.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTCameraRoll.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 8312EAEC1B85EB7C001867A2 /* RCTAssetsLibraryRequestHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTAssetsLibraryRequestHandler.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 8312EAED1B85EB7C001867A2 /* RCTAssetsLibraryRequestHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAssetsLibraryRequestHandler.m; sourceTree = ""; }; - 8312EAEF1B85F071001867A2 /* RCTPhotoLibraryImageLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTPhotoLibraryImageLoader.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 8312EAF01B85F071001867A2 /* RCTPhotoLibraryImageLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPhotoLibraryImageLoader.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 58B5115A1A9E6B3D00147676 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 58B511541A9E6B3D00147676 = { - isa = PBXGroup; - children = ( - 8312EAEC1B85EB7C001867A2 /* RCTAssetsLibraryRequestHandler.h */, - 8312EAED1B85EB7C001867A2 /* RCTAssetsLibraryRequestHandler.m */, - 143879331AAD238D00F088A5 /* RCTCameraRollManager.h */, - 143879341AAD238D00F088A5 /* RCTCameraRollManager.m */, - 137620331B31C53500677FF0 /* RCTImagePickerManager.h */, - 137620341B31C53500677FF0 /* RCTImagePickerManager.m */, - 8312EAEF1B85F071001867A2 /* RCTPhotoLibraryImageLoader.h */, - 8312EAF01B85F071001867A2 /* RCTPhotoLibraryImageLoader.m */, - 58B5115E1A9E6B3D00147676 /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 58B5115E1A9E6B3D00147676 /* Products */ = { - isa = PBXGroup; - children = ( - 58B5115D1A9E6B3D00147676 /* libRCTCameraRoll.a */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 58B5115C1A9E6B3D00147676 /* RCTCameraRoll */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511711A9E6B3D00147676 /* Build configuration list for PBXNativeTarget "RCTCameraRoll" */; - buildPhases = ( - 58B511591A9E6B3D00147676 /* Sources */, - 58B5115A1A9E6B3D00147676 /* Frameworks */, - 58B5115B1A9E6B3D00147676 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTCameraRoll; - productName = RCTNetworkImage; - productReference = 58B5115D1A9E6B3D00147676 /* libRCTCameraRoll.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511551A9E6B3D00147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 58B5115C1A9E6B3D00147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511581A9E6B3D00147676 /* Build configuration list for PBXProject "RCTCameraRoll" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511541A9E6B3D00147676; - productRefGroup = 58B5115E1A9E6B3D00147676 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B5115C1A9E6B3D00147676 /* RCTCameraRoll */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 58B511591A9E6B3D00147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8312EAEE1B85EB7C001867A2 /* RCTAssetsLibraryRequestHandler.m in Sources */, - 8312EAF11B85F071001867A2 /* RCTPhotoLibraryImageLoader.m in Sources */, - 137620351B31C53500677FF0 /* RCTImagePickerManager.m in Sources */, - 143879351AAD238D00F088A5 /* RCTCameraRollManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 58B5116F1A9E6B3D00147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - "-Wno-deprecated-declarations", - ); - }; - name = Debug; - }; - 58B511701A9E6B3D00147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - "-Wno-deprecated-declarations", - ); - }; - name = Release; - }; - 58B511721A9E6B3D00147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTCameraRoll; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 58B511731A9E6B3D00147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTCameraRoll; - RUN_CLANG_STATIC_ANALYZER = NO; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 58B511581A9E6B3D00147676 /* Build configuration list for PBXProject "RCTCameraRoll" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B5116F1A9E6B3D00147676 /* Debug */, - 58B511701A9E6B3D00147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511711A9E6B3D00147676 /* Build configuration list for PBXNativeTarget "RCTCameraRoll" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511721A9E6B3D00147676 /* Debug */, - 58B511731A9E6B3D00147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511551A9E6B3D00147676 /* Project object */; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTCameraRollManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTCameraRollManager.h deleted file mode 100644 index b5d25a04..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTCameraRollManager.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -@interface RCTConvert (PHFetchOptions) - -+ (PHFetchOptions *)PHFetchOptionsFromMediaType:(NSString *)mediaType; - -@end - - -@interface RCTCameraRollManager : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTCameraRollManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTCameraRollManager.m deleted file mode 100644 index 245546a8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTCameraRollManager.m +++ /dev/null @@ -1,347 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTCameraRollManager.h" - -#import -#import -#import -#import -#import -#import -#import - -#import -#import -#import -#import -#import - -#import "RCTAssetsLibraryRequestHandler.h" - -@implementation RCTConvert (PHAssetCollectionSubtype) - -RCT_ENUM_CONVERTER(PHAssetCollectionSubtype, (@{ - @"album": @(PHAssetCollectionSubtypeAny), - @"all": @(PHAssetCollectionSubtypeAny), - @"event": @(PHAssetCollectionSubtypeAlbumSyncedEvent), - @"faces": @(PHAssetCollectionSubtypeAlbumSyncedFaces), - @"library": @(PHAssetCollectionSubtypeSmartAlbumUserLibrary), - @"photo-stream": @(PHAssetCollectionSubtypeAlbumMyPhotoStream), // incorrect, but legacy - @"photostream": @(PHAssetCollectionSubtypeAlbumMyPhotoStream), - @"saved-photos": @(PHAssetCollectionSubtypeAny), // incorrect, but legacy - @"savedphotos": @(PHAssetCollectionSubtypeAny), // This was ALAssetsGroupSavedPhotos, seems to have no direct correspondence in PHAssetCollectionSubtype -}), PHAssetCollectionSubtypeAny, integerValue) - - -@end - -@implementation RCTConvert (PHFetchOptions) - -+ (PHFetchOptions *)PHFetchOptionsFromMediaType:(NSString *)mediaType -{ - // This is not exhaustive in terms of supported media type predicates; more can be added in the future - NSString *const lowercase = [mediaType lowercaseString]; - - if ([lowercase isEqualToString:@"photos"]) { - PHFetchOptions *const options = [PHFetchOptions new]; - options.predicate = [NSPredicate predicateWithFormat:@"mediaType = %d", PHAssetMediaTypeImage]; - return options; - } else if ([lowercase isEqualToString:@"videos"]) { - PHFetchOptions *const options = [PHFetchOptions new]; - options.predicate = [NSPredicate predicateWithFormat:@"mediaType = %d", PHAssetMediaTypeVideo]; - return options; - } else { - if (![lowercase isEqualToString:@"all"]) { - RCTLogError(@"Invalid filter option: '%@'. Expected one of 'photos'," - "'videos' or 'all'.", mediaType); - } - // This case includes the "all" mediatype - return nil; - } -} - -@end - -@implementation RCTCameraRollManager - -RCT_EXPORT_MODULE() - -@synthesize bridge = _bridge; - -static NSString *const kErrorUnableToSave = @"E_UNABLE_TO_SAVE"; -static NSString *const kErrorUnableToLoad = @"E_UNABLE_TO_LOAD"; - -static NSString *const kErrorAuthRestricted = @"E_PHOTO_LIBRARY_AUTH_RESTRICTED"; -static NSString *const kErrorAuthDenied = @"E_PHOTO_LIBRARY_AUTH_DENIED"; - -typedef void (^PhotosAuthorizedBlock)(void); - -static void requestPhotoLibraryAccess(RCTPromiseRejectBlock reject, PhotosAuthorizedBlock authorizedBlock) { - PHAuthorizationStatus authStatus = [PHPhotoLibrary authorizationStatus]; - if (authStatus == PHAuthorizationStatusRestricted) { - reject(kErrorAuthRestricted, @"Access to photo library is restricted", nil); - } else if (authStatus == PHAuthorizationStatusAuthorized) { - authorizedBlock(); - } else if (authStatus == PHAuthorizationStatusNotDetermined) { - [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) { - requestPhotoLibraryAccess(reject, authorizedBlock); - }]; - } else { - reject(kErrorAuthDenied, @"Access to photo library was denied", nil); - } -} - -RCT_EXPORT_METHOD(saveToCameraRoll:(NSURLRequest *)request - type:(NSString *)type - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject) -{ - __block PHObjectPlaceholder *placeholder; - - // We load images and videos differently. - // Images have many custom loaders which can load images from ALAssetsLibrary URLs, PHPhotoLibrary - // URLs, `data:` URIs, etc. Video URLs are passed directly through for now; it may be nice to support - // more ways of loading videos in the future. - __block NSURL *inputURI = nil; - __block UIImage *inputImage = nil; - - void (^saveBlock)(void) = ^void() { - // performChanges and the completionHandler are called on - // arbitrary threads, not the main thread - this is safe - // for now since all JS is queued and executed on a single thread. - // We should reevaluate this if that assumption changes. - [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ - PHAssetChangeRequest *changeRequest; - - // Defaults to "photo". `type` is an optional param. - if ([type isEqualToString:@"video"]) { - changeRequest = [PHAssetChangeRequest creationRequestForAssetFromVideoAtFileURL:inputURI]; - } else { - changeRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:inputImage]; - } - - placeholder = [changeRequest placeholderForCreatedAsset]; - } completionHandler:^(BOOL success, NSError * _Nullable error) { - if (success) { - NSString *uri = [NSString stringWithFormat:@"ph://%@", [placeholder localIdentifier]]; - resolve(uri); - } else { - reject(kErrorUnableToSave, nil, error); - } - }]; - }; - - void (^loadBlock)(void) = ^void() { - if ([type isEqualToString:@"video"]) { - inputURI = request.URL; - saveBlock(); - } else { - [self.bridge.imageLoader loadImageWithURLRequest:request callback:^(NSError *error, UIImage *image) { - if (error) { - reject(kErrorUnableToLoad, nil, error); - return; - } - - inputImage = image; - saveBlock(); - }]; - } - }; - - requestPhotoLibraryAccess(reject, loadBlock); -} - -static void RCTResolvePromise(RCTPromiseResolveBlock resolve, - NSArray *> *assets, - BOOL hasNextPage) -{ - if (!assets.count) { - resolve(@{ - @"edges": assets, - @"page_info": @{ - @"has_next_page": @NO, - } - }); - return; - } - resolve(@{ - @"edges": assets, - @"page_info": @{ - @"start_cursor": assets[0][@"node"][@"image"][@"uri"], - @"end_cursor": assets[assets.count - 1][@"node"][@"image"][@"uri"], - @"has_next_page": @(hasNextPage), - } - }); -} - -RCT_EXPORT_METHOD(getPhotos:(NSDictionary *)params - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject) -{ - checkPhotoLibraryConfig(); - - NSUInteger const first = [RCTConvert NSInteger:params[@"first"]]; - NSString *const afterCursor = [RCTConvert NSString:params[@"after"]]; - NSString *const groupName = [RCTConvert NSString:params[@"groupName"]]; - NSString *const groupTypes = [[RCTConvert NSString:params[@"groupTypes"]] lowercaseString]; - NSString *const mediaType = [RCTConvert NSString:params[@"assetType"]]; - NSArray *const mimeTypes = [RCTConvert NSStringArray:params[@"mimeTypes"]]; - - // If groupTypes is "all", we want to fetch the SmartAlbum "all photos". Otherwise, all - // other groupTypes values require the "album" collection type. - PHAssetCollectionType const collectionType = ([groupTypes isEqualToString:@"all"] - ? PHAssetCollectionTypeSmartAlbum - : PHAssetCollectionTypeAlbum); - PHAssetCollectionSubtype const collectionSubtype = [RCTConvert PHAssetCollectionSubtype:groupTypes]; - - // Predicate for fetching assets within a collection - PHFetchOptions *const assetFetchOptions = [RCTConvert PHFetchOptionsFromMediaType:mediaType]; - assetFetchOptions.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:NO]]; - - BOOL __block foundAfter = NO; - BOOL __block hasNextPage = NO; - BOOL __block resolvedPromise = NO; - NSMutableArray *> *assets = [NSMutableArray new]; - - // Filter collection name ("group") - PHFetchOptions *const collectionFetchOptions = [PHFetchOptions new]; - collectionFetchOptions.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"endDate" ascending:NO]]; - if (groupName != nil) { - collectionFetchOptions.predicate = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"localizedTitle == '%@'", groupName]]; - } - - requestPhotoLibraryAccess(reject, ^{ - PHFetchResult *const assetCollectionFetchResult = [PHAssetCollection fetchAssetCollectionsWithType:collectionType subtype:collectionSubtype options:collectionFetchOptions]; - [assetCollectionFetchResult enumerateObjectsUsingBlock:^(PHAssetCollection * _Nonnull assetCollection, NSUInteger collectionIdx, BOOL * _Nonnull stopCollections) { - // Enumerate assets within the collection - PHFetchResult *const assetsFetchResult = [PHAsset fetchAssetsInAssetCollection:assetCollection options:assetFetchOptions]; - - [assetsFetchResult enumerateObjectsUsingBlock:^(PHAsset * _Nonnull asset, NSUInteger assetIdx, BOOL * _Nonnull stopAssets) { - NSString *const uri = [NSString stringWithFormat:@"ph://%@", [asset localIdentifier]]; - if (afterCursor && !foundAfter) { - if ([afterCursor isEqualToString:uri]) { - foundAfter = YES; - } - return; // skip until we get to the first one - } - - // Get underlying resources of an asset - this includes files as well as details about edited PHAssets - if ([mimeTypes count] > 0) { - NSArray *const assetResources = [PHAssetResource assetResourcesForAsset:asset]; - if (![assetResources firstObject]) { - return; - } - - PHAssetResource *const _Nonnull resource = [assetResources firstObject]; - CFStringRef const uti = (__bridge CFStringRef _Nonnull)(resource.uniformTypeIdentifier); - NSString *const mimeType = (NSString *)CFBridgingRelease(UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)); - - BOOL __block mimeTypeFound = NO; - [mimeTypes enumerateObjectsUsingBlock:^(NSString * _Nonnull mimeTypeFilter, NSUInteger idx, BOOL * _Nonnull stop) { - if ([mimeType isEqualToString:mimeTypeFilter]) { - mimeTypeFound = YES; - *stop = YES; - } - }]; - - if (!mimeTypeFound) { - return; - } - } - - // If we've accumulated enough results to resolve a single promise - if (first == assets.count) { - *stopAssets = YES; - *stopCollections = YES; - hasNextPage = YES; - RCTAssert(resolvedPromise == NO, @"Resolved the promise before we finished processing the results."); - RCTResolvePromise(resolve, assets, hasNextPage); - resolvedPromise = YES; - return; - } - - NSString *const assetMediaTypeLabel = (asset.mediaType == PHAssetMediaTypeVideo - ? @"video" - : (asset.mediaType == PHAssetMediaTypeImage - ? @"image" - : (asset.mediaType == PHAssetMediaTypeAudio - ? @"audio" - : @"unknown"))); - CLLocation *const loc = asset.location; - - // A note on isStored: in the previous code that used ALAssets, isStored - // was always set to YES, probably because iCloud-synced images were never returned (?). - // To get the "isStored" information and filename, we would need to actually request the - // image data from the image manager. Those operations could get really expensive and - // would definitely utilize the disk too much. - // Thus, this field is actually not reliable. - // Note that Android also does not return the `isStored` field at all. - [assets addObject:@{ - @"node": @{ - @"type": assetMediaTypeLabel, // TODO: switch to mimeType? - @"group_name": [assetCollection localizedTitle], - @"image": @{ - @"uri": uri, - @"height": @([asset pixelHeight]), - @"width": @([asset pixelWidth]), - @"isStored": @YES, // this field doesn't seem to exist on android - @"playableDuration": @([asset duration]) // fractional seconds - }, - @"timestamp": @(asset.creationDate.timeIntervalSince1970), - @"location": (loc ? @{ - @"latitude": @(loc.coordinate.latitude), - @"longitude": @(loc.coordinate.longitude), - @"altitude": @(loc.altitude), - @"heading": @(loc.course), - @"speed": @(loc.speed), // speed in m/s - } : @{}) - } - }]; - }]; - }]; - - // If we get this far and haven't resolved the promise yet, we reached the end of the list of photos - if (!resolvedPromise) { - hasNextPage = NO; - RCTResolvePromise(resolve, assets, hasNextPage); - resolvedPromise = YES; - } - }); -} - -RCT_EXPORT_METHOD(deletePhotos:(NSArray*)assets - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject) -{ - NSArray *assets_ = [RCTConvert NSURLArray:assets]; - [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ - PHFetchResult *fetched = - [PHAsset fetchAssetsWithALAssetURLs:assets_ options:nil]; - [PHAssetChangeRequest deleteAssets:fetched]; - } - completionHandler:^(BOOL success, NSError *error) { - if (success == YES) { - resolve(@(success)); - } - else { - reject(@"Couldn't delete", @"Couldn't delete assets", error); - } - } - ]; -} - -static void checkPhotoLibraryConfig() -{ -#if RCT_DEV - if (![[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSPhotoLibraryUsageDescription"]) { - RCTLogError(@"NSPhotoLibraryUsageDescription key must be present in Info.plist to use camera roll."); - } -#endif -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTImagePickerManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTImagePickerManager.h deleted file mode 100644 index 5f489191..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTImagePickerManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - -#import - -@interface RCTImagePickerManager : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTImagePickerManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTImagePickerManager.m deleted file mode 100644 index b8e570cf..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTImagePickerManager.m +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - -#import "RCTImagePickerManager.h" - -#import -#import - -#import -#import -#import -#import - -@interface RCTImagePickerController : UIImagePickerController - -@property (nonatomic, assign) BOOL unmirrorFrontFacingCamera; - -@end - -@implementation RCTImagePickerController - -@end - -@interface RCTImagePickerManager () - -@end - -@implementation RCTImagePickerManager -{ - NSMutableArray *_pickers; - NSMutableArray *_pickerCallbacks; - NSMutableArray *_pickerCancelCallbacks; -} - -RCT_EXPORT_MODULE(ImagePickerIOS); - -@synthesize bridge = _bridge; - -- (id)init -{ - if (self = [super init]) { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(cameraChanged:) - name:@"AVCaptureDeviceDidStartRunningNotification" - object:nil]; - } - return self; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self name:@"AVCaptureDeviceDidStartRunningNotification" object:nil]; -} - -- (dispatch_queue_t)methodQueue -{ - return dispatch_get_main_queue(); -} - -RCT_EXPORT_METHOD(canRecordVideos:(RCTResponseSenderBlock)callback) -{ - NSArray *availableMediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera]; - callback(@[@([availableMediaTypes containsObject:(NSString *)kUTTypeMovie])]); -} - -RCT_EXPORT_METHOD(canUseCamera:(RCTResponseSenderBlock)callback) -{ - callback(@[@([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])]); -} - -RCT_EXPORT_METHOD(openCameraDialog:(NSDictionary *)config - successCallback:(RCTResponseSenderBlock)callback - cancelCallback:(RCTResponseSenderBlock)cancelCallback) -{ - if (RCTRunningInAppExtension()) { - cancelCallback(@[@"Camera access is unavailable in an app extension"]); - return; - } - - RCTImagePickerController *imagePicker = [RCTImagePickerController new]; - imagePicker.delegate = self; - imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; - imagePicker.unmirrorFrontFacingCamera = [RCTConvert BOOL:config[@"unmirrorFrontFacingCamera"]]; - - if ([RCTConvert BOOL:config[@"videoMode"]]) { - imagePicker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo; - } - - [self _presentPicker:imagePicker - successCallback:callback - cancelCallback:cancelCallback]; -} - -RCT_EXPORT_METHOD(openSelectDialog:(NSDictionary *)config - successCallback:(RCTResponseSenderBlock)callback - cancelCallback:(RCTResponseSenderBlock)cancelCallback) -{ - if (RCTRunningInAppExtension()) { - cancelCallback(@[@"Image picker is currently unavailable in an app extension"]); - return; - } - - UIImagePickerController *imagePicker = [UIImagePickerController new]; - imagePicker.delegate = self; - imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; - - NSMutableArray *allowedTypes = [NSMutableArray new]; - if ([RCTConvert BOOL:config[@"showImages"]]) { - [allowedTypes addObject:(NSString *)kUTTypeImage]; - } - if ([RCTConvert BOOL:config[@"showVideos"]]) { - [allowedTypes addObject:(NSString *)kUTTypeMovie]; - } - - imagePicker.mediaTypes = allowedTypes; - - [self _presentPicker:imagePicker - successCallback:callback - cancelCallback:cancelCallback]; -} - -- (void)imagePickerController:(UIImagePickerController *)picker -didFinishPickingMediaWithInfo:(NSDictionary *)info -{ - NSString *mediaType = info[UIImagePickerControllerMediaType]; - BOOL isMovie = [mediaType isEqualToString:(NSString *)kUTTypeMovie]; - NSString *key = isMovie ? UIImagePickerControllerMediaURL : UIImagePickerControllerReferenceURL; - NSURL *imageURL = info[key]; - UIImage *image = info[UIImagePickerControllerOriginalImage]; - NSNumber *width = 0; - NSNumber *height = 0; - if (image) { - height = @(image.size.height); - width = @(image.size.width); - } - if (imageURL) { - [self _dismissPicker:picker args:@[imageURL.absoluteString, RCTNullIfNil(height), RCTNullIfNil(width)]]; - return; - } - - // This is a newly taken image, and doesn't have a URL yet. - // We need to save it to the image store first. - UIImage *originalImage = info[UIImagePickerControllerOriginalImage]; - - // WARNING: Using ImageStoreManager may cause a memory leak because the - // image isn't automatically removed from store once we're done using it. - [_bridge.imageStoreManager storeImage:originalImage withBlock:^(NSString *tempImageTag) { - [self _dismissPicker:picker args:tempImageTag ? @[tempImageTag, RCTNullIfNil(height), RCTNullIfNil(width)] : nil]; - }]; -} - -- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker -{ - [self _dismissPicker:picker args:nil]; -} - -- (void)_presentPicker:(UIImagePickerController *)imagePicker - successCallback:(RCTResponseSenderBlock)callback - cancelCallback:(RCTResponseSenderBlock)cancelCallback -{ - if (!_pickers) { - _pickers = [NSMutableArray new]; - _pickerCallbacks = [NSMutableArray new]; - _pickerCancelCallbacks = [NSMutableArray new]; - } - - [_pickers addObject:imagePicker]; - [_pickerCallbacks addObject:callback]; - [_pickerCancelCallbacks addObject:cancelCallback]; - - UIViewController *rootViewController = RCTPresentedViewController(); - [rootViewController presentViewController:imagePicker animated:YES completion:nil]; -} - -- (void)_dismissPicker:(UIImagePickerController *)picker args:(NSArray *)args -{ - NSUInteger index = [_pickers indexOfObject:picker]; - if (index == NSNotFound) { - // This happens if the user selects multiple items in succession. - return; - } - - RCTResponseSenderBlock successCallback = _pickerCallbacks[index]; - RCTResponseSenderBlock cancelCallback = _pickerCancelCallbacks[index]; - - [_pickers removeObjectAtIndex:index]; - [_pickerCallbacks removeObjectAtIndex:index]; - [_pickerCancelCallbacks removeObjectAtIndex:index]; - - UIViewController *rootViewController = RCTPresentedViewController(); - [rootViewController dismissViewControllerAnimated:YES completion:nil]; - - if (args) { - successCallback(args); - } else { - cancelCallback(@[]); - } -} - -- (void)cameraChanged:(NSNotification *)notification -{ - for (UIImagePickerController *picker in _pickers) { - if ([picker isKindOfClass:[RCTImagePickerController class]] - && ((RCTImagePickerController *)picker).unmirrorFrontFacingCamera - && picker.cameraDevice == UIImagePickerControllerCameraDeviceFront) { - picker.cameraViewTransform = CGAffineTransformScale(CGAffineTransformIdentity, -1, 1); - } else { - picker.cameraViewTransform = CGAffineTransformIdentity; - } - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTPhotoLibraryImageLoader.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTPhotoLibraryImageLoader.h deleted file mode 100644 index d3b8dc64..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTPhotoLibraryImageLoader.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTPhotoLibraryImageLoader : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTPhotoLibraryImageLoader.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTPhotoLibraryImageLoader.m deleted file mode 100644 index ccdf3c27..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/RCTPhotoLibraryImageLoader.m +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTPhotoLibraryImageLoader.h" - -#import - -#import - -@implementation RCTPhotoLibraryImageLoader - -RCT_EXPORT_MODULE() - -@synthesize bridge = _bridge; - -#pragma mark - RCTImageLoader - -- (BOOL)canLoadImageURL:(NSURL *)requestURL -{ - if (![PHAsset class]) { - return NO; - } - return [requestURL.scheme caseInsensitiveCompare:@"assets-library"] == NSOrderedSame || - [requestURL.scheme caseInsensitiveCompare:@"ph"] == NSOrderedSame; -} - -- (RCTImageLoaderCancellationBlock)loadImageForURL:(NSURL *)imageURL - size:(CGSize)size - scale:(CGFloat)scale - resizeMode:(RCTResizeMode)resizeMode - progressHandler:(RCTImageLoaderProgressBlock)progressHandler - partialLoadHandler:(RCTImageLoaderPartialLoadBlock)partialLoadHandler - completionHandler:(RCTImageLoaderCompletionBlock)completionHandler -{ - // Using PhotoKit for iOS 8+ - // The 'ph://' prefix is used by FBMediaKit to differentiate between - // assets-library. It is prepended to the local ID so that it is in the - // form of an NSURL which is what assets-library uses. - NSString *assetID = @""; - PHFetchResult *results; - if (!imageURL) { - completionHandler(RCTErrorWithMessage(@"Cannot load a photo library asset with no URL"), nil); - return ^{}; - } else if ([imageURL.scheme caseInsensitiveCompare:@"assets-library"] == NSOrderedSame) { - assetID = [imageURL absoluteString]; - results = [PHAsset fetchAssetsWithALAssetURLs:@[imageURL] options:nil]; - } else { - assetID = [imageURL.absoluteString substringFromIndex:@"ph://".length]; - results = [PHAsset fetchAssetsWithLocalIdentifiers:@[assetID] options:nil]; - } - if (results.count == 0) { - NSString *errorText = [NSString stringWithFormat:@"Failed to fetch PHAsset with local identifier %@ with no error message.", assetID]; - completionHandler(RCTErrorWithMessage(errorText), nil); - return ^{}; - } - - PHAsset *asset = [results firstObject]; - PHImageRequestOptions *imageOptions = [PHImageRequestOptions new]; - - // Allow PhotoKit to fetch images from iCloud - imageOptions.networkAccessAllowed = YES; - - if (progressHandler) { - imageOptions.progressHandler = ^(double progress, NSError *error, BOOL *stop, NSDictionary *info) { - static const double multiplier = 1e6; - progressHandler(progress * multiplier, multiplier); - }; - } - - // Note: PhotoKit defaults to a deliveryMode of PHImageRequestOptionsDeliveryModeOpportunistic - // which means it may call back multiple times - we probably don't want that - imageOptions.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat; - - BOOL useMaximumSize = CGSizeEqualToSize(size, CGSizeZero); - CGSize targetSize; - if (useMaximumSize) { - targetSize = PHImageManagerMaximumSize; - imageOptions.resizeMode = PHImageRequestOptionsResizeModeNone; - } else { - targetSize = CGSizeApplyAffineTransform(size, CGAffineTransformMakeScale(scale, scale)); - imageOptions.resizeMode = PHImageRequestOptionsResizeModeFast; - } - - PHImageContentMode contentMode = PHImageContentModeAspectFill; - if (resizeMode == RCTResizeModeContain) { - contentMode = PHImageContentModeAspectFit; - } - - PHImageRequestID requestID = - [[PHImageManager defaultManager] requestImageForAsset:asset - targetSize:targetSize - contentMode:contentMode - options:imageOptions - resultHandler:^(UIImage *result, NSDictionary *info) { - if (result) { - completionHandler(nil, result); - } else { - completionHandler(info[PHImageErrorKey], nil); - } - }]; - - return ^{ - [[PHImageManager defaultManager] cancelImageRequest:requestID]; - }; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/__mocks__/CameraRoll.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/__mocks__/CameraRoll.js deleted file mode 100644 index 5094bdc7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/CameraRoll/__mocks__/CameraRoll.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ -'use strict'; - -const CameraRoll = {}; - -export default CameraRoll; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Geolocation/Geolocation.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Geolocation/Geolocation.js deleted file mode 100644 index 943dc09f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Geolocation/Geolocation.js +++ /dev/null @@ -1,175 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const NativeEventEmitter = require('NativeEventEmitter'); -const RCTLocationObserver = require('NativeModules').LocationObserver; - -const invariant = require('invariant'); -const logError = require('logError'); -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ -const warning = require('fbjs/lib/warning'); - -const LocationEventEmitter = new NativeEventEmitter(RCTLocationObserver); - -const Platform = require('Platform'); -const PermissionsAndroid = require('PermissionsAndroid'); - -let subscriptions = []; -let updatesEnabled = false; - -type GeoConfiguration = { - skipPermissionRequests: boolean, -}; - -type GeoOptions = { - timeout?: number, - maximumAge?: number, - enableHighAccuracy?: boolean, - distanceFilter: number, - useSignificantChanges?: boolean, -}; - -/** - * The Geolocation API extends the web spec: - * https://developer.mozilla.org/en-US/docs/Web/API/Geolocation - * - * See https://facebook.github.io/react-native/docs/geolocation.html - */ -const Geolocation = { - /* - * Sets configuration options that will be used in all location requests. - * - * See https://facebook.github.io/react-native/docs/geolocation.html#setrnconfiguration - * - */ - setRNConfiguration: function(config: GeoConfiguration) { - if (RCTLocationObserver.setConfiguration) { - RCTLocationObserver.setConfiguration(config); - } - }, - - /* - * Request suitable Location permission based on the key configured on pList. - * - * See https://facebook.github.io/react-native/docs/geolocation.html#requestauthorization - */ - requestAuthorization: function() { - RCTLocationObserver.requestAuthorization(); - }, - - /* - * Invokes the success callback once with the latest location info. - * - * See https://facebook.github.io/react-native/docs/geolocation.html#getcurrentposition - */ - getCurrentPosition: async function( - geo_success: Function, - geo_error?: Function, - geo_options?: GeoOptions, - ) { - invariant( - typeof geo_success === 'function', - 'Must provide a valid geo_success callback.', - ); - let hasPermission = true; - // Supports Android's new permission model. For Android older devices, - // it's always on. - if (Platform.OS === 'android' && Platform.Version >= 23) { - hasPermission = await PermissionsAndroid.check( - PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION, - ); - if (!hasPermission) { - const status = await PermissionsAndroid.request( - PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION, - ); - hasPermission = status === PermissionsAndroid.RESULTS.GRANTED; - } - } - if (hasPermission) { - RCTLocationObserver.getCurrentPosition( - geo_options || {}, - geo_success, - geo_error || logError, - ); - } - }, - - /* - * Invokes the success callback whenever the location changes. - * - * See https://facebook.github.io/react-native/docs/geolocation.html#watchposition - */ - watchPosition: function( - success: Function, - error?: Function, - options?: GeoOptions, - ): number { - if (!updatesEnabled) { - RCTLocationObserver.startObserving(options || {}); - updatesEnabled = true; - } - const watchID = subscriptions.length; - subscriptions.push([ - LocationEventEmitter.addListener('geolocationDidChange', success), - error - ? LocationEventEmitter.addListener('geolocationError', error) - : null, - ]); - return watchID; - }, - - clearWatch: function(watchID: number) { - const sub = subscriptions[watchID]; - if (!sub) { - // Silently exit when the watchID is invalid or already cleared - // This is consistent with timers - return; - } - - sub[0].remove(); - // array element refinements not yet enabled in Flow - const sub1 = sub[1]; - sub1 && sub1.remove(); - subscriptions[watchID] = undefined; - let noWatchers = true; - for (let ii = 0; ii < subscriptions.length; ii++) { - if (subscriptions[ii]) { - noWatchers = false; // still valid subscriptions - } - } - if (noWatchers) { - Geolocation.stopObserving(); - } - }, - - stopObserving: function() { - if (updatesEnabled) { - RCTLocationObserver.stopObserving(); - updatesEnabled = false; - for (let ii = 0; ii < subscriptions.length; ii++) { - const sub = subscriptions[ii]; - if (sub) { - warning(false, 'Called stopObserving with existing subscriptions.'); - sub[0].remove(); - // array element refinements not yet enabled in Flow - const sub1 = sub[1]; - sub1 && sub1.remove(); - } - } - subscriptions = []; - } - }, -}; - -module.exports = Geolocation; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Geolocation/RCTGeolocation.xcodeproj/project.pbxproj b/ios/ElectrodeApiImpl/Libraries/ReactNative/Geolocation/RCTGeolocation.xcodeproj/project.pbxproj deleted file mode 100644 index c0754118..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Geolocation/RCTGeolocation.xcodeproj/project.pbxproj +++ /dev/null @@ -1,257 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 134814061AA4E45400B7C361 /* RCTLocationObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 134814051AA4E45400B7C361 /* RCTLocationObserver.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 134814041AA4E45400B7C361 /* RCTLocationObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTLocationObserver.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 134814051AA4E45400B7C361 /* RCTLocationObserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTLocationObserver.m; sourceTree = ""; }; - 134814201AA4EA6300B7C361 /* libRCTGeolocation.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTGeolocation.a; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 134814211AA4EA7D00B7C361 /* Products */ = { - isa = PBXGroup; - children = ( - 134814201AA4EA6300B7C361 /* libRCTGeolocation.a */, - ); - name = Products; - sourceTree = ""; - }; - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - 134814041AA4E45400B7C361 /* RCTLocationObserver.h */, - 134814051AA4E45400B7C361 /* RCTLocationObserver.m */, - 134814211AA4EA7D00B7C361 /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 58B511DA1A9E6C8500147676 /* RCTGeolocation */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTGeolocation" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTGeolocation; - productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libRCTGeolocation.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTGeolocation" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511D21A9E6C8500147676; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B511DA1A9E6C8500147676 /* RCTGeolocation */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 134814061AA4E45400B7C361 /* RCTLocationObserver.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTGeolocation" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTGeolocation" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Geolocation/RCTLocationObserver.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Geolocation/RCTLocationObserver.h deleted file mode 100644 index f3f9e19b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Geolocation/RCTLocationObserver.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTLocationObserver : RCTEventEmitter - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Geolocation/RCTLocationObserver.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Geolocation/RCTLocationObserver.m deleted file mode 100644 index 09cec2b3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Geolocation/RCTLocationObserver.m +++ /dev/null @@ -1,400 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTLocationObserver.h" - -#import -#import -#import - -#import -#import -#import -#import -#import - -typedef NS_ENUM(NSInteger, RCTPositionErrorCode) { - RCTPositionErrorDenied = 1, - RCTPositionErrorUnavailable, - RCTPositionErrorTimeout, -}; - -#define RCT_DEFAULT_LOCATION_ACCURACY kCLLocationAccuracyHundredMeters - -typedef struct { - BOOL skipPermissionRequests; -} RCTLocationConfiguration; - -typedef struct { - double timeout; - double maximumAge; - double accuracy; - double distanceFilter; - BOOL useSignificantChanges; -} RCTLocationOptions; - -@implementation RCTConvert (RCTLocationOptions) - -+ (RCTLocationConfiguration)RCTLocationConfiguration:(id)json -{ - NSDictionary *options = [RCTConvert NSDictionary:json]; - - return (RCTLocationConfiguration) { - .skipPermissionRequests = [RCTConvert BOOL:options[@"skipPermissionRequests"]] - }; -} - -+ (RCTLocationOptions)RCTLocationOptions:(id)json -{ - NSDictionary *options = [RCTConvert NSDictionary:json]; - - double distanceFilter = options[@"distanceFilter"] == NULL ? RCT_DEFAULT_LOCATION_ACCURACY - : [RCTConvert double:options[@"distanceFilter"]] ?: kCLDistanceFilterNone; - - return (RCTLocationOptions){ - .timeout = [RCTConvert NSTimeInterval:options[@"timeout"]] ?: INFINITY, - .maximumAge = [RCTConvert NSTimeInterval:options[@"maximumAge"]] ?: INFINITY, - .accuracy = [RCTConvert BOOL:options[@"enableHighAccuracy"]] ? kCLLocationAccuracyBest : RCT_DEFAULT_LOCATION_ACCURACY, - .distanceFilter = distanceFilter, - .useSignificantChanges = [RCTConvert BOOL:options[@"useSignificantChanges"]] ?: NO, - }; -} - -@end - -static NSDictionary *RCTPositionError(RCTPositionErrorCode code, NSString *msg /* nil for default */) -{ - if (!msg) { - switch (code) { - case RCTPositionErrorDenied: - msg = @"User denied access to location services."; - break; - case RCTPositionErrorUnavailable: - msg = @"Unable to retrieve location."; - break; - case RCTPositionErrorTimeout: - msg = @"The location request timed out."; - break; - } - } - - return @{ - @"code": @(code), - @"message": msg, - @"PERMISSION_DENIED": @(RCTPositionErrorDenied), - @"POSITION_UNAVAILABLE": @(RCTPositionErrorUnavailable), - @"TIMEOUT": @(RCTPositionErrorTimeout) - }; -} - -@interface RCTLocationRequest : NSObject - -@property (nonatomic, copy) RCTResponseSenderBlock successBlock; -@property (nonatomic, copy) RCTResponseSenderBlock errorBlock; -@property (nonatomic, assign) RCTLocationOptions options; -@property (nonatomic, strong) NSTimer *timeoutTimer; - -@end - -@implementation RCTLocationRequest - -- (void)dealloc -{ - if (_timeoutTimer.valid) { - [_timeoutTimer invalidate]; - } -} - -@end - -@interface RCTLocationObserver () - -@end - -@implementation RCTLocationObserver -{ - CLLocationManager *_locationManager; - NSDictionary *_lastLocationEvent; - NSMutableArray *_pendingRequests; - BOOL _observingLocation; - BOOL _usingSignificantChanges; - RCTLocationConfiguration _locationConfiguration; - RCTLocationOptions _observerOptions; -} - -RCT_EXPORT_MODULE() - -#pragma mark - Lifecycle - -- (void)dealloc -{ - _usingSignificantChanges ? - [_locationManager stopMonitoringSignificantLocationChanges] : - [_locationManager stopUpdatingLocation]; - - _locationManager.delegate = nil; -} - -- (dispatch_queue_t)methodQueue -{ - return dispatch_get_main_queue(); -} - -- (NSArray *)supportedEvents -{ - return @[@"geolocationDidChange", @"geolocationError"]; -} - -#pragma mark - Private API - -- (void)beginLocationUpdatesWithDesiredAccuracy:(CLLocationAccuracy)desiredAccuracy distanceFilter:(CLLocationDistance)distanceFilter useSignificantChanges:(BOOL)useSignificantChanges -{ - if (!_locationConfiguration.skipPermissionRequests) { - [self requestAuthorization]; - } - - if (!_locationManager) { - _locationManager = [CLLocationManager new]; - _locationManager.delegate = self; - } - - _locationManager.distanceFilter = distanceFilter; - _locationManager.desiredAccuracy = desiredAccuracy; - _usingSignificantChanges = useSignificantChanges; - - // Start observing location - _usingSignificantChanges ? - [_locationManager startMonitoringSignificantLocationChanges] : - [_locationManager startUpdatingLocation]; -} - -#pragma mark - Timeout handler - -- (void)timeout:(NSTimer *)timer -{ - RCTLocationRequest *request = timer.userInfo; - NSString *message = [NSString stringWithFormat: @"Unable to fetch location within %.1fs.", request.options.timeout]; - request.errorBlock(@[RCTPositionError(RCTPositionErrorTimeout, message)]); - [_pendingRequests removeObject:request]; - - // Stop updating if no pending requests - if (_pendingRequests.count == 0 && !_observingLocation) { - _usingSignificantChanges ? - [_locationManager stopMonitoringSignificantLocationChanges] : - [_locationManager stopUpdatingLocation]; - } -} - -#pragma mark - Public API - -RCT_EXPORT_METHOD(setConfiguration:(RCTLocationConfiguration)config) -{ - _locationConfiguration = config; -} - -RCT_EXPORT_METHOD(requestAuthorization) -{ - if (!_locationManager) { - _locationManager = [CLLocationManager new]; - _locationManager.delegate = self; - } - - // Request location access permission - if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"] && - [_locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) { - [_locationManager requestAlwaysAuthorization]; - - // On iOS 9+ we also need to enable background updates - NSArray *backgroundModes = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIBackgroundModes"]; - if (backgroundModes && [backgroundModes containsObject:@"location"]) { - if ([_locationManager respondsToSelector:@selector(setAllowsBackgroundLocationUpdates:)]) { - [_locationManager setAllowsBackgroundLocationUpdates:YES]; - } - } - } else if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"] && - [_locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) { - [_locationManager requestWhenInUseAuthorization]; - } -} - -RCT_EXPORT_METHOD(startObserving:(RCTLocationOptions)options) -{ - checkLocationConfig(); - - // Select best options - _observerOptions = options; - for (RCTLocationRequest *request in _pendingRequests) { - _observerOptions.accuracy = MIN(_observerOptions.accuracy, request.options.accuracy); - } - - [self beginLocationUpdatesWithDesiredAccuracy:_observerOptions.accuracy - distanceFilter:_observerOptions.distanceFilter - useSignificantChanges:_observerOptions.useSignificantChanges]; - _observingLocation = YES; -} - -RCT_EXPORT_METHOD(stopObserving) -{ - // Stop observing - _observingLocation = NO; - - // Stop updating if no pending requests - if (_pendingRequests.count == 0) { - _usingSignificantChanges ? - [_locationManager stopMonitoringSignificantLocationChanges] : - [_locationManager stopUpdatingLocation]; - } -} - -RCT_EXPORT_METHOD(getCurrentPosition:(RCTLocationOptions)options - withSuccessCallback:(RCTResponseSenderBlock)successBlock - errorCallback:(RCTResponseSenderBlock)errorBlock) -{ - checkLocationConfig(); - - if (!successBlock) { - RCTLogError(@"%@.getCurrentPosition called with nil success parameter.", [self class]); - return; - } - - if (![CLLocationManager locationServicesEnabled]) { - if (errorBlock) { - errorBlock(@[ - RCTPositionError(RCTPositionErrorUnavailable, @"Location services disabled.") - ]); - return; - } - } - - if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied) { - if (errorBlock) { - errorBlock(@[ - RCTPositionError(RCTPositionErrorDenied, nil) - ]); - return; - } - } - - // Check if previous recorded location exists and is good enough - if (_lastLocationEvent && - [NSDate date].timeIntervalSince1970 - [RCTConvert NSTimeInterval:_lastLocationEvent[@"timestamp"]] < options.maximumAge && - [_lastLocationEvent[@"coords"][@"accuracy"] doubleValue] <= options.accuracy) { - - // Call success block with most recent known location - successBlock(@[_lastLocationEvent]); - return; - } - - // Create request - RCTLocationRequest *request = [RCTLocationRequest new]; - request.successBlock = successBlock; - request.errorBlock = errorBlock ?: ^(NSArray *args){}; - request.options = options; - request.timeoutTimer = [NSTimer scheduledTimerWithTimeInterval:options.timeout - target:self - selector:@selector(timeout:) - userInfo:request - repeats:NO]; - if (!_pendingRequests) { - _pendingRequests = [NSMutableArray new]; - } - [_pendingRequests addObject:request]; - - // Configure location manager and begin updating location - CLLocationAccuracy accuracy = options.accuracy; - if (_locationManager) { - accuracy = MIN(_locationManager.desiredAccuracy, accuracy); - } - [self beginLocationUpdatesWithDesiredAccuracy:accuracy - distanceFilter:options.distanceFilter - useSignificantChanges:options.useSignificantChanges]; -} - -#pragma mark - CLLocationManagerDelegate - -- (void)locationManager:(CLLocationManager *)manager - didUpdateLocations:(NSArray *)locations -{ - // Create event - CLLocation *location = locations.lastObject; - _lastLocationEvent = @{ - @"coords": @{ - @"latitude": @(location.coordinate.latitude), - @"longitude": @(location.coordinate.longitude), - @"altitude": @(location.altitude), - @"accuracy": @(location.horizontalAccuracy), - @"altitudeAccuracy": @(location.verticalAccuracy), - @"heading": @(location.course), - @"speed": @(location.speed), - }, - @"timestamp": @([location.timestamp timeIntervalSince1970] * 1000) // in ms - }; - - // Send event - if (_observingLocation) { - [self sendEventWithName:@"geolocationDidChange" body:_lastLocationEvent]; - } - - // Fire all queued callbacks - for (RCTLocationRequest *request in _pendingRequests) { - request.successBlock(@[_lastLocationEvent]); - [request.timeoutTimer invalidate]; - } - [_pendingRequests removeAllObjects]; - - // Stop updating if not observing - if (!_observingLocation) { - _usingSignificantChanges ? - [_locationManager stopMonitoringSignificantLocationChanges] : - [_locationManager stopUpdatingLocation]; - } - -} - -- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error -{ - // Check error type - NSDictionary *jsError = nil; - switch (error.code) { - case kCLErrorDenied: - jsError = RCTPositionError(RCTPositionErrorDenied, nil); - break; - case kCLErrorNetwork: - jsError = RCTPositionError(RCTPositionErrorUnavailable, @"Unable to retrieve location due to a network failure"); - break; - case kCLErrorLocationUnknown: - default: - jsError = RCTPositionError(RCTPositionErrorUnavailable, nil); - break; - } - - // Send event - if (_observingLocation) { - [self sendEventWithName:@"geolocationError" body:jsError]; - } - - // Fire all queued error callbacks - for (RCTLocationRequest *request in _pendingRequests) { - request.errorBlock(@[jsError]); - [request.timeoutTimer invalidate]; - } - [_pendingRequests removeAllObjects]; - -} - -static void checkLocationConfig() -{ -#if RCT_DEV - if (!([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"] || - [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"] || - [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysAndWhenInUseUsageDescription"])) { - RCTLogError(@"Either NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription or NSLocationAlwaysAndWhenInUseUsageDescription key must be present in Info.plist to use geolocation."); - } -#endif -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/AssetRegistry.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/AssetRegistry.js deleted file mode 100644 index 7d9626f8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/AssetRegistry.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict - * @format - */ -'use strict'; - -export type PackagerAsset = { - +__packager_asset: boolean, - +fileSystemLocation: string, - +httpServerLocation: string, - +width: ?number, - +height: ?number, - +scales: Array, - +hash: string, - +name: string, - +type: string, -}; - -const assets: Array = []; - -function registerAsset(asset: PackagerAsset): number { - // `push` returns new array length, so the first asset will - // get id 1 (not 0) to make the value truthy - return assets.push(asset); -} - -function getAssetByID(assetId: number): PackagerAsset { - return assets[assetId - 1]; -} - -module.exports = {registerAsset, getAssetByID}; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/AssetSourceResolver.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/AssetSourceResolver.js deleted file mode 100644 index da2daa93..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/AssetSourceResolver.js +++ /dev/null @@ -1,170 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ -'use strict'; - -export type ResolvedAssetSource = {| - +__packager_asset: boolean, - +width: ?number, - +height: ?number, - +uri: string, - +scale: number, -|}; - -import type {PackagerAsset} from 'AssetRegistry'; - -const PixelRatio = require('PixelRatio'); -const Platform = require('Platform'); - -const assetPathUtils = require('./assetPathUtils'); -const invariant = require('invariant'); - -/** - * Returns a path like 'assets/AwesomeModule/icon@2x.png' - */ -function getScaledAssetPath(asset): string { - const scale = AssetSourceResolver.pickScale(asset.scales, PixelRatio.get()); - const scaleSuffix = scale === 1 ? '' : '@' + scale + 'x'; - const assetDir = assetPathUtils.getBasePath(asset); - return assetDir + '/' + asset.name + scaleSuffix + '.' + asset.type; -} - -/** - * Returns a path like 'drawable-mdpi/icon.png' - */ -function getAssetPathInDrawableFolder(asset): string { - const scale = AssetSourceResolver.pickScale(asset.scales, PixelRatio.get()); - const drawbleFolder = assetPathUtils.getAndroidResourceFolderName( - asset, - scale, - ); - const fileName = assetPathUtils.getAndroidResourceIdentifier(asset); - return drawbleFolder + '/' + fileName + '.' + asset.type; -} - -class AssetSourceResolver { - serverUrl: ?string; - // where the jsbundle is being run from - jsbundleUrl: ?string; - // the asset to resolve - asset: PackagerAsset; - - constructor(serverUrl: ?string, jsbundleUrl: ?string, asset: PackagerAsset) { - this.serverUrl = serverUrl; - this.jsbundleUrl = jsbundleUrl; - this.asset = asset; - } - - isLoadedFromServer(): boolean { - return !!this.serverUrl; - } - - isLoadedFromFileSystem(): boolean { - return !!(this.jsbundleUrl && this.jsbundleUrl.startsWith('file://')); - } - - defaultAsset(): ResolvedAssetSource { - if (this.isLoadedFromServer()) { - return this.assetServerURL(); - } - - if (Platform.OS === 'android') { - return this.isLoadedFromFileSystem() - ? this.drawableFolderInBundle() - : this.resourceIdentifierWithoutScale(); - } else { - return this.scaledAssetURLNearBundle(); - } - } - - /** - * Returns an absolute URL which can be used to fetch the asset - * from the devserver - */ - assetServerURL(): ResolvedAssetSource { - invariant(!!this.serverUrl, 'need server to load from'); - return this.fromSource( - this.serverUrl + - getScaledAssetPath(this.asset) + - '?platform=' + - Platform.OS + - '&hash=' + - this.asset.hash, - ); - } - - /** - * Resolves to just the scaled asset filename - * E.g. 'assets/AwesomeModule/icon@2x.png' - */ - scaledAssetPath(): ResolvedAssetSource { - return this.fromSource(getScaledAssetPath(this.asset)); - } - - /** - * Resolves to where the bundle is running from, with a scaled asset filename - * E.g. 'file:///sdcard/bundle/assets/AwesomeModule/icon@2x.png' - */ - scaledAssetURLNearBundle(): ResolvedAssetSource { - const path = this.jsbundleUrl || 'file://'; - return this.fromSource(path + getScaledAssetPath(this.asset)); - } - - /** - * The default location of assets bundled with the app, located by - * resource identifier - * The Android resource system picks the correct scale. - * E.g. 'assets_awesomemodule_icon' - */ - resourceIdentifierWithoutScale(): ResolvedAssetSource { - invariant( - Platform.OS === 'android', - 'resource identifiers work on Android', - ); - return this.fromSource( - assetPathUtils.getAndroidResourceIdentifier(this.asset), - ); - } - - /** - * If the jsbundle is running from a sideload location, this resolves assets - * relative to its location - * E.g. 'file:///sdcard/AwesomeModule/drawable-mdpi/icon.png' - */ - drawableFolderInBundle(): ResolvedAssetSource { - const path = this.jsbundleUrl || 'file://'; - return this.fromSource(path + getAssetPathInDrawableFolder(this.asset)); - } - - fromSource(source: string): ResolvedAssetSource { - return { - __packager_asset: true, - width: this.asset.width, - height: this.asset.height, - uri: source, - scale: AssetSourceResolver.pickScale(this.asset.scales, PixelRatio.get()), - }; - } - - static pickScale(scales: Array, deviceScale: number): number { - // Packager guarantees that `scales` array is sorted - for (let i = 0; i < scales.length; i++) { - if (scales[i] >= deviceScale) { - return scales[i]; - } - } - - // If nothing matches, device scale is larger than any available - // scales, so we return the biggest one. Unless the array is empty, - // in which case we default to 1 - return scales[scales.length - 1] || 1; - } -} - -module.exports = AssetSourceResolver; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/Image.android.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/Image.android.js deleted file mode 100644 index a4269be7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/Image.android.js +++ /dev/null @@ -1,329 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const DeprecatedImageStylePropTypes = require('DeprecatedImageStylePropTypes'); -const DeprecatedStyleSheetPropType = require('DeprecatedStyleSheetPropType'); -const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); -const ImageViewNativeComponent = require('ImageViewNativeComponent'); -const NativeModules = require('NativeModules'); -const PropTypes = require('prop-types'); -const React = require('React'); -const ReactNative = require('ReactNative'); // eslint-disable-line no-unused-vars -const StyleSheet = require('StyleSheet'); -const TextAncestor = require('TextAncestor'); - -const flattenStyle = require('flattenStyle'); -const merge = require('merge'); -const resolveAssetSource = require('resolveAssetSource'); - -const {ImageLoader} = NativeModules; - -const TextInlineImageNativeComponent = require('TextInlineImageNativeComponent'); - -import type {ImageProps as ImagePropsType} from 'ImageProps'; - -let _requestId = 1; -function generateRequestId() { - return _requestId++; -} - -const ImageProps = { - ...DeprecatedViewPropTypes, - style: DeprecatedStyleSheetPropType(DeprecatedImageStylePropTypes), - /** - * See https://facebook.github.io/react-native/docs/image.html#source - */ - source: PropTypes.oneOfType([ - PropTypes.shape({ - uri: PropTypes.string, - headers: PropTypes.objectOf(PropTypes.string), - }), - // Opaque type returned by require('./image.jpg') - PropTypes.number, - // Multiple sources - PropTypes.arrayOf( - PropTypes.shape({ - uri: PropTypes.string, - width: PropTypes.number, - height: PropTypes.number, - headers: PropTypes.objectOf(PropTypes.string), - }), - ), - ]), - /** - * blurRadius: the blur radius of the blur filter added to the image - * - * See https://facebook.github.io/react-native/docs/image.html#blurradius - */ - blurRadius: PropTypes.number, - /** - * See https://facebook.github.io/react-native/docs/image.html#defaultsource - */ - defaultSource: PropTypes.number, - /** - * See https://facebook.github.io/react-native/docs/image.html#loadingindicatorsource - */ - loadingIndicatorSource: PropTypes.oneOfType([ - PropTypes.shape({ - uri: PropTypes.string, - }), - // Opaque type returned by require('./image.jpg') - PropTypes.number, - ]), - progressiveRenderingEnabled: PropTypes.bool, - fadeDuration: PropTypes.number, - /** - * Invoked on load start - */ - onLoadStart: PropTypes.func, - /** - * Invoked on load error - */ - onError: PropTypes.func, - /** - * Invoked when load completes successfully - */ - onLoad: PropTypes.func, - /** - * Invoked when load either succeeds or fails - */ - onLoadEnd: PropTypes.func, - /** - * Used to locate this view in end-to-end tests. - */ - testID: PropTypes.string, - /** - * The mechanism that should be used to resize the image when the image's dimensions - * differ from the image view's dimensions. Defaults to `auto`. - * - * See https://facebook.github.io/react-native/docs/image.html#resizemethod - */ - resizeMethod: PropTypes.oneOf(['auto', 'resize', 'scale']), - /** - * Determines how to resize the image when the frame doesn't match the raw - * image dimensions. - * - * See https://facebook.github.io/react-native/docs/image.html#resizemode - */ - resizeMode: PropTypes.oneOf([ - 'cover', - 'contain', - 'stretch', - 'repeat', - 'center', - ]), -}; - -function getSize( - url: string, - success: (width: number, height: number) => void, - failure?: (error: any) => void, -) { - return ImageLoader.getSize(url) - .then(function(sizes) { - success(sizes.width, sizes.height); - }) - .catch( - failure || - function() { - console.warn('Failed to get size for image: ' + url); - }, - ); -} - -function prefetch(url: string, callback: ?Function) { - const requestId = generateRequestId(); - callback && callback(requestId); - return ImageLoader.prefetchImage(url, requestId); -} - -function abortPrefetch(requestId: number) { - ImageLoader.abortRequest(requestId); -} - -/** - * Perform cache interrogation. - * - * See https://facebook.github.io/react-native/docs/image.html#querycache - */ -async function queryCache( - urls: Array, -): Promise> { - return await ImageLoader.queryCache(urls); -} - -declare class ImageComponentType extends ReactNative.NativeComponent< - ImagePropsType, -> { - static getSize: typeof getSize; - static prefetch: typeof prefetch; - static abortPrefetch: typeof abortPrefetch; - static queryCache: typeof queryCache; - static resolveAssetSource: typeof resolveAssetSource; - static propTypes: typeof ImageProps; -} - -/** - * A React component for displaying different types of images, - * including network images, static resources, temporary local images, and - * images from local disk, such as the camera roll. - * - * See https://facebook.github.io/react-native/docs/image.html - */ -let Image = ( - props: ImagePropsType, - forwardedRef: ?React.Ref<'RCTTextInlineImage' | 'ImageViewNativeComponent'>, -) => { - let source = resolveAssetSource(props.source); - const defaultSource = resolveAssetSource(props.defaultSource); - const loadingIndicatorSource = resolveAssetSource( - props.loadingIndicatorSource, - ); - - if (source && source.uri === '') { - console.warn('source.uri should not be an empty string'); - } - - if (props.src) { - console.warn( - 'The component requires a `source` property rather than `src`.', - ); - } - - if (props.children) { - throw new Error( - 'The component cannot contain children. If you want to render content on top of the image, consider using the component or absolute positioning.', - ); - } - - if (props.defaultSource && props.loadingIndicatorSource) { - throw new Error( - 'The component cannot have defaultSource and loadingIndicatorSource at the same time. Please use either defaultSource or loadingIndicatorSource.', - ); - } - - if (source && !source.uri && !Array.isArray(source)) { - source = null; - } - - let style; - let sources; - if (source?.uri != null) { - /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found - * when making Flow check .android.js files. */ - const {width, height} = source; - style = flattenStyle([{width, height}, styles.base, props.style]); - /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found - * when making Flow check .android.js files. */ - sources = [{uri: source.uri}]; - } else { - style = flattenStyle([styles.base, props.style]); - sources = source; - } - - const {onLoadStart, onLoad, onLoadEnd, onError} = props; - const nativeProps = merge(props, { - style, - shouldNotifyLoadEvents: !!(onLoadStart || onLoad || onLoadEnd || onError), - src: sources, - /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found - * when making Flow check .android.js files. */ - headers: source?.headers, - defaultSrc: defaultSource ? defaultSource.uri : null, - loadingIndicatorSrc: loadingIndicatorSource - ? loadingIndicatorSource.uri - : null, - ref: forwardedRef, - }); - - return ( - - {hasTextAncestor => - hasTextAncestor ? ( - - ) : ( - - ) - } - - ); -}; - -Image = React.forwardRef(Image); -Image.displayName = 'Image'; - -/** - * Retrieve the width and height (in pixels) of an image prior to displaying it - * - * See https://facebook.github.io/react-native/docs/image.html#getsize - */ -/* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete this - * comment and run Flow. */ -Image.getSize = getSize; - -/** - * Prefetches a remote image for later use by downloading it to the disk - * cache - * - * See https://facebook.github.io/react-native/docs/image.html#prefetch - */ -/* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete this - * comment and run Flow. */ -Image.prefetch = prefetch; - -/** - * Abort prefetch request. - * - * See https://facebook.github.io/react-native/docs/image.html#abortprefetch - */ -/* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete this - * comment and run Flow. */ -Image.abortPrefetch = abortPrefetch; - -/** - * Perform cache interrogation. - * - * See https://facebook.github.io/react-native/docs/image.html#querycache - */ -/* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete this - * comment and run Flow. */ -Image.queryCache = queryCache; - -/** - * Resolves an asset reference into an object. - * - * See https://facebook.github.io/react-native/docs/image.html#resolveassetsource - */ -/* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete this - * comment and run Flow. */ -Image.resolveAssetSource = resolveAssetSource; - -/* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete this - * comment and run Flow. */ -Image.propTypes = ImageProps; - -const styles = StyleSheet.create({ - base: { - overflow: 'hidden', - }, -}); - -/* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete this - * comment and run Flow. */ -module.exports = (Image: Class); diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/Image.ios.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/Image.ios.js deleted file mode 100644 index 7475caa0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/Image.ios.js +++ /dev/null @@ -1,184 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ -'use strict'; - -const DeprecatedImagePropType = require('DeprecatedImagePropType'); -const NativeModules = require('NativeModules'); -const React = require('React'); -const ReactNative = require('ReactNative'); // eslint-disable-line no-unused-vars -const StyleSheet = require('StyleSheet'); - -const flattenStyle = require('flattenStyle'); -const requireNativeComponent = require('requireNativeComponent'); -const resolveAssetSource = require('resolveAssetSource'); - -const ImageViewManager = NativeModules.ImageViewManager; - -const RCTImageView = requireNativeComponent('RCTImageView'); - -import type {ImageProps as ImagePropsType} from 'ImageProps'; - -import type {ImageStyleProp} from 'StyleSheet'; - -function getSize( - uri: string, - success: (width: number, height: number) => void, - failure?: (error: any) => void, -) { - ImageViewManager.getSize( - uri, - success, - failure || - function() { - console.warn('Failed to get size for image: ' + uri); - }, - ); -} - -function prefetch(url: string) { - return ImageViewManager.prefetchImage(url); -} - -async function queryCache( - urls: Array, -): Promise> { - return await ImageViewManager.queryCache(urls); -} - -declare class ImageComponentType extends ReactNative.NativeComponent< - ImagePropsType, -> { - static getSize: typeof getSize; - static prefetch: typeof prefetch; - static queryCache: typeof queryCache; - static resolveAssetSource: typeof resolveAssetSource; - static propTypes: typeof DeprecatedImagePropType; -} - -/** - * A React component for displaying different types of images, - * including network images, static resources, temporary local images, and - * images from local disk, such as the camera roll. - * - * See https://facebook.github.io/react-native/docs/image.html - */ -let Image = ( - props: ImagePropsType, - forwardedRef: ?React.Ref<'RCTImageView'>, -) => { - const source = resolveAssetSource(props.source) || { - uri: undefined, - width: undefined, - height: undefined, - }; - - let sources; - let style: ImageStyleProp; - if (Array.isArray(source)) { - // $FlowFixMe flattenStyle is not strong enough - style = flattenStyle([styles.base, props.style]) || {}; - sources = source; - } else { - const {width, height, uri} = source; - // $FlowFixMe flattenStyle is not strong enough - style = flattenStyle([{width, height}, styles.base, props.style]) || {}; - sources = [source]; - - if (uri === '') { - console.warn('source.uri should not be an empty string'); - } - } - - const resizeMode = props.resizeMode || style.resizeMode || 'cover'; - const tintColor = style.tintColor; - - if (props.src != null) { - console.warn( - 'The component requires a `source` property rather than `src`.', - ); - } - - if (props.children != null) { - throw new Error( - 'The component cannot contain children. If you want to render content on top of the image, consider using the component or absolute positioning.', - ); - } - - return ( - - ); -}; - -Image = React.forwardRef(Image); -Image.displayName = 'Image'; - -/** - * Retrieve the width and height (in pixels) of an image prior to displaying it. - * - * See https://facebook.github.io/react-native/docs/image.html#getsize - */ -/* $FlowFixMe(>=0.89.0 site=react_native_ios_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete this - * comment and run Flow. */ -Image.getSize = getSize; - -/** - * Prefetches a remote image for later use by downloading it to the disk - * cache. - * - * See https://facebook.github.io/react-native/docs/image.html#prefetch - */ -/* $FlowFixMe(>=0.89.0 site=react_native_ios_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete this - * comment and run Flow. */ -Image.prefetch = prefetch; - -/** - * Performs cache interrogation. - * - * See https://facebook.github.io/react-native/docs/image.html#querycache - */ -/* $FlowFixMe(>=0.89.0 site=react_native_ios_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete this - * comment and run Flow. */ -Image.queryCache = queryCache; - -/** - * Resolves an asset reference into an object. - * - * See https://facebook.github.io/react-native/docs/image.html#resolveassetsource - */ -/* $FlowFixMe(>=0.89.0 site=react_native_ios_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete this - * comment and run Flow. */ -Image.resolveAssetSource = resolveAssetSource; - -/* $FlowFixMe(>=0.89.0 site=react_native_ios_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete this - * comment and run Flow. */ -Image.propTypes = DeprecatedImagePropType; - -const styles = StyleSheet.create({ - base: { - overflow: 'hidden', - }, -}); - -/* $FlowFixMe(>=0.89.0 site=react_native_ios_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete this - * comment and run Flow. */ -module.exports = (Image: Class); diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageBackground.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageBackground.js deleted file mode 100644 index 7d04576d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageBackground.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ -'use strict'; - -const Image = require('Image'); -const React = require('React'); -const StyleSheet = require('StyleSheet'); -const View = require('View'); - -const ensureComponentIsNative = require('ensureComponentIsNative'); - -/** - * Very simple drop-in replacement for which supports nesting views. - * - * ```ReactNativeWebPlayer - * import React, { Component } from 'react'; - * import { AppRegistry, View, ImageBackground, Text } from 'react-native'; - * - * class DisplayAnImageBackground extends Component { - * render() { - * return ( - * - * React - * - * ); - * } - * } - * - * // App registration and rendering - * AppRegistry.registerComponent('DisplayAnImageBackground', () => DisplayAnImageBackground); - * ``` - */ -class ImageBackground extends React.Component<$FlowFixMeProps> { - setNativeProps(props: Object) { - // Work-around flow - const viewRef = this._viewRef; - if (viewRef) { - ensureComponentIsNative(viewRef); - viewRef.setNativeProps(props); - } - } - - _viewRef: ?React.ElementRef = null; - - _captureRef = ref => { - this._viewRef = ref; - }; - - render() { - const {children, style, imageStyle, imageRef, ...props} = this.props; - - return ( - - overwrites width and height styles - // (which is not quite correct), and these styles conflict with explicitly set styles - // of and with our internal layout model here. - // So, we have to proxy/reapply these styles explicitly for actual component. - // This workaround should be removed after implementing proper support of - // intrinsic content size of the . - width: style.width, - height: style.height, - }, - imageStyle, - ]} - ref={imageRef} - /> - {children} - - ); - } -} - -module.exports = ImageBackground; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageEditor.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageEditor.js deleted file mode 100644 index 53785b68..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageEditor.js +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ -'use strict'; - -const RCTImageEditingManager = require('NativeModules').ImageEditingManager; - -type ImageCropData = { - /** - * The top-left corner of the cropped image, specified in the original - * image's coordinate space. - */ - offset: {| - x: number, - y: number, - |}, - /** - * The size (dimensions) of the cropped image, specified in the original - * image's coordinate space. - */ - size: {| - width: number, - height: number, - |}, - /** - * (Optional) size to scale the cropped image to. - */ - displaySize?: ?{| - width: number, - height: number, - |}, - /** - * (Optional) the resizing mode to use when scaling the image. If the - * `displaySize` param is not specified, this has no effect. - */ - resizeMode?: ?$Enum<{ - contain: string, - cover: string, - stretch: string, - }>, -}; - -class ImageEditor { - /** - * Crop the image specified by the URI param. If URI points to a remote - * image, it will be downloaded automatically. If the image cannot be - * loaded/downloaded, the failure callback will be called. On Android, a - * downloaded image may be cached in external storage, a publicly accessible - * location, if it has more available space than internal storage. - * - * If the cropping process is successful, the resultant cropped image - * will be stored in the ImageStore, and the URI returned in the success - * callback will point to the image in the store. Remember to delete the - * cropped image from the ImageStore when you are done with it. - */ - static cropImage( - uri: string, - cropData: ImageCropData, - success: (uri: string) => void, - failure: (error: Object) => void, - ) { - RCTImageEditingManager.cropImage(uri, cropData, success, failure); - } -} - -module.exports = ImageEditor; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageProps.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageProps.js deleted file mode 100644 index 99591c48..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageProps.js +++ /dev/null @@ -1,168 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -import type {SyntheticEvent, LayoutEvent} from 'CoreEventTypes'; -import type {EdgeInsetsProp} from 'EdgeInsetsPropType'; -import type {ImageSource} from 'ImageSource'; -import type {ViewStyleProp, ImageStyleProp} from 'StyleSheet'; -import type {DimensionValue} from 'StyleSheetTypes'; -import type {ViewProps} from 'ViewPropTypes'; - -export type ImageLoadEvent = SyntheticEvent< - $ReadOnly<{| - source: $ReadOnly<{| - width: number, - height: number, - url: string, - |}>, - uri?: string, // Only on Android - |}>, ->; - -type IOSImageProps = $ReadOnly<{| - /** - * A static image to display while loading the image source. - * - * See https://facebook.github.io/react-native/docs/image.html#defaultsource - */ - defaultSource?: ?ImageSource, - /** - * Invoked when a partial load of the image is complete. - * - * See https://facebook.github.io/react-native/docs/image.html#onpartialload - */ - onPartialLoad?: ?() => void, - /** - * Invoked on download progress with `{nativeEvent: {loaded, total}}`. - * - * See https://facebook.github.io/react-native/docs/image.html#onprogress - */ - onProgress?: ?( - event: SyntheticEvent<$ReadOnly<{|loaded: number, total: number|}>>, - ) => void, -|}>; - -type AndroidImageProps = $ReadOnly<{| - loadingIndicatorSource?: ?(number | $ReadOnly<{|uri: string|}>), - progressiveRenderingEnabled?: ?boolean, - fadeDuration?: ?number, -|}>; - -export type ImageProps = {| - ...$Diff>, - ...IOSImageProps, - ...AndroidImageProps, - - /** - * When true, indicates the image is an accessibility element. - * - * See https://facebook.github.io/react-native/docs/image.html#accessible - */ - accessible?: ?boolean, - - /** - * The text that's read by the screen reader when the user interacts with - * the image. - * - * See https://facebook.github.io/react-native/docs/image.html#accessibilitylabel - */ - accessibilityLabel?: ?Stringish, - - /** - * blurRadius: the blur radius of the blur filter added to the image - * - * See https://facebook.github.io/react-native/docs/image.html#blurradius - */ - blurRadius?: ?number, - - /** - * See https://facebook.github.io/react-native/docs/image.html#capinsets - */ - capInsets?: ?EdgeInsetsProp, - - /** - * Invoked on load error with `{nativeEvent: {error}}`. - * - * See https://facebook.github.io/react-native/docs/image.html#onerror - */ - onError?: ?(event: SyntheticEvent<$ReadOnly<{||}>>) => void, - - /** - * Invoked on mount and layout changes with - * `{nativeEvent: {layout: {x, y, width, height}}}`. - * - * See https://facebook.github.io/react-native/docs/image.html#onlayout - */ - - onLayout?: ?(event: LayoutEvent) => mixed, - - /** - * Invoked when load completes successfully. - * - * See https://facebook.github.io/react-native/docs/image.html#onload - */ - onLoad?: ?(event: ImageLoadEvent) => void, - - /** - * Invoked when load either succeeds or fails. - * - * See https://facebook.github.io/react-native/docs/image.html#onloadend - */ - onLoadEnd?: ?() => void, - - /** - * Invoked on load start. - * - * See https://facebook.github.io/react-native/docs/image.html#onloadstart - */ - onLoadStart?: ?() => void, - - /** - * See https://facebook.github.io/react-native/docs/image.html#resizemethod - */ - resizeMethod?: ?('auto' | 'resize' | 'scale'), - - /** - * The image source (either a remote URL or a local file resource). - * - * See https://facebook.github.io/react-native/docs/image.html#source - */ - source?: ?ImageSource, - - /** - * See https://facebook.github.io/react-native/docs/image.html#style - */ - style?: ?ImageStyleProp, - - // Can be set via props or style, for now - height?: ?DimensionValue, - width?: ?DimensionValue, - - /** - * Determines how to resize the image when the frame doesn't match the raw - * image dimensions. - * - * See https://facebook.github.io/react-native/docs/image.html#resizemode - */ - resizeMode?: ?('cover' | 'contain' | 'stretch' | 'repeat' | 'center'), - - /** - * A unique identifier for this element to be used in UI Automation - * testing scripts. - * - * See https://facebook.github.io/react-native/docs/image.html#testid - */ - testID?: ?string, - - src?: empty, - children?: empty, -|}; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageResizeMode.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageResizeMode.js deleted file mode 100644 index 1dad3309..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageResizeMode.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict - * @format - */ - -'use strict'; - -/** - * ImageResizeMode defines valid values for different image resizing modes set - * via the `resizeMode` style property on ``. - */ -export type ImageResizeMode = - // Resize by scaling down such that it is completely visible, if bigger than - // the area of the view. The image will not be scaled up. - | 'center' - - // Resize such that it will be completely visible, contained within the frame - // of the View. - | 'contain' - - // Resize such that the entire area of the view is covered by the image, - // potentially clipping parts of the image. - | 'cover' - - // Resize by repeating to cover the frame of the View. The image will keep its - // size and aspect ratio. - | 'repeat' - - // Resize by stretching it to fill the entire frame of the view without - // clipping. This may change the aspect ratio of the image, distorting it. - | 'stretch'; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageSource.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageSource.js deleted file mode 100644 index 0e03dc78..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageSource.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ -'use strict'; - -// This is to sync with ImageSourcePropTypes.js. -// We explicitly don't want this to be strict so that we can pass in objects -// that might have more keys. This also has to be inexact to support taking -// instances of classes like FBIcon. -// https://fburl.com/8lynhvtw -export type ImageURISource = $ReadOnly<{ - /** - * `uri` is a string representing the resource identifier for the image, which - * could be an http address, a local file path, or the name of a static image - * resource (which should be wrapped in the `require('./path/to/image.png')` - * function). - */ - uri?: ?string, - - /** - * `bundle` is the iOS asset bundle which the image is included in. This - * will default to [NSBundle mainBundle] if not set. - * @platform ios - */ - bundle?: ?string, - - /** - * `method` is the HTTP Method to use. Defaults to GET if not specified. - */ - method?: ?string, - - /** - * `headers` is an object representing the HTTP headers to send along with the - * request for a remote image. - */ - headers?: ?Object, - - /** - * `body` is the HTTP body to send with the request. This must be a valid - * UTF-8 string, and will be sent exactly as specified, with no - * additional encoding (e.g. URL-escaping or base64) applied. - */ - body?: ?string, - - /** - * `cache` determines how the requests handles potentially cached - * responses. - * - * - `default`: Use the native platforms default strategy. `useProtocolCachePolicy` on iOS. - * - * - `reload`: The data for the URL will be loaded from the originating source. - * No existing cache data should be used to satisfy a URL load request. - * - * - `force-cache`: The existing cached data will be used to satisfy the request, - * regardless of its age or expiration date. If there is no existing data in the cache - * corresponding the request, the data is loaded from the originating source. - * - * - `only-if-cached`: The existing cache data will be used to satisfy a request, regardless of - * its age or expiration date. If there is no existing data in the cache corresponding - * to a URL load request, no attempt is made to load the data from the originating source, - * and the load is considered to have failed. - * - * @platform ios - */ - cache?: ?('default' | 'reload' | 'force-cache' | 'only-if-cached'), - - /** - * `width` and `height` can be specified if known at build time, in which case - * these will be used to set the default `` component dimensions. - */ - width?: ?number, - height?: ?number, - - /** - * `scale` is used to indicate the scale factor of the image. Defaults to 1.0 if - * unspecified, meaning that one image pixel equates to one display point / DIP. - */ - scale?: ?number, -}>; - -// We have to export any because of an issue in Flow with objects that come from Relay: -// https://fburl.com/8ljo5tmr -// https://fb.facebook.com/groups/flow/permalink/1824103160971624/ -// $FlowFixMe T26861415 -export type ImageSource = ImageURISource | number | Array; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageStore.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageStore.js deleted file mode 100644 index 8ba5c316..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageStore.js +++ /dev/null @@ -1,107 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ -'use strict'; - -const RCTImageStoreManager = require('NativeModules').ImageStoreManager; - -const Platform = require('Platform'); - -const warnOnce = require('warnOnce'); - -function warnUnimplementedMethod(methodName: string): void { - warnOnce( - `imagestore-${methodName}`, - `react-native: ImageStore.${methodName}() is not implemented on ${ - Platform.OS - }`, - ); -} - -class ImageStore { - /** - * Check if the ImageStore contains image data for the specified URI. - * @platform ios - */ - static hasImageForTag(uri: string, callback: (hasImage: boolean) => void) { - if (RCTImageStoreManager.hasImageForTag) { - RCTImageStoreManager.hasImageForTag(uri, callback); - } else { - warnUnimplementedMethod('hasImageForTag'); - } - } - - /** - * Delete an image from the ImageStore. Images are stored in memory and - * must be manually removed when you are finished with them, otherwise they - * will continue to use up RAM until the app is terminated. It is safe to - * call `removeImageForTag()` without first calling `hasImageForTag()`, it - * will simply fail silently. - * @platform ios - */ - static removeImageForTag(uri: string) { - if (RCTImageStoreManager.removeImageForTag) { - RCTImageStoreManager.removeImageForTag(uri); - } else { - warnUnimplementedMethod('removeImageForTag'); - } - } - - /** - * Stores a base64-encoded image in the ImageStore, and returns a URI that - * can be used to access or display the image later. Images are stored in - * memory only, and must be manually deleted when you are finished with - * them by calling `removeImageForTag()`. - * - * Note that it is very inefficient to transfer large quantities of binary - * data between JS and native code, so you should avoid calling this more - * than necessary. - * @platform ios - */ - static addImageFromBase64( - base64ImageData: string, - success: (uri: string) => void, - failure: (error: any) => void, - ) { - if (RCTImageStoreManager.addImageFromBase64) { - RCTImageStoreManager.addImageFromBase64( - base64ImageData, - success, - failure, - ); - } else { - warnUnimplementedMethod('addImageFromBase64'); - } - } - - /** - * Retrieves the base64-encoded data for an image in the ImageStore. If the - * specified URI does not match an image in the store, the failure callback - * will be called. - * - * Note that it is very inefficient to transfer large quantities of binary - * data between JS and native code, so you should avoid calling this more - * than necessary. To display an image in the ImageStore, you can just pass - * the URI to an `` component; there is no need to retrieve the - * base64 data. - */ - static getBase64ForTag( - uri: string, - success: (base64ImageData: string) => void, - failure: (error: any) => void, - ) { - if (RCTImageStoreManager.getBase64ForTag) { - RCTImageStoreManager.getBase64ForTag(uri, success, failure); - } else { - warnUnimplementedMethod('getBase64ForTag'); - } - } -} - -module.exports = ImageStore; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageViewNativeComponent.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageViewNativeComponent.js deleted file mode 100644 index 47f8d531..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/ImageViewNativeComponent.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const requireNativeComponent = require('requireNativeComponent'); - -const ImageViewNativeComponent = requireNativeComponent('RCTImageView'); - -module.exports = ImageViewNativeComponent; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTGIFImageDecoder.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTGIFImageDecoder.h deleted file mode 100644 index f9cc0eef..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTGIFImageDecoder.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTGIFImageDecoder : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTGIFImageDecoder.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTGIFImageDecoder.m deleted file mode 100644 index a0afd43f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTGIFImageDecoder.m +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTGIFImageDecoder.h" - -#import -#import - -#import - -@implementation RCTGIFImageDecoder - -RCT_EXPORT_MODULE() - -- (BOOL)canDecodeImageData:(NSData *)imageData -{ - char header[7] = {}; - [imageData getBytes:header length:6]; - - return !strcmp(header, "GIF87a") || !strcmp(header, "GIF89a"); -} - -- (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)imageData - size:(CGSize)size - scale:(CGFloat)scale - resizeMode:(RCTResizeMode)resizeMode - completionHandler:(RCTImageLoaderCompletionBlock)completionHandler -{ - CGImageSourceRef imageSource = CGImageSourceCreateWithData((CFDataRef)imageData, NULL); - if (!imageSource) { - completionHandler(nil, nil); - return ^{}; - } - NSDictionary *properties = (__bridge_transfer NSDictionary *)CGImageSourceCopyProperties(imageSource, NULL); - CGFloat loopCount = 0; - if ([[properties[(id)kCGImagePropertyGIFDictionary] allKeys] containsObject:(id)kCGImagePropertyGIFLoopCount]) { - loopCount = [properties[(id)kCGImagePropertyGIFDictionary][(id)kCGImagePropertyGIFLoopCount] unsignedIntegerValue]; - if (loopCount == 0) { - // A loop count of 0 means infinite - loopCount = HUGE_VALF; - } else { - // A loop count of 1 means it should repeat twice, 2 means, thrice, etc. - loopCount += 1; - } - } - - UIImage *image = nil; - size_t imageCount = CGImageSourceGetCount(imageSource); - if (imageCount > 1) { - - NSTimeInterval duration = 0; - NSMutableArray *delays = [NSMutableArray arrayWithCapacity:imageCount]; - NSMutableArray *images = [NSMutableArray arrayWithCapacity:imageCount]; - for (size_t i = 0; i < imageCount; i++) { - - CGImageRef imageRef = CGImageSourceCreateImageAtIndex(imageSource, i, NULL); - if (!imageRef) { - continue; - } - if (!image) { - image = [UIImage imageWithCGImage:imageRef scale:scale orientation:UIImageOrientationUp]; - } - - NSDictionary *frameProperties = (__bridge_transfer NSDictionary *)CGImageSourceCopyPropertiesAtIndex(imageSource, i, NULL); - NSDictionary *frameGIFProperties = frameProperties[(id)kCGImagePropertyGIFDictionary]; - - const NSTimeInterval kDelayTimeIntervalDefault = 0.1; - NSNumber *delayTime = frameGIFProperties[(id)kCGImagePropertyGIFUnclampedDelayTime] ?: frameGIFProperties[(id)kCGImagePropertyGIFDelayTime]; - if (delayTime == nil) { - if (delays.count == 0) { - delayTime = @(kDelayTimeIntervalDefault); - } else { - delayTime = delays.lastObject; - } - } - - const NSTimeInterval kDelayTimeIntervalMinimum = 0.02; - if (delayTime.floatValue < (float)kDelayTimeIntervalMinimum - FLT_EPSILON) { - delayTime = @(kDelayTimeIntervalDefault); - } - - duration += delayTime.doubleValue; - [delays addObject:delayTime]; - [images addObject:(__bridge_transfer id)imageRef]; - } - CFRelease(imageSource); - - NSMutableArray *keyTimes = [NSMutableArray arrayWithCapacity:delays.count]; - NSTimeInterval runningDuration = 0; - for (NSNumber *delayNumber in delays) { - [keyTimes addObject:@(runningDuration / duration)]; - runningDuration += delayNumber.doubleValue; - } - - [keyTimes addObject:@1.0]; - - // Create animation - CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"contents"]; - animation.calculationMode = kCAAnimationDiscrete; - animation.repeatCount = loopCount; - animation.keyTimes = keyTimes; - animation.values = images; - animation.duration = duration; - animation.removedOnCompletion = NO; - animation.fillMode = kCAFillModeForwards; - image.reactKeyframeAnimation = animation; - - } else { - - // Don't bother creating an animation - CGImageRef imageRef = CGImageSourceCreateImageAtIndex(imageSource, 0, NULL); - if (imageRef) { - image = [UIImage imageWithCGImage:imageRef scale:scale orientation:UIImageOrientationUp]; - CFRelease(imageRef); - } - CFRelease(imageSource); - } - - completionHandler(nil, image); - return ^{}; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImage.xcodeproj/project.pbxproj b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImage.xcodeproj/project.pbxproj deleted file mode 100644 index bbf4d710..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImage.xcodeproj/project.pbxproj +++ /dev/null @@ -1,528 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 1304D5AB1AA8C4A30002E2BE /* RCTImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1304D5A81AA8C4A30002E2BE /* RCTImageView.m */; }; - 1304D5AC1AA8C4A30002E2BE /* RCTImageViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1304D5AA1AA8C4A30002E2BE /* RCTImageViewManager.m */; }; - 1304D5B21AA8C50D0002E2BE /* RCTGIFImageDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 1304D5B11AA8C50D0002E2BE /* RCTGIFImageDecoder.m */; }; - 134B00A21B54232B00EC8DFB /* RCTImageUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 134B00A11B54232B00EC8DFB /* RCTImageUtils.m */; }; - 139A38841C4D587C00862840 /* RCTResizeMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 139A38831C4D587C00862840 /* RCTResizeMode.m */; }; - 13EF7F7F1BC825B1003F47DD /* RCTLocalAssetImageLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 13EF7F7E1BC825B1003F47DD /* RCTLocalAssetImageLoader.m */; }; - 143879381AAD32A300F088A5 /* RCTImageLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 143879371AAD32A300F088A5 /* RCTImageLoader.m */; }; - 2D3B5F1A1D9B0D0400451313 /* RCTImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = CCD34C261D4B8FE900268922 /* RCTImageCache.m */; }; - 2D3B5F1B1D9B0D0700451313 /* RCTImageBlurUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = EEF314711C9B0DD30049118E /* RCTImageBlurUtils.m */; }; - 2D3B5F1C1D9B0D1300451313 /* RCTResizeMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 139A38831C4D587C00862840 /* RCTResizeMode.m */; }; - 2D3B5F1D1D9B0D1300451313 /* RCTLocalAssetImageLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 13EF7F7E1BC825B1003F47DD /* RCTLocalAssetImageLoader.m */; }; - 2D3B5F1E1D9B0D1300451313 /* RCTGIFImageDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 1304D5B11AA8C50D0002E2BE /* RCTGIFImageDecoder.m */; }; - 2D3B5F1F1D9B0D1300451313 /* RCTImageEditingManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 354631671B69857700AA0B86 /* RCTImageEditingManager.m */; }; - 2D3B5F201D9B0D1300451313 /* RCTImageLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 143879371AAD32A300F088A5 /* RCTImageLoader.m */; }; - 2D3B5F211D9B0D1300451313 /* RCTImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1304D5A81AA8C4A30002E2BE /* RCTImageView.m */; }; - 2D3B5F221D9B0D1300451313 /* RCTImageViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1304D5AA1AA8C4A30002E2BE /* RCTImageViewManager.m */; }; - 2D3B5F231D9B0D1300451313 /* RCTImageStoreManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 35123E6A1B59C99D00EBAD80 /* RCTImageStoreManager.m */; }; - 2D3B5F241D9B0D1300451313 /* RCTImageUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 134B00A11B54232B00EC8DFB /* RCTImageUtils.m */; }; - 35123E6B1B59C99D00EBAD80 /* RCTImageStoreManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 35123E6A1B59C99D00EBAD80 /* RCTImageStoreManager.m */; }; - 354631681B69857700AA0B86 /* RCTImageEditingManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 354631671B69857700AA0B86 /* RCTImageEditingManager.m */; }; - 3D302E181DF8228100D6DDAE /* RCTImageUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; }; - 3D302F211DF8269200D6DDAE /* RCTImageUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; }; - 3DA05A5A1EE0312600805843 /* RCTImageShadowView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59AB09281EDE5DD1009F97B5 /* RCTImageShadowView.h */; }; - 3DA05A5B1EE0312900805843 /* RCTImageShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59AB09291EDE5DD1009F97B5 /* RCTImageShadowView.m */; }; - 3DED3A8A1DE6F79800336DD7 /* RCTGIFImageDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5B01AA8C50D0002E2BE /* RCTGIFImageDecoder.h */; }; - 3DED3A8B1DE6F79800336DD7 /* RCTImageBlurUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = EEF314701C9B0DD30049118E /* RCTImageBlurUtils.h */; }; - 3DED3A8C1DE6F79800336DD7 /* RCTImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = CCD34C251D4B8FE900268922 /* RCTImageCache.h */; }; - 3DED3A8D1DE6F79800336DD7 /* RCTImageEditingManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 354631661B69857700AA0B86 /* RCTImageEditingManager.h */; }; - 3DED3A8E1DE6F79800336DD7 /* RCTImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63C1DE4B44A0058FD77 /* RCTImageLoader.h */; }; - 3DED3A8F1DE6F79800336DD7 /* RCTImageStoreManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63D1DE4B44A0058FD77 /* RCTImageStoreManager.h */; }; - 3DED3A901DE6F79800336DD7 /* RCTImageUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; }; - 3DED3A911DE6F79800336DD7 /* RCTImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5A71AA8C4A30002E2BE /* RCTImageView.h */; }; - 3DED3A921DE6F79800336DD7 /* RCTImageViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5A91AA8C4A30002E2BE /* RCTImageViewManager.h */; }; - 3DED3A931DE6F79800336DD7 /* RCTLocalAssetImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 13EF7F7D1BC825B1003F47DD /* RCTLocalAssetImageLoader.h */; }; - 3DED3A941DE6F79800336DD7 /* RCTResizeMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63E1DE4B44A0058FD77 /* RCTResizeMode.h */; }; - 3DED3A961DE6F7A400336DD7 /* RCTGIFImageDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5B01AA8C50D0002E2BE /* RCTGIFImageDecoder.h */; }; - 3DED3A971DE6F7A400336DD7 /* RCTImageBlurUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = EEF314701C9B0DD30049118E /* RCTImageBlurUtils.h */; }; - 3DED3A981DE6F7A400336DD7 /* RCTImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = CCD34C251D4B8FE900268922 /* RCTImageCache.h */; }; - 3DED3A991DE6F7A400336DD7 /* RCTImageEditingManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 354631661B69857700AA0B86 /* RCTImageEditingManager.h */; }; - 3DED3A9A1DE6F7A400336DD7 /* RCTImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63C1DE4B44A0058FD77 /* RCTImageLoader.h */; }; - 3DED3A9B1DE6F7A400336DD7 /* RCTImageStoreManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63D1DE4B44A0058FD77 /* RCTImageStoreManager.h */; }; - 3DED3A9C1DE6F7A400336DD7 /* RCTImageUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; }; - 3DED3A9D1DE6F7A400336DD7 /* RCTImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5A71AA8C4A30002E2BE /* RCTImageView.h */; }; - 3DED3A9E1DE6F7A400336DD7 /* RCTImageViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5A91AA8C4A30002E2BE /* RCTImageViewManager.h */; }; - 3DED3A9F1DE6F7A400336DD7 /* RCTLocalAssetImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 13EF7F7D1BC825B1003F47DD /* RCTLocalAssetImageLoader.h */; }; - 3DED3AA01DE6F7A400336DD7 /* RCTResizeMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63E1DE4B44A0058FD77 /* RCTResizeMode.h */; }; - 59AB092A1EDE5DD1009F97B5 /* RCTImageShadowView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59AB09281EDE5DD1009F97B5 /* RCTImageShadowView.h */; }; - 59AB092B1EDE5DD1009F97B5 /* RCTImageShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59AB09291EDE5DD1009F97B5 /* RCTImageShadowView.m */; }; - CCD34C271D4B8FE900268922 /* RCTImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = CCD34C261D4B8FE900268922 /* RCTImageCache.m */; }; - EEF314721C9B0DD30049118E /* RCTImageBlurUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = EEF314711C9B0DD30049118E /* RCTImageBlurUtils.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 3D302E171DF8225500D6DDAE /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTImage; - dstSubfolderSpec = 16; - files = ( - 3D302E181DF8228100D6DDAE /* RCTImageUtils.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - 3D302F201DF8268700D6DDAE /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTImage; - dstSubfolderSpec = 16; - files = ( - 3D302F211DF8269200D6DDAE /* RCTImageUtils.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 1304D5A71AA8C4A30002E2BE /* RCTImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageView.h; sourceTree = ""; }; - 1304D5A81AA8C4A30002E2BE /* RCTImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageView.m; sourceTree = ""; }; - 1304D5A91AA8C4A30002E2BE /* RCTImageViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageViewManager.h; sourceTree = ""; }; - 1304D5AA1AA8C4A30002E2BE /* RCTImageViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageViewManager.m; sourceTree = ""; }; - 1304D5B01AA8C50D0002E2BE /* RCTGIFImageDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTGIFImageDecoder.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 1304D5B11AA8C50D0002E2BE /* RCTGIFImageDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTGIFImageDecoder.m; sourceTree = ""; }; - 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageUtils.h; sourceTree = ""; }; - 134B00A11B54232B00EC8DFB /* RCTImageUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageUtils.m; sourceTree = ""; }; - 139A38831C4D587C00862840 /* RCTResizeMode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTResizeMode.m; sourceTree = ""; }; - 13EF7F7D1BC825B1003F47DD /* RCTLocalAssetImageLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTLocalAssetImageLoader.h; sourceTree = ""; }; - 13EF7F7E1BC825B1003F47DD /* RCTLocalAssetImageLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTLocalAssetImageLoader.m; sourceTree = ""; }; - 143879371AAD32A300F088A5 /* RCTImageLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageLoader.m; sourceTree = ""; }; - 2D2A283A1D9B042B00D4039D /* libRCTImage-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTImage-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 35123E6A1B59C99D00EBAD80 /* RCTImageStoreManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageStoreManager.m; sourceTree = ""; }; - 354631661B69857700AA0B86 /* RCTImageEditingManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTImageEditingManager.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 354631671B69857700AA0B86 /* RCTImageEditingManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageEditingManager.m; sourceTree = ""; }; - 3D5FA63C1DE4B44A0058FD77 /* RCTImageLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageLoader.h; sourceTree = ""; }; - 3D5FA63D1DE4B44A0058FD77 /* RCTImageStoreManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageStoreManager.h; sourceTree = ""; }; - 3D5FA63E1DE4B44A0058FD77 /* RCTResizeMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTResizeMode.h; sourceTree = ""; }; - 3D5FA68C1DE4BA290058FD77 /* libRCTNetwork.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libRCTNetwork.a; path = "../Network/build/Debug-iphoneos/libRCTNetwork.a"; sourceTree = ""; }; - 58B5115D1A9E6B3D00147676 /* libRCTImage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTImage.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 59AB09281EDE5DD1009F97B5 /* RCTImageShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageShadowView.h; sourceTree = ""; }; - 59AB09291EDE5DD1009F97B5 /* RCTImageShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageShadowView.m; sourceTree = ""; }; - CCD34C251D4B8FE900268922 /* RCTImageCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTImageCache.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - CCD34C261D4B8FE900268922 /* RCTImageCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageCache.m; sourceTree = ""; }; - EEF314701C9B0DD30049118E /* RCTImageBlurUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTImageBlurUtils.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - EEF314711C9B0DD30049118E /* RCTImageBlurUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageBlurUtils.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 3D5FA68B1DE4BA290058FD77 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 3D5FA68C1DE4BA290058FD77 /* libRCTNetwork.a */, - ); - name = Frameworks; - sourceTree = ""; - }; - 58B511541A9E6B3D00147676 = { - isa = PBXGroup; - children = ( - 3D5FA68B1DE4BA290058FD77 /* Frameworks */, - 58B5115E1A9E6B3D00147676 /* Products */, - 1304D5B01AA8C50D0002E2BE /* RCTGIFImageDecoder.h */, - 1304D5B11AA8C50D0002E2BE /* RCTGIFImageDecoder.m */, - EEF314701C9B0DD30049118E /* RCTImageBlurUtils.h */, - EEF314711C9B0DD30049118E /* RCTImageBlurUtils.m */, - CCD34C251D4B8FE900268922 /* RCTImageCache.h */, - CCD34C261D4B8FE900268922 /* RCTImageCache.m */, - 354631661B69857700AA0B86 /* RCTImageEditingManager.h */, - 354631671B69857700AA0B86 /* RCTImageEditingManager.m */, - 3D5FA63C1DE4B44A0058FD77 /* RCTImageLoader.h */, - 143879371AAD32A300F088A5 /* RCTImageLoader.m */, - 59AB09281EDE5DD1009F97B5 /* RCTImageShadowView.h */, - 59AB09291EDE5DD1009F97B5 /* RCTImageShadowView.m */, - 3D5FA63D1DE4B44A0058FD77 /* RCTImageStoreManager.h */, - 35123E6A1B59C99D00EBAD80 /* RCTImageStoreManager.m */, - 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */, - 134B00A11B54232B00EC8DFB /* RCTImageUtils.m */, - 1304D5A71AA8C4A30002E2BE /* RCTImageView.h */, - 1304D5A81AA8C4A30002E2BE /* RCTImageView.m */, - 1304D5A91AA8C4A30002E2BE /* RCTImageViewManager.h */, - 1304D5AA1AA8C4A30002E2BE /* RCTImageViewManager.m */, - 13EF7F7D1BC825B1003F47DD /* RCTLocalAssetImageLoader.h */, - 13EF7F7E1BC825B1003F47DD /* RCTLocalAssetImageLoader.m */, - 3D5FA63E1DE4B44A0058FD77 /* RCTResizeMode.h */, - 139A38831C4D587C00862840 /* RCTResizeMode.m */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 58B5115E1A9E6B3D00147676 /* Products */ = { - isa = PBXGroup; - children = ( - 58B5115D1A9E6B3D00147676 /* libRCTImage.a */, - 2D2A283A1D9B042B00D4039D /* libRCTImage-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 3DED3A891DE6F78800336DD7 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 3DED3A8A1DE6F79800336DD7 /* RCTGIFImageDecoder.h in Headers */, - 3DED3A901DE6F79800336DD7 /* RCTImageUtils.h in Headers */, - 3DED3A8B1DE6F79800336DD7 /* RCTImageBlurUtils.h in Headers */, - 3DED3A8C1DE6F79800336DD7 /* RCTImageCache.h in Headers */, - 3DED3A8D1DE6F79800336DD7 /* RCTImageEditingManager.h in Headers */, - 3DED3A8E1DE6F79800336DD7 /* RCTImageLoader.h in Headers */, - 3DED3A8F1DE6F79800336DD7 /* RCTImageStoreManager.h in Headers */, - 59AB092A1EDE5DD1009F97B5 /* RCTImageShadowView.h in Headers */, - 3DED3A911DE6F79800336DD7 /* RCTImageView.h in Headers */, - 3DED3A921DE6F79800336DD7 /* RCTImageViewManager.h in Headers */, - 3DED3A931DE6F79800336DD7 /* RCTLocalAssetImageLoader.h in Headers */, - 3DED3A941DE6F79800336DD7 /* RCTResizeMode.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3DED3A951DE6F79D00336DD7 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 3DED3A961DE6F7A400336DD7 /* RCTGIFImageDecoder.h in Headers */, - 3DED3A971DE6F7A400336DD7 /* RCTImageBlurUtils.h in Headers */, - 3DED3A981DE6F7A400336DD7 /* RCTImageCache.h in Headers */, - 3DED3A991DE6F7A400336DD7 /* RCTImageEditingManager.h in Headers */, - 3DED3A9A1DE6F7A400336DD7 /* RCTImageLoader.h in Headers */, - 3DED3A9B1DE6F7A400336DD7 /* RCTImageStoreManager.h in Headers */, - 3DED3A9C1DE6F7A400336DD7 /* RCTImageUtils.h in Headers */, - 3DA05A5A1EE0312600805843 /* RCTImageShadowView.h in Headers */, - 3DED3A9D1DE6F7A400336DD7 /* RCTImageView.h in Headers */, - 3DED3A9E1DE6F7A400336DD7 /* RCTImageViewManager.h in Headers */, - 3DED3A9F1DE6F7A400336DD7 /* RCTLocalAssetImageLoader.h in Headers */, - 3DED3AA01DE6F7A400336DD7 /* RCTResizeMode.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 2D2A28391D9B042B00D4039D /* RCTImage-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D2A28421D9B042B00D4039D /* Build configuration list for PBXNativeTarget "RCTImage-tvOS" */; - buildPhases = ( - 3DED3A951DE6F79D00336DD7 /* Headers */, - 3D302F201DF8268700D6DDAE /* Copy Headers */, - 2D2A28361D9B042B00D4039D /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTImage-tvOS"; - productName = "RCTImage-tvOS"; - productReference = 2D2A283A1D9B042B00D4039D /* libRCTImage-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 58B5115C1A9E6B3D00147676 /* RCTImage */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511711A9E6B3D00147676 /* Build configuration list for PBXNativeTarget "RCTImage" */; - buildPhases = ( - 3DED3A891DE6F78800336DD7 /* Headers */, - 3D302E171DF8225500D6DDAE /* Copy Headers */, - 58B511591A9E6B3D00147676 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTImage; - productName = RCTNetworkImage; - productReference = 58B5115D1A9E6B3D00147676 /* libRCTImage.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511551A9E6B3D00147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 2D2A28391D9B042B00D4039D = { - CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Automatic; - }; - 58B5115C1A9E6B3D00147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511581A9E6B3D00147676 /* Build configuration list for PBXProject "RCTImage" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511541A9E6B3D00147676; - productRefGroup = 58B5115E1A9E6B3D00147676 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B5115C1A9E6B3D00147676 /* RCTImage */, - 2D2A28391D9B042B00D4039D /* RCTImage-tvOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 2D2A28361D9B042B00D4039D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D3B5F231D9B0D1300451313 /* RCTImageStoreManager.m in Sources */, - 2D3B5F1A1D9B0D0400451313 /* RCTImageCache.m in Sources */, - 2D3B5F1D1D9B0D1300451313 /* RCTLocalAssetImageLoader.m in Sources */, - 2D3B5F1F1D9B0D1300451313 /* RCTImageEditingManager.m in Sources */, - 2D3B5F1E1D9B0D1300451313 /* RCTGIFImageDecoder.m in Sources */, - 2D3B5F1C1D9B0D1300451313 /* RCTResizeMode.m in Sources */, - 2D3B5F221D9B0D1300451313 /* RCTImageViewManager.m in Sources */, - 2D3B5F211D9B0D1300451313 /* RCTImageView.m in Sources */, - 3DA05A5B1EE0312900805843 /* RCTImageShadowView.m in Sources */, - 2D3B5F201D9B0D1300451313 /* RCTImageLoader.m in Sources */, - 2D3B5F1B1D9B0D0700451313 /* RCTImageBlurUtils.m in Sources */, - 2D3B5F241D9B0D1300451313 /* RCTImageUtils.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 58B511591A9E6B3D00147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 35123E6B1B59C99D00EBAD80 /* RCTImageStoreManager.m in Sources */, - 1304D5AC1AA8C4A30002E2BE /* RCTImageViewManager.m in Sources */, - 1304D5B21AA8C50D0002E2BE /* RCTGIFImageDecoder.m in Sources */, - 143879381AAD32A300F088A5 /* RCTImageLoader.m in Sources */, - 354631681B69857700AA0B86 /* RCTImageEditingManager.m in Sources */, - 139A38841C4D587C00862840 /* RCTResizeMode.m in Sources */, - 1304D5AB1AA8C4A30002E2BE /* RCTImageView.m in Sources */, - EEF314721C9B0DD30049118E /* RCTImageBlurUtils.m in Sources */, - 59AB092B1EDE5DD1009F97B5 /* RCTImageShadowView.m in Sources */, - 13EF7F7F1BC825B1003F47DD /* RCTLocalAssetImageLoader.m in Sources */, - 134B00A21B54232B00EC8DFB /* RCTImageUtils.m in Sources */, - CCD34C271D4B8FE900268922 /* RCTImageCache.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 2D2A28401D9B042B00D4039D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTImage; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 2D2A28411D9B042B00D4039D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTImage; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 58B5116F1A9E6B3D00147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 58B511701A9E6B3D00147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 58B511721A9E6B3D00147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTImage; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTImage; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 58B511731A9E6B3D00147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTImage; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTImage; - RUN_CLANG_STATIC_ANALYZER = NO; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2D2A28421D9B042B00D4039D /* Build configuration list for PBXNativeTarget "RCTImage-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D2A28401D9B042B00D4039D /* Debug */, - 2D2A28411D9B042B00D4039D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511581A9E6B3D00147676 /* Build configuration list for PBXProject "RCTImage" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B5116F1A9E6B3D00147676 /* Debug */, - 58B511701A9E6B3D00147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511711A9E6B3D00147676 /* Build configuration list for PBXNativeTarget "RCTImage" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511721A9E6B3D00147676 /* Debug */, - 58B511731A9E6B3D00147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511551A9E6B3D00147676 /* Project object */; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageBlurUtils.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageBlurUtils.h deleted file mode 100644 index 2ec7b358..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageBlurUtils.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - -#import -#import - -#import - -RCT_EXTERN UIImage *RCTBlurredImageWithRadius(UIImage *inputImage, CGFloat radius); diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageBlurUtils.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageBlurUtils.m deleted file mode 100644 index 8ee3282d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageBlurUtils.m +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTImageBlurUtils.h" - -UIImage *RCTBlurredImageWithRadius(UIImage *inputImage, CGFloat radius) -{ - CGImageRef imageRef = inputImage.CGImage; - CGFloat imageScale = inputImage.scale; - UIImageOrientation imageOrientation = inputImage.imageOrientation; - - // Image must be nonzero size - if (CGImageGetWidth(imageRef) * CGImageGetHeight(imageRef) == 0) { - return inputImage; - } - - //convert to ARGB if it isn't - if (CGImageGetBitsPerPixel(imageRef) != 32 || - CGImageGetBitsPerComponent(imageRef) != 8 || - !((CGImageGetBitmapInfo(imageRef) & kCGBitmapAlphaInfoMask))) { - UIGraphicsBeginImageContextWithOptions(inputImage.size, NO, inputImage.scale); - [inputImage drawAtPoint:CGPointZero]; - imageRef = UIGraphicsGetImageFromCurrentImageContext().CGImage; - UIGraphicsEndImageContext(); - } - - vImage_Buffer buffer1, buffer2; - buffer1.width = buffer2.width = CGImageGetWidth(imageRef); - buffer1.height = buffer2.height = CGImageGetHeight(imageRef); - buffer1.rowBytes = buffer2.rowBytes = CGImageGetBytesPerRow(imageRef); - size_t bytes = buffer1.rowBytes * buffer1.height; - buffer1.data = malloc(bytes); - buffer2.data = malloc(bytes); - if (!buffer1.data || !buffer2.data) { - // CWE - 391 : Unchecked error condition - // https://www.cvedetails.com/cwe-details/391/Unchecked-Error-Condition.html - // https://eli.thegreenplace.net/2009/10/30/handling-out-of-memory-conditions-in-c - abort(); - } - - // A description of how to compute the box kernel width from the Gaussian - // radius (aka standard deviation) appears in the SVG spec: - // http://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement - uint32_t boxSize = floor((radius * imageScale * 3 * sqrt(2 * M_PI) / 4 + 0.5) / 2); - boxSize |= 1; // Ensure boxSize is odd - - //create temp buffer - void *tempBuffer = malloc((size_t)vImageBoxConvolve_ARGB8888(&buffer1, &buffer2, NULL, 0, 0, boxSize, boxSize, - NULL, kvImageEdgeExtend + kvImageGetTempBufferSize)); - if (!tempBuffer) { - // CWE - 391 : Unchecked error condition - // https://www.cvedetails.com/cwe-details/391/Unchecked-Error-Condition.html - // https://eli.thegreenplace.net/2009/10/30/handling-out-of-memory-conditions-in-c - abort(); - } - - //copy image data - CFDataRef dataSource = CGDataProviderCopyData(CGImageGetDataProvider(imageRef)); - memcpy(buffer1.data, CFDataGetBytePtr(dataSource), bytes); - CFRelease(dataSource); - - //perform blur - vImageBoxConvolve_ARGB8888(&buffer1, &buffer2, tempBuffer, 0, 0, boxSize, boxSize, NULL, kvImageEdgeExtend); - vImageBoxConvolve_ARGB8888(&buffer2, &buffer1, tempBuffer, 0, 0, boxSize, boxSize, NULL, kvImageEdgeExtend); - vImageBoxConvolve_ARGB8888(&buffer1, &buffer2, tempBuffer, 0, 0, boxSize, boxSize, NULL, kvImageEdgeExtend); - - //free buffers - free(buffer2.data); - free(tempBuffer); - - //create image context from buffer - CGContextRef ctx = CGBitmapContextCreate(buffer1.data, buffer1.width, buffer1.height, - 8, buffer1.rowBytes, CGImageGetColorSpace(imageRef), - CGImageGetBitmapInfo(imageRef)); - - //create image from context - imageRef = CGBitmapContextCreateImage(ctx); - UIImage *outputImage = [UIImage imageWithCGImage:imageRef scale:imageScale orientation:imageOrientation]; - CGImageRelease(imageRef); - CGContextRelease(ctx); - free(buffer1.data); - return outputImage; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageCache.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageCache.h deleted file mode 100644 index b7acc112..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageCache.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTImageCache : NSObject -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageCache.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageCache.m deleted file mode 100644 index a6546a7e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageCache.m +++ /dev/null @@ -1,168 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTImageCache.h" - -#import - -#import - -#import -#import -#import -#import - -#import "RCTImageUtils.h" - -static const NSUInteger RCTMaxCachableDecodedImageSizeInBytes = 2097152; // 2 MB - -static NSString *RCTCacheKeyForImage(NSString *imageTag, CGSize size, CGFloat scale, - RCTResizeMode resizeMode) -{ - return [NSString stringWithFormat:@"%@|%g|%g|%g|%lld", - imageTag, size.width, size.height, scale, (long long)resizeMode]; -} - -@implementation RCTImageCache -{ - NSOperationQueue *_imageDecodeQueue; - NSCache *_decodedImageCache; - NSMutableDictionary *_cacheStaleTimes; -} - -- (instancetype)init -{ - if (self = [super init]) { - _decodedImageCache = [NSCache new]; - _decodedImageCache.totalCostLimit = 20 * 1024 * 1024; // 20 MB - _cacheStaleTimes = [[NSMutableDictionary alloc] init]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(clearCache) - name:UIApplicationDidReceiveMemoryWarningNotification - object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(clearCache) - name:UIApplicationWillResignActiveNotification - object:nil]; - } - - return self; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (void)clearCache -{ - [_decodedImageCache removeAllObjects]; - @synchronized(_cacheStaleTimes) { - [_cacheStaleTimes removeAllObjects]; - } -} - -- (void)addImageToCache:(UIImage *)image - forKey:(NSString *)cacheKey -{ - if (!image) { - return; - } - NSInteger bytes = image.reactDecodedImageBytes; - if (bytes <= RCTMaxCachableDecodedImageSizeInBytes) { - [self->_decodedImageCache setObject:image - forKey:cacheKey - cost:bytes]; - } -} - -- (UIImage *)imageForUrl:(NSString *)url - size:(CGSize)size - scale:(CGFloat)scale - resizeMode:(RCTResizeMode)resizeMode -{ - NSString *cacheKey = RCTCacheKeyForImage(url, size, scale, resizeMode); - @synchronized(_cacheStaleTimes) { - id staleTime = _cacheStaleTimes[cacheKey]; - if (staleTime) { - if ([[NSDate new] compare:(NSDate *)staleTime] == NSOrderedDescending) { - // cached image has expired, clear it out to make room for others - [_cacheStaleTimes removeObjectForKey:cacheKey]; - [_decodedImageCache removeObjectForKey:cacheKey]; - return nil; - } - } - } - return [_decodedImageCache objectForKey:cacheKey]; -} - -- (void)addImageToCache:(UIImage *)image - URL:(NSString *)url - size:(CGSize)size - scale:(CGFloat)scale - resizeMode:(RCTResizeMode)resizeMode - response:(NSURLResponse *)response -{ - if ([response isKindOfClass:[NSHTTPURLResponse class]]) { - NSString *cacheKey = RCTCacheKeyForImage(url, size, scale, resizeMode); - BOOL shouldCache = YES; - NSString *responseDate = ((NSHTTPURLResponse *)response).allHeaderFields[@"Date"]; - NSDate *originalDate = [self dateWithHeaderString:responseDate]; - NSString *cacheControl = ((NSHTTPURLResponse *)response).allHeaderFields[@"Cache-Control"]; - NSDate *staleTime; - NSArray *components = [cacheControl componentsSeparatedByString:@","]; - for (NSString *component in components) { - if ([component containsString:@"no-cache"] || [component containsString:@"no-store"] || [component hasSuffix:@"max-age=0"]) { - shouldCache = NO; - break; - } else { - NSRange range = [component rangeOfString:@"max-age="]; - if (range.location != NSNotFound) { - NSInteger seconds = [[component substringFromIndex:range.location + range.length] integerValue]; - staleTime = [originalDate dateByAddingTimeInterval:(NSTimeInterval)seconds]; - } - } - } - if (shouldCache) { - if (!staleTime && originalDate) { - NSString *expires = ((NSHTTPURLResponse *)response).allHeaderFields[@"Expires"]; - NSString *lastModified = ((NSHTTPURLResponse *)response).allHeaderFields[@"Last-Modified"]; - if (expires) { - staleTime = [self dateWithHeaderString:expires]; - } else if (lastModified) { - NSDate *lastModifiedDate = [self dateWithHeaderString:lastModified]; - if (lastModifiedDate) { - NSTimeInterval interval = [originalDate timeIntervalSinceDate:lastModifiedDate] / 10; - staleTime = [originalDate dateByAddingTimeInterval:interval]; - } - } - } - if (staleTime) { - @synchronized(_cacheStaleTimes) { - _cacheStaleTimes[cacheKey] = staleTime; - } - } - return [self addImageToCache:image forKey:cacheKey]; - } - } -} - -- (NSDate *)dateWithHeaderString:(NSString *)headerDateString { - static NSDateFormatter *formatter; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - formatter = [[NSDateFormatter alloc] init]; - formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]; - formatter.dateFormat = @"EEE',' dd MMM yyyy HH':'mm':'ss 'GMT'"; - formatter.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0]; - }); - - return [formatter dateFromString:headerDateString]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageEditingManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageEditingManager.h deleted file mode 100644 index 684855f9..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageEditingManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTImageEditingManager : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageEditingManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageEditingManager.m deleted file mode 100644 index eb87df96..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageEditingManager.m +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTImageEditingManager.h" - -#import - -#import -#import -#import - -#import "RCTImageLoader.h" -#import "RCTImageStoreManager.h" -#import "RCTImageUtils.h" - -@implementation RCTImageEditingManager - -RCT_EXPORT_MODULE() - -@synthesize bridge = _bridge; - -/** - * Crops an image and adds the result to the image store. - * - * @param imageRequest An image URL - * @param cropData Dictionary with `offset`, `size` and `displaySize`. - * `offset` and `size` are relative to the full-resolution image size. - * `displaySize` is an optimization - if specified, the image will - * be scaled down to `displaySize` rather than `size`. - * All units are in px (not points). - */ -RCT_EXPORT_METHOD(cropImage:(NSURLRequest *)imageRequest - cropData:(NSDictionary *)cropData - successCallback:(RCTResponseSenderBlock)successCallback - errorCallback:(RCTResponseErrorBlock)errorCallback) -{ - CGRect rect = { - [RCTConvert CGPoint:cropData[@"offset"]], - [RCTConvert CGSize:cropData[@"size"]] - }; - - [_bridge.imageLoader loadImageWithURLRequest:imageRequest callback:^(NSError *error, UIImage *image) { - if (error) { - errorCallback(error); - return; - } - - // Crop image - CGSize targetSize = rect.size; - CGRect targetRect = {{-rect.origin.x, -rect.origin.y}, image.size}; - CGAffineTransform transform = RCTTransformFromTargetRect(image.size, targetRect); - UIImage *croppedImage = RCTTransformImage(image, targetSize, image.scale, transform); - - // Scale image - if (cropData[@"displaySize"]) { - targetSize = [RCTConvert CGSize:cropData[@"displaySize"]]; // in pixels - RCTResizeMode resizeMode = [RCTConvert RCTResizeMode:cropData[@"resizeMode"] ?: @"contain"]; - targetRect = RCTTargetRect(croppedImage.size, targetSize, 1, resizeMode); - transform = RCTTransformFromTargetRect(croppedImage.size, targetRect); - croppedImage = RCTTransformImage(croppedImage, targetSize, image.scale, transform); - } - - // Store image - [self->_bridge.imageStoreManager storeImage:croppedImage withBlock:^(NSString *croppedImageTag) { - if (!croppedImageTag) { - NSString *errorMessage = @"Error storing cropped image in RCTImageStoreManager"; - RCTLogWarn(@"%@", errorMessage); - errorCallback(RCTErrorWithMessage(errorMessage)); - return; - } - successCallback(@[croppedImageTag]); - }]; - }]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageLoader.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageLoader.h deleted file mode 100644 index da4e04ce..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageLoader.h +++ /dev/null @@ -1,258 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import - -typedef void (^RCTImageLoaderProgressBlock)(int64_t progress, int64_t total); -typedef void (^RCTImageLoaderPartialLoadBlock)(UIImage *image); -typedef void (^RCTImageLoaderCompletionBlock)(NSError *error, UIImage *image); -typedef dispatch_block_t RCTImageLoaderCancellationBlock; - -/** - * Provides an interface to use for providing a image caching strategy. - */ -@protocol RCTImageCache - -- (UIImage *)imageForUrl:(NSString *)url - size:(CGSize)size - scale:(CGFloat)scale - resizeMode:(RCTResizeMode)resizeMode; - -- (void)addImageToCache:(UIImage *)image - URL:(NSString *)url - size:(CGSize)size - scale:(CGFloat)scale - resizeMode:(RCTResizeMode)resizeMode - response:(NSURLResponse *)response; - -@end - -/** - * If available, RCTImageRedirectProtocol is invoked before loading an asset. - * Implementation should return either a new URL or nil when redirection is - * not needed. - */ - -@protocol RCTImageRedirectProtocol - -- (NSURL *)redirectAssetsURL:(NSURL *)URL; - -@end - -@interface UIImage (React) - -@property (nonatomic, copy) CAKeyframeAnimation *reactKeyframeAnimation; - -/** - * Memory bytes of the image with the default calculation of static image or GIF. Custom calculations of decoded bytes can be assigned manually. - */ -@property (nonatomic, assign) NSInteger reactDecodedImageBytes; - -@end - -@interface RCTImageLoader : NSObject - -/** - * The maximum number of concurrent image loading tasks. Loading and decoding - * images can consume a lot of memory, so setting this to a higher value may - * cause memory to spike. If you are seeing out-of-memory crashes, try reducing - * this value. - */ -@property (nonatomic, assign) NSUInteger maxConcurrentLoadingTasks; - -/** - * The maximum number of concurrent image decoding tasks. Decoding large - * images can be especially CPU and memory intensive, so if your are decoding a - * lot of large images in your app, you may wish to adjust this value. - */ -@property (nonatomic, assign) NSUInteger maxConcurrentDecodingTasks; - -/** - * Decoding large images can use a lot of memory, and potentially cause the app - * to crash. This value allows you to throttle the amount of memory used by the - * decoder independently of the number of concurrent threads. This means you can - * still decode a lot of small images in parallel, without allowing the decoder - * to try to decompress multiple huge images at once. Note that this value is - * only a hint, and not an indicator of the total memory used by the app. - */ -@property (nonatomic, assign) NSUInteger maxConcurrentDecodingBytes; - -- (instancetype)init; -- (instancetype)initWithRedirectDelegate:(id)redirectDelegate NS_DESIGNATED_INITIALIZER; - -/** - * Loads the specified image at the highest available resolution. - * Can be called from any thread, will call back on an unspecified thread. - */ -- (RCTImageLoaderCancellationBlock)loadImageWithURLRequest:(NSURLRequest *)imageURLRequest - callback:(RCTImageLoaderCompletionBlock)callback; - -/** - * As above, but includes target `size`, `scale` and `resizeMode`, which are used to - * select the optimal dimensions for the loaded image. The `clipped` option - * controls whether the image will be clipped to fit the specified size exactly, - * or if the original aspect ratio should be retained. - * `partialLoadBlock` is meant for custom image loaders that do not ship with the core RN library. - * It is meant to be called repeatedly while loading the image as higher quality versions are decoded, - * for instance with progressive JPEGs. - */ -- (RCTImageLoaderCancellationBlock)loadImageWithURLRequest:(NSURLRequest *)imageURLRequest - size:(CGSize)size - scale:(CGFloat)scale - clipped:(BOOL)clipped - resizeMode:(RCTResizeMode)resizeMode - progressBlock:(RCTImageLoaderProgressBlock)progressBlock - partialLoadBlock:(RCTImageLoaderPartialLoadBlock)partialLoadBlock - completionBlock:(RCTImageLoaderCompletionBlock)completionBlock; - -/** - * Finds an appropriate image decoder and passes the target `size`, `scale` and - * `resizeMode` for optimal image decoding. The `clipped` option controls - * whether the image will be clipped to fit the specified size exactly, or - * if the original aspect ratio should be retained. Can be called from any - * thread, will call callback on an unspecified thread. - */ -- (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)imageData - size:(CGSize)size - scale:(CGFloat)scale - clipped:(BOOL)clipped - resizeMode:(RCTResizeMode)resizeMode - completionBlock:(RCTImageLoaderCompletionBlock)completionBlock; - -/** - * Get image size, in pixels. This method will do the least work possible to get - * the information, and won't decode the image if it doesn't have to. - */ -- (RCTImageLoaderCancellationBlock)getImageSizeForURLRequest:(NSURLRequest *)imageURLRequest - block:(void(^)(NSError *error, CGSize size))completionBlock; -/** - * Determines whether given image URLs are cached locally. The `requests` array is expected - * to contain objects convertible to NSURLRequest. The return value maps URLs to strings: - * "disk" for images known to be cached in non-volatile storage, "memory" for images known - * to be cached in memory. Dictionary items corresponding to images that are not known to be - * cached are simply missing. - */ -- (NSDictionary *)getImageCacheStatus:(NSArray *)requests; - -/** - * Allows developers to set their own caching implementation for - * decoded images as long as it conforms to the RCTImageCache - * protocol. This method should be called in bridgeDidInitializeModule. - */ -- (void)setImageCache:(id)cache; - -@end - -@interface RCTBridge (RCTImageLoader) - -/** - * The shared image loader instance - */ -@property (nonatomic, readonly) RCTImageLoader *imageLoader; - -@end - -/** - * Provides the interface needed to register an image loader. Image data - * loaders are also bridge modules, so should be registered using - * RCT_EXPORT_MODULE(). - */ -@protocol RCTImageURLLoader - -/** - * Indicates whether this data loader is capable of processing the specified - * request URL. Typically the handler would examine the scheme/protocol of the - * URL to determine this. - */ -- (BOOL)canLoadImageURL:(NSURL *)requestURL; - -/** - * Send a network request to load the request URL. The method should call the - * progressHandler (if applicable) and the completionHandler when the request - * has finished. The method should also return a cancellation block, if - * applicable. - */ -- (RCTImageLoaderCancellationBlock)loadImageForURL:(NSURL *)imageURL - size:(CGSize)size - scale:(CGFloat)scale - resizeMode:(RCTResizeMode)resizeMode - progressHandler:(RCTImageLoaderProgressBlock)progressHandler - partialLoadHandler:(RCTImageLoaderPartialLoadBlock)partialLoadHandler - completionHandler:(RCTImageLoaderCompletionBlock)completionHandler; - -@optional - -/** - * If more than one RCTImageURLLoader responds YES to `-canLoadImageURL:` - * then `loaderPriority` is used to determine which one to use. The loader - * with the highest priority will be selected. Default priority is zero. If - * two or more valid loaders have the same priority, the selection order is - * undefined. - */ -- (float)loaderPriority; - -/** - * If the loader must be called on the serial url cache queue, and whether the completion - * block should be dispatched off the main thread. If this is NO, the loader will be - * called from the main queue. Defaults to YES. - * - * Use with care: disabling scheduling will reduce RCTImageLoader's ability to throttle - * network requests. - */ -- (BOOL)requiresScheduling; - -/** - * If images loaded by the loader should be cached in the decoded image cache. - * Defaults to YES. - */ -- (BOOL)shouldCacheLoadedImages; - -@end - -/** - * Provides the interface needed to register an image decoder. Image decoders - * are also bridge modules, so should be registered using RCT_EXPORT_MODULE(). - */ -@protocol RCTImageDataDecoder - -/** - * Indicates whether this handler is capable of decoding the specified data. - * Typically the handler would examine some sort of header data to determine - * this. - */ -- (BOOL)canDecodeImageData:(NSData *)imageData; - -/** - * Decode an image from the data object. The method should call the - * completionHandler when the decoding operation has finished. The method - * should also return a cancellation block, if applicable. - * - * If you provide a custom image decoder, you most implement scheduling yourself, - * to avoid decoding large amounts of images at the same time. - */ -- (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)imageData - size:(CGSize)size - scale:(CGFloat)scale - resizeMode:(RCTResizeMode)resizeMode - completionHandler:(RCTImageLoaderCompletionBlock)completionHandler; - -@optional - -/** - * If more than one RCTImageDataDecoder responds YES to `-canDecodeImageData:` - * then `decoderPriority` is used to determine which one to use. The decoder - * with the highest priority will be selected. Default priority is zero. - * If two or more valid decoders have the same priority, the selection order is - * undefined. - */ -- (float)decoderPriority; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageLoader.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageLoader.m deleted file mode 100644 index b9276f00..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageLoader.m +++ /dev/null @@ -1,915 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -#import - -#import -#import -#import -#import -#import -#import - -#import "RCTImageCache.h" -#import "RCTImageUtils.h" - -static NSInteger RCTImageBytesForImage(UIImage *image) -{ - CAKeyframeAnimation *keyFrameAnimation = [image reactKeyframeAnimation]; - NSInteger singleImageBytes = image.size.width * image.size.height * image.scale * image.scale * 4; - if (keyFrameAnimation) { - return keyFrameAnimation.values.count * singleImageBytes; - } else { - return image.images ? image.images.count * singleImageBytes : singleImageBytes; - } -} - -@implementation UIImage (React) - -- (CAKeyframeAnimation *)reactKeyframeAnimation -{ - return objc_getAssociatedObject(self, _cmd); -} - -- (void)setReactKeyframeAnimation:(CAKeyframeAnimation *)reactKeyframeAnimation -{ - objc_setAssociatedObject(self, @selector(reactKeyframeAnimation), reactKeyframeAnimation, OBJC_ASSOCIATION_COPY_NONATOMIC); -} - -- (NSInteger)reactDecodedImageBytes -{ - NSNumber *imageBytes = objc_getAssociatedObject(self, _cmd); - if (!imageBytes) { - imageBytes = @(RCTImageBytesForImage(self)); - } - return [imageBytes integerValue]; -} - -- (void)setReactDecodedImageBytes:(NSInteger)bytes -{ - objc_setAssociatedObject(self, @selector(reactDecodedImageBytes), @(bytes), OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -@end - -@implementation RCTImageLoader -{ - NSArray> *_loaders; - NSArray> *_decoders; - NSOperationQueue *_imageDecodeQueue; - dispatch_queue_t _URLRequestQueue; - id _imageCache; - NSMutableArray *_pendingTasks; - NSInteger _activeTasks; - NSMutableArray *_pendingDecodes; - NSInteger _scheduledDecodes; - NSUInteger _activeBytes; - __weak id _redirectDelegate; -} - -@synthesize bridge = _bridge; - -RCT_EXPORT_MODULE() - -- (instancetype)init -{ - return [self initWithRedirectDelegate:nil]; -} - -+ (BOOL)requiresMainQueueSetup -{ - return NO; -} - -- (instancetype)initWithRedirectDelegate:(id)redirectDelegate -{ - if (self = [super init]) { - _redirectDelegate = redirectDelegate; - } - return self; -} - -- (void)setUp -{ - // Set defaults - _maxConcurrentLoadingTasks = _maxConcurrentLoadingTasks ?: 4; - _maxConcurrentDecodingTasks = _maxConcurrentDecodingTasks ?: 2; - _maxConcurrentDecodingBytes = _maxConcurrentDecodingBytes ?: 30 * 1024 * 1024; // 30MB - - _URLRequestQueue = dispatch_queue_create("com.facebook.react.ImageLoaderURLRequestQueue", DISPATCH_QUEUE_SERIAL); -} - -- (float)handlerPriority -{ - return 2; -} - -- (id)imageCache -{ - if (!_imageCache) { - //set up with default cache - _imageCache = [RCTImageCache new]; - } - return _imageCache; -} - -- (void)setImageCache:(id)cache -{ - if (_imageCache) { - RCTLogWarn(@"RCTImageCache was already set and has now been overriden."); - } - _imageCache = cache; -} - -- (id)imageURLLoaderForURL:(NSURL *)URL -{ - if (!_maxConcurrentLoadingTasks) { - [self setUp]; - } - - if (!_loaders) { - // Get loaders, sorted in reverse priority order (highest priority first) - RCTAssert(_bridge, @"Bridge not set"); - _loaders = [[_bridge modulesConformingToProtocol:@protocol(RCTImageURLLoader)] sortedArrayUsingComparator:^NSComparisonResult(id a, id b) { - float priorityA = [a respondsToSelector:@selector(loaderPriority)] ? [a loaderPriority] : 0; - float priorityB = [b respondsToSelector:@selector(loaderPriority)] ? [b loaderPriority] : 0; - if (priorityA > priorityB) { - return NSOrderedAscending; - } else if (priorityA < priorityB) { - return NSOrderedDescending; - } else { - return NSOrderedSame; - } - }]; - } - - if (RCT_DEBUG) { - // Check for handler conflicts - float previousPriority = 0; - id previousLoader = nil; - for (id loader in _loaders) { - float priority = [loader respondsToSelector:@selector(loaderPriority)] ? [loader loaderPriority] : 0; - if (previousLoader && priority < previousPriority) { - return previousLoader; - } - if ([loader canLoadImageURL:URL]) { - if (previousLoader) { - if (priority == previousPriority) { - RCTLogError(@"The RCTImageURLLoaders %@ and %@ both reported that" - " they can load the URL %@, and have equal priority" - " (%g). This could result in non-deterministic behavior.", - loader, previousLoader, URL, priority); - } - } else { - previousLoader = loader; - previousPriority = priority; - } - } - } - return previousLoader; - } - - // Normal code path - for (id loader in _loaders) { - if ([loader canLoadImageURL:URL]) { - return loader; - } - } - return nil; -} - -- (id)imageDataDecoderForData:(NSData *)data -{ - if (!_maxConcurrentLoadingTasks) { - [self setUp]; - } - - if (!_decoders) { - // Get decoders, sorted in reverse priority order (highest priority first) - RCTAssert(_bridge, @"Bridge not set"); - _decoders = [[_bridge modulesConformingToProtocol:@protocol(RCTImageDataDecoder)] sortedArrayUsingComparator:^NSComparisonResult(id a, id b) { - float priorityA = [a respondsToSelector:@selector(decoderPriority)] ? [a decoderPriority] : 0; - float priorityB = [b respondsToSelector:@selector(decoderPriority)] ? [b decoderPriority] : 0; - if (priorityA > priorityB) { - return NSOrderedAscending; - } else if (priorityA < priorityB) { - return NSOrderedDescending; - } else { - return NSOrderedSame; - } - }]; - } - - if (RCT_DEBUG) { - // Check for handler conflicts - float previousPriority = 0; - id previousDecoder = nil; - for (id decoder in _decoders) { - float priority = [decoder respondsToSelector:@selector(decoderPriority)] ? [decoder decoderPriority] : 0; - if (previousDecoder && priority < previousPriority) { - return previousDecoder; - } - if ([decoder canDecodeImageData:data]) { - if (previousDecoder) { - if (priority == previousPriority) { - RCTLogError(@"The RCTImageDataDecoders %@ and %@ both reported that" - " they can decode the data , and" - " have equal priority (%g). This could result in" - " non-deterministic behavior.", - decoder, previousDecoder, data, data.length, priority); - } - } else { - previousDecoder = decoder; - previousPriority = priority; - } - } - } - return previousDecoder; - } - - // Normal code path - for (id decoder in _decoders) { - if ([decoder canDecodeImageData:data]) { - return decoder; - } - } - return nil; -} - -static UIImage *RCTResizeImageIfNeeded(UIImage *image, - CGSize size, - CGFloat scale, - RCTResizeMode resizeMode) -{ - if (CGSizeEqualToSize(size, CGSizeZero) || - CGSizeEqualToSize(image.size, CGSizeZero) || - CGSizeEqualToSize(image.size, size)) { - return image; - } - CAKeyframeAnimation *animation = image.reactKeyframeAnimation; - CGRect targetSize = RCTTargetRect(image.size, size, scale, resizeMode); - CGAffineTransform transform = RCTTransformFromTargetRect(image.size, targetSize); - image = RCTTransformImage(image, size, scale, transform); - image.reactKeyframeAnimation = animation; - return image; -} - -- (RCTImageLoaderCancellationBlock) loadImageWithURLRequest:(NSURLRequest *)imageURLRequest - callback:(RCTImageLoaderCompletionBlock)callback -{ - return [self loadImageWithURLRequest:imageURLRequest - size:CGSizeZero - scale:1 - clipped:YES - resizeMode:RCTResizeModeStretch - progressBlock:nil - partialLoadBlock:nil - completionBlock:callback]; -} - -- (void)dequeueTasks -{ - dispatch_async(_URLRequestQueue, ^{ - // Remove completed tasks - NSMutableArray *tasksToRemove = nil; - for (RCTNetworkTask *task in self->_pendingTasks.reverseObjectEnumerator) { - switch (task.status) { - case RCTNetworkTaskFinished: - if (!tasksToRemove) { - tasksToRemove = [NSMutableArray new]; - } - [tasksToRemove addObject:task]; - self->_activeTasks--; - break; - case RCTNetworkTaskPending: - break; - case RCTNetworkTaskInProgress: - // Check task isn't "stuck" - if (task.requestToken == nil) { - RCTLogWarn(@"Task orphaned for request %@", task.request); - if (!tasksToRemove) { - tasksToRemove = [NSMutableArray new]; - } - [tasksToRemove addObject:task]; - self->_activeTasks--; - [task cancel]; - } - break; - } - } - - if (tasksToRemove) { - [self->_pendingTasks removeObjectsInArray:tasksToRemove]; - } - - // Start queued decode - NSInteger activeDecodes = self->_scheduledDecodes - self->_pendingDecodes.count; - while (activeDecodes == 0 || (self->_activeBytes <= self->_maxConcurrentDecodingBytes && - activeDecodes <= self->_maxConcurrentDecodingTasks)) { - dispatch_block_t decodeBlock = self->_pendingDecodes.firstObject; - if (decodeBlock) { - [self->_pendingDecodes removeObjectAtIndex:0]; - decodeBlock(); - } else { - break; - } - } - - // Start queued tasks - for (RCTNetworkTask *task in self->_pendingTasks) { - if (MAX(self->_activeTasks, self->_scheduledDecodes) >= self->_maxConcurrentLoadingTasks) { - break; - } - if (task.status == RCTNetworkTaskPending) { - [task start]; - self->_activeTasks++; - } - } - }); -} - -/** - * This returns either an image, or raw image data, depending on the loading - * path taken. This is useful if you want to skip decoding, e.g. when preloading - * the image, or retrieving metadata. - */ -- (RCTImageLoaderCancellationBlock)_loadImageOrDataWithURLRequest:(NSURLRequest *)request - size:(CGSize)size - scale:(CGFloat)scale - resizeMode:(RCTResizeMode)resizeMode - progressBlock:(RCTImageLoaderProgressBlock)progressHandler - partialLoadBlock:(RCTImageLoaderPartialLoadBlock)partialLoadHandler - completionBlock:(void (^)(NSError *error, id imageOrData, BOOL cacheResult, NSURLResponse *response))completionBlock -{ - { - NSMutableURLRequest *mutableRequest = [request mutableCopy]; - [NSURLProtocol setProperty:@"RCTImageLoader" - forKey:@"trackingName" - inRequest:mutableRequest]; - - // Add missing png extension - if (request.URL.fileURL && request.URL.pathExtension.length == 0) { - mutableRequest.URL = [request.URL URLByAppendingPathExtension:@"png"]; - } - if (_redirectDelegate != nil) { - mutableRequest.URL = [_redirectDelegate redirectAssetsURL:mutableRequest.URL]; - } - request = mutableRequest; - } - - // Find suitable image URL loader - id loadHandler = [self imageURLLoaderForURL:request.URL]; - BOOL requiresScheduling = [loadHandler respondsToSelector:@selector(requiresScheduling)] ? - [loadHandler requiresScheduling] : YES; - - BOOL cacheResult = [loadHandler respondsToSelector:@selector(shouldCacheLoadedImages)] ? - [loadHandler shouldCacheLoadedImages] : YES; - - __block atomic_bool cancelled = ATOMIC_VAR_INIT(NO); - // TODO: Protect this variable shared between threads. - __block dispatch_block_t cancelLoad = nil; - void (^completionHandler)(NSError *, id, NSURLResponse *) = ^(NSError *error, id imageOrData, NSURLResponse *response) { - cancelLoad = nil; - - // If we've received an image, we should try to set it synchronously, - // if it's data, do decoding on a background thread. - if (RCTIsMainQueue() && ![imageOrData isKindOfClass:[UIImage class]]) { - // Most loaders do not return on the main thread, so caller is probably not - // expecting it, and may do expensive post-processing in the callback - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - if (!atomic_load(&cancelled)) { - completionBlock(error, imageOrData, cacheResult, response); - } - }); - } else if (!atomic_load(&cancelled)) { - completionBlock(error, imageOrData, cacheResult, response); - } - }; - - // If the loader doesn't require scheduling we call it directly on - // the main queue. - if (loadHandler && !requiresScheduling) { - return [loadHandler loadImageForURL:request.URL - size:size - scale:scale - resizeMode:resizeMode - progressHandler:progressHandler - partialLoadHandler:partialLoadHandler - completionHandler:^(NSError *error, UIImage *image){ - completionHandler(error, image, nil); - }]; - } - - // All access to URL cache must be serialized - if (!_URLRequestQueue) { - [self setUp]; - } - - __weak RCTImageLoader *weakSelf = self; - dispatch_async(_URLRequestQueue, ^{ - __typeof(self) strongSelf = weakSelf; - if (atomic_load(&cancelled) || !strongSelf) { - return; - } - - if (loadHandler) { - cancelLoad = [loadHandler loadImageForURL:request.URL - size:size - scale:scale - resizeMode:resizeMode - progressHandler:progressHandler - partialLoadHandler:partialLoadHandler - completionHandler:^(NSError *error, UIImage *image) { - completionHandler(error, image, nil); - }]; - } else { - UIImage *image; - if (cacheResult) { - image = [[strongSelf imageCache] imageForUrl:request.URL.absoluteString - size:size - scale:scale - resizeMode:resizeMode]; - } - - if (image) { - completionHandler(nil, image, nil); - } else { - // Use networking module to load image - cancelLoad = [strongSelf _loadURLRequest:request - progressBlock:progressHandler - completionBlock:completionHandler]; - } - } - }); - - return ^{ - BOOL alreadyCancelled = atomic_fetch_or(&cancelled, 1); - if (alreadyCancelled) { - return; - } - dispatch_block_t cancelLoadLocal = cancelLoad; - cancelLoad = nil; - if (cancelLoadLocal) { - cancelLoadLocal(); - } - }; -} - -- (RCTImageLoaderCancellationBlock)_loadURLRequest:(NSURLRequest *)request - progressBlock:(RCTImageLoaderProgressBlock)progressHandler - completionBlock:(void (^)(NSError *error, id imageOrData, NSURLResponse *response))completionHandler -{ - // Check if networking module is available - if (RCT_DEBUG && ![_bridge respondsToSelector:@selector(networking)]) { - RCTLogError(@"No suitable image URL loader found for %@. You may need to " - " import the RCTNetwork library in order to load images.", - request.URL.absoluteString); - return NULL; - } - - RCTNetworking *networking = [_bridge networking]; - - // Check if networking module can load image - if (RCT_DEBUG && ![networking canHandleRequest:request]) { - RCTLogError(@"No suitable image URL loader found for %@", request.URL.absoluteString); - return NULL; - } - - // Use networking module to load image - RCTURLRequestCompletionBlock processResponse = ^(NSURLResponse *response, NSData *data, NSError *error) { - // Check for system errors - if (error) { - completionHandler(error, nil, response); - return; - } else if (!response) { - completionHandler(RCTErrorWithMessage(@"Response metadata error"), nil, response); - return; - } else if (!data) { - completionHandler(RCTErrorWithMessage(@"Unknown image download error"), nil, response); - return; - } - - // Check for http errors - if ([response isKindOfClass:[NSHTTPURLResponse class]]) { - NSInteger statusCode = ((NSHTTPURLResponse *)response).statusCode; - if (statusCode != 200) { - NSString *errorMessage = [NSString stringWithFormat:@"Failed to load %@", response.URL]; - NSDictionary *userInfo = @{NSLocalizedDescriptionKey: errorMessage}; - completionHandler([[NSError alloc] initWithDomain:NSURLErrorDomain - code:statusCode - userInfo:userInfo], nil, response); - return; - } - } - - // Call handler - completionHandler(nil, data, response); - }; - - // Download image - __weak __typeof(self) weakSelf = self; - __block RCTNetworkTask *task = - [networking networkTaskWithRequest:request - completionBlock:^(NSURLResponse *response, NSData *data, NSError *error) { - __typeof(self) strongSelf = weakSelf; - if (!strongSelf) { - return; - } - - if (error || !response || !data) { - NSError *someError = nil; - if (error) { - someError = error; - } else if (!response) { - someError = RCTErrorWithMessage(@"Response metadata error"); - } else { - someError = RCTErrorWithMessage(@"Unknown image download error"); - } - completionHandler(someError, nil, response); - [strongSelf dequeueTasks]; - return; - } - - dispatch_async(strongSelf->_URLRequestQueue, ^{ - // Process image data - processResponse(response, data, nil); - - // Prepare for next task - [strongSelf dequeueTasks]; - }); - }]; - - task.downloadProgressBlock = ^(int64_t progress, int64_t total) { - if (progressHandler) { - progressHandler(progress, total); - } - }; - - if (task) { - if (!_pendingTasks) { - _pendingTasks = [NSMutableArray new]; - } - [_pendingTasks addObject:task]; - [self dequeueTasks]; - } - - return ^{ - __typeof(self) strongSelf = weakSelf; - if (!strongSelf || !task) { - return; - } - dispatch_async(strongSelf->_URLRequestQueue, ^{ - [task cancel]; - task = nil; - }); - [strongSelf dequeueTasks]; - }; -} - -- (RCTImageLoaderCancellationBlock)loadImageWithURLRequest:(NSURLRequest *)imageURLRequest - size:(CGSize)size - scale:(CGFloat)scale - clipped:(BOOL)clipped - resizeMode:(RCTResizeMode)resizeMode - progressBlock:(RCTImageLoaderProgressBlock)progressBlock - partialLoadBlock:(RCTImageLoaderPartialLoadBlock)partialLoadBlock - completionBlock:(RCTImageLoaderCompletionBlock)completionBlock -{ - __block atomic_bool cancelled = ATOMIC_VAR_INIT(NO); - // TODO: Protect this variable shared between threads. - __block dispatch_block_t cancelLoad = nil; - dispatch_block_t cancellationBlock = ^{ - BOOL alreadyCancelled = atomic_fetch_or(&cancelled, 1); - if (alreadyCancelled) { - return; - } - dispatch_block_t cancelLoadLocal = cancelLoad; - cancelLoad = nil; - if (cancelLoadLocal) { - cancelLoadLocal(); - } - }; - - __weak RCTImageLoader *weakSelf = self; - void (^completionHandler)(NSError *, id, BOOL, NSURLResponse *) = ^(NSError *error, id imageOrData, BOOL cacheResult, NSURLResponse *response) { - __typeof(self) strongSelf = weakSelf; - if (atomic_load(&cancelled) || !strongSelf) { - return; - } - - if (!imageOrData || [imageOrData isKindOfClass:[UIImage class]]) { - cancelLoad = nil; - completionBlock(error, imageOrData); - return; - } - - RCTImageLoaderCompletionBlock decodeCompletionHandler = ^(NSError *error_, UIImage *image) { - if (cacheResult && image) { - // Store decoded image in cache - [[strongSelf imageCache] addImageToCache:image - URL:imageURLRequest.URL.absoluteString - size:size - scale:scale - resizeMode:resizeMode - response:response]; - } - - cancelLoad = nil; - completionBlock(error_, image); - }; - - cancelLoad = [strongSelf decodeImageData:imageOrData - size:size - scale:scale - clipped:clipped - resizeMode:resizeMode - completionBlock:decodeCompletionHandler]; - }; - - cancelLoad = [self _loadImageOrDataWithURLRequest:imageURLRequest - size:size - scale:scale - resizeMode:resizeMode - progressBlock:progressBlock - partialLoadBlock:partialLoadBlock - completionBlock:completionHandler]; - return cancellationBlock; -} - -- (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)data - size:(CGSize)size - scale:(CGFloat)scale - clipped:(BOOL)clipped - resizeMode:(RCTResizeMode)resizeMode - completionBlock:(RCTImageLoaderCompletionBlock)completionBlock -{ - if (data.length == 0) { - completionBlock(RCTErrorWithMessage(@"No image data"), nil); - return ^{}; - } - - __block atomic_bool cancelled = ATOMIC_VAR_INIT(NO); - void (^completionHandler)(NSError *, UIImage *) = ^(NSError *error, UIImage *image) { - if (RCTIsMainQueue()) { - // Most loaders do not return on the main thread, so caller is probably not - // expecting it, and may do expensive post-processing in the callback - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - if (!atomic_load(&cancelled)) { - completionBlock(error, clipped ? RCTResizeImageIfNeeded(image, size, scale, resizeMode) : image); - } - }); - } else if (!atomic_load(&cancelled)) { - completionBlock(error, clipped ? RCTResizeImageIfNeeded(image, size, scale, resizeMode) : image); - } - }; - - id imageDecoder = [self imageDataDecoderForData:data]; - if (imageDecoder) { - return [imageDecoder decodeImageData:data - size:size - scale:scale - resizeMode:resizeMode - completionHandler:completionHandler] ?: ^{}; - } else { - dispatch_block_t decodeBlock = ^{ - // Calculate the size, in bytes, that the decompressed image will require - NSInteger decodedImageBytes = (size.width * scale) * (size.height * scale) * 4; - - // Mark these bytes as in-use - self->_activeBytes += decodedImageBytes; - - // Do actual decompression on a concurrent background queue - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - if (!atomic_load(&cancelled)) { - - // Decompress the image data (this may be CPU and memory intensive) - UIImage *image = RCTDecodeImageWithData(data, size, scale, resizeMode); - -#if RCT_DEV - CGSize imagePixelSize = RCTSizeInPixels(image.size, image.scale); - CGSize screenPixelSize = RCTSizeInPixels(RCTScreenSize(), RCTScreenScale()); - if (imagePixelSize.width * imagePixelSize.height > - screenPixelSize.width * screenPixelSize.height) { - RCTLogInfo(@"[PERF ASSETS] Loading image at size %@, which is larger " - "than the screen size %@", NSStringFromCGSize(imagePixelSize), - NSStringFromCGSize(screenPixelSize)); - } -#endif - - if (image) { - completionHandler(nil, image); - } else { - NSString *errorMessage = [NSString stringWithFormat:@"Error decoding image data ", data, data.length]; - NSError *finalError = RCTErrorWithMessage(errorMessage); - completionHandler(finalError, nil); - } - } - - // We're no longer retaining the uncompressed data, so now we'll mark - // the decoding as complete so that the loading task queue can resume. - dispatch_async(self->_URLRequestQueue, ^{ - self->_scheduledDecodes--; - self->_activeBytes -= decodedImageBytes; - [self dequeueTasks]; - }); - }); - }; - - if (!_URLRequestQueue) { - [self setUp]; - } - dispatch_async(_URLRequestQueue, ^{ - // The decode operation retains the compressed image data until it's - // complete, so we'll mark it as having started, in order to block - // further image loads from happening until we're done with the data. - self->_scheduledDecodes++; - - if (!self->_pendingDecodes) { - self->_pendingDecodes = [NSMutableArray new]; - } - NSInteger activeDecodes = self->_scheduledDecodes - self->_pendingDecodes.count - 1; - if (activeDecodes == 0 || (self->_activeBytes <= self->_maxConcurrentDecodingBytes && - activeDecodes <= self->_maxConcurrentDecodingTasks)) { - decodeBlock(); - } else { - [self->_pendingDecodes addObject:decodeBlock]; - } - }); - - return ^{ - atomic_store(&cancelled, YES); - }; - } -} - -- (RCTImageLoaderCancellationBlock)getImageSizeForURLRequest:(NSURLRequest *)imageURLRequest - block:(void(^)(NSError *error, CGSize size))callback -{ - void (^completion)(NSError *, id, BOOL, NSURLResponse *) = ^(NSError *error, id imageOrData, BOOL cacheResult, NSURLResponse *response) { - CGSize size; - if ([imageOrData isKindOfClass:[NSData class]]) { - NSDictionary *meta = RCTGetImageMetadata(imageOrData); - - NSInteger imageOrientation = [meta[(id)kCGImagePropertyOrientation] integerValue]; - switch (imageOrientation) { - case kCGImagePropertyOrientationLeft: - case kCGImagePropertyOrientationRight: - case kCGImagePropertyOrientationLeftMirrored: - case kCGImagePropertyOrientationRightMirrored: - // swap width and height - size = (CGSize){ - [meta[(id)kCGImagePropertyPixelHeight] doubleValue], - [meta[(id)kCGImagePropertyPixelWidth] doubleValue], - }; - break; - case kCGImagePropertyOrientationUp: - case kCGImagePropertyOrientationDown: - case kCGImagePropertyOrientationUpMirrored: - case kCGImagePropertyOrientationDownMirrored: - default: - size = (CGSize){ - [meta[(id)kCGImagePropertyPixelWidth] doubleValue], - [meta[(id)kCGImagePropertyPixelHeight] doubleValue], - }; - break; - } - } else { - UIImage *image = imageOrData; - size = (CGSize){ - image.size.width * image.scale, - image.size.height * image.scale, - }; - } - callback(error, size); - }; - - return [self _loadImageOrDataWithURLRequest:imageURLRequest - size:CGSizeZero - scale:1 - resizeMode:RCTResizeModeStretch - progressBlock:NULL - partialLoadBlock:NULL - completionBlock:completion]; -} - -- (NSDictionary *)getImageCacheStatus:(NSArray *)requests -{ - NSMutableDictionary *results = [NSMutableDictionary dictionary]; - for (id request in requests) { - NSURLRequest *urlRequest = [RCTConvert NSURLRequest:request]; - if (urlRequest) { - NSCachedURLResponse *cachedResponse = [NSURLCache.sharedURLCache cachedResponseForRequest:urlRequest]; - if (cachedResponse) { - if (cachedResponse.storagePolicy == NSURLCacheStorageAllowedInMemoryOnly) { - [results setObject:@"memory" forKey:urlRequest.URL.absoluteString]; - } else { - [results setObject:@"disk" forKey:urlRequest.URL.absoluteString]; - } - } - } - } - return results; -} - -#pragma mark - RCTURLRequestHandler - -- (BOOL)canHandleRequest:(NSURLRequest *)request -{ - NSURL *requestURL = request.URL; - - // If the data being loaded is a video, return NO - // Even better may be to implement this on the RCTImageURLLoader that would try to load it, - // but we'd have to run the logic both in RCTPhotoLibraryImageLoader and - // RCTAssetsLibraryRequestHandler. Once we drop iOS7 though, we'd drop - // RCTAssetsLibraryRequestHandler and can move it there. - static NSRegularExpression *videoRegex; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - NSError *error = nil; - videoRegex = [NSRegularExpression regularExpressionWithPattern:@"(?:&|^)ext=MOV(?:&|$)" - options:NSRegularExpressionCaseInsensitive - error:&error]; - if (error) { - RCTLogError(@"%@", error); - } - }); - - NSString *query = requestURL.query; - if ( - query != nil && - [videoRegex firstMatchInString:query - options:0 - range:NSMakeRange(0, query.length)] - ) { - return NO; - } - - for (id loader in _loaders) { - // Don't use RCTImageURLLoader protocol for modules that already conform to - // RCTURLRequestHandler as it's inefficient to decode an image and then - // convert it back into data - if (![loader conformsToProtocol:@protocol(RCTURLRequestHandler)] && - [loader canLoadImageURL:requestURL]) { - return YES; - } - } - - return NO; -} - -- (id)sendRequest:(NSURLRequest *)request withDelegate:(id)delegate -{ - __block RCTImageLoaderCancellationBlock requestToken; - requestToken = [self loadImageWithURLRequest:request callback:^(NSError *error, UIImage *image) { - if (error) { - [delegate URLRequest:requestToken didCompleteWithError:error]; - return; - } - - NSString *mimeType = nil; - NSData *imageData = nil; - if (RCTImageHasAlpha(image.CGImage)) { - mimeType = @"image/png"; - imageData = UIImagePNGRepresentation(image); - } else { - mimeType = @"image/jpeg"; - imageData = UIImageJPEGRepresentation(image, 1.0); - } - - NSURLResponse *response = [[NSURLResponse alloc] initWithURL:request.URL - MIMEType:mimeType - expectedContentLength:imageData.length - textEncodingName:nil]; - - [delegate URLRequest:requestToken didReceiveResponse:response]; - [delegate URLRequest:requestToken didReceiveData:imageData]; - [delegate URLRequest:requestToken didCompleteWithError:nil]; - }]; - - return requestToken; -} - -- (void)cancelRequest:(id)requestToken -{ - if (requestToken) { - ((RCTImageLoaderCancellationBlock)requestToken)(); - } -} - -@end - -@implementation RCTBridge (RCTImageLoader) - -- (RCTImageLoader *)imageLoader -{ - return [self moduleForClass:[RCTImageLoader class]]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageShadowView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageShadowView.h deleted file mode 100644 index f79281e7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageShadowView.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTImageShadowView : RCTShadowView - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageShadowView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageShadowView.m deleted file mode 100644 index 9102dc1b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageShadowView.m +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTImageShadowView.h" - -#import - -@implementation RCTImageShadowView - -- (BOOL)isYogaLeafNode -{ - return YES; -} - -- (BOOL)canHaveSubviews -{ - return NO; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageStoreManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageStoreManager.h deleted file mode 100644 index b1969044..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageStoreManager.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#import - -#import -#import - -@interface RCTImageStoreManager : NSObject - -/** - * Set and get cached image data asynchronously. It is safe to call these from any - * thread. The callbacks will be called on an unspecified thread. - */ -- (void)removeImageForTag:(NSString *)imageTag withBlock:(void (^)(void))block; -- (void)storeImageData:(NSData *)imageData withBlock:(void (^)(NSString *imageTag))block; -- (void)getImageDataForTag:(NSString *)imageTag withBlock:(void (^)(NSData *imageData))block; - -/** - * Convenience method to store an image directly (image is converted to data - * internally, so any metadata such as scale or orientation will be lost). - */ -- (void)storeImage:(UIImage *)image withBlock:(void (^)(NSString *imageTag))block; - -@end - -@interface RCTImageStoreManager (Deprecated) - -/** - * These methods are deprecated - use the data-based alternatives instead. - */ -- (NSString *)storeImage:(UIImage *)image __deprecated; -- (UIImage *)imageForTag:(NSString *)imageTag __deprecated; -- (void)getImageForTag:(NSString *)imageTag withBlock:(void (^)(UIImage *image))block __deprecated; - -@end - -@interface RCTBridge (RCTImageStoreManager) - -@property (nonatomic, readonly) RCTImageStoreManager *imageStoreManager; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageStoreManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageStoreManager.m deleted file mode 100644 index 03656e4e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageStoreManager.m +++ /dev/null @@ -1,240 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTImageStoreManager.h" - -#import - -#import -#import - -#import -#import -#import - -#import "RCTImageUtils.h" - -static NSString *const RCTImageStoreURLScheme = @"rct-image-store"; - -@implementation RCTImageStoreManager -{ - NSMutableDictionary *_store; - NSUInteger _id; -} - -@synthesize methodQueue = _methodQueue; - -RCT_EXPORT_MODULE() - -- (float)handlerPriority -{ - return 1; -} - -- (void)removeImageForTag:(NSString *)imageTag withBlock:(void (^)(void))block -{ - dispatch_async(_methodQueue, ^{ - [self removeImageForTag:imageTag]; - if (block) { - block(); - } - }); -} - -- (NSString *)_storeImageData:(NSData *)imageData -{ - RCTAssertThread(_methodQueue, @"Must be called on RCTImageStoreManager thread"); - - if (!_store) { - _store = [NSMutableDictionary new]; - _id = 0; - } - - NSString *imageTag = [NSString stringWithFormat:@"%@://%tu", RCTImageStoreURLScheme, _id++]; - _store[imageTag] = imageData; - return imageTag; -} - -- (void)storeImageData:(NSData *)imageData withBlock:(void (^)(NSString *imageTag))block -{ - RCTAssertParam(block); - dispatch_async(_methodQueue, ^{ - block([self _storeImageData:imageData]); - }); -} - -- (void)getImageDataForTag:(NSString *)imageTag withBlock:(void (^)(NSData *imageData))block -{ - RCTAssertParam(block); - dispatch_async(_methodQueue, ^{ - block(self->_store[imageTag]); - }); -} - -- (void)storeImage:(UIImage *)image withBlock:(void (^)(NSString *imageTag))block -{ - RCTAssertParam(block); - dispatch_async(_methodQueue, ^{ - NSString *imageTag = [self _storeImageData:RCTGetImageData(image, 0.75)]; - dispatch_async(dispatch_get_main_queue(), ^{ - block(imageTag); - }); - }); -} - -RCT_EXPORT_METHOD(removeImageForTag:(NSString *)imageTag) -{ - [_store removeObjectForKey:imageTag]; -} - -RCT_EXPORT_METHOD(hasImageForTag:(NSString *)imageTag - callback:(RCTResponseSenderBlock)callback) -{ - callback(@[@(_store[imageTag] != nil)]); -} - -// TODO (#5906496): Name could be more explicit - something like getBase64EncodedDataForTag:? -RCT_EXPORT_METHOD(getBase64ForTag:(NSString *)imageTag - successCallback:(RCTResponseSenderBlock)successCallback - errorCallback:(RCTResponseErrorBlock)errorCallback) -{ - NSData *imageData = _store[imageTag]; - if (!imageData) { - errorCallback(RCTErrorWithMessage([NSString stringWithFormat:@"Invalid imageTag: %@", imageTag])); - return; - } - // Dispatching to a background thread to perform base64 encoding - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - successCallback(@[[imageData base64EncodedStringWithOptions:0]]); - }); -} - -RCT_EXPORT_METHOD(addImageFromBase64:(NSString *)base64String - successCallback:(RCTResponseSenderBlock)successCallback - errorCallback:(RCTResponseErrorBlock)errorCallback) - -{ - // Dispatching to a background thread to perform base64 decoding - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - NSData *imageData = [[NSData alloc] initWithBase64EncodedString:base64String options:0]; - if (imageData) { - dispatch_async(self->_methodQueue, ^{ - successCallback(@[[self _storeImageData:imageData]]); - }); - } else { - errorCallback(RCTErrorWithMessage(@"Failed to add image from base64String")); - } - }); -} - -#pragma mark - RCTURLRequestHandler - -- (BOOL)canHandleRequest:(NSURLRequest *)request -{ - return [request.URL.scheme caseInsensitiveCompare:RCTImageStoreURLScheme] == NSOrderedSame; -} - -- (id)sendRequest:(NSURLRequest *)request withDelegate:(id)delegate -{ - __block atomic_bool cancelled = ATOMIC_VAR_INIT(NO); - void (^cancellationBlock)(void) = ^{ - atomic_store(&cancelled, YES); - }; - - // Dispatch async to give caller time to cancel the request - dispatch_async(_methodQueue, ^{ - if (atomic_load(&cancelled)) { - return; - } - - NSString *imageTag = request.URL.absoluteString; - NSData *imageData = self->_store[imageTag]; - if (!imageData) { - NSError *error = RCTErrorWithMessage([NSString stringWithFormat:@"Invalid imageTag: %@", imageTag]); - [delegate URLRequest:cancellationBlock didCompleteWithError:error]; - return; - } - - CGImageSourceRef sourceRef = CGImageSourceCreateWithData((__bridge CFDataRef)imageData, NULL); - if (!sourceRef) { - NSError *error = RCTErrorWithMessage([NSString stringWithFormat:@"Unable to decode data for imageTag: %@", imageTag]); - [delegate URLRequest:cancellationBlock didCompleteWithError:error]; - return; - } - CFStringRef UTI = CGImageSourceGetType(sourceRef); - CFRelease(sourceRef); - - NSString *MIMEType = (__bridge_transfer NSString *)UTTypeCopyPreferredTagWithClass(UTI, kUTTagClassMIMEType); - NSURLResponse *response = [[NSURLResponse alloc] initWithURL:request.URL - MIMEType:MIMEType - expectedContentLength:imageData.length - textEncodingName:nil]; - - [delegate URLRequest:cancellationBlock didReceiveResponse:response]; - [delegate URLRequest:cancellationBlock didReceiveData:imageData]; - [delegate URLRequest:cancellationBlock didCompleteWithError:nil]; - - }); - - return cancellationBlock; -} - -- (void)cancelRequest:(id)requestToken -{ - if (requestToken) { - ((void (^)(void))requestToken)(); - } -} - -@end - -@implementation RCTImageStoreManager (Deprecated) - -- (NSString *)storeImage:(UIImage *)image -{ - RCTAssertMainQueue(); - RCTLogWarn(@"RCTImageStoreManager.storeImage() is deprecated and has poor performance. Use an alternative method instead."); - __block NSString *imageTag; - dispatch_sync(_methodQueue, ^{ - imageTag = [self _storeImageData:RCTGetImageData(image, 0.75)]; - }); - return imageTag; -} - -- (UIImage *)imageForTag:(NSString *)imageTag -{ - RCTAssertMainQueue(); - RCTLogWarn(@"RCTImageStoreManager.imageForTag() is deprecated and has poor performance. Use an alternative method instead."); - __block NSData *imageData; - dispatch_sync(_methodQueue, ^{ - imageData = self->_store[imageTag]; - }); - return [UIImage imageWithData:imageData]; -} - -- (void)getImageForTag:(NSString *)imageTag withBlock:(void (^)(UIImage *image))block -{ - RCTAssertParam(block); - dispatch_async(_methodQueue, ^{ - NSData *imageData = self->_store[imageTag]; - dispatch_async(dispatch_get_main_queue(), ^{ - // imageWithData: is not thread-safe, so we can't do this on methodQueue - block([UIImage imageWithData:imageData]); - }); - }); -} - -@end - -@implementation RCTBridge (RCTImageStoreManager) - -- (RCTImageStoreManager *)imageStoreManager -{ - return [self moduleForClass:[RCTImageStoreManager class]]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageUtils.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageUtils.h deleted file mode 100644 index a4b8216c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageUtils.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - -#import - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * This function takes an source size (typically from an image), a target size - * and scale that it will be drawn at (typically in a CGContext) and then - * calculates the rectangle to draw the image into so that it will be sized and - * positioned correctly according to the specified resizeMode. - */ -RCT_EXTERN CGRect RCTTargetRect(CGSize sourceSize, CGSize destSize, - CGFloat destScale, RCTResizeMode resizeMode); - -/** - * This function takes a source size (typically from an image), a target rect - * that it will be drawn into (typically relative to a CGContext), and works out - * the transform needed to draw the image at the correct scale and position. - */ -RCT_EXTERN CGAffineTransform RCTTransformFromTargetRect(CGSize sourceSize, - CGRect targetRect); - -/** - * This function takes an input content size & scale (typically from an image), - * a target size & scale at which it will be displayed (typically in a - * UIImageView) and then calculates the optimal size at which to redraw the - * image so that it will be displayed correctly with the specified resizeMode. - */ -RCT_EXTERN CGSize RCTTargetSize(CGSize sourceSize, CGFloat sourceScale, - CGSize destSize, CGFloat destScale, - RCTResizeMode resizeMode, BOOL allowUpscaling); - -/** - * This function takes an input content size & scale (typically from an image), - * a target size & scale that it will be displayed at, and determines if the - * source will need to be upscaled to fit (which may result in pixelization). - */ -RCT_EXTERN BOOL RCTUpscalingRequired(CGSize sourceSize, CGFloat sourceScale, - CGSize destSize, CGFloat destScale, - RCTResizeMode resizeMode); - -/** - * This function takes the source data for an image and decodes it at the - * specified size. If the original image is smaller than the destination size, - * the resultant image's scale will be decreased to compensate, so the - * width/height of the returned image is guaranteed to be >= destSize. - * Pass a destSize of CGSizeZero to decode the image at its original size. - */ -RCT_EXTERN UIImage *__nullable RCTDecodeImageWithData(NSData *data, - CGSize destSize, - CGFloat destScale, - RCTResizeMode resizeMode); - -/** - * This function takes the source data for an image and decodes just the - * metadata, without decompressing the image itself. - */ -RCT_EXTERN NSDictionary *__nullable RCTGetImageMetadata(NSData *data); - -/** - * Convert an image back into data. Images with an alpha channel will be - * converted to lossless PNG data. Images without alpha will be converted to - * JPEG. The `quality` argument controls the compression ratio of the JPEG - * conversion, with 1.0 being maximum quality. It has no effect for images - * using PNG compression. - */ -RCT_EXTERN NSData *__nullable RCTGetImageData(UIImage *image, float quality); - -/** - * This function transforms an image. `destSize` is the size of the final image, - * and `destScale` is its scale. The `transform` argument controls how the - * source image will be mapped to the destination image. - */ -RCT_EXTERN UIImage *__nullable RCTTransformImage(UIImage *image, - CGSize destSize, - CGFloat destScale, - CGAffineTransform transform); - -/* - * Return YES if image has an alpha component - */ -RCT_EXTERN BOOL RCTImageHasAlpha(CGImageRef image); - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageUtils.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageUtils.m deleted file mode 100644 index 5470c8f7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageUtils.m +++ /dev/null @@ -1,386 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTImageUtils.h" - -#import - -#import -#import - -#import -#import - -static CGFloat RCTCeilValue(CGFloat value, CGFloat scale) -{ - return ceil(value * scale) / scale; -} - -static CGFloat RCTFloorValue(CGFloat value, CGFloat scale) -{ - return floor(value * scale) / scale; -} - -static CGSize RCTCeilSize(CGSize size, CGFloat scale) -{ - return (CGSize){ - RCTCeilValue(size.width, scale), - RCTCeilValue(size.height, scale) - }; -} - -static CGImagePropertyOrientation CGImagePropertyOrientationFromUIImageOrientation(UIImageOrientation imageOrientation) -{ - // see https://stackoverflow.com/a/6699649/496389 - switch (imageOrientation) { - case UIImageOrientationUp: return kCGImagePropertyOrientationUp; - case UIImageOrientationDown: return kCGImagePropertyOrientationDown; - case UIImageOrientationLeft: return kCGImagePropertyOrientationLeft; - case UIImageOrientationRight: return kCGImagePropertyOrientationRight; - case UIImageOrientationUpMirrored: return kCGImagePropertyOrientationUpMirrored; - case UIImageOrientationDownMirrored: return kCGImagePropertyOrientationDownMirrored; - case UIImageOrientationLeftMirrored: return kCGImagePropertyOrientationLeftMirrored; - case UIImageOrientationRightMirrored: return kCGImagePropertyOrientationRightMirrored; - default: return kCGImagePropertyOrientationUp; - } -} - -CGRect RCTTargetRect(CGSize sourceSize, CGSize destSize, - CGFloat destScale, RCTResizeMode resizeMode) -{ - if (CGSizeEqualToSize(destSize, CGSizeZero)) { - // Assume we require the largest size available - return (CGRect){CGPointZero, sourceSize}; - } - - CGFloat aspect = sourceSize.width / sourceSize.height; - // If only one dimension in destSize is non-zero (for example, an Image - // with `flex: 1` whose height is indeterminate), calculate the unknown - // dimension based on the aspect ratio of sourceSize - if (destSize.width == 0) { - destSize.width = destSize.height * aspect; - } - if (destSize.height == 0) { - destSize.height = destSize.width / aspect; - } - - // Calculate target aspect ratio if needed - CGFloat targetAspect = 0.0; - if (resizeMode != RCTResizeModeCenter && - resizeMode != RCTResizeModeStretch) { - targetAspect = destSize.width / destSize.height; - if (aspect == targetAspect) { - resizeMode = RCTResizeModeStretch; - } - } - - switch (resizeMode) { - case RCTResizeModeStretch: - case RCTResizeModeRepeat: - - return (CGRect){CGPointZero, RCTCeilSize(destSize, destScale)}; - - case RCTResizeModeContain: - - if (targetAspect <= aspect) { // target is taller than content - - sourceSize.width = destSize.width; - sourceSize.height = sourceSize.width / aspect; - - } else { // target is wider than content - - sourceSize.height = destSize.height; - sourceSize.width = sourceSize.height * aspect; - } - return (CGRect){ - { - RCTFloorValue((destSize.width - sourceSize.width) / 2, destScale), - RCTFloorValue((destSize.height - sourceSize.height) / 2, destScale), - }, - RCTCeilSize(sourceSize, destScale) - }; - - case RCTResizeModeCover: - - if (targetAspect <= aspect) { // target is taller than content - - sourceSize.height = destSize.height; - sourceSize.width = sourceSize.height * aspect; - destSize.width = destSize.height * targetAspect; - return (CGRect){ - {RCTFloorValue((destSize.width - sourceSize.width) / 2, destScale), 0}, - RCTCeilSize(sourceSize, destScale) - }; - - } else { // target is wider than content - - sourceSize.width = destSize.width; - sourceSize.height = sourceSize.width / aspect; - destSize.height = destSize.width / targetAspect; - return (CGRect){ - {0, RCTFloorValue((destSize.height - sourceSize.height) / 2, destScale)}, - RCTCeilSize(sourceSize, destScale) - }; - } - - case RCTResizeModeCenter: - - // Make sure the image is not clipped by the target. - if (sourceSize.height > destSize.height) { - sourceSize.width = destSize.width; - sourceSize.height = sourceSize.width / aspect; - } - if (sourceSize.width > destSize.width) { - sourceSize.height = destSize.height; - sourceSize.width = sourceSize.height * aspect; - } - - return (CGRect){ - { - RCTFloorValue((destSize.width - sourceSize.width) / 2, destScale), - RCTFloorValue((destSize.height - sourceSize.height) / 2, destScale), - }, - RCTCeilSize(sourceSize, destScale) - }; - } -} - -CGAffineTransform RCTTransformFromTargetRect(CGSize sourceSize, CGRect targetRect) -{ - CGAffineTransform transform = CGAffineTransformIdentity; - transform = CGAffineTransformTranslate(transform, - targetRect.origin.x, - targetRect.origin.y); - transform = CGAffineTransformScale(transform, - targetRect.size.width / sourceSize.width, - targetRect.size.height / sourceSize.height); - return transform; -} - -CGSize RCTTargetSize(CGSize sourceSize, CGFloat sourceScale, - CGSize destSize, CGFloat destScale, - RCTResizeMode resizeMode, - BOOL allowUpscaling) -{ - switch (resizeMode) { - case RCTResizeModeCenter: - - return RCTTargetRect(sourceSize, destSize, destScale, resizeMode).size; - - case RCTResizeModeStretch: - - if (!allowUpscaling) { - CGFloat scale = sourceScale / destScale; - destSize.width = MIN(sourceSize.width * scale, destSize.width); - destSize.height = MIN(sourceSize.height * scale, destSize.height); - } - return RCTCeilSize(destSize, destScale); - - default: { - - // Get target size - CGSize size = RCTTargetRect(sourceSize, destSize, destScale, resizeMode).size; - if (!allowUpscaling) { - // return sourceSize if target size is larger - if (sourceSize.width * sourceScale < size.width * destScale) { - return sourceSize; - } - } - return size; - } - } -} - -BOOL RCTUpscalingRequired(CGSize sourceSize, CGFloat sourceScale, - CGSize destSize, CGFloat destScale, - RCTResizeMode resizeMode) -{ - if (CGSizeEqualToSize(destSize, CGSizeZero)) { - // Assume we require the largest size available - return YES; - } - - // Precompensate for scale - CGFloat scale = sourceScale / destScale; - sourceSize.width *= scale; - sourceSize.height *= scale; - - // Calculate aspect ratios if needed (don't bother if resizeMode == stretch) - CGFloat aspect = 0.0, targetAspect = 0.0; - if (resizeMode != UIViewContentModeScaleToFill) { - aspect = sourceSize.width / sourceSize.height; - targetAspect = destSize.width / destSize.height; - if (aspect == targetAspect) { - resizeMode = RCTResizeModeStretch; - } - } - - switch (resizeMode) { - case RCTResizeModeStretch: - - return destSize.width > sourceSize.width || destSize.height > sourceSize.height; - - case RCTResizeModeContain: - - if (targetAspect <= aspect) { // target is taller than content - - return destSize.width > sourceSize.width; - - } else { // target is wider than content - - return destSize.height > sourceSize.height; - } - - case RCTResizeModeCover: - - if (targetAspect <= aspect) { // target is taller than content - - return destSize.height > sourceSize.height; - - } else { // target is wider than content - - return destSize.width > sourceSize.width; - } - - case RCTResizeModeRepeat: - case RCTResizeModeCenter: - - return NO; - } -} - -UIImage *__nullable RCTDecodeImageWithData(NSData *data, - CGSize destSize, - CGFloat destScale, - RCTResizeMode resizeMode) -{ - CGImageSourceRef sourceRef = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); - if (!sourceRef) { - return nil; - } - - // Get original image size - CFDictionaryRef imageProperties = CGImageSourceCopyPropertiesAtIndex(sourceRef, 0, NULL); - if (!imageProperties) { - CFRelease(sourceRef); - return nil; - } - NSNumber *width = CFDictionaryGetValue(imageProperties, kCGImagePropertyPixelWidth); - NSNumber *height = CFDictionaryGetValue(imageProperties, kCGImagePropertyPixelHeight); - CGSize sourceSize = {width.doubleValue, height.doubleValue}; - CFRelease(imageProperties); - - if (CGSizeEqualToSize(destSize, CGSizeZero)) { - destSize = sourceSize; - if (!destScale) { - destScale = 1; - } - } else if (!destScale) { - destScale = RCTScreenScale(); - } - - if (resizeMode == UIViewContentModeScaleToFill) { - // Decoder cannot change aspect ratio, so RCTResizeModeStretch is equivalent - // to RCTResizeModeCover for our purposes - resizeMode = RCTResizeModeCover; - } - - // Calculate target size - CGSize targetSize = RCTTargetSize(sourceSize, 1, destSize, destScale, resizeMode, NO); - CGSize targetPixelSize = RCTSizeInPixels(targetSize, destScale); - CGFloat maxPixelSize = fmax(fmin(sourceSize.width, targetPixelSize.width), - fmin(sourceSize.height, targetPixelSize.height)); - - NSDictionary *options = @{ - (id)kCGImageSourceShouldAllowFloat: @YES, - (id)kCGImageSourceCreateThumbnailWithTransform: @YES, - (id)kCGImageSourceCreateThumbnailFromImageAlways: @YES, - (id)kCGImageSourceThumbnailMaxPixelSize: @(maxPixelSize), - }; - - // Get thumbnail - CGImageRef imageRef = CGImageSourceCreateThumbnailAtIndex(sourceRef, 0, (__bridge CFDictionaryRef)options); - CFRelease(sourceRef); - if (!imageRef) { - return nil; - } - - // Return image - UIImage *image = [UIImage imageWithCGImage:imageRef - scale:destScale - orientation:UIImageOrientationUp]; - CGImageRelease(imageRef); - return image; -} - -NSDictionary *__nullable RCTGetImageMetadata(NSData *data) -{ - CGImageSourceRef sourceRef = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); - if (!sourceRef) { - return nil; - } - CFDictionaryRef imageProperties = CGImageSourceCopyPropertiesAtIndex(sourceRef, 0, NULL); - CFRelease(sourceRef); - return (__bridge_transfer id)imageProperties; -} - -NSData *__nullable RCTGetImageData(UIImage *image, float quality) -{ - NSMutableDictionary *properties = [[NSMutableDictionary alloc] initWithDictionary:@{ - (id)kCGImagePropertyOrientation : @(CGImagePropertyOrientationFromUIImageOrientation(image.imageOrientation)) - }]; - CGImageDestinationRef destination; - CFMutableDataRef imageData = CFDataCreateMutable(NULL, 0); - CGImageRef cgImage = image.CGImage; - if (RCTImageHasAlpha(cgImage)) { - // get png data - destination = CGImageDestinationCreateWithData(imageData, kUTTypePNG, 1, NULL); - } else { - // get jpeg data - destination = CGImageDestinationCreateWithData(imageData, kUTTypeJPEG, 1, NULL); - [properties setValue:@(quality) forKey:(id)kCGImageDestinationLossyCompressionQuality]; - } - CGImageDestinationAddImage(destination, cgImage, (__bridge CFDictionaryRef)properties); - if (!CGImageDestinationFinalize(destination)) - { - CFRelease(imageData); - imageData = NULL; - } - CFRelease(destination); - return (__bridge_transfer NSData *)imageData; -} - -UIImage *__nullable RCTTransformImage(UIImage *image, - CGSize destSize, - CGFloat destScale, - CGAffineTransform transform) -{ - if (destSize.width <= 0 | destSize.height <= 0 || destScale <= 0) { - return nil; - } - - BOOL opaque = !RCTImageHasAlpha(image.CGImage); - UIGraphicsBeginImageContextWithOptions(destSize, opaque, destScale); - CGContextRef currentContext = UIGraphicsGetCurrentContext(); - CGContextConcatCTM(currentContext, transform); - [image drawAtPoint:CGPointZero]; - UIImage *result = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - return result; -} - -BOOL RCTImageHasAlpha(CGImageRef image) -{ - switch (CGImageGetAlphaInfo(image)) { - case kCGImageAlphaNone: - case kCGImageAlphaNoneSkipLast: - case kCGImageAlphaNoneSkipFirst: - return NO; - default: - return YES; - } -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageView.h deleted file mode 100644 index 38f82db4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageView.h +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@class RCTBridge; -@class RCTImageSource; - -@interface RCTImageView : UIImageView - -- (instancetype)initWithBridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER; - -@property (nonatomic, assign) UIEdgeInsets capInsets; -@property (nonatomic, strong) UIImage *defaultImage; -@property (nonatomic, assign) UIImageRenderingMode renderingMode; -@property (nonatomic, copy) NSArray *imageSources; -@property (nonatomic, assign) CGFloat blurRadius; -@property (nonatomic, assign) RCTResizeMode resizeMode; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageView.m deleted file mode 100644 index 3392a54c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageView.m +++ /dev/null @@ -1,453 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTImageView.h" - -#import -#import -#import -#import -#import -#import - -#import "RCTImageBlurUtils.h" -#import "RCTImageLoader.h" -#import "RCTImageUtils.h" - -/** - * Determines whether an image of `currentSize` should be reloaded for display - * at `idealSize`. - */ -static BOOL RCTShouldReloadImageForSizeChange(CGSize currentSize, CGSize idealSize) -{ - static const CGFloat upscaleThreshold = 1.2; - static const CGFloat downscaleThreshold = 0.5; - - CGFloat widthMultiplier = idealSize.width / currentSize.width; - CGFloat heightMultiplier = idealSize.height / currentSize.height; - - return widthMultiplier > upscaleThreshold || widthMultiplier < downscaleThreshold || - heightMultiplier > upscaleThreshold || heightMultiplier < downscaleThreshold; -} - -/** - * See RCTConvert (ImageSource). We want to send down the source as a similar - * JSON parameter. - */ -static NSDictionary *onLoadParamsForSource(RCTImageSource *source) -{ - NSDictionary *dict = @{ - @"width": @(source.size.width), - @"height": @(source.size.height), - @"url": source.request.URL.absoluteString, - }; - return @{ @"source": dict }; -} - -@interface RCTImageView () - -@property (nonatomic, copy) RCTDirectEventBlock onLoadStart; -@property (nonatomic, copy) RCTDirectEventBlock onProgress; -@property (nonatomic, copy) RCTDirectEventBlock onError; -@property (nonatomic, copy) RCTDirectEventBlock onPartialLoad; -@property (nonatomic, copy) RCTDirectEventBlock onLoad; -@property (nonatomic, copy) RCTDirectEventBlock onLoadEnd; - -@end - -@implementation RCTImageView -{ - // Weak reference back to the bridge, for image loading - __weak RCTBridge *_bridge; - - // The image source that's currently displayed - RCTImageSource *_imageSource; - - // The image source that's being loaded from the network - RCTImageSource *_pendingImageSource; - - // Size of the image loaded / being loaded, so we can determine when to issue a reload to accommodate a changing size. - CGSize _targetSize; - - // A block that can be invoked to cancel the most recent call to -reloadImage, if any - RCTImageLoaderCancellationBlock _reloadImageCancellationBlock; - - // Whether the latest change of props requires the image to be reloaded - BOOL _needsReload; -} - -- (instancetype)initWithBridge:(RCTBridge *)bridge -{ - if ((self = [super init])) { - _bridge = bridge; - - NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; - [center addObserver:self - selector:@selector(clearImageIfDetached) - name:UIApplicationDidReceiveMemoryWarningNotification - object:nil]; - [center addObserver:self - selector:@selector(clearImageIfDetached) - name:UIApplicationDidEnterBackgroundNotification - object:nil]; - } - return self; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (void)updateWithImage:(UIImage *)image -{ - if (!image) { - super.image = nil; - return; - } - - // Apply rendering mode - if (_renderingMode != image.renderingMode) { - image = [image imageWithRenderingMode:_renderingMode]; - } - - if (_resizeMode == RCTResizeModeRepeat) { - image = [image resizableImageWithCapInsets:_capInsets resizingMode:UIImageResizingModeTile]; - } else if (!UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, _capInsets)) { - // Applying capInsets of 0 will switch the "resizingMode" of the image to "tile" which is undesired - image = [image resizableImageWithCapInsets:_capInsets resizingMode:UIImageResizingModeStretch]; - } - - // Apply trilinear filtering to smooth out mis-sized images - self.layer.minificationFilter = kCAFilterTrilinear; - self.layer.magnificationFilter = kCAFilterTrilinear; - - super.image = image; -} - -- (void)setImage:(UIImage *)image -{ - image = image ?: _defaultImage; - if (image != self.image) { - [self updateWithImage:image]; - } -} - -- (void)setBlurRadius:(CGFloat)blurRadius -{ - if (blurRadius != _blurRadius) { - _blurRadius = blurRadius; - _needsReload = YES; - } -} - -- (void)setCapInsets:(UIEdgeInsets)capInsets -{ - if (!UIEdgeInsetsEqualToEdgeInsets(_capInsets, capInsets)) { - if (UIEdgeInsetsEqualToEdgeInsets(_capInsets, UIEdgeInsetsZero) || - UIEdgeInsetsEqualToEdgeInsets(capInsets, UIEdgeInsetsZero)) { - _capInsets = capInsets; - // Need to reload image when enabling or disabling capInsets - _needsReload = YES; - } else { - _capInsets = capInsets; - [self updateWithImage:self.image]; - } - } -} - -- (void)setRenderingMode:(UIImageRenderingMode)renderingMode -{ - if (_renderingMode != renderingMode) { - _renderingMode = renderingMode; - [self updateWithImage:self.image]; - } -} - -- (void)setImageSources:(NSArray *)imageSources -{ - if (![imageSources isEqual:_imageSources]) { - _imageSources = [imageSources copy]; - _needsReload = YES; - } -} - -- (void)setResizeMode:(RCTResizeMode)resizeMode -{ - if (_resizeMode != resizeMode) { - _resizeMode = resizeMode; - - if (_resizeMode == RCTResizeModeRepeat) { - // Repeat resize mode is handled by the UIImage. Use scale to fill - // so the repeated image fills the UIImageView. - self.contentMode = UIViewContentModeScaleToFill; - } else { - self.contentMode = (UIViewContentMode)resizeMode; - } - - if ([self shouldReloadImageSourceAfterResize]) { - _needsReload = YES; - } - } -} - -- (void)cancelImageLoad -{ - RCTImageLoaderCancellationBlock previousCancellationBlock = _reloadImageCancellationBlock; - if (previousCancellationBlock) { - previousCancellationBlock(); - _reloadImageCancellationBlock = nil; - } - - _pendingImageSource = nil; -} - -- (void)clearImage -{ - [self cancelImageLoad]; - [self.layer removeAnimationForKey:@"contents"]; - self.image = nil; - _imageSource = nil; -} - -- (void)clearImageIfDetached -{ - if (!self.window) { - [self clearImage]; - } -} - -- (BOOL)hasMultipleSources -{ - return _imageSources.count > 1; -} - -- (RCTImageSource *)imageSourceForSize:(CGSize)size -{ - if (![self hasMultipleSources]) { - return _imageSources.firstObject; - } - - // Need to wait for layout pass before deciding. - if (CGSizeEqualToSize(size, CGSizeZero)) { - return nil; - } - - const CGFloat scale = RCTScreenScale(); - const CGFloat targetImagePixels = size.width * size.height * scale * scale; - - RCTImageSource *bestSource = nil; - CGFloat bestFit = CGFLOAT_MAX; - for (RCTImageSource *source in _imageSources) { - CGSize imgSize = source.size; - const CGFloat imagePixels = - imgSize.width * imgSize.height * source.scale * source.scale; - const CGFloat fit = ABS(1 - (imagePixels / targetImagePixels)); - - if (fit < bestFit) { - bestFit = fit; - bestSource = source; - } - } - return bestSource; -} - -- (BOOL)shouldReloadImageSourceAfterResize -{ - // If capInsets are set, image doesn't need reloading when resized - return UIEdgeInsetsEqualToEdgeInsets(_capInsets, UIEdgeInsetsZero); -} - -- (BOOL)shouldChangeImageSource -{ - // We need to reload if the desired image source is different from the current image - // source AND the image load that's pending - RCTImageSource *desiredImageSource = [self imageSourceForSize:self.frame.size]; - return ![desiredImageSource isEqual:_imageSource] && - ![desiredImageSource isEqual:_pendingImageSource]; -} - -- (void)reloadImage -{ - [self cancelImageLoad]; - _needsReload = NO; - - RCTImageSource *source = [self imageSourceForSize:self.frame.size]; - _pendingImageSource = source; - - if (source && self.frame.size.width > 0 && self.frame.size.height > 0) { - if (_onLoadStart) { - _onLoadStart(nil); - } - - RCTImageLoaderProgressBlock progressHandler = nil; - if (_onProgress) { - progressHandler = ^(int64_t loaded, int64_t total) { - self->_onProgress(@{ - @"loaded": @((double)loaded), - @"total": @((double)total), - }); - }; - } - - __weak RCTImageView *weakSelf = self; - RCTImageLoaderPartialLoadBlock partialLoadHandler = ^(UIImage *image) { - [weakSelf imageLoaderLoadedImage:image error:nil forImageSource:source partial:YES]; - }; - - CGSize imageSize = self.bounds.size; - CGFloat imageScale = RCTScreenScale(); - if (!UIEdgeInsetsEqualToEdgeInsets(_capInsets, UIEdgeInsetsZero)) { - // Don't resize images that use capInsets - imageSize = CGSizeZero; - imageScale = source.scale; - } - - RCTImageLoaderCompletionBlock completionHandler = ^(NSError *error, UIImage *loadedImage) { - [weakSelf imageLoaderLoadedImage:loadedImage error:error forImageSource:source partial:NO]; - }; - - _reloadImageCancellationBlock = - [_bridge.imageLoader loadImageWithURLRequest:source.request - size:imageSize - scale:imageScale - clipped:NO - resizeMode:_resizeMode - progressBlock:progressHandler - partialLoadBlock:partialLoadHandler - completionBlock:completionHandler]; - } else { - [self clearImage]; - } -} - -- (void)imageLoaderLoadedImage:(UIImage *)loadedImage error:(NSError *)error forImageSource:(RCTImageSource *)source partial:(BOOL)isPartialLoad -{ - if (![source isEqual:_pendingImageSource]) { - // Bail out if source has changed since we started loading - return; - } - - if (error) { - if (_onError) { - _onError(@{ @"error": error.localizedDescription }); - } - if (_onLoadEnd) { - _onLoadEnd(nil); - } - return; - } - - void (^setImageBlock)(UIImage *) = ^(UIImage *image) { - if (!isPartialLoad) { - self->_imageSource = source; - self->_pendingImageSource = nil; - } - - if (image.reactKeyframeAnimation) { - [self.layer addAnimation:image.reactKeyframeAnimation forKey:@"contents"]; - } else { - [self.layer removeAnimationForKey:@"contents"]; - self.image = image; - } - - if (isPartialLoad) { - if (self->_onPartialLoad) { - self->_onPartialLoad(nil); - } - } else { - if (self->_onLoad) { - RCTImageSource *sourceLoaded = [source imageSourceWithSize:image.size scale:source.scale]; - self->_onLoad(onLoadParamsForSource(sourceLoaded)); - } - if (self->_onLoadEnd) { - self->_onLoadEnd(nil); - } - } - }; - - if (_blurRadius > __FLT_EPSILON__) { - // Blur on a background thread to avoid blocking interaction - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - UIImage *blurredImage = RCTBlurredImageWithRadius(loadedImage, self->_blurRadius); - RCTExecuteOnMainQueue(^{ - setImageBlock(blurredImage); - }); - }); - } else { - // No blur, so try to set the image on the main thread synchronously to minimize image - // flashing. (For instance, if this view gets attached to a window, then -didMoveToWindow - // calls -reloadImage, and we want to set the image synchronously if possible so that the - // image property is set in the same CATransaction that attaches this view to the window.) - RCTExecuteOnMainQueue(^{ - setImageBlock(loadedImage); - }); - } -} - -- (void)reactSetFrame:(CGRect)frame -{ - [super reactSetFrame:frame]; - - // If we didn't load an image yet, or the new frame triggers a different image source - // to be loaded, reload to swap to the proper image source. - if ([self shouldChangeImageSource]) { - _targetSize = frame.size; - [self reloadImage]; - } else if ([self shouldReloadImageSourceAfterResize]) { - CGSize imageSize = self.image.size; - CGFloat imageScale = self.image.scale; - CGSize idealSize = RCTTargetSize(imageSize, imageScale, frame.size, RCTScreenScale(), - (RCTResizeMode)self.contentMode, YES); - - // Don't reload if the current image or target image size is close enough - if (!RCTShouldReloadImageForSizeChange(imageSize, idealSize) || - !RCTShouldReloadImageForSizeChange(_targetSize, idealSize)) { - return; - } - - // Don't reload if the current image size is the maximum size of the image source - CGSize imageSourceSize = _imageSource.size; - if (imageSize.width * imageScale == imageSourceSize.width * _imageSource.scale && - imageSize.height * imageScale == imageSourceSize.height * _imageSource.scale) { - return; - } - - RCTLogInfo(@"Reloading image %@ as size %@", _imageSource.request.URL.absoluteString, NSStringFromCGSize(idealSize)); - - // If the existing image or an image being loaded are not the right - // size, reload the asset in case there is a better size available. - _targetSize = idealSize; - [self reloadImage]; - } -} - -- (void)didSetProps:(NSArray *)changedProps -{ - if (_needsReload) { - [self reloadImage]; - } -} - -- (void)didMoveToWindow -{ - [super didMoveToWindow]; - - if (!self.window) { - // Cancel loading the image if we've moved offscreen. In addition to helping - // prioritise image requests that are actually on-screen, this removes - // requests that have gotten "stuck" from the queue, unblocking other images - // from loading. - [self cancelImageLoad]; - } else if ([self shouldChangeImageSource]) { - [self reloadImage]; - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageViewManager.h deleted file mode 100644 index 9aef96cd..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageViewManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTImageViewManager : RCTViewManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageViewManager.m deleted file mode 100644 index 70c5cb98..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTImageViewManager.m +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTImageViewManager.h" - -#import - -#import - -#import "RCTImageLoader.h" -#import "RCTImageShadowView.h" -#import "RCTImageView.h" - -@implementation RCTImageViewManager - -RCT_EXPORT_MODULE() - -- (RCTShadowView *)shadowView -{ - return [RCTImageShadowView new]; -} - -- (UIView *)view -{ - return [[RCTImageView alloc] initWithBridge:self.bridge]; -} - -RCT_EXPORT_VIEW_PROPERTY(blurRadius, CGFloat) -RCT_EXPORT_VIEW_PROPERTY(capInsets, UIEdgeInsets) -RCT_REMAP_VIEW_PROPERTY(defaultSource, defaultImage, UIImage) -RCT_EXPORT_VIEW_PROPERTY(onLoadStart, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onProgress, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onError, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onPartialLoad, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onLoad, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onLoadEnd, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(resizeMode, RCTResizeMode) -RCT_REMAP_VIEW_PROPERTY(source, imageSources, NSArray); -RCT_CUSTOM_VIEW_PROPERTY(tintColor, UIColor, RCTImageView) -{ - // Default tintColor isn't nil - it's inherited from the superView - but we - // want to treat a null json value for `tintColor` as meaning 'disable tint', - // so we toggle `renderingMode` here instead of in `-[RCTImageView setTintColor:]` - view.tintColor = [RCTConvert UIColor:json] ?: defaultView.tintColor; - view.renderingMode = json ? UIImageRenderingModeAlwaysTemplate : defaultView.renderingMode; -} - -RCT_EXPORT_METHOD(getSize:(NSURLRequest *)request - successBlock:(RCTResponseSenderBlock)successBlock - errorBlock:(RCTResponseErrorBlock)errorBlock) -{ - [self.bridge.imageLoader getImageSizeForURLRequest:request - block:^(NSError *error, CGSize size) { - if (error) { - errorBlock(error); - } else { - successBlock(@[@(size.width), @(size.height)]); - } - }]; -} - -RCT_EXPORT_METHOD(prefetchImage:(NSURLRequest *)request - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject) -{ - if (!request) { - reject(@"E_INVALID_URI", @"Cannot prefetch an image for an empty URI", nil); - return; - } - - [self.bridge.imageLoader loadImageWithURLRequest:request - callback:^(NSError *error, UIImage *image) { - if (error) { - reject(@"E_PREFETCH_FAILURE", nil, error); - return; - } - resolve(@YES); - }]; -} - -RCT_EXPORT_METHOD(queryCache:(NSArray *)requests - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject) -{ - resolve([self.bridge.imageLoader getImageCacheStatus:requests]); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTLocalAssetImageLoader.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTLocalAssetImageLoader.h deleted file mode 100644 index df3918ad..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTLocalAssetImageLoader.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTLocalAssetImageLoader : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTLocalAssetImageLoader.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTLocalAssetImageLoader.m deleted file mode 100644 index 68407f38..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTLocalAssetImageLoader.m +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTLocalAssetImageLoader.h" - -#import - -#import - -@implementation RCTLocalAssetImageLoader - -RCT_EXPORT_MODULE() - -- (BOOL)canLoadImageURL:(NSURL *)requestURL -{ - return RCTIsLocalAssetURL(requestURL); -} - -- (BOOL)requiresScheduling -{ - // Don't schedule this loader on the URL queue so we can load the - // local assets synchronously to avoid flickers. - return NO; -} - -- (BOOL)shouldCacheLoadedImages -{ - // UIImage imageNamed handles the caching automatically so we don't want - // to add it to the image cache. - return NO; -} - - - (RCTImageLoaderCancellationBlock)loadImageForURL:(NSURL *)imageURL - size:(CGSize)size - scale:(CGFloat)scale - resizeMode:(RCTResizeMode)resizeMode - progressHandler:(RCTImageLoaderProgressBlock)progressHandler - partialLoadHandler:(RCTImageLoaderPartialLoadBlock)partialLoadHandler - completionHandler:(RCTImageLoaderCompletionBlock)completionHandler -{ - __block atomic_bool cancelled = ATOMIC_VAR_INIT(NO); - RCTExecuteOnMainQueue(^{ - if (atomic_load(&cancelled)) { - return; - } - - UIImage *image = RCTImageFromLocalAssetURL(imageURL); - if (image) { - if (progressHandler) { - progressHandler(1, 1); - } - completionHandler(nil, image); - } else { - NSString *message = [NSString stringWithFormat:@"Could not find image %@", imageURL]; - RCTLogWarn(@"%@", message); - completionHandler(RCTErrorWithMessage(message), nil); - } - }); - - return ^{ - atomic_store(&cancelled, YES); - }; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTResizeMode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTResizeMode.h deleted file mode 100644 index 9d49f2d3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTResizeMode.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -typedef NS_ENUM(NSInteger, RCTResizeMode) { - RCTResizeModeCover = UIViewContentModeScaleAspectFill, - RCTResizeModeContain = UIViewContentModeScaleAspectFit, - RCTResizeModeStretch = UIViewContentModeScaleToFill, - RCTResizeModeCenter = UIViewContentModeCenter, - RCTResizeModeRepeat = -1, // Use negative values to avoid conflicts with iOS enum values. -}; - -@interface RCTConvert(RCTResizeMode) - -+ (RCTResizeMode)RCTResizeMode:(id)json; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTResizeMode.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTResizeMode.m deleted file mode 100644 index 34027f8e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RCTResizeMode.m +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTResizeMode.h" - -@implementation RCTConvert(RCTResizeMode) - -RCT_ENUM_CONVERTER(RCTResizeMode, (@{ - @"cover": @(RCTResizeModeCover), - @"contain": @(RCTResizeModeContain), - @"stretch": @(RCTResizeModeStretch), - @"center": @(RCTResizeModeCenter), - @"repeat": @(RCTResizeModeRepeat), -}), RCTResizeModeStretch, integerValue) - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RelativeImageStub.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RelativeImageStub.js deleted file mode 100644 index f5592d18..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/RelativeImageStub.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -'use strict'; - -// This is a stub for flow to make it understand require('./icon.png') -// See metro/src/Bundler/index.js - -const AssetRegistry = require('AssetRegistry'); - -module.exports = AssetRegistry.registerAsset({ - __packager_asset: true, - fileSystemLocation: '/full/path/to/directory', - httpServerLocation: '/assets/full/path/to/directory', - width: 100, - height: 100, - scales: [1, 2, 3], - hash: 'nonsense', - name: 'icon', - type: 'png', -}); diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/TextInlineImageNativeComponent.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/TextInlineImageNativeComponent.js deleted file mode 100644 index 6cbe5636..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/TextInlineImageNativeComponent.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const requireNativeComponent = require('requireNativeComponent'); - -const TextInlineImage = requireNativeComponent('RCTTextInlineImage'); - -module.exports = TextInlineImage; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/assetPathUtils.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/assetPathUtils.js deleted file mode 100644 index 402680ce..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/assetPathUtils.js +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -'use strict'; - -import type {PackagerAsset} from './AssetRegistry'; - -const androidScaleSuffix = { - '0.75': 'ldpi', - '1': 'mdpi', - '1.5': 'hdpi', - '2': 'xhdpi', - '3': 'xxhdpi', - '4': 'xxxhdpi', -}; - -/** - * FIXME: using number to represent discrete scale numbers is fragile in essence because of - * floating point numbers imprecision. - */ -function getAndroidAssetSuffix(scale: number): string { - if (scale.toString() in androidScaleSuffix) { - return androidScaleSuffix[scale.toString()]; - } - - throw new Error('no such scale ' + scale.toString()); -} - -// See https://developer.android.com/guide/topics/resources/drawable-resource.html -const drawableFileTypes = new Set([ - 'gif', - 'jpeg', - 'jpg', - 'png', - 'svg', - 'webp', - 'xml', -]); - -function getAndroidResourceFolderName(asset: PackagerAsset, scale: number) { - if (!drawableFileTypes.has(asset.type)) { - return 'raw'; - } - var suffix = getAndroidAssetSuffix(scale); - if (!suffix) { - throw new Error( - "Don't know which android drawable suffix to use for scale: " + - scale + - '\nAsset: ' + - JSON.stringify(asset, null, '\t') + - '\nPossible scales are:' + - JSON.stringify(androidScaleSuffix, null, '\t'), - ); - } - const androidFolder = 'drawable-' + suffix; - return androidFolder; -} - -function getAndroidResourceIdentifier(asset: PackagerAsset) { - var folderPath = getBasePath(asset); - return (folderPath + '/' + asset.name) - .toLowerCase() - .replace(/\//g, '_') // Encode folder structure in file name - .replace(/([^a-z0-9_])/g, '') // Remove illegal chars - .replace(/^assets_/, ''); // Remove "assets_" prefix -} - -function getBasePath(asset: PackagerAsset) { - var basePath = asset.httpServerLocation; - if (basePath[0] === '/') { - basePath = basePath.substr(1); - } - return basePath; -} - -module.exports = { - getAndroidAssetSuffix: getAndroidAssetSuffix, - getAndroidResourceFolderName: getAndroidResourceFolderName, - getAndroidResourceIdentifier: getAndroidResourceIdentifier, - getBasePath: getBasePath, -}; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/nativeImageSource.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/nativeImageSource.js deleted file mode 100644 index ead514fa..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/nativeImageSource.js +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const Platform = require('Platform'); - -// TODO: Change `nativeImageSource` to return this type. -export type NativeImageSource = {| - +deprecated: true, - +height: number, - +uri: string, - +width: number, -|}; - -type NativeImageSourceSpec = {| - +android?: string, - +ios?: string, - +default?: string, - - // For more details on width and height, see - // http://facebook.github.io/react-native/docs/images.html#why-not-automatically-size-everything - +height: number, - +width: number, -|}; - -/** - * In hybrid apps, use `nativeImageSource` to access images that are already - * available on the native side, for example in Xcode Asset Catalogs or - * Android's drawable folder. - * - * However, keep in mind that React Native Packager does not guarantee that the - * image exists. If the image is missing you'll get an empty box. When adding - * new images your app needs to be recompiled. - * - * Prefer Static Image Resources system which provides more guarantees, - * automates measurements and allows adding new images without rebuilding the - * native app. For more details visit: - * - * http://facebook.github.io/react-native/docs/images.html - * - */ -function nativeImageSource(spec: NativeImageSourceSpec): Object { - let uri = Platform.select({ - android: spec.android, - default: spec.default, - ios: spec.ios, - }); - if (uri == null) { - console.warn( - 'nativeImageSource(...): No image name supplied for `%s`:\n%s', - Platform.OS, - JSON.stringify(spec, null, 2), - ); - uri = ''; - } - return { - deprecated: true, - height: spec.height, - uri, - width: spec.width, - }; -} - -module.exports = nativeImageSource; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/resolveAssetSource.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/resolveAssetSource.js deleted file mode 100644 index ebd19e33..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Image/resolveAssetSource.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - * Resolves an asset into a `source` for `Image`. - * - * @format - * @flow - */ - -'use strict'; - -const AssetRegistry = require('AssetRegistry'); -const AssetSourceResolver = require('AssetSourceResolver'); - -import type {ResolvedAssetSource} from 'AssetSourceResolver'; - -let _customSourceTransformer, _serverURL, _scriptURL; - -let _sourceCodeScriptURL: ?string; -function getSourceCodeScriptURL(): ?string { - if (_sourceCodeScriptURL) { - return _sourceCodeScriptURL; - } - - let sourceCode = - global.nativeExtensions && global.nativeExtensions.SourceCode; - if (!sourceCode) { - const NativeModules = require('NativeModules'); - sourceCode = NativeModules && NativeModules.SourceCode; - } - _sourceCodeScriptURL = sourceCode.scriptURL; - return _sourceCodeScriptURL; -} - -function getDevServerURL(): ?string { - if (_serverURL === undefined) { - const sourceCodeScriptURL = getSourceCodeScriptURL(); - const match = - sourceCodeScriptURL && sourceCodeScriptURL.match(/^https?:\/\/.*?\//); - if (match) { - // jsBundle was loaded from network - _serverURL = match[0]; - } else { - // jsBundle was loaded from file - _serverURL = null; - } - } - return _serverURL; -} - -function _coerceLocalScriptURL(scriptURL: ?string): ?string { - if (scriptURL) { - if (scriptURL.startsWith('assets://')) { - // android: running from within assets, no offline path to use - return null; - } - scriptURL = scriptURL.substring(0, scriptURL.lastIndexOf('/') + 1); - if (!scriptURL.includes('://')) { - // Add file protocol in case we have an absolute file path and not a URL. - // This shouldn't really be necessary. scriptURL should be a URL. - scriptURL = 'file://' + scriptURL; - } - } - return scriptURL; -} - -function getScriptURL(): ?string { - if (_scriptURL === undefined) { - _scriptURL = _coerceLocalScriptURL(getSourceCodeScriptURL()); - } - return _scriptURL; -} - -function setCustomSourceTransformer( - transformer: (resolver: AssetSourceResolver) => ResolvedAssetSource, -): void { - _customSourceTransformer = transformer; -} - -/** - * `source` is either a number (opaque type returned by require('./foo.png')) - * or an `ImageSource` like { uri: '' } - */ -function resolveAssetSource(source: any): ?ResolvedAssetSource { - if (typeof source === 'object') { - return source; - } - - const asset = AssetRegistry.getAssetByID(source); - if (!asset) { - return null; - } - - const resolver = new AssetSourceResolver( - getDevServerURL(), - getScriptURL(), - asset, - ); - if (_customSourceTransformer) { - return _customSourceTransformer(resolver); - } - return resolver.defaultAsset(); -} - -module.exports = resolveAssetSource; -module.exports.pickScale = AssetSourceResolver.pickScale; -module.exports.setCustomSourceTransformer = setCustomSourceTransformer; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/LinkingIOS/RCTLinking.xcodeproj/project.pbxproj b/ios/ElectrodeApiImpl/Libraries/ReactNative/LinkingIOS/RCTLinking.xcodeproj/project.pbxproj deleted file mode 100644 index 34003d2a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/LinkingIOS/RCTLinking.xcodeproj/project.pbxproj +++ /dev/null @@ -1,326 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 148699CF1ABD045300480536 /* RCTLinkingManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 148699CE1ABD045300480536 /* RCTLinkingManager.m */; }; - 2D3B5F251D9B0DE600451313 /* RCTLinkingManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 148699CE1ABD045300480536 /* RCTLinkingManager.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libRCTLinking.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTLinking.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 148699CD1ABD045300480536 /* RCTLinkingManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTLinkingManager.h; sourceTree = ""; }; - 148699CE1ABD045300480536 /* RCTLinkingManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTLinkingManager.m; sourceTree = ""; }; - 2D2A28471D9B043800D4039D /* libRCTLinking-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTLinking-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 134814211AA4EA7D00B7C361 /* Products */ = { - isa = PBXGroup; - children = ( - 134814201AA4EA6300B7C361 /* libRCTLinking.a */, - ); - name = Products; - sourceTree = ""; - }; - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - 148699CD1ABD045300480536 /* RCTLinkingManager.h */, - 148699CE1ABD045300480536 /* RCTLinkingManager.m */, - 134814211AA4EA7D00B7C361 /* Products */, - 2D2A28471D9B043800D4039D /* libRCTLinking-tvOS.a */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 2D2A28461D9B043800D4039D /* RCTLinking-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D2A284F1D9B043800D4039D /* Build configuration list for PBXNativeTarget "RCTLinking-tvOS" */; - buildPhases = ( - 2D2A28431D9B043800D4039D /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTLinking-tvOS"; - productName = "RCTLinking-tvOS"; - productReference = 2D2A28471D9B043800D4039D /* libRCTLinking-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 58B511DA1A9E6C8500147676 /* RCTLinking */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTLinking" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTLinking; - productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libRCTLinking.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 2D2A28461D9B043800D4039D = { - CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Automatic; - }; - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTLinking" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511D21A9E6C8500147676; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B511DA1A9E6C8500147676 /* RCTLinking */, - 2D2A28461D9B043800D4039D /* RCTLinking-tvOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 2D2A28431D9B043800D4039D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D3B5F251D9B0DE600451313 /* RCTLinkingManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 148699CF1ABD045300480536 /* RCTLinkingManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 2D2A284D1D9B043800D4039D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 2D2A284E1D9B043800D4039D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTLinking; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTLinking; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2D2A284F1D9B043800D4039D /* Build configuration list for PBXNativeTarget "RCTLinking-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D2A284D1D9B043800D4039D /* Debug */, - 2D2A284E1D9B043800D4039D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTLinking" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTLinking" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/LinkingIOS/RCTLinkingManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/LinkingIOS/RCTLinkingManager.h deleted file mode 100644 index b0d8d005..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/LinkingIOS/RCTLinkingManager.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTLinkingManager : RCTEventEmitter - -+ (BOOL)application:(nonnull UIApplication *)app - openURL:(nonnull NSURL *)URL - options:(nonnull NSDictionary *)options; - -+ (BOOL)application:(nonnull UIApplication *)application - openURL:(nonnull NSURL *)URL - sourceApplication:(nullable NSString *)sourceApplication - annotation:(nonnull id)annotation; - -+ (BOOL)application:(nonnull UIApplication *)application - continueUserActivity:(nonnull NSUserActivity *)userActivity - restorationHandler: - #if __has_include() && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 12000) /* __IPHONE_12_0 */ - (nonnull void (^)(NSArray> *_Nullable))restorationHandler; - #else - (nonnull void (^)(NSArray *_Nullable))restorationHandler; - #endif - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/LinkingIOS/RCTLinkingManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/LinkingIOS/RCTLinkingManager.m deleted file mode 100644 index 353d0f78..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/LinkingIOS/RCTLinkingManager.m +++ /dev/null @@ -1,138 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTLinkingManager.h" - -#import -#import -#import - -static NSString *const kOpenURLNotification = @"RCTOpenURLNotification"; - -static void postNotificationWithURL(NSURL *URL, id sender) -{ - NSDictionary *payload = @{@"url": URL.absoluteString}; - [[NSNotificationCenter defaultCenter] postNotificationName:kOpenURLNotification - object:sender - userInfo:payload]; -} - -@implementation RCTLinkingManager - -RCT_EXPORT_MODULE() - -- (dispatch_queue_t)methodQueue -{ - return dispatch_get_main_queue(); -} - -- (void)startObserving -{ - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleOpenURLNotification:) - name:kOpenURLNotification - object:nil]; -} - -- (void)stopObserving -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (NSArray *)supportedEvents -{ - return @[@"url"]; -} - -+ (BOOL)application:(UIApplication *)app - openURL:(NSURL *)URL - options:(NSDictionary *)options -{ - postNotificationWithURL(URL, self); - return YES; -} - -+ (BOOL)application:(UIApplication *)application - openURL:(NSURL *)URL - sourceApplication:(NSString *)sourceApplication - annotation:(id)annotation -{ - postNotificationWithURL(URL, self); - return YES; -} - -+ (BOOL)application:(UIApplication *)application -continueUserActivity:(NSUserActivity *)userActivity - restorationHandler: - #if __has_include() && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 12000) /* __IPHONE_12_0 */ - (nonnull void (^)(NSArray> *_Nullable))restorationHandler { - #else - (nonnull void (^)(NSArray *_Nullable))restorationHandler { - #endif - if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) { - NSDictionary *payload = @{@"url": userActivity.webpageURL.absoluteString}; - [[NSNotificationCenter defaultCenter] postNotificationName:kOpenURLNotification - object:self - userInfo:payload]; - } - return YES; -} - -- (void)handleOpenURLNotification:(NSNotification *)notification -{ - [self sendEventWithName:@"url" body:notification.userInfo]; -} - -RCT_EXPORT_METHOD(openURL:(NSURL *)URL - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject) -{ - BOOL opened = [RCTSharedApplication() openURL:URL]; - if (opened) { - resolve(nil); - } else { - reject(RCTErrorUnspecified, [NSString stringWithFormat:@"Unable to open URL: %@", URL], nil); - } -} - -RCT_EXPORT_METHOD(canOpenURL:(NSURL *)URL - resolve:(RCTPromiseResolveBlock)resolve - reject:(__unused RCTPromiseRejectBlock)reject) -{ - if (RCTRunningInAppExtension()) { - // Technically Today widgets can open urls, but supporting that would require - // a reference to the NSExtensionContext - resolve(@NO); - return; - } - - // TODO: on iOS9 this will fail if URL isn't included in the plist - // we should probably check for that and reject in that case instead of - // simply resolving with NO - - // This can be expensive, so we deliberately don't call on main thread - BOOL canOpen = [RCTSharedApplication() canOpenURL:URL]; - resolve(@(canOpen)); -} - -RCT_EXPORT_METHOD(getInitialURL:(RCTPromiseResolveBlock)resolve - reject:(__unused RCTPromiseRejectBlock)reject) -{ - NSURL *initialURL = nil; - if (self.bridge.launchOptions[UIApplicationLaunchOptionsURLKey]) { - initialURL = self.bridge.launchOptions[UIApplicationLaunchOptionsURLKey]; - } else { - NSDictionary *userActivityDictionary = - self.bridge.launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey]; - if ([userActivityDictionary[UIApplicationLaunchOptionsUserActivityTypeKey] isEqual:NSUserActivityTypeBrowsingWeb]) { - initialURL = ((NSUserActivity *)userActivityDictionary[@"UIApplicationLaunchOptionsUserActivityKey"]).webpageURL; - } - } - resolve(RCTNullIfNil(initialURL.absoluteString)); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTAnimationDriver.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTAnimationDriver.h deleted file mode 100644 index 915606c2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTAnimationDriver.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -#import - -static CGFloat RCTSingleFrameInterval = 1.0 / 60.0; - -@class RCTValueAnimatedNode; - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTAnimationDriver - -@property (nonatomic, readonly) NSNumber *animationId; -@property (nonatomic, readonly) RCTValueAnimatedNode *valueNode; -@property (nonatomic, readonly) BOOL animationHasBegun; -@property (nonatomic, readonly) BOOL animationHasFinished; - -- (instancetype)initWithId:(NSNumber *)animationId - config:(NSDictionary *)config - forNode:(RCTValueAnimatedNode *)valueNode - callBack:(nullable RCTResponseSenderBlock)callback; - -- (void)startAnimation; -- (void)stepAnimationWithTime:(NSTimeInterval)currentTime; -- (void)stopAnimation; -- (void)resetAnimationConfig:(NSDictionary *)config; - -NS_ASSUME_NONNULL_END - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTDecayAnimation.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTDecayAnimation.h deleted file mode 100644 index f4aeaee2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTDecayAnimation.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAnimationDriver.h" - -@interface RCTDecayAnimation : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTDecayAnimation.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTDecayAnimation.m deleted file mode 100644 index 27d4edfc..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTDecayAnimation.m +++ /dev/null @@ -1,128 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTDecayAnimation.h" - -#import -#import - -#import "RCTAnimationUtils.h" -#import "RCTValueAnimatedNode.h" - -@interface RCTDecayAnimation () - -@property (nonatomic, strong) NSNumber *animationId; -@property (nonatomic, strong) RCTValueAnimatedNode *valueNode; -@property (nonatomic, assign) BOOL animationHasBegun; -@property (nonatomic, assign) BOOL animationHasFinished; - -@end - -@implementation RCTDecayAnimation -{ - CGFloat _velocity; - CGFloat _deceleration; - NSTimeInterval _frameStartTime; - CGFloat _fromValue; - CGFloat _lastValue; - NSInteger _iterations; - NSInteger _currentLoop; - RCTResponseSenderBlock _callback; -} - -- (instancetype)initWithId:(NSNumber *)animationId - config:(NSDictionary *)config - forNode:(RCTValueAnimatedNode *)valueNode - callBack:(nullable RCTResponseSenderBlock)callback; -{ - if ((self = [super init])) { - _callback = [callback copy]; - _animationId = animationId; - _valueNode = valueNode; - _fromValue = 0; - _lastValue = 0; - _velocity = [RCTConvert CGFloat:config[@"velocity"]]; // initial velocity - [self resetAnimationConfig:config]; - } - return self; -} - -- (void)resetAnimationConfig:(NSDictionary *)config -{ - NSNumber *iterations = [RCTConvert NSNumber:config[@"iterations"]] ?: @1; - _fromValue = _lastValue; - _deceleration = [RCTConvert CGFloat:config[@"deceleration"]]; - _iterations = iterations.integerValue; - _currentLoop = 1; - _animationHasFinished = iterations.integerValue == 0; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (void)startAnimation -{ - _frameStartTime = -1; - _animationHasBegun = YES; -} - -- (void)stopAnimation -{ - _valueNode = nil; - if (_callback) { - _callback(@[@{ - @"finished": @(_animationHasFinished) - }]); - } -} - -- (void)stepAnimationWithTime:(NSTimeInterval)currentTime -{ - if (!_animationHasBegun || _animationHasFinished) { - // Animation has not begun or animation has already finished. - return; - } - - if (_frameStartTime == -1) { - // Since this is the first animation step, consider the start to be on the previous frame. - _frameStartTime = currentTime - RCTSingleFrameInterval; - if (_fromValue == _lastValue) { - // First iteration, assign _fromValue based on _valueNode. - _fromValue = _valueNode.value; - } else { - // Not the first iteration, reset _valueNode based on _fromValue. - [self updateValue:_fromValue]; - } - _lastValue = _valueNode.value; - } - - CGFloat value = _fromValue + - (_velocity / (1 - _deceleration)) * - (1 - exp(-(1 - _deceleration) * (currentTime - _frameStartTime) * 1000.0 / RCTAnimationDragCoefficient())); - - [self updateValue:value]; - - if (fabs(_lastValue - value) < 0.1) { - if (_iterations == -1 || _currentLoop < _iterations) { - // Set _frameStartTime to -1 to reset instance variables on the next runAnimationStep. - _frameStartTime = -1; - _currentLoop++; - } else { - _animationHasFinished = true; - return; - } - } - - _lastValue = value; -} - -- (void)updateValue:(CGFloat)outputValue -{ - _valueNode.value = outputValue; - [_valueNode setNeedsUpdate]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTEventAnimation.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTEventAnimation.h deleted file mode 100644 index db90f961..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTEventAnimation.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "RCTValueAnimatedNode.h" - -@interface RCTEventAnimation : NSObject - -@property (nonatomic, readonly, weak) RCTValueAnimatedNode *valueNode; - -- (instancetype)initWithEventPath:(NSArray *)eventPath - valueNode:(RCTValueAnimatedNode *)valueNode; - -- (void)updateWithEvent:(id)event; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTEventAnimation.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTEventAnimation.m deleted file mode 100644 index 7ae667bb..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTEventAnimation.m +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTEventAnimation.h" - -@implementation RCTEventAnimation -{ - NSArray *_eventPath; -} - -- (instancetype)initWithEventPath:(NSArray *)eventPath - valueNode:(RCTValueAnimatedNode *)valueNode -{ - if ((self = [super init])) { - _eventPath = eventPath; - _valueNode = valueNode; - } - return self; -} - -- (void)updateWithEvent:(id)event -{ - NSArray *args = event.arguments; - // Supported events args are in the following order: viewTag, eventName, eventData. - id currentValue = args[2]; - for (NSString *key in _eventPath) { - currentValue = [currentValue valueForKey:key]; - } - - _valueNode.value = ((NSNumber *)currentValue).doubleValue; - [_valueNode setNeedsUpdate]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTFrameAnimation.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTFrameAnimation.h deleted file mode 100644 index 3f66d346..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTFrameAnimation.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAnimationDriver.h" - -@interface RCTFrameAnimation : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTFrameAnimation.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTFrameAnimation.m deleted file mode 100644 index a6dfde50..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTFrameAnimation.m +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTFrameAnimation.h" - -#import - -#import -#import - -#import "RCTAnimationUtils.h" -#import "RCTValueAnimatedNode.h" - -@interface RCTFrameAnimation () - -@property (nonatomic, strong) NSNumber *animationId; -@property (nonatomic, strong) RCTValueAnimatedNode *valueNode; -@property (nonatomic, assign) BOOL animationHasBegun; -@property (nonatomic, assign) BOOL animationHasFinished; - -@end - -@implementation RCTFrameAnimation -{ - NSArray *_frames; - CGFloat _toValue; - CGFloat _fromValue; - CGFloat _lastPosition; - NSTimeInterval _animationStartTime; - NSTimeInterval _animationCurrentTime; - RCTResponseSenderBlock _callback; - NSInteger _iterations; - NSInteger _currentLoop; -} - -- (instancetype)initWithId:(NSNumber *)animationId - config:(NSDictionary *)config - forNode:(RCTValueAnimatedNode *)valueNode - callBack:(nullable RCTResponseSenderBlock)callback; -{ - if ((self = [super init])) { - _animationId = animationId; - _lastPosition = _fromValue = valueNode.value; - _valueNode = valueNode; - _callback = [callback copy]; - [self resetAnimationConfig:config]; - } - return self; -} - -- (void)resetAnimationConfig:(NSDictionary *)config -{ - NSNumber *toValue = [RCTConvert NSNumber:config[@"toValue"]] ?: @1; - NSArray *frames = [RCTConvert NSNumberArray:config[@"frames"]]; - NSNumber *iterations = [RCTConvert NSNumber:config[@"iterations"]] ?: @1; - - _fromValue = _lastPosition; - _toValue = toValue.floatValue; - _frames = [frames copy]; - _animationStartTime = _animationCurrentTime = -1; - _animationHasFinished = iterations.integerValue == 0; - _iterations = iterations.integerValue; - _currentLoop = 1; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (void)startAnimation -{ - _animationStartTime = _animationCurrentTime = -1; - _animationHasBegun = YES; -} - -- (void)stopAnimation -{ - _valueNode = nil; - if (_callback) { - _callback(@[@{ - @"finished": @(_animationHasFinished) - }]); - } -} - -- (void)stepAnimationWithTime:(NSTimeInterval)currentTime -{ - if (!_animationHasBegun || _animationHasFinished || _frames.count == 0) { - // Animation has not begun or animation has already finished. - return; - } - - if (_animationStartTime == -1) { - _animationStartTime = _animationCurrentTime = currentTime; - } - - _animationCurrentTime = currentTime; - NSTimeInterval currentDuration = (_animationCurrentTime - _animationStartTime) / RCTAnimationDragCoefficient(); - - // Determine how many frames have passed since last update. - // Get index of frames that surround the current interval - NSUInteger startIndex = floor(currentDuration / RCTSingleFrameInterval); - NSUInteger nextIndex = startIndex + 1; - - if (nextIndex >= _frames.count) { - if (_iterations == -1 || _currentLoop < _iterations) { - // Looping, reset to the first frame value. - _animationStartTime = currentTime; - _currentLoop++; - NSNumber *firstValue = _frames.firstObject; - [self updateOutputWithFrameOutput:firstValue.doubleValue]; - } else { - _animationHasFinished = YES; - // We are at the end of the animation - // Update value and flag animation has ended. - NSNumber *finalValue = _frames.lastObject; - [self updateOutputWithFrameOutput:finalValue.doubleValue]; - } - return; - } - - // Do a linear remap of the two frames to safeguard against variable framerates - NSNumber *fromFrameValue = _frames[startIndex]; - NSNumber *toFrameValue = _frames[nextIndex]; - NSTimeInterval fromInterval = startIndex * RCTSingleFrameInterval; - NSTimeInterval toInterval = nextIndex * RCTSingleFrameInterval; - - // Interpolate between the individual frames to ensure the animations are - //smooth and of the proper duration regardless of the framerate. - CGFloat frameOutput = RCTInterpolateValue(currentDuration, - fromInterval, - toInterval, - fromFrameValue.doubleValue, - toFrameValue.doubleValue, - EXTRAPOLATE_TYPE_EXTEND, - EXTRAPOLATE_TYPE_EXTEND); - - [self updateOutputWithFrameOutput:frameOutput]; -} - -- (void)updateOutputWithFrameOutput:(CGFloat)frameOutput -{ - CGFloat outputValue = RCTInterpolateValue(frameOutput, - 0, - 1, - _fromValue, - _toValue, - EXTRAPOLATE_TYPE_EXTEND, - EXTRAPOLATE_TYPE_EXTEND); - - _lastPosition = outputValue; - _valueNode.value = outputValue; - [_valueNode setNeedsUpdate]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTSpringAnimation.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTSpringAnimation.h deleted file mode 100644 index 2369cd8e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTSpringAnimation.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAnimationDriver.h" - -@interface RCTSpringAnimation : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTSpringAnimation.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTSpringAnimation.m deleted file mode 100644 index b7e784b6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Drivers/RCTSpringAnimation.m +++ /dev/null @@ -1,216 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSpringAnimation.h" - -#import - -#import -#import - -#import "RCTAnimationUtils.h" -#import "RCTValueAnimatedNode.h" - -@interface RCTSpringAnimation () - -@property (nonatomic, strong) NSNumber *animationId; -@property (nonatomic, strong) RCTValueAnimatedNode *valueNode; -@property (nonatomic, assign) BOOL animationHasBegun; -@property (nonatomic, assign) BOOL animationHasFinished; - -@end - -const NSTimeInterval MAX_DELTA_TIME = 0.064; - -@implementation RCTSpringAnimation -{ - CGFloat _toValue; - CGFloat _fromValue; - BOOL _overshootClamping; - CGFloat _restDisplacementThreshold; - CGFloat _restSpeedThreshold; - CGFloat _stiffness; - CGFloat _damping; - CGFloat _mass; - CGFloat _initialVelocity; - NSTimeInterval _animationStartTime; - NSTimeInterval _animationCurrentTime; - RCTResponseSenderBlock _callback; - - CGFloat _lastPosition; - CGFloat _lastVelocity; - - NSInteger _iterations; - NSInteger _currentLoop; - - NSTimeInterval _t; // Current time (startTime + dt) -} - -- (instancetype)initWithId:(NSNumber *)animationId - config:(NSDictionary *)config - forNode:(RCTValueAnimatedNode *)valueNode - callBack:(nullable RCTResponseSenderBlock)callback -{ - if ((self = [super init])) { - _animationId = animationId; - _lastPosition = valueNode.value; - _valueNode = valueNode; - _lastVelocity = [RCTConvert CGFloat:config[@"initialVelocity"]]; - _callback = [callback copy]; - [self resetAnimationConfig:config]; - } - return self; -} - -- (void)resetAnimationConfig:(NSDictionary *)config -{ - NSNumber *iterations = [RCTConvert NSNumber:config[@"iterations"]] ?: @1; - _toValue = [RCTConvert CGFloat:config[@"toValue"]]; - _overshootClamping = [RCTConvert BOOL:config[@"overshootClamping"]]; - _restDisplacementThreshold = [RCTConvert CGFloat:config[@"restDisplacementThreshold"]]; - _restSpeedThreshold = [RCTConvert CGFloat:config[@"restSpeedThreshold"]]; - _stiffness = [RCTConvert CGFloat:config[@"stiffness"]]; - _damping = [RCTConvert CGFloat:config[@"damping"]]; - _mass = [RCTConvert CGFloat:config[@"mass"]]; - _initialVelocity = _lastVelocity; - _fromValue = _lastPosition; - _fromValue = _lastPosition; - _lastVelocity = _initialVelocity; - _animationHasFinished = iterations.integerValue == 0; - _iterations = iterations.integerValue; - _currentLoop = 1; - _animationStartTime = _animationCurrentTime = -1; - _animationHasBegun = YES; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (void)startAnimation -{ - _animationStartTime = _animationCurrentTime = -1; - _animationHasBegun = YES; -} - -- (void)stopAnimation -{ - _valueNode = nil; - if (_callback) { - _callback(@[@{ - @"finished": @(_animationHasFinished) - }]); - } -} - -- (void)stepAnimationWithTime:(NSTimeInterval)currentTime -{ - if (!_animationHasBegun || _animationHasFinished) { - // Animation has not begun or animation has already finished. - return; - } - - // calculate delta time - NSTimeInterval deltaTime; - if(_animationStartTime == -1) { - _t = 0.0; - _animationStartTime = currentTime; - deltaTime = 0.0; - } else { - // Handle frame drops, and only advance dt by a max of MAX_DELTA_TIME - deltaTime = MIN(MAX_DELTA_TIME, currentTime - _animationCurrentTime); - _t = _t + deltaTime / RCTAnimationDragCoefficient(); - } - - // store the timestamp - _animationCurrentTime = currentTime; - - CGFloat c = _damping; - CGFloat m = _mass; - CGFloat k = _stiffness; - CGFloat v0 = -_initialVelocity; - - CGFloat zeta = c / (2 * sqrtf(k * m)); - CGFloat omega0 = sqrtf(k / m); - CGFloat omega1 = omega0 * sqrtf(1.0 - (zeta * zeta)); - CGFloat x0 = _toValue - _fromValue; - - CGFloat position; - CGFloat velocity; - if (zeta < 1) { - // Under damped - CGFloat envelope = expf(-zeta * omega0 * _t); - position = - _toValue - - envelope * - ((v0 + zeta * omega0 * x0) / omega1 * sinf(omega1 * _t) + - x0 * cosf(omega1 * _t)); - // This looks crazy -- it's actually just the derivative of the - // oscillation function - velocity = - zeta * - omega0 * - envelope * - (sinf(omega1 * _t) * (v0 + zeta * omega0 * x0) / omega1 + - x0 * cosf(omega1 * _t)) - - envelope * - (cosf(omega1 * _t) * (v0 + zeta * omega0 * x0) - - omega1 * x0 * sinf(omega1 * _t)); - } else { - CGFloat envelope = expf(-omega0 * _t); - position = _toValue - envelope * (x0 + (v0 + omega0 * x0) * _t); - velocity = - envelope * (v0 * (_t * omega0 - 1) + _t * x0 * (omega0 * omega0)); - } - - _lastPosition = position; - _lastVelocity = velocity; - - [self onUpdate:position]; - - // Conditions for stopping the spring animation - BOOL isOvershooting = NO; - if (_overshootClamping && _stiffness != 0) { - if (_fromValue < _toValue) { - isOvershooting = position > _toValue; - } else { - isOvershooting = position < _toValue; - } - } - BOOL isVelocity = ABS(velocity) <= _restSpeedThreshold; - BOOL isDisplacement = YES; - if (_stiffness != 0) { - isDisplacement = ABS(_toValue - position) <= _restDisplacementThreshold; - } - - if (isOvershooting || (isVelocity && isDisplacement)) { - if (_stiffness != 0) { - // Ensure that we end up with a round value - if (_animationHasFinished) { - return; - } - [self onUpdate:_toValue]; - } - - if (_iterations == -1 || _currentLoop < _iterations) { - _lastPosition = _fromValue; - _lastVelocity = _initialVelocity; - // Set _animationStartTime to -1 to reset instance variables on the next animation step. - _animationStartTime = -1; - _currentLoop++; - [self onUpdate:_fromValue]; - } else { - _animationHasFinished = YES; - } - } -} - -- (void)onUpdate:(CGFloat)outputValue -{ - _valueNode.value = outputValue; - [_valueNode setNeedsUpdate]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTAdditionAnimatedNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTAdditionAnimatedNode.h deleted file mode 100644 index fba81d61..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTAdditionAnimatedNode.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTValueAnimatedNode.h" - -@interface RCTAdditionAnimatedNode : RCTValueAnimatedNode - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTAdditionAnimatedNode.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTAdditionAnimatedNode.m deleted file mode 100644 index dfb6f92a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTAdditionAnimatedNode.m +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAdditionAnimatedNode.h" - -@implementation RCTAdditionAnimatedNode - -- (void)performUpdate -{ - [super performUpdate]; - NSArray *inputNodes = self.config[@"input"]; - if (inputNodes.count > 1) { - RCTValueAnimatedNode *parent1 = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:inputNodes[0]]; - RCTValueAnimatedNode *parent2 = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:inputNodes[1]]; - if ([parent1 isKindOfClass:[RCTValueAnimatedNode class]] && - [parent2 isKindOfClass:[RCTValueAnimatedNode class]]) { - self.value = parent1.value + parent2.value; - } - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTAnimatedNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTAnimatedNode.h deleted file mode 100644 index 81b5b8b9..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTAnimatedNode.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@class RCTNativeAnimatedNodesManager; - -@interface RCTAnimatedNode : NSObject - -- (instancetype)initWithTag:(NSNumber *)tag - config:(NSDictionary *)config NS_DESIGNATED_INITIALIZER; - -@property (nonatomic, readonly) NSNumber *nodeTag; -@property (nonatomic, weak) RCTNativeAnimatedNodesManager *manager; -@property (nonatomic, copy, readonly) NSDictionary *config; - -@property (nonatomic, copy, readonly) NSMapTable *childNodes; -@property (nonatomic, copy, readonly) NSMapTable *parentNodes; - -@property (nonatomic, readonly) BOOL needsUpdate; - -/** - * Marks a node and its children as needing update. - */ -- (void)setNeedsUpdate NS_REQUIRES_SUPER; - -/** - * The node will update its value if necesarry and only after its parents have updated. - */ -- (void)updateNodeIfNecessary NS_REQUIRES_SUPER; - -/** - * Where the actual update code lives. Called internally from updateNodeIfNecessary - */ -- (void)performUpdate NS_REQUIRES_SUPER; - -- (void)addChild:(RCTAnimatedNode *)child NS_REQUIRES_SUPER; -- (void)removeChild:(RCTAnimatedNode *)child NS_REQUIRES_SUPER; - -- (void)onAttachedToNode:(RCTAnimatedNode *)parent NS_REQUIRES_SUPER; -- (void)onDetachedFromNode:(RCTAnimatedNode *)parent NS_REQUIRES_SUPER; - -- (void)detachNode NS_REQUIRES_SUPER; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTAnimatedNode.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTAnimatedNode.m deleted file mode 100644 index 7d9a2fc6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTAnimatedNode.m +++ /dev/null @@ -1,118 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAnimatedNode.h" - -#import - -@implementation RCTAnimatedNode -{ - NSMapTable *_childNodes; - NSMapTable *_parentNodes; -} - -- (instancetype)initWithTag:(NSNumber *)tag - config:(NSDictionary *)config -{ - if ((self = [super init])) { - _nodeTag = tag; - _config = [config copy]; - } - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (NSMapTable *)childNodes -{ - return _childNodes; -} - -- (NSMapTable *)parentNodes -{ - return _parentNodes; -} - -- (void)addChild:(RCTAnimatedNode *)child -{ - if (!_childNodes) { - _childNodes = [NSMapTable strongToWeakObjectsMapTable]; - } - if (child) { - [_childNodes setObject:child forKey:child.nodeTag]; - [child onAttachedToNode:self]; - } -} - -- (void)removeChild:(RCTAnimatedNode *)child -{ - if (!_childNodes) { - return; - } - if (child) { - [_childNodes removeObjectForKey:child.nodeTag]; - [child onDetachedFromNode:self]; - } -} - -- (void)onAttachedToNode:(RCTAnimatedNode *)parent -{ - if (!_parentNodes) { - _parentNodes = [NSMapTable strongToWeakObjectsMapTable]; - } - if (parent) { - [_parentNodes setObject:parent forKey:parent.nodeTag]; - } -} - -- (void)onDetachedFromNode:(RCTAnimatedNode *)parent -{ - if (!_parentNodes) { - return; - } - if (parent) { - [_parentNodes removeObjectForKey:parent.nodeTag]; - } -} - -- (void)detachNode -{ - for (RCTAnimatedNode *parent in _parentNodes.objectEnumerator) { - [parent removeChild:self]; - } - for (RCTAnimatedNode *child in _childNodes.objectEnumerator) { - [self removeChild:child]; - } -} - -- (void)setNeedsUpdate -{ - _needsUpdate = YES; - for (RCTAnimatedNode *child in _childNodes.objectEnumerator) { - [child setNeedsUpdate]; - } -} - -- (void)updateNodeIfNecessary -{ - if (_needsUpdate) { - for (RCTAnimatedNode *parent in _parentNodes.objectEnumerator) { - [parent updateNodeIfNecessary]; - } - [self performUpdate]; - } -} - -- (void)performUpdate -{ - _needsUpdate = NO; - // To be overidden by subclasses - // This method is called on a node only if it has been marked for update - // during the current update loop -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.h deleted file mode 100644 index ca725866..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTValueAnimatedNode.h" - -@interface RCTDiffClampAnimatedNode : RCTValueAnimatedNode - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.m deleted file mode 100644 index 56974172..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.m +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTDiffClampAnimatedNode.h" - -#import - -@implementation RCTDiffClampAnimatedNode -{ - NSNumber *_inputNodeTag; - CGFloat _min; - CGFloat _max; - CGFloat _lastValue; -} - -- (instancetype)initWithTag:(NSNumber *)tag - config:(NSDictionary *)config -{ - if (self = [super initWithTag:tag config:config]) { - _inputNodeTag = config[@"input"]; - _min = [config[@"min"] floatValue]; - _max = [config[@"max"] floatValue]; - } - - return self; -} - -- (void)onAttachedToNode:(RCTAnimatedNode *)parent -{ - [super onAttachedToNode:parent]; - - self.value = _lastValue = [self inputNodeValue]; -} - -- (void)performUpdate -{ - [super performUpdate]; - - CGFloat value = [self inputNodeValue]; - - CGFloat diff = value - _lastValue; - _lastValue = value; - self.value = MIN(MAX(self.value + diff, _min), _max); -} - -- (CGFloat)inputNodeValue -{ - RCTValueAnimatedNode *inputNode = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:_inputNodeTag]; - if (![inputNode isKindOfClass:[RCTValueAnimatedNode class]]) { - RCTLogError(@"Illegal node ID set as an input for Animated.DiffClamp node"); - return 0; - } - - return inputNode.value; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTDivisionAnimatedNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTDivisionAnimatedNode.h deleted file mode 100644 index 4a6168f2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTDivisionAnimatedNode.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTValueAnimatedNode.h" - -@interface RCTDivisionAnimatedNode : RCTValueAnimatedNode - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTDivisionAnimatedNode.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTDivisionAnimatedNode.m deleted file mode 100644 index d2cd3a13..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTDivisionAnimatedNode.m +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTDivisionAnimatedNode.h" - -#import - -@implementation RCTDivisionAnimatedNode - -- (void)performUpdate -{ - [super performUpdate]; - - NSArray *inputNodes = self.config[@"input"]; - if (inputNodes.count > 1) { - RCTValueAnimatedNode *parent1 = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:inputNodes[0]]; - RCTValueAnimatedNode *parent2 = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:inputNodes[1]]; - if ([parent1 isKindOfClass:[RCTValueAnimatedNode class]] && - [parent2 isKindOfClass:[RCTValueAnimatedNode class]]) { - if (parent2.value == 0) { - RCTLogError(@"Detected a division by zero in Animated.divide node"); - return; - } - self.value = parent1.value / parent2.value; - } - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.h deleted file mode 100644 index aa01c81c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTValueAnimatedNode.h" - -@interface RCTInterpolationAnimatedNode : RCTValueAnimatedNode - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.m deleted file mode 100644 index 0fbaf57d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.m +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTInterpolationAnimatedNode.h" - -#import "RCTAnimationUtils.h" - -@implementation RCTInterpolationAnimatedNode -{ - __weak RCTValueAnimatedNode *_parentNode; - NSArray *_inputRange; - NSArray *_outputRange; - NSString *_extrapolateLeft; - NSString *_extrapolateRight; -} - -- (instancetype)initWithTag:(NSNumber *)tag - config:(NSDictionary *)config -{ - if ((self = [super initWithTag:tag config:config])) { - _inputRange = [config[@"inputRange"] copy]; - NSMutableArray *outputRange = [NSMutableArray array]; - for (id value in config[@"outputRange"]) { - if ([value isKindOfClass:[NSNumber class]]) { - [outputRange addObject:value]; - } - } - _outputRange = [outputRange copy]; - _extrapolateLeft = config[@"extrapolateLeft"]; - _extrapolateRight = config[@"extrapolateRight"]; - } - return self; -} - -- (void)onAttachedToNode:(RCTAnimatedNode *)parent -{ - [super onAttachedToNode:parent]; - if ([parent isKindOfClass:[RCTValueAnimatedNode class]]) { - _parentNode = (RCTValueAnimatedNode *)parent; - } -} - -- (void)onDetachedFromNode:(RCTAnimatedNode *)parent -{ - [super onDetachedFromNode:parent]; - if (_parentNode == parent) { - _parentNode = nil; - } -} - -- (void)performUpdate -{ - [super performUpdate]; - if (!_parentNode) { - return; - } - - CGFloat inputValue = _parentNode.value; - - self.value = RCTInterpolateValueInRange(inputValue, - _inputRange, - _outputRange, - _extrapolateLeft, - _extrapolateRight); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTModuloAnimatedNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTModuloAnimatedNode.h deleted file mode 100644 index 319dab5a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTModuloAnimatedNode.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTValueAnimatedNode.h" - -@interface RCTModuloAnimatedNode : RCTValueAnimatedNode - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTModuloAnimatedNode.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTModuloAnimatedNode.m deleted file mode 100644 index e9b6f13b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTModuloAnimatedNode.m +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTModuloAnimatedNode.h" - -@implementation RCTModuloAnimatedNode - -- (void)performUpdate -{ - [super performUpdate]; - NSNumber *inputNode = self.config[@"input"]; - NSNumber *modulus = self.config[@"modulus"]; - RCTValueAnimatedNode *parent = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:inputNode]; - self.value = fmodf(parent.value, modulus.floatValue); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.h deleted file mode 100644 index 55c396b8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTValueAnimatedNode.h" - -@interface RCTMultiplicationAnimatedNode : RCTValueAnimatedNode - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.m deleted file mode 100644 index 05a664e2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.m +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTMultiplicationAnimatedNode.h" - -@implementation RCTMultiplicationAnimatedNode - -- (void)performUpdate -{ - [super performUpdate]; - - NSArray *inputNodes = self.config[@"input"]; - if (inputNodes.count > 1) { - RCTValueAnimatedNode *parent1 = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:inputNodes[0]]; - RCTValueAnimatedNode *parent2 = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:inputNodes[1]]; - if ([parent1 isKindOfClass:[RCTValueAnimatedNode class]] && - [parent2 isKindOfClass:[RCTValueAnimatedNode class]]) { - self.value = parent1.value * parent2.value; - } - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTPropsAnimatedNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTPropsAnimatedNode.h deleted file mode 100644 index 4bf39fe3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTPropsAnimatedNode.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAnimatedNode.h" - -@class RCTUIManager; -@class RCTViewPropertyMapper; - -@interface RCTPropsAnimatedNode : RCTAnimatedNode - -- (void)connectToView:(NSNumber *)viewTag - viewName:(NSString *)viewName - uiManager:(RCTUIManager *)uiManager; - -- (void)disconnectFromView:(NSNumber *)viewTag; - -- (void)restoreDefaultValues; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTPropsAnimatedNode.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTPropsAnimatedNode.m deleted file mode 100644 index 473a921b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTPropsAnimatedNode.m +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTPropsAnimatedNode.h" - -#import -#import - -#import "RCTAnimationUtils.h" -#import "RCTStyleAnimatedNode.h" -#import "RCTValueAnimatedNode.h" - -@implementation RCTPropsAnimatedNode -{ - NSNumber *_connectedViewTag; - NSString *_connectedViewName; - __weak RCTUIManager *_uiManager; - NSMutableDictionary *_propsDictionary; -} - -- (instancetype)initWithTag:(NSNumber *)tag - config:(NSDictionary *)config; -{ - if (self = [super initWithTag:tag config:config]) { - _propsDictionary = [NSMutableDictionary new]; - } - return self; -} - -- (void)connectToView:(NSNumber *)viewTag - viewName:(NSString *)viewName - uiManager:(RCTUIManager *)uiManager -{ - _connectedViewTag = viewTag; - _connectedViewName = viewName; - _uiManager = uiManager; -} - -- (void)disconnectFromView:(NSNumber *)viewTag -{ - _connectedViewTag = nil; - _connectedViewName = nil; - _uiManager = nil; -} - -- (void)restoreDefaultValues -{ - // Restore the default value for all props that were modified by this node. - for (NSString *key in _propsDictionary.allKeys) { - _propsDictionary[key] = [NSNull null]; - } - - if (_propsDictionary.count) { - [_uiManager synchronouslyUpdateViewOnUIThread:_connectedViewTag - viewName:_connectedViewName - props:_propsDictionary]; - } -} - -- (NSString *)propertyNameForParentTag:(NSNumber *)parentTag -{ - __block NSString *propertyName; - [self.config[@"props"] enumerateKeysAndObjectsUsingBlock:^(NSString *_Nonnull property, NSNumber *_Nonnull tag, BOOL *_Nonnull stop) { - if ([tag isEqualToNumber:parentTag]) { - propertyName = property; - *stop = YES; - } - }]; - return propertyName; -} - -- (void)performUpdate -{ - [super performUpdate]; - - // Since we are updating nodes after detaching them from views there is a time where it's - // possible that the view was disconnected and still receive an update, this is normal and we can - // simply skip that update. - if (!_connectedViewTag) { - return; - } - - for (NSNumber *parentTag in self.parentNodes.keyEnumerator) { - RCTAnimatedNode *parentNode = [self.parentNodes objectForKey:parentTag]; - if ([parentNode isKindOfClass:[RCTStyleAnimatedNode class]]) { - [self->_propsDictionary addEntriesFromDictionary:[(RCTStyleAnimatedNode *)parentNode propsDictionary]]; - - } else if ([parentNode isKindOfClass:[RCTValueAnimatedNode class]]) { - NSString *property = [self propertyNameForParentTag:parentTag]; - CGFloat value = [(RCTValueAnimatedNode *)parentNode value]; - self->_propsDictionary[property] = @(value); - } - } - - if (_propsDictionary.count) { - [_uiManager synchronouslyUpdateViewOnUIThread:_connectedViewTag - viewName:_connectedViewName - props:_propsDictionary]; - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTStyleAnimatedNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTStyleAnimatedNode.h deleted file mode 100644 index b1181a4d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTStyleAnimatedNode.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAnimatedNode.h" - -@interface RCTStyleAnimatedNode : RCTAnimatedNode - -- (NSDictionary *)propsDictionary; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTStyleAnimatedNode.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTStyleAnimatedNode.m deleted file mode 100644 index 665545be..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTStyleAnimatedNode.m +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTStyleAnimatedNode.h" -#import "RCTAnimationUtils.h" -#import "RCTValueAnimatedNode.h" -#import "RCTTransformAnimatedNode.h" - -@implementation RCTStyleAnimatedNode -{ - NSMutableDictionary *_propsDictionary; -} - -- (instancetype)initWithTag:(NSNumber *)tag - config:(NSDictionary *)config; -{ - if ((self = [super initWithTag:tag config:config])) { - _propsDictionary = [NSMutableDictionary new]; - } - return self; -} - -- (NSDictionary *)propsDictionary -{ - return _propsDictionary; -} - -- (void)performUpdate -{ - [super performUpdate]; - - NSDictionary *style = self.config[@"style"]; - [style enumerateKeysAndObjectsUsingBlock:^(NSString *property, NSNumber *nodeTag, __unused BOOL *stop) { - RCTAnimatedNode *node = [self.parentNodes objectForKey:nodeTag]; - if (node) { - if ([node isKindOfClass:[RCTValueAnimatedNode class]]) { - RCTValueAnimatedNode *parentNode = (RCTValueAnimatedNode *)node; - [self->_propsDictionary setObject:@(parentNode.value) forKey:property]; - } else if ([node isKindOfClass:[RCTTransformAnimatedNode class]]) { - RCTTransformAnimatedNode *parentNode = (RCTTransformAnimatedNode *)node; - [self->_propsDictionary addEntriesFromDictionary:parentNode.propsDictionary]; - } - } - }]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.h deleted file mode 100644 index 5f0cdb6f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTValueAnimatedNode.h" - -@interface RCTSubtractionAnimatedNode : RCTValueAnimatedNode - -@end - diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.m deleted file mode 100644 index c5489d15..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.m +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSubtractionAnimatedNode.h" - -@implementation RCTSubtractionAnimatedNode - -- (void)performUpdate -{ - [super performUpdate]; - NSArray *inputNodes = self.config[@"input"]; - if (inputNodes.count > 1) { - RCTValueAnimatedNode *parent1 = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:inputNodes[0]]; - RCTValueAnimatedNode *parent2 = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:inputNodes[1]]; - if ([parent1 isKindOfClass:[RCTValueAnimatedNode class]] && - [parent2 isKindOfClass:[RCTValueAnimatedNode class]]) { - self.value = parent1.value - parent2.value; - } - } -} - -@end - diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTTrackingAnimatedNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTTrackingAnimatedNode.h deleted file mode 100644 index 22e5fed8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTTrackingAnimatedNode.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAnimatedNode.h" - - -@interface RCTTrackingAnimatedNode : RCTAnimatedNode - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m deleted file mode 100644 index 337a1555..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTrackingAnimatedNode.h" -#import "RCTValueAnimatedNode.h" -#import "RCTNativeAnimatedNodesManager.h" - -@implementation RCTTrackingAnimatedNode { - NSNumber *_animationId; - NSNumber *_toValueNodeTag; - NSNumber *_valueNodeTag; - NSMutableDictionary *_animationConfig; -} - -- (instancetype)initWithTag:(NSNumber *)tag - config:(NSDictionary *)config -{ - if ((self = [super initWithTag:tag config:config])) { - _animationId = config[@"animationId"]; - _toValueNodeTag = config[@"toValue"]; - _valueNodeTag = config[@"value"]; - _animationConfig = [NSMutableDictionary dictionaryWithDictionary:config[@"animationConfig"]]; - } - return self; -} - -- (void)onDetachedFromNode:(RCTAnimatedNode *)parent -{ - [self.manager stopAnimation:_animationId]; - [super onDetachedFromNode:parent]; -} - -- (void)performUpdate -{ - [super performUpdate]; - - // change animation config's "toValue" to reflect updated value of the parent node - RCTValueAnimatedNode *node = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:_toValueNodeTag]; - _animationConfig[@"toValue"] = @(node.value); - - [self.manager startAnimatingNode:_animationId - nodeTag:_valueNodeTag - config:_animationConfig - endCallback:nil]; -} - -@end - diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTTransformAnimatedNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTTransformAnimatedNode.h deleted file mode 100644 index b72788ac..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTTransformAnimatedNode.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAnimatedNode.h" - -@interface RCTTransformAnimatedNode : RCTAnimatedNode - -- (NSDictionary *)propsDictionary; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTTransformAnimatedNode.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTTransformAnimatedNode.m deleted file mode 100644 index 708cd846..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTTransformAnimatedNode.m +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTransformAnimatedNode.h" -#import "RCTValueAnimatedNode.h" - -@implementation RCTTransformAnimatedNode -{ - NSMutableDictionary *_propsDictionary; -} - -- (instancetype)initWithTag:(NSNumber *)tag - config:(NSDictionary *)config; -{ - if ((self = [super initWithTag:tag config:config])) { - _propsDictionary = [NSMutableDictionary new]; - } - return self; -} - -- (NSDictionary *)propsDictionary -{ - return _propsDictionary; -} - -- (void)performUpdate -{ - [super performUpdate]; - - NSArray *transformConfigs = self.config[@"transforms"]; - NSMutableArray *transform = [NSMutableArray arrayWithCapacity:transformConfigs.count]; - for (NSDictionary *transformConfig in transformConfigs) { - NSString *type = transformConfig[@"type"]; - NSString *property = transformConfig[@"property"]; - NSNumber *value; - if ([type isEqualToString: @"animated"]) { - NSNumber *nodeTag = transformConfig[@"nodeTag"]; - RCTAnimatedNode *node = [self.parentNodes objectForKey:nodeTag]; - if (![node isKindOfClass:[RCTValueAnimatedNode class]]) { - continue; - } - RCTValueAnimatedNode *parentNode = (RCTValueAnimatedNode *)node; - value = @(parentNode.value); - } else { - value = transformConfig[@"value"]; - } - [transform addObject:@{property: value}]; - } - - _propsDictionary[@"transform"] = transform; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTValueAnimatedNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTValueAnimatedNode.h deleted file mode 100644 index 53b5da38..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTValueAnimatedNode.h +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "RCTAnimatedNode.h" - -@class RCTValueAnimatedNode; - -@protocol RCTValueAnimatedNodeObserver - -- (void)animatedNode:(RCTValueAnimatedNode *)node didUpdateValue:(CGFloat)value; - -@end - -@interface RCTValueAnimatedNode : RCTAnimatedNode - -- (void)setOffset:(CGFloat)offset; -- (void)flattenOffset; -- (void)extractOffset; - -@property (nonatomic, assign) CGFloat value; -@property (nonatomic, weak) id valueObserver; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTValueAnimatedNode.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTValueAnimatedNode.m deleted file mode 100644 index 949fcad1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/Nodes/RCTValueAnimatedNode.m +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTValueAnimatedNode.h" - -@interface RCTValueAnimatedNode () - -@property (nonatomic, assign) CGFloat offset; - -@end - -@implementation RCTValueAnimatedNode - -@synthesize value = _value; - -- (instancetype)initWithTag:(NSNumber *)tag - config:(NSDictionary *)config -{ - if (self = [super initWithTag:tag config:config]) { - _offset = [self.config[@"offset"] floatValue]; - _value = [self.config[@"value"] floatValue]; - } - return self; -} - -- (void)flattenOffset -{ - _value += _offset; - _offset = 0; -} - -- (void)extractOffset -{ - _offset += _value; - _value = 0; -} - -- (CGFloat)value -{ - return _value + _offset; -} - -- (void)setValue:(CGFloat)value -{ - _value = value; - - if (_valueObserver) { - [_valueObserver animatedNode:self didUpdateValue:_value]; - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTAnimation.xcodeproj/project.pbxproj b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTAnimation.xcodeproj/project.pbxproj deleted file mode 100644 index d74745fb..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTAnimation.xcodeproj/project.pbxproj +++ /dev/null @@ -1,693 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 13E501CC1D07A644005F35D8 /* RCTAnimationUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501B81D07A644005F35D8 /* RCTAnimationUtils.m */; }; - 13E501CF1D07A644005F35D8 /* RCTNativeAnimatedModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501BE1D07A644005F35D8 /* RCTNativeAnimatedModule.m */; }; - 13E501E81D07A6C9005F35D8 /* RCTAdditionAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501D71D07A6C9005F35D8 /* RCTAdditionAnimatedNode.m */; }; - 13E501E91D07A6C9005F35D8 /* RCTAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501D91D07A6C9005F35D8 /* RCTAnimatedNode.m */; }; - 13E501EB1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501DD1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.m */; }; - 13E501EC1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501DF1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.m */; }; - 13E501ED1D07A6C9005F35D8 /* RCTPropsAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E11D07A6C9005F35D8 /* RCTPropsAnimatedNode.m */; }; - 13E501EE1D07A6C9005F35D8 /* RCTStyleAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E31D07A6C9005F35D8 /* RCTStyleAnimatedNode.m */; }; - 13E501EF1D07A6C9005F35D8 /* RCTTransformAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E51D07A6C9005F35D8 /* RCTTransformAnimatedNode.m */; }; - 13E501F01D07A6C9005F35D8 /* RCTValueAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E71D07A6C9005F35D8 /* RCTValueAnimatedNode.m */; }; - 192F69811E823F4A008692C7 /* RCTAnimationUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501B71D07A644005F35D8 /* RCTAnimationUtils.h */; }; - 192F69821E823F4A008692C7 /* RCTNativeAnimatedModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501BD1D07A644005F35D8 /* RCTNativeAnimatedModule.h */; }; - 192F69831E823F4A008692C7 /* RCTNativeAnimatedNodesManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 94DA09161DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.h */; }; - 192F69841E823F4A008692C7 /* RCTAnimationDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 94C1294A1D4069170025F25C /* RCTAnimationDriver.h */; }; - 192F69851E823F4A008692C7 /* RCTEventAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 19F00F201DC8847500113FEE /* RCTEventAnimation.h */; }; - 192F69861E823F4A008692C7 /* RCTFrameAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 94C1294C1D4069170025F25C /* RCTFrameAnimation.h */; }; - 192F69871E823F4A008692C7 /* RCTSpringAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 94C1294E1D4069170025F25C /* RCTSpringAnimation.h */; }; - 192F69881E823F4A008692C7 /* RCTDivisionAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C9894931D999639008027DB /* RCTDivisionAnimatedNode.h */; }; - 192F69891E823F4A008692C7 /* RCTDiffClampAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 193F64F21D776EC6004D1CAA /* RCTDiffClampAnimatedNode.h */; }; - 192F698A1E823F4A008692C7 /* RCTAdditionAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501D61D07A6C9005F35D8 /* RCTAdditionAnimatedNode.h */; }; - 192F698B1E823F4A008692C7 /* RCTAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501D81D07A6C9005F35D8 /* RCTAnimatedNode.h */; }; - 192F698C1E823F4A008692C7 /* RCTInterpolationAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501DC1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.h */; }; - 192F698D1E823F4A008692C7 /* RCTModuloAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 94DAE3F71D7334A70059942F /* RCTModuloAnimatedNode.h */; }; - 192F698E1E823F4A008692C7 /* RCTMultiplicationAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501DE1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.h */; }; - 192F698F1E823F4A008692C7 /* RCTPropsAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E01D07A6C9005F35D8 /* RCTPropsAnimatedNode.h */; }; - 192F69901E823F4A008692C7 /* RCTStyleAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E21D07A6C9005F35D8 /* RCTStyleAnimatedNode.h */; }; - 192F69911E823F4A008692C7 /* RCTTransformAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E41D07A6C9005F35D8 /* RCTTransformAnimatedNode.h */; }; - 192F69921E823F4A008692C7 /* RCTValueAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */; }; - 192F69941E823F78008692C7 /* RCTAnimationUtils.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501B71D07A644005F35D8 /* RCTAnimationUtils.h */; }; - 192F69951E823F78008692C7 /* RCTNativeAnimatedModule.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501BD1D07A644005F35D8 /* RCTNativeAnimatedModule.h */; }; - 192F69961E823F78008692C7 /* RCTNativeAnimatedNodesManager.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94DA09161DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.h */; }; - 192F69971E823F78008692C7 /* RCTAnimationDriver.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94C1294A1D4069170025F25C /* RCTAnimationDriver.h */; }; - 192F69981E823F78008692C7 /* RCTEventAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 19F00F201DC8847500113FEE /* RCTEventAnimation.h */; }; - 192F69991E823F78008692C7 /* RCTFrameAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94C1294C1D4069170025F25C /* RCTFrameAnimation.h */; }; - 192F699A1E823F78008692C7 /* RCTSpringAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94C1294E1D4069170025F25C /* RCTSpringAnimation.h */; }; - 192F699B1E823F78008692C7 /* RCTDivisionAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5C9894931D999639008027DB /* RCTDivisionAnimatedNode.h */; }; - 192F699C1E823F78008692C7 /* RCTDiffClampAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 193F64F21D776EC6004D1CAA /* RCTDiffClampAnimatedNode.h */; }; - 192F699D1E823F78008692C7 /* RCTAdditionAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501D61D07A6C9005F35D8 /* RCTAdditionAnimatedNode.h */; }; - 192F699E1E823F78008692C7 /* RCTAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501D81D07A6C9005F35D8 /* RCTAnimatedNode.h */; }; - 192F699F1E823F78008692C7 /* RCTInterpolationAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501DC1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.h */; }; - 192F69A01E823F78008692C7 /* RCTModuloAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94DAE3F71D7334A70059942F /* RCTModuloAnimatedNode.h */; }; - 192F69A11E823F78008692C7 /* RCTMultiplicationAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501DE1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.h */; }; - 192F69A21E823F78008692C7 /* RCTPropsAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E01D07A6C9005F35D8 /* RCTPropsAnimatedNode.h */; }; - 192F69A31E823F78008692C7 /* RCTStyleAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E21D07A6C9005F35D8 /* RCTStyleAnimatedNode.h */; }; - 192F69A41E823F78008692C7 /* RCTTransformAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E41D07A6C9005F35D8 /* RCTTransformAnimatedNode.h */; }; - 192F69A51E823F78008692C7 /* RCTValueAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */; }; - 193F64F41D776EC6004D1CAA /* RCTDiffClampAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 193F64F31D776EC6004D1CAA /* RCTDiffClampAnimatedNode.m */; }; - 194804ED1E975D8E00623005 /* RCTDecayAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 194804EB1E975D8E00623005 /* RCTDecayAnimation.h */; }; - 194804EE1E975D8E00623005 /* RCTDecayAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 194804EC1E975D8E00623005 /* RCTDecayAnimation.m */; }; - 194804EF1E975DB500623005 /* RCTDecayAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 194804EB1E975D8E00623005 /* RCTDecayAnimation.h */; }; - 194804F01E975DCF00623005 /* RCTDecayAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 194804EB1E975D8E00623005 /* RCTDecayAnimation.h */; }; - 194804F11E975DD700623005 /* RCTDecayAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 194804EB1E975D8E00623005 /* RCTDecayAnimation.h */; }; - 194804F21E977DDB00623005 /* RCTDecayAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 194804EC1E975D8E00623005 /* RCTDecayAnimation.m */; }; - 1980B70E1E80D1C4004DC789 /* RCTAnimationUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501B71D07A644005F35D8 /* RCTAnimationUtils.h */; }; - 1980B7101E80D1C4004DC789 /* RCTNativeAnimatedModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501BD1D07A644005F35D8 /* RCTNativeAnimatedModule.h */; }; - 1980B7121E80D1C4004DC789 /* RCTNativeAnimatedNodesManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 94DA09161DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.h */; }; - 1980B7141E80D1C4004DC789 /* RCTAnimationDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 94C1294A1D4069170025F25C /* RCTAnimationDriver.h */; }; - 1980B7151E80D1C4004DC789 /* RCTEventAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 19F00F201DC8847500113FEE /* RCTEventAnimation.h */; }; - 1980B7171E80D1C4004DC789 /* RCTFrameAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 94C1294C1D4069170025F25C /* RCTFrameAnimation.h */; }; - 1980B7191E80D1C4004DC789 /* RCTSpringAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 94C1294E1D4069170025F25C /* RCTSpringAnimation.h */; }; - 1980B71B1E80D1C4004DC789 /* RCTDivisionAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C9894931D999639008027DB /* RCTDivisionAnimatedNode.h */; }; - 1980B71D1E80D1C4004DC789 /* RCTDiffClampAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 193F64F21D776EC6004D1CAA /* RCTDiffClampAnimatedNode.h */; }; - 1980B71F1E80D1C4004DC789 /* RCTAdditionAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501D61D07A6C9005F35D8 /* RCTAdditionAnimatedNode.h */; }; - 1980B7211E80D1C4004DC789 /* RCTAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501D81D07A6C9005F35D8 /* RCTAnimatedNode.h */; }; - 1980B7231E80D1C4004DC789 /* RCTInterpolationAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501DC1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.h */; }; - 1980B7251E80D1C4004DC789 /* RCTModuloAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 94DAE3F71D7334A70059942F /* RCTModuloAnimatedNode.h */; }; - 1980B7271E80D1C4004DC789 /* RCTMultiplicationAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501DE1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.h */; }; - 1980B7291E80D1C4004DC789 /* RCTPropsAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E01D07A6C9005F35D8 /* RCTPropsAnimatedNode.h */; }; - 1980B72B1E80D1C4004DC789 /* RCTStyleAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E21D07A6C9005F35D8 /* RCTStyleAnimatedNode.h */; }; - 1980B72D1E80D1C4004DC789 /* RCTTransformAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E41D07A6C9005F35D8 /* RCTTransformAnimatedNode.h */; }; - 1980B72F1E80D1C4004DC789 /* RCTValueAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */; }; - 1980B7321E80D259004DC789 /* RCTAnimationUtils.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501B71D07A644005F35D8 /* RCTAnimationUtils.h */; }; - 1980B7351E80DD6F004DC789 /* RCTNativeAnimatedModule.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501BD1D07A644005F35D8 /* RCTNativeAnimatedModule.h */; }; - 1980B7361E80DD6F004DC789 /* RCTNativeAnimatedNodesManager.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94DA09161DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.h */; }; - 1980B7371E80DD6F004DC789 /* RCTAnimationDriver.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94C1294A1D4069170025F25C /* RCTAnimationDriver.h */; }; - 1980B7381E80DD6F004DC789 /* RCTEventAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 19F00F201DC8847500113FEE /* RCTEventAnimation.h */; }; - 1980B7391E80DD6F004DC789 /* RCTFrameAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94C1294C1D4069170025F25C /* RCTFrameAnimation.h */; }; - 1980B73A1E80DD6F004DC789 /* RCTSpringAnimation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94C1294E1D4069170025F25C /* RCTSpringAnimation.h */; }; - 1980B73B1E80DD6F004DC789 /* RCTDivisionAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5C9894931D999639008027DB /* RCTDivisionAnimatedNode.h */; }; - 1980B73C1E80DD6F004DC789 /* RCTDiffClampAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 193F64F21D776EC6004D1CAA /* RCTDiffClampAnimatedNode.h */; }; - 1980B73D1E80DD6F004DC789 /* RCTAdditionAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501D61D07A6C9005F35D8 /* RCTAdditionAnimatedNode.h */; }; - 1980B73E1E80DD6F004DC789 /* RCTAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501D81D07A6C9005F35D8 /* RCTAnimatedNode.h */; }; - 1980B73F1E80DD6F004DC789 /* RCTInterpolationAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501DC1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.h */; }; - 1980B7401E80DD6F004DC789 /* RCTModuloAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 94DAE3F71D7334A70059942F /* RCTModuloAnimatedNode.h */; }; - 1980B7411E80DD6F004DC789 /* RCTMultiplicationAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501DE1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.h */; }; - 1980B7421E80DD6F004DC789 /* RCTPropsAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E01D07A6C9005F35D8 /* RCTPropsAnimatedNode.h */; }; - 1980B7431E80DD6F004DC789 /* RCTStyleAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E21D07A6C9005F35D8 /* RCTStyleAnimatedNode.h */; }; - 1980B7441E80DD6F004DC789 /* RCTTransformAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E41D07A6C9005F35D8 /* RCTTransformAnimatedNode.h */; }; - 1980B7451E80DD6F004DC789 /* RCTValueAnimatedNode.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */; }; - 19F00F221DC8847500113FEE /* RCTEventAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 19F00F211DC8847500113FEE /* RCTEventAnimation.m */; }; - 19F00F231DC8848E00113FEE /* RCTEventAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 19F00F211DC8847500113FEE /* RCTEventAnimation.m */; }; - 2D3B5EF21D9B0B3100451313 /* RCTAnimationUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501B81D07A644005F35D8 /* RCTAnimationUtils.m */; }; - 2D3B5EF41D9B0B3700451313 /* RCTNativeAnimatedModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501BE1D07A644005F35D8 /* RCTNativeAnimatedModule.m */; }; - 2D3B5EF51D9B0B4800451313 /* RCTDivisionAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C9894941D999639008027DB /* RCTDivisionAnimatedNode.m */; }; - 2D3B5EF61D9B0B4800451313 /* RCTDiffClampAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 193F64F31D776EC6004D1CAA /* RCTDiffClampAnimatedNode.m */; }; - 2D3B5EF71D9B0B4800451313 /* RCTAdditionAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501D71D07A6C9005F35D8 /* RCTAdditionAnimatedNode.m */; }; - 2D3B5EF81D9B0B4800451313 /* RCTAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501D91D07A6C9005F35D8 /* RCTAnimatedNode.m */; }; - 2D3B5EFA1D9B0B4800451313 /* RCTInterpolationAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501DD1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.m */; }; - 2D3B5EFB1D9B0B4800451313 /* RCTModuloAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 94DAE3F81D7334A70059942F /* RCTModuloAnimatedNode.m */; }; - 2D3B5EFC1D9B0B4800451313 /* RCTMultiplicationAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501DF1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.m */; }; - 2D3B5EFD1D9B0B4800451313 /* RCTPropsAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E11D07A6C9005F35D8 /* RCTPropsAnimatedNode.m */; }; - 2D3B5EFE1D9B0B4800451313 /* RCTStyleAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E31D07A6C9005F35D8 /* RCTStyleAnimatedNode.m */; }; - 2D3B5EFF1D9B0B4800451313 /* RCTTransformAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E51D07A6C9005F35D8 /* RCTTransformAnimatedNode.m */; }; - 2D3B5F001D9B0B4800451313 /* RCTValueAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E501E71D07A6C9005F35D8 /* RCTValueAnimatedNode.m */; }; - 2D65C80020732E4700C62FDF /* RCTSubtractionAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EC00630206EA19300586E91 /* RCTSubtractionAnimatedNode.m */; }; - 2EC00631206EA19300586E91 /* RCTSubtractionAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EC00630206EA19300586E91 /* RCTSubtractionAnimatedNode.m */; }; - 44DB7D942024F74200588FCD /* RCTTrackingAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 44DB7D932024F74200588FCD /* RCTTrackingAnimatedNode.h */; }; - 44DB7D952024F74200588FCD /* RCTTrackingAnimatedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 44DB7D932024F74200588FCD /* RCTTrackingAnimatedNode.h */; }; - 44DB7D972024F75100588FCD /* RCTTrackingAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 44DB7D962024F75100588FCD /* RCTTrackingAnimatedNode.m */; }; - 44DB7D982024F75100588FCD /* RCTTrackingAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 44DB7D962024F75100588FCD /* RCTTrackingAnimatedNode.m */; }; - 5C9894951D999639008027DB /* RCTDivisionAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C9894941D999639008027DB /* RCTDivisionAnimatedNode.m */; }; - 944244D01DB962DA0032A02B /* RCTFrameAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 94C1294D1D4069170025F25C /* RCTFrameAnimation.m */; }; - 944244D11DB962DC0032A02B /* RCTSpringAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 94C1294F1D4069170025F25C /* RCTSpringAnimation.m */; }; - 9476E8EC1DC9232D005D5CD1 /* RCTNativeAnimatedNodesManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 94DA09171DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.m */; }; - 94C129511D40692B0025F25C /* RCTFrameAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 94C1294D1D4069170025F25C /* RCTFrameAnimation.m */; }; - 94C129521D40692B0025F25C /* RCTSpringAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 94C1294F1D4069170025F25C /* RCTSpringAnimation.m */; }; - 94DA09181DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 94DA09171DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.m */; }; - 94DAE3F91D7334A70059942F /* RCTModuloAnimatedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 94DAE3F81D7334A70059942F /* RCTModuloAnimatedNode.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 192F69931E823F4F008692C7 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTAnimation; - dstSubfolderSpec = 16; - files = ( - 194804F11E975DD700623005 /* RCTDecayAnimation.h in CopyFiles */, - 192F69941E823F78008692C7 /* RCTAnimationUtils.h in CopyFiles */, - 192F69951E823F78008692C7 /* RCTNativeAnimatedModule.h in CopyFiles */, - 192F69961E823F78008692C7 /* RCTNativeAnimatedNodesManager.h in CopyFiles */, - 192F69971E823F78008692C7 /* RCTAnimationDriver.h in CopyFiles */, - 192F69981E823F78008692C7 /* RCTEventAnimation.h in CopyFiles */, - 192F69991E823F78008692C7 /* RCTFrameAnimation.h in CopyFiles */, - 192F699A1E823F78008692C7 /* RCTSpringAnimation.h in CopyFiles */, - 192F699B1E823F78008692C7 /* RCTDivisionAnimatedNode.h in CopyFiles */, - 192F699C1E823F78008692C7 /* RCTDiffClampAnimatedNode.h in CopyFiles */, - 192F699D1E823F78008692C7 /* RCTAdditionAnimatedNode.h in CopyFiles */, - 192F699E1E823F78008692C7 /* RCTAnimatedNode.h in CopyFiles */, - 192F699F1E823F78008692C7 /* RCTInterpolationAnimatedNode.h in CopyFiles */, - 192F69A01E823F78008692C7 /* RCTModuloAnimatedNode.h in CopyFiles */, - 192F69A11E823F78008692C7 /* RCTMultiplicationAnimatedNode.h in CopyFiles */, - 192F69A21E823F78008692C7 /* RCTPropsAnimatedNode.h in CopyFiles */, - 192F69A31E823F78008692C7 /* RCTStyleAnimatedNode.h in CopyFiles */, - 192F69A41E823F78008692C7 /* RCTTransformAnimatedNode.h in CopyFiles */, - 192F69A51E823F78008692C7 /* RCTValueAnimatedNode.h in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 1980B7311E80D21C004DC789 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTAnimation; - dstSubfolderSpec = 16; - files = ( - 194804EF1E975DB500623005 /* RCTDecayAnimation.h in CopyFiles */, - 1980B7351E80DD6F004DC789 /* RCTNativeAnimatedModule.h in CopyFiles */, - 1980B7361E80DD6F004DC789 /* RCTNativeAnimatedNodesManager.h in CopyFiles */, - 1980B7371E80DD6F004DC789 /* RCTAnimationDriver.h in CopyFiles */, - 1980B7381E80DD6F004DC789 /* RCTEventAnimation.h in CopyFiles */, - 1980B7391E80DD6F004DC789 /* RCTFrameAnimation.h in CopyFiles */, - 1980B73A1E80DD6F004DC789 /* RCTSpringAnimation.h in CopyFiles */, - 1980B73B1E80DD6F004DC789 /* RCTDivisionAnimatedNode.h in CopyFiles */, - 1980B73C1E80DD6F004DC789 /* RCTDiffClampAnimatedNode.h in CopyFiles */, - 1980B73D1E80DD6F004DC789 /* RCTAdditionAnimatedNode.h in CopyFiles */, - 1980B73E1E80DD6F004DC789 /* RCTAnimatedNode.h in CopyFiles */, - 1980B73F1E80DD6F004DC789 /* RCTInterpolationAnimatedNode.h in CopyFiles */, - 1980B7401E80DD6F004DC789 /* RCTModuloAnimatedNode.h in CopyFiles */, - 1980B7411E80DD6F004DC789 /* RCTMultiplicationAnimatedNode.h in CopyFiles */, - 1980B7421E80DD6F004DC789 /* RCTPropsAnimatedNode.h in CopyFiles */, - 1980B7431E80DD6F004DC789 /* RCTStyleAnimatedNode.h in CopyFiles */, - 1980B7441E80DD6F004DC789 /* RCTTransformAnimatedNode.h in CopyFiles */, - 1980B7451E80DD6F004DC789 /* RCTValueAnimatedNode.h in CopyFiles */, - 1980B7321E80D259004DC789 /* RCTAnimationUtils.h in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libRCTAnimation.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTAnimation.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 13E501B71D07A644005F35D8 /* RCTAnimationUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTAnimationUtils.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13E501B81D07A644005F35D8 /* RCTAnimationUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAnimationUtils.m; sourceTree = ""; }; - 13E501BD1D07A644005F35D8 /* RCTNativeAnimatedModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTNativeAnimatedModule.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13E501BE1D07A644005F35D8 /* RCTNativeAnimatedModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTNativeAnimatedModule.m; sourceTree = ""; }; - 13E501D61D07A6C9005F35D8 /* RCTAdditionAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAdditionAnimatedNode.h; sourceTree = ""; }; - 13E501D71D07A6C9005F35D8 /* RCTAdditionAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAdditionAnimatedNode.m; sourceTree = ""; }; - 13E501D81D07A6C9005F35D8 /* RCTAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAnimatedNode.h; sourceTree = ""; }; - 13E501D91D07A6C9005F35D8 /* RCTAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAnimatedNode.m; sourceTree = ""; }; - 13E501DC1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTInterpolationAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13E501DD1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTInterpolationAnimatedNode.m; sourceTree = ""; }; - 13E501DE1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTMultiplicationAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13E501DF1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMultiplicationAnimatedNode.m; sourceTree = ""; }; - 13E501E01D07A6C9005F35D8 /* RCTPropsAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTPropsAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13E501E11D07A6C9005F35D8 /* RCTPropsAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPropsAnimatedNode.m; sourceTree = ""; }; - 13E501E21D07A6C9005F35D8 /* RCTStyleAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTStyleAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13E501E31D07A6C9005F35D8 /* RCTStyleAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTStyleAnimatedNode.m; sourceTree = ""; }; - 13E501E41D07A6C9005F35D8 /* RCTTransformAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTTransformAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13E501E51D07A6C9005F35D8 /* RCTTransformAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTransformAnimatedNode.m; sourceTree = ""; }; - 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTValueAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13E501E71D07A6C9005F35D8 /* RCTValueAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTValueAnimatedNode.m; sourceTree = ""; }; - 193F64F21D776EC6004D1CAA /* RCTDiffClampAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTDiffClampAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 193F64F31D776EC6004D1CAA /* RCTDiffClampAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDiffClampAnimatedNode.m; sourceTree = ""; }; - 194804EB1E975D8E00623005 /* RCTDecayAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDecayAnimation.h; sourceTree = ""; }; - 194804EC1E975D8E00623005 /* RCTDecayAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDecayAnimation.m; sourceTree = ""; }; - 19F00F201DC8847500113FEE /* RCTEventAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTEventAnimation.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 19F00F211DC8847500113FEE /* RCTEventAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTEventAnimation.m; sourceTree = ""; }; - 2D2A28201D9B03D100D4039D /* libRCTAnimation.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTAnimation.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 2EC0062F206EA15F00586E91 /* RCTSubtractionAnimatedNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTSubtractionAnimatedNode.h; sourceTree = ""; }; - 2EC00630206EA19300586E91 /* RCTSubtractionAnimatedNode.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTSubtractionAnimatedNode.m; sourceTree = ""; }; - 44DB7D932024F74200588FCD /* RCTTrackingAnimatedNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTTrackingAnimatedNode.h; sourceTree = ""; }; - 44DB7D962024F75100588FCD /* RCTTrackingAnimatedNode.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTTrackingAnimatedNode.m; sourceTree = ""; }; - 5C9894931D999639008027DB /* RCTDivisionAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTDivisionAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 5C9894941D999639008027DB /* RCTDivisionAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDivisionAnimatedNode.m; sourceTree = ""; }; - 94C1294A1D4069170025F25C /* RCTAnimationDriver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTAnimationDriver.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 94C1294C1D4069170025F25C /* RCTFrameAnimation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTFrameAnimation.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 94C1294D1D4069170025F25C /* RCTFrameAnimation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTFrameAnimation.m; sourceTree = ""; }; - 94C1294E1D4069170025F25C /* RCTSpringAnimation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTSpringAnimation.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 94C1294F1D4069170025F25C /* RCTSpringAnimation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTSpringAnimation.m; sourceTree = ""; }; - 94DA09161DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTNativeAnimatedNodesManager.h; sourceTree = ""; }; - 94DA09171DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTNativeAnimatedNodesManager.m; sourceTree = ""; }; - 94DAE3F71D7334A70059942F /* RCTModuloAnimatedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTModuloAnimatedNode.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 94DAE3F81D7334A70059942F /* RCTModuloAnimatedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTModuloAnimatedNode.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 134814211AA4EA7D00B7C361 /* Products */ = { - isa = PBXGroup; - children = ( - 134814201AA4EA6300B7C361 /* libRCTAnimation.a */, - ); - name = Products; - sourceTree = ""; - }; - 13E501D51D07A6C9005F35D8 /* Nodes */ = { - isa = PBXGroup; - children = ( - 5C9894931D999639008027DB /* RCTDivisionAnimatedNode.h */, - 5C9894941D999639008027DB /* RCTDivisionAnimatedNode.m */, - 193F64F21D776EC6004D1CAA /* RCTDiffClampAnimatedNode.h */, - 193F64F31D776EC6004D1CAA /* RCTDiffClampAnimatedNode.m */, - 13E501D61D07A6C9005F35D8 /* RCTAdditionAnimatedNode.h */, - 13E501D71D07A6C9005F35D8 /* RCTAdditionAnimatedNode.m */, - 2EC0062F206EA15F00586E91 /* RCTSubtractionAnimatedNode.h */, - 2EC00630206EA19300586E91 /* RCTSubtractionAnimatedNode.m */, - 13E501D81D07A6C9005F35D8 /* RCTAnimatedNode.h */, - 13E501D91D07A6C9005F35D8 /* RCTAnimatedNode.m */, - 13E501DC1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.h */, - 13E501DD1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.m */, - 94DAE3F71D7334A70059942F /* RCTModuloAnimatedNode.h */, - 94DAE3F81D7334A70059942F /* RCTModuloAnimatedNode.m */, - 13E501DE1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.h */, - 13E501DF1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.m */, - 13E501E01D07A6C9005F35D8 /* RCTPropsAnimatedNode.h */, - 13E501E11D07A6C9005F35D8 /* RCTPropsAnimatedNode.m */, - 13E501E21D07A6C9005F35D8 /* RCTStyleAnimatedNode.h */, - 13E501E31D07A6C9005F35D8 /* RCTStyleAnimatedNode.m */, - 13E501E41D07A6C9005F35D8 /* RCTTransformAnimatedNode.h */, - 13E501E51D07A6C9005F35D8 /* RCTTransformAnimatedNode.m */, - 13E501E61D07A6C9005F35D8 /* RCTValueAnimatedNode.h */, - 13E501E71D07A6C9005F35D8 /* RCTValueAnimatedNode.m */, - 44DB7D932024F74200588FCD /* RCTTrackingAnimatedNode.h */, - 44DB7D962024F75100588FCD /* RCTTrackingAnimatedNode.m */, - ); - path = Nodes; - sourceTree = ""; - }; - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - 13E501B71D07A644005F35D8 /* RCTAnimationUtils.h */, - 13E501B81D07A644005F35D8 /* RCTAnimationUtils.m */, - 13E501BD1D07A644005F35D8 /* RCTNativeAnimatedModule.h */, - 13E501BE1D07A644005F35D8 /* RCTNativeAnimatedModule.m */, - 94DA09161DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.h */, - 94DA09171DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.m */, - 94C129491D4069170025F25C /* Drivers */, - 13E501D51D07A6C9005F35D8 /* Nodes */, - 134814211AA4EA7D00B7C361 /* Products */, - 2D2A28201D9B03D100D4039D /* libRCTAnimation.a */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 94C129491D4069170025F25C /* Drivers */ = { - isa = PBXGroup; - children = ( - 94C1294A1D4069170025F25C /* RCTAnimationDriver.h */, - 194804EB1E975D8E00623005 /* RCTDecayAnimation.h */, - 194804EC1E975D8E00623005 /* RCTDecayAnimation.m */, - 19F00F201DC8847500113FEE /* RCTEventAnimation.h */, - 19F00F211DC8847500113FEE /* RCTEventAnimation.m */, - 94C1294C1D4069170025F25C /* RCTFrameAnimation.h */, - 94C1294D1D4069170025F25C /* RCTFrameAnimation.m */, - 94C1294E1D4069170025F25C /* RCTSpringAnimation.h */, - 94C1294F1D4069170025F25C /* RCTSpringAnimation.m */, - ); - path = Drivers; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 192F69801E823F2E008692C7 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 194804F01E975DCF00623005 /* RCTDecayAnimation.h in Headers */, - 192F69811E823F4A008692C7 /* RCTAnimationUtils.h in Headers */, - 192F69821E823F4A008692C7 /* RCTNativeAnimatedModule.h in Headers */, - 192F69831E823F4A008692C7 /* RCTNativeAnimatedNodesManager.h in Headers */, - 192F69841E823F4A008692C7 /* RCTAnimationDriver.h in Headers */, - 192F69851E823F4A008692C7 /* RCTEventAnimation.h in Headers */, - 192F69861E823F4A008692C7 /* RCTFrameAnimation.h in Headers */, - 192F69871E823F4A008692C7 /* RCTSpringAnimation.h in Headers */, - 192F69881E823F4A008692C7 /* RCTDivisionAnimatedNode.h in Headers */, - 192F69891E823F4A008692C7 /* RCTDiffClampAnimatedNode.h in Headers */, - 192F698A1E823F4A008692C7 /* RCTAdditionAnimatedNode.h in Headers */, - 192F698B1E823F4A008692C7 /* RCTAnimatedNode.h in Headers */, - 44DB7D952024F74200588FCD /* RCTTrackingAnimatedNode.h in Headers */, - 192F698C1E823F4A008692C7 /* RCTInterpolationAnimatedNode.h in Headers */, - 192F698D1E823F4A008692C7 /* RCTModuloAnimatedNode.h in Headers */, - 192F698E1E823F4A008692C7 /* RCTMultiplicationAnimatedNode.h in Headers */, - 192F698F1E823F4A008692C7 /* RCTPropsAnimatedNode.h in Headers */, - 192F69901E823F4A008692C7 /* RCTStyleAnimatedNode.h in Headers */, - 192F69911E823F4A008692C7 /* RCTTransformAnimatedNode.h in Headers */, - 192F69921E823F4A008692C7 /* RCTValueAnimatedNode.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 1980B70D1E80D1B5004DC789 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 1980B70E1E80D1C4004DC789 /* RCTAnimationUtils.h in Headers */, - 1980B7101E80D1C4004DC789 /* RCTNativeAnimatedModule.h in Headers */, - 1980B7121E80D1C4004DC789 /* RCTNativeAnimatedNodesManager.h in Headers */, - 1980B7141E80D1C4004DC789 /* RCTAnimationDriver.h in Headers */, - 1980B7151E80D1C4004DC789 /* RCTEventAnimation.h in Headers */, - 194804ED1E975D8E00623005 /* RCTDecayAnimation.h in Headers */, - 1980B7171E80D1C4004DC789 /* RCTFrameAnimation.h in Headers */, - 1980B7191E80D1C4004DC789 /* RCTSpringAnimation.h in Headers */, - 1980B71B1E80D1C4004DC789 /* RCTDivisionAnimatedNode.h in Headers */, - 1980B71D1E80D1C4004DC789 /* RCTDiffClampAnimatedNode.h in Headers */, - 1980B71F1E80D1C4004DC789 /* RCTAdditionAnimatedNode.h in Headers */, - 1980B7211E80D1C4004DC789 /* RCTAnimatedNode.h in Headers */, - 44DB7D942024F74200588FCD /* RCTTrackingAnimatedNode.h in Headers */, - 1980B7231E80D1C4004DC789 /* RCTInterpolationAnimatedNode.h in Headers */, - 1980B7251E80D1C4004DC789 /* RCTModuloAnimatedNode.h in Headers */, - 1980B7271E80D1C4004DC789 /* RCTMultiplicationAnimatedNode.h in Headers */, - 1980B7291E80D1C4004DC789 /* RCTPropsAnimatedNode.h in Headers */, - 1980B72B1E80D1C4004DC789 /* RCTStyleAnimatedNode.h in Headers */, - 1980B72D1E80D1C4004DC789 /* RCTTransformAnimatedNode.h in Headers */, - 1980B72F1E80D1C4004DC789 /* RCTValueAnimatedNode.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 2D2A281F1D9B03D100D4039D /* RCTAnimation-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D2A28281D9B03D100D4039D /* Build configuration list for PBXNativeTarget "RCTAnimation-tvOS" */; - buildPhases = ( - 2D2A281C1D9B03D100D4039D /* Sources */, - 192F69801E823F2E008692C7 /* Headers */, - 192F69931E823F4F008692C7 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTAnimation-tvOS"; - productName = "RCTAnimation-tvOS"; - productReference = 2D2A28201D9B03D100D4039D /* libRCTAnimation.a */; - productType = "com.apple.product-type.library.static"; - }; - 58B511DA1A9E6C8500147676 /* RCTAnimation */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTAnimation" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - 1980B70D1E80D1B5004DC789 /* Headers */, - 1980B7311E80D21C004DC789 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTAnimation; - productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libRCTAnimation.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 2D2A281F1D9B03D100D4039D = { - CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Automatic; - }; - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTAnimation" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511D21A9E6C8500147676; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B511DA1A9E6C8500147676 /* RCTAnimation */, - 2D2A281F1D9B03D100D4039D /* RCTAnimation-tvOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 2D2A281C1D9B03D100D4039D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D3B5F001D9B0B4800451313 /* RCTValueAnimatedNode.m in Sources */, - 2D3B5EFB1D9B0B4800451313 /* RCTModuloAnimatedNode.m in Sources */, - 2D3B5EF21D9B0B3100451313 /* RCTAnimationUtils.m in Sources */, - 2D3B5EF51D9B0B4800451313 /* RCTDivisionAnimatedNode.m in Sources */, - 2D3B5EF71D9B0B4800451313 /* RCTAdditionAnimatedNode.m in Sources */, - 19F00F231DC8848E00113FEE /* RCTEventAnimation.m in Sources */, - 2D3B5EF41D9B0B3700451313 /* RCTNativeAnimatedModule.m in Sources */, - 2D3B5EF61D9B0B4800451313 /* RCTDiffClampAnimatedNode.m in Sources */, - 2D3B5EF81D9B0B4800451313 /* RCTAnimatedNode.m in Sources */, - 2D3B5EFE1D9B0B4800451313 /* RCTStyleAnimatedNode.m in Sources */, - 2D3B5EFA1D9B0B4800451313 /* RCTInterpolationAnimatedNode.m in Sources */, - 2D3B5EFF1D9B0B4800451313 /* RCTTransformAnimatedNode.m in Sources */, - 2D3B5EFC1D9B0B4800451313 /* RCTMultiplicationAnimatedNode.m in Sources */, - 44DB7D982024F75100588FCD /* RCTTrackingAnimatedNode.m in Sources */, - 2D3B5EFD1D9B0B4800451313 /* RCTPropsAnimatedNode.m in Sources */, - 944244D01DB962DA0032A02B /* RCTFrameAnimation.m in Sources */, - 944244D11DB962DC0032A02B /* RCTSpringAnimation.m in Sources */, - 9476E8EC1DC9232D005D5CD1 /* RCTNativeAnimatedNodesManager.m in Sources */, - 194804F21E977DDB00623005 /* RCTDecayAnimation.m in Sources */, - 2D65C80020732E4700C62FDF /* RCTSubtractionAnimatedNode.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 94C129511D40692B0025F25C /* RCTFrameAnimation.m in Sources */, - 94C129521D40692B0025F25C /* RCTSpringAnimation.m in Sources */, - 94DA09181DC7971C00AEA8C9 /* RCTNativeAnimatedNodesManager.m in Sources */, - 13E501F01D07A6C9005F35D8 /* RCTValueAnimatedNode.m in Sources */, - 94DAE3F91D7334A70059942F /* RCTModuloAnimatedNode.m in Sources */, - 193F64F41D776EC6004D1CAA /* RCTDiffClampAnimatedNode.m in Sources */, - 19F00F221DC8847500113FEE /* RCTEventAnimation.m in Sources */, - 13E501EE1D07A6C9005F35D8 /* RCTStyleAnimatedNode.m in Sources */, - 13E501CC1D07A644005F35D8 /* RCTAnimationUtils.m in Sources */, - 13E501CF1D07A644005F35D8 /* RCTNativeAnimatedModule.m in Sources */, - 13E501EC1D07A6C9005F35D8 /* RCTMultiplicationAnimatedNode.m in Sources */, - 13E501ED1D07A6C9005F35D8 /* RCTPropsAnimatedNode.m in Sources */, - 13E501E91D07A6C9005F35D8 /* RCTAnimatedNode.m in Sources */, - 44DB7D972024F75100588FCD /* RCTTrackingAnimatedNode.m in Sources */, - 13E501EB1D07A6C9005F35D8 /* RCTInterpolationAnimatedNode.m in Sources */, - 13E501E81D07A6C9005F35D8 /* RCTAdditionAnimatedNode.m in Sources */, - 5C9894951D999639008027DB /* RCTDivisionAnimatedNode.m in Sources */, - 13E501EF1D07A6C9005F35D8 /* RCTTransformAnimatedNode.m in Sources */, - 194804EE1E975D8E00623005 /* RCTDecayAnimation.m in Sources */, - 2EC00631206EA19300586E91 /* RCTSubtractionAnimatedNode.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 2D2A28261D9B03D100D4039D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTAnimation; - SDKROOT = appletvos; - }; - name = Debug; - }; - 2D2A28271D9B03D100D4039D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTAnimation; - SDKROOT = appletvos; - }; - name = Release; - }; - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 9.2; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 9.2; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTAnimation; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTAnimation; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2D2A28281D9B03D100D4039D /* Build configuration list for PBXNativeTarget "RCTAnimation-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D2A28261D9B03D100D4039D /* Debug */, - 2D2A28271D9B03D100D4039D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTAnimation" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTAnimation" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTAnimationUtils.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTAnimationUtils.h deleted file mode 100644 index 39f2fe47..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTAnimationUtils.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -#import - -static NSString *const EXTRAPOLATE_TYPE_IDENTITY = @"identity"; -static NSString *const EXTRAPOLATE_TYPE_CLAMP = @"clamp"; -static NSString *const EXTRAPOLATE_TYPE_EXTEND = @"extend"; - -RCT_EXTERN CGFloat RCTInterpolateValueInRange(CGFloat value, - NSArray *inputRange, - NSArray *outputRange, - NSString *extrapolateLeft, - NSString *extrapolateRight); - -RCT_EXTERN CGFloat RCTInterpolateValue(CGFloat value, - CGFloat inputMin, - CGFloat inputMax, - CGFloat outputMin, - CGFloat outputMax, - NSString *extrapolateLeft, - NSString *extrapolateRight); - -RCT_EXTERN CGFloat RCTRadiansToDegrees(CGFloat radians); -RCT_EXTERN CGFloat RCTDegreesToRadians(CGFloat degrees); - -/** - * Coefficient to slow down animations, respects the ios - * simulator `Slow Animations (⌘T)` option. - */ -RCT_EXTERN CGFloat RCTAnimationDragCoefficient(void); diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTAnimationUtils.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTAnimationUtils.m deleted file mode 100644 index bd4b2c33..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTAnimationUtils.m +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAnimationUtils.h" - -#import - -static NSUInteger _RCTFindIndexOfNearestValue(CGFloat value, NSArray *range) -{ - NSUInteger index; - NSUInteger rangeCount = range.count; - for (index = 1; index < rangeCount - 1; index++) { - NSNumber *inputValue = range[index]; - if (inputValue.doubleValue >= value) { - break; - } - } - return index - 1; -} - -/** - * Interpolates value by remapping it linearly fromMin->fromMax to toMin->toMax - */ -CGFloat RCTInterpolateValue(CGFloat value, - CGFloat inputMin, - CGFloat inputMax, - CGFloat outputMin, - CGFloat outputMax, - NSString *extrapolateLeft, - NSString *extrapolateRight) -{ - if (value < inputMin) { - if ([extrapolateLeft isEqualToString:EXTRAPOLATE_TYPE_IDENTITY]) { - return value; - } else if ([extrapolateLeft isEqualToString:EXTRAPOLATE_TYPE_CLAMP]) { - value = inputMin; - } else if ([extrapolateLeft isEqualToString:EXTRAPOLATE_TYPE_EXTEND]) { - // noop - } else { - RCTLogError(@"Invalid extrapolation type %@ for left extrapolation", extrapolateLeft); - } - } - - if (value > inputMax) { - if ([extrapolateRight isEqualToString:EXTRAPOLATE_TYPE_IDENTITY]) { - return value; - } else if ([extrapolateRight isEqualToString:EXTRAPOLATE_TYPE_CLAMP]) { - value = inputMax; - } else if ([extrapolateRight isEqualToString:EXTRAPOLATE_TYPE_EXTEND]) { - // noop - } else { - RCTLogError(@"Invalid extrapolation type %@ for right extrapolation", extrapolateRight); - } - } - - return outputMin + (value - inputMin) * (outputMax - outputMin) / (inputMax - inputMin); -} - -/** - * Interpolates value by mapping it from the inputRange to the outputRange. - */ -CGFloat RCTInterpolateValueInRange(CGFloat value, - NSArray *inputRange, - NSArray *outputRange, - NSString *extrapolateLeft, - NSString *extrapolateRight) -{ - NSUInteger rangeIndex = _RCTFindIndexOfNearestValue(value, inputRange); - CGFloat inputMin = inputRange[rangeIndex].doubleValue; - CGFloat inputMax = inputRange[rangeIndex + 1].doubleValue; - CGFloat outputMin = outputRange[rangeIndex].doubleValue; - CGFloat outputMax = outputRange[rangeIndex + 1].doubleValue; - - return RCTInterpolateValue(value, - inputMin, - inputMax, - outputMin, - outputMax, - extrapolateLeft, - extrapolateRight); -} - -CGFloat RCTRadiansToDegrees(CGFloat radians) -{ - return radians * 180.0 / M_PI; -} - -CGFloat RCTDegreesToRadians(CGFloat degrees) -{ - return degrees / 180.0 * M_PI; -} - -#if TARGET_IPHONE_SIMULATOR -// Based on https://stackoverflow.com/a/13307674 -float UIAnimationDragCoefficient(void); -#endif - -CGFloat RCTAnimationDragCoefficient() -{ -#if TARGET_IPHONE_SIMULATOR - if (NSClassFromString(@"XCTest") != nil) { - // UIAnimationDragCoefficient is 10.0 in tests for some reason, but - // we need it to be 1.0. Fixes T34233294 - return 1.0; - } else { - return (CGFloat)UIAnimationDragCoefficient(); - } -#else - return 1.0; -#endif -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTNativeAnimatedModule.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTNativeAnimatedModule.h deleted file mode 100644 index b4af40c7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTNativeAnimatedModule.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import -#import -#import -#import -#import - -#import "RCTValueAnimatedNode.h" - -@interface RCTNativeAnimatedModule : RCTEventEmitter - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTNativeAnimatedModule.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTNativeAnimatedModule.m deleted file mode 100644 index 57f08034..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTNativeAnimatedModule.m +++ /dev/null @@ -1,247 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -#import "RCTNativeAnimatedModule.h" - -#import "RCTNativeAnimatedNodesManager.h" - -typedef void (^AnimatedOperation)(RCTNativeAnimatedNodesManager *nodesManager); - -@implementation RCTNativeAnimatedModule -{ - RCTNativeAnimatedNodesManager *_nodesManager; - - // Oparations called after views have been updated. - NSMutableArray *_operations; - // Operations called before views have been updated. - NSMutableArray *_preOperations; -} - -RCT_EXPORT_MODULE(); - -- (void)invalidate -{ - [_nodesManager stopAnimationLoop]; - [self.bridge.eventDispatcher removeDispatchObserver:self]; - [self.bridge.uiManager.observerCoordinator removeObserver:self]; -} - -- (dispatch_queue_t)methodQueue -{ - // This module needs to be on the same queue as the UIManager to avoid - // having to lock `_operations` and `_preOperations` since `uiManagerWillPerformMounting` - // will be called from that queue. - return RCTGetUIManagerQueue(); -} - -- (void)setBridge:(RCTBridge *)bridge -{ - [super setBridge:bridge]; - - _nodesManager = [[RCTNativeAnimatedNodesManager alloc] initWithUIManager:self.bridge.uiManager]; - _operations = [NSMutableArray new]; - _preOperations = [NSMutableArray new]; - - [bridge.eventDispatcher addDispatchObserver:self]; - [bridge.uiManager.observerCoordinator addObserver:self]; -} - -#pragma mark -- API - -RCT_EXPORT_METHOD(createAnimatedNode:(nonnull NSNumber *)tag - config:(NSDictionary *)config) -{ - [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager createAnimatedNode:tag config:config]; - }]; -} - -RCT_EXPORT_METHOD(connectAnimatedNodes:(nonnull NSNumber *)parentTag - childTag:(nonnull NSNumber *)childTag) -{ - [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager connectAnimatedNodes:parentTag childTag:childTag]; - }]; -} - -RCT_EXPORT_METHOD(disconnectAnimatedNodes:(nonnull NSNumber *)parentTag - childTag:(nonnull NSNumber *)childTag) -{ - [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager disconnectAnimatedNodes:parentTag childTag:childTag]; - }]; -} - -RCT_EXPORT_METHOD(startAnimatingNode:(nonnull NSNumber *)animationId - nodeTag:(nonnull NSNumber *)nodeTag - config:(NSDictionary *)config - endCallback:(RCTResponseSenderBlock)callBack) -{ - [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager startAnimatingNode:animationId nodeTag:nodeTag config:config endCallback:callBack]; - }]; -} - -RCT_EXPORT_METHOD(stopAnimation:(nonnull NSNumber *)animationId) -{ - [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager stopAnimation:animationId]; - }]; -} - -RCT_EXPORT_METHOD(setAnimatedNodeValue:(nonnull NSNumber *)nodeTag - value:(nonnull NSNumber *)value) -{ - [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager setAnimatedNodeValue:nodeTag value:value]; - }]; -} - -RCT_EXPORT_METHOD(setAnimatedNodeOffset:(nonnull NSNumber *)nodeTag - offset:(nonnull NSNumber *)offset) -{ - [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager setAnimatedNodeOffset:nodeTag offset:offset]; - }]; -} - -RCT_EXPORT_METHOD(flattenAnimatedNodeOffset:(nonnull NSNumber *)nodeTag) -{ - [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager flattenAnimatedNodeOffset:nodeTag]; - }]; -} - -RCT_EXPORT_METHOD(extractAnimatedNodeOffset:(nonnull NSNumber *)nodeTag) -{ - [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager extractAnimatedNodeOffset:nodeTag]; - }]; -} - -RCT_EXPORT_METHOD(connectAnimatedNodeToView:(nonnull NSNumber *)nodeTag - viewTag:(nonnull NSNumber *)viewTag) -{ - NSString *viewName = [self.bridge.uiManager viewNameForReactTag:viewTag]; - [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager connectAnimatedNodeToView:nodeTag viewTag:viewTag viewName:viewName]; - }]; -} - -RCT_EXPORT_METHOD(disconnectAnimatedNodeFromView:(nonnull NSNumber *)nodeTag - viewTag:(nonnull NSNumber *)viewTag) -{ - [self addPreOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager restoreDefaultValues:nodeTag]; - }]; - [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager disconnectAnimatedNodeFromView:nodeTag viewTag:viewTag]; - }]; -} - -RCT_EXPORT_METHOD(dropAnimatedNode:(nonnull NSNumber *)tag) -{ - [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager dropAnimatedNode:tag]; - }]; -} - -RCT_EXPORT_METHOD(startListeningToAnimatedNodeValue:(nonnull NSNumber *)tag) -{ - __weak id valueObserver = self; - [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager startListeningToAnimatedNodeValue:tag valueObserver:valueObserver]; - }]; -} - -RCT_EXPORT_METHOD(stopListeningToAnimatedNodeValue:(nonnull NSNumber *)tag) -{ - [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager stopListeningToAnimatedNodeValue:tag]; - }]; -} - -RCT_EXPORT_METHOD(addAnimatedEventToView:(nonnull NSNumber *)viewTag - eventName:(nonnull NSString *)eventName - eventMapping:(NSDictionary *)eventMapping) -{ - [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager addAnimatedEventToView:viewTag eventName:eventName eventMapping:eventMapping]; - }]; -} - -RCT_EXPORT_METHOD(removeAnimatedEventFromView:(nonnull NSNumber *)viewTag - eventName:(nonnull NSString *)eventName - animatedNodeTag:(nonnull NSNumber *)animatedNodeTag) -{ - [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager removeAnimatedEventFromView:viewTag eventName:eventName animatedNodeTag:animatedNodeTag]; - }]; -} - -#pragma mark -- Batch handling - -- (void)addOperationBlock:(AnimatedOperation)operation -{ - [_operations addObject:operation]; -} - -- (void)addPreOperationBlock:(AnimatedOperation)operation -{ - [_preOperations addObject:operation]; -} - -#pragma mark - RCTUIManagerObserver - -- (void)uiManagerWillPerformMounting:(RCTUIManager *)uiManager -{ - if (_preOperations.count == 0 && _operations.count == 0) { - return; - } - - NSArray *preOperations = _preOperations; - NSArray *operations = _operations; - _preOperations = [NSMutableArray new]; - _operations = [NSMutableArray new]; - - [uiManager prependUIBlock:^(__unused RCTUIManager *manager, __unused NSDictionary *viewRegistry) { - for (AnimatedOperation operation in preOperations) { - operation(self->_nodesManager); - } - }]; - - [uiManager addUIBlock:^(__unused RCTUIManager *manager, __unused NSDictionary *viewRegistry) { - for (AnimatedOperation operation in operations) { - operation(self->_nodesManager); - } - - [self->_nodesManager updateAnimations]; - }]; -} - -#pragma mark -- Events - -- (NSArray *)supportedEvents -{ - return @[@"onAnimatedValueUpdate"]; -} - -- (void)animatedNode:(RCTValueAnimatedNode *)node didUpdateValue:(CGFloat)value -{ - [self sendEventWithName:@"onAnimatedValueUpdate" - body:@{@"tag": node.nodeTag, @"value": @(value)}]; -} - -- (void)eventDispatcherWillDispatchEvent:(id)event -{ - // Events can be dispatched from any queue so we have to make sure handleAnimatedEvent - // is run from the main queue. - RCTExecuteOnMainQueue(^{ - [self->_nodesManager handleAnimatedEvent:event]; - }); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTNativeAnimatedNodesManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTNativeAnimatedNodesManager.h deleted file mode 100644 index 6f30f96f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTNativeAnimatedNodesManager.h +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import -#import - -@protocol RCTValueAnimatedNodeObserver; - -@interface RCTNativeAnimatedNodesManager : NSObject - -- (nonnull instancetype)initWithUIManager:(nonnull RCTUIManager *)uiManager; - -- (void)updateAnimations; - -- (void)stepAnimations:(nonnull CADisplayLink *)displaylink; - -// graph - -- (void)createAnimatedNode:(nonnull NSNumber *)tag - config:(NSDictionary *__nonnull)config; - -- (void)connectAnimatedNodes:(nonnull NSNumber *)parentTag - childTag:(nonnull NSNumber *)childTag; - -- (void)disconnectAnimatedNodes:(nonnull NSNumber *)parentTag - childTag:(nonnull NSNumber *)childTag; - -- (void)connectAnimatedNodeToView:(nonnull NSNumber *)nodeTag - viewTag:(nonnull NSNumber *)viewTag - viewName:(nonnull NSString *)viewName; - -- (void)restoreDefaultValues:(nonnull NSNumber *)nodeTag; - -- (void)disconnectAnimatedNodeFromView:(nonnull NSNumber *)nodeTag - viewTag:(nonnull NSNumber *)viewTag; - -- (void)dropAnimatedNode:(nonnull NSNumber *)tag; - -// mutations - -- (void)setAnimatedNodeValue:(nonnull NSNumber *)nodeTag - value:(nonnull NSNumber *)value; - -- (void)setAnimatedNodeOffset:(nonnull NSNumber *)nodeTag - offset:(nonnull NSNumber *)offset; - -- (void)flattenAnimatedNodeOffset:(nonnull NSNumber *)nodeTag; - -- (void)extractAnimatedNodeOffset:(nonnull NSNumber *)nodeTag; - -// drivers - -- (void)startAnimatingNode:(nonnull NSNumber *)animationId - nodeTag:(nonnull NSNumber *)nodeTag - config:(NSDictionary *__nonnull)config - endCallback:(nullable RCTResponseSenderBlock)callBack; - -- (void)stopAnimation:(nonnull NSNumber *)animationId; - -- (void)stopAnimationLoop; - -// events - -- (void)addAnimatedEventToView:(nonnull NSNumber *)viewTag - eventName:(nonnull NSString *)eventName - eventMapping:(NSDictionary *__nonnull)eventMapping; - -- (void)removeAnimatedEventFromView:(nonnull NSNumber *)viewTag - eventName:(nonnull NSString *)eventName - animatedNodeTag:(nonnull NSNumber *)animatedNodeTag; - -- (void)handleAnimatedEvent:(nonnull id)event; - -// listeners - -- (void)startListeningToAnimatedNodeValue:(nonnull NSNumber *)tag - valueObserver:(nonnull id)valueObserver; - -- (void)stopListeningToAnimatedNodeValue:(nonnull NSNumber *)tag; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTNativeAnimatedNodesManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTNativeAnimatedNodesManager.m deleted file mode 100644 index 30ec0e42..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/NativeAnimation/RCTNativeAnimatedNodesManager.m +++ /dev/null @@ -1,442 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTNativeAnimatedNodesManager.h" - -#import - -#import "RCTAdditionAnimatedNode.h" -#import "RCTAnimatedNode.h" -#import "RCTAnimationDriver.h" -#import "RCTDiffClampAnimatedNode.h" -#import "RCTDivisionAnimatedNode.h" -#import "RCTEventAnimation.h" -#import "RCTFrameAnimation.h" -#import "RCTDecayAnimation.h" -#import "RCTInterpolationAnimatedNode.h" -#import "RCTModuloAnimatedNode.h" -#import "RCTMultiplicationAnimatedNode.h" -#import "RCTPropsAnimatedNode.h" -#import "RCTSpringAnimation.h" -#import "RCTStyleAnimatedNode.h" -#import "RCTSubtractionAnimatedNode.h" -#import "RCTTransformAnimatedNode.h" -#import "RCTValueAnimatedNode.h" -#import "RCTTrackingAnimatedNode.h" - -@implementation RCTNativeAnimatedNodesManager -{ - __weak RCTUIManager *_uiManager; - NSMutableDictionary *_animationNodes; - // Mapping of a view tag and an event name to a list of event animation drivers. 99% of the time - // there will be only one driver per mapping so all code code should be optimized around that. - NSMutableDictionary *> *_eventDrivers; - NSMutableSet> *_activeAnimations; - CADisplayLink *_displayLink; -} - -- (instancetype)initWithUIManager:(nonnull RCTUIManager *)uiManager -{ - if ((self = [super init])) { - _uiManager = uiManager; - _animationNodes = [NSMutableDictionary new]; - _eventDrivers = [NSMutableDictionary new]; - _activeAnimations = [NSMutableSet new]; - } - return self; -} - -#pragma mark -- Graph - -- (void)createAnimatedNode:(nonnull NSNumber *)tag - config:(NSDictionary *)config -{ - static NSDictionary *map; - static dispatch_once_t mapToken; - dispatch_once(&mapToken, ^{ - map = @{@"style" : [RCTStyleAnimatedNode class], - @"value" : [RCTValueAnimatedNode class], - @"props" : [RCTPropsAnimatedNode class], - @"interpolation" : [RCTInterpolationAnimatedNode class], - @"addition" : [RCTAdditionAnimatedNode class], - @"diffclamp": [RCTDiffClampAnimatedNode class], - @"division" : [RCTDivisionAnimatedNode class], - @"multiplication" : [RCTMultiplicationAnimatedNode class], - @"modulus" : [RCTModuloAnimatedNode class], - @"subtraction" : [RCTSubtractionAnimatedNode class], - @"transform" : [RCTTransformAnimatedNode class], - @"tracking" : [RCTTrackingAnimatedNode class]}; - }); - - NSString *nodeType = [RCTConvert NSString:config[@"type"]]; - - Class nodeClass = map[nodeType]; - if (!nodeClass) { - RCTLogError(@"Animated node type %@ not supported natively", nodeType); - return; - } - - RCTAnimatedNode *node = [[nodeClass alloc] initWithTag:tag config:config]; - node.manager = self; - _animationNodes[tag] = node; - [node setNeedsUpdate]; -} - -- (void)connectAnimatedNodes:(nonnull NSNumber *)parentTag - childTag:(nonnull NSNumber *)childTag -{ - RCTAssertParam(parentTag); - RCTAssertParam(childTag); - - RCTAnimatedNode *parentNode = _animationNodes[parentTag]; - RCTAnimatedNode *childNode = _animationNodes[childTag]; - - RCTAssertParam(parentNode); - RCTAssertParam(childNode); - - [parentNode addChild:childNode]; - [childNode setNeedsUpdate]; -} - -- (void)disconnectAnimatedNodes:(nonnull NSNumber *)parentTag - childTag:(nonnull NSNumber *)childTag -{ - RCTAssertParam(parentTag); - RCTAssertParam(childTag); - - RCTAnimatedNode *parentNode = _animationNodes[parentTag]; - RCTAnimatedNode *childNode = _animationNodes[childTag]; - - RCTAssertParam(parentNode); - RCTAssertParam(childNode); - - [parentNode removeChild:childNode]; - [childNode setNeedsUpdate]; -} - -- (void)connectAnimatedNodeToView:(nonnull NSNumber *)nodeTag - viewTag:(nonnull NSNumber *)viewTag - viewName:(nonnull NSString *)viewName -{ - RCTAnimatedNode *node = _animationNodes[nodeTag]; - if ([node isKindOfClass:[RCTPropsAnimatedNode class]]) { - [(RCTPropsAnimatedNode *)node connectToView:viewTag viewName:viewName uiManager:_uiManager]; - } - [node setNeedsUpdate]; -} - -- (void)disconnectAnimatedNodeFromView:(nonnull NSNumber *)nodeTag - viewTag:(nonnull NSNumber *)viewTag -{ - RCTAnimatedNode *node = _animationNodes[nodeTag]; - if ([node isKindOfClass:[RCTPropsAnimatedNode class]]) { - [(RCTPropsAnimatedNode *)node disconnectFromView:viewTag]; - } -} - -- (void)restoreDefaultValues:(nonnull NSNumber *)nodeTag -{ - RCTAnimatedNode *node = _animationNodes[nodeTag]; - // Restoring default values needs to happen before UIManager operations so it is - // possible the node hasn't been created yet if it is being connected and - // disconnected in the same batch. In that case we don't need to restore - // default values since it will never actually update the view. - if (node == nil) { - return; - } - if (![node isKindOfClass:[RCTPropsAnimatedNode class]]) { - RCTLogError(@"Not a props node."); - } - [(RCTPropsAnimatedNode *)node restoreDefaultValues]; -} - -- (void)dropAnimatedNode:(nonnull NSNumber *)tag -{ - RCTAnimatedNode *node = _animationNodes[tag]; - if (node) { - [node detachNode]; - [_animationNodes removeObjectForKey:tag]; - } -} - -#pragma mark -- Mutations - -- (void)setAnimatedNodeValue:(nonnull NSNumber *)nodeTag - value:(nonnull NSNumber *)value -{ - RCTAnimatedNode *node = _animationNodes[nodeTag]; - if (![node isKindOfClass:[RCTValueAnimatedNode class]]) { - RCTLogError(@"Not a value node."); - return; - } - [self stopAnimationsForNode:node]; - - RCTValueAnimatedNode *valueNode = (RCTValueAnimatedNode *)node; - valueNode.value = value.floatValue; - [valueNode setNeedsUpdate]; -} - -- (void)setAnimatedNodeOffset:(nonnull NSNumber *)nodeTag - offset:(nonnull NSNumber *)offset -{ - RCTAnimatedNode *node = _animationNodes[nodeTag]; - if (![node isKindOfClass:[RCTValueAnimatedNode class]]) { - RCTLogError(@"Not a value node."); - return; - } - - RCTValueAnimatedNode *valueNode = (RCTValueAnimatedNode *)node; - [valueNode setOffset:offset.floatValue]; - [valueNode setNeedsUpdate]; -} - -- (void)flattenAnimatedNodeOffset:(nonnull NSNumber *)nodeTag -{ - RCTAnimatedNode *node = _animationNodes[nodeTag]; - if (![node isKindOfClass:[RCTValueAnimatedNode class]]) { - RCTLogError(@"Not a value node."); - return; - } - - RCTValueAnimatedNode *valueNode = (RCTValueAnimatedNode *)node; - [valueNode flattenOffset]; -} - -- (void)extractAnimatedNodeOffset:(nonnull NSNumber *)nodeTag -{ - RCTAnimatedNode *node = _animationNodes[nodeTag]; - if (![node isKindOfClass:[RCTValueAnimatedNode class]]) { - RCTLogError(@"Not a value node."); - return; - } - - RCTValueAnimatedNode *valueNode = (RCTValueAnimatedNode *)node; - [valueNode extractOffset]; -} - -#pragma mark -- Drivers - -- (void)startAnimatingNode:(nonnull NSNumber *)animationId - nodeTag:(nonnull NSNumber *)nodeTag - config:(NSDictionary *)config - endCallback:(RCTResponseSenderBlock)callBack -{ - // check if the animation has already started - for (id driver in _activeAnimations) { - if ([driver.animationId isEqual:animationId]) { - // if the animation is running, we restart it with an updated configuration - [driver resetAnimationConfig:config]; - return; - } - } - - RCTValueAnimatedNode *valueNode = (RCTValueAnimatedNode *)_animationNodes[nodeTag]; - - NSString *type = config[@"type"]; - id animationDriver; - - if ([type isEqual:@"frames"]) { - animationDriver = [[RCTFrameAnimation alloc] initWithId:animationId - config:config - forNode:valueNode - callBack:callBack]; - - } else if ([type isEqual:@"spring"]) { - animationDriver = [[RCTSpringAnimation alloc] initWithId:animationId - config:config - forNode:valueNode - callBack:callBack]; - - } else if ([type isEqual:@"decay"]) { - animationDriver = [[RCTDecayAnimation alloc] initWithId:animationId - config:config - forNode:valueNode - callBack:callBack]; - } else { - RCTLogError(@"Unsupported animation type: %@", config[@"type"]); - return; - } - - [_activeAnimations addObject:animationDriver]; - [animationDriver startAnimation]; - [self startAnimationLoopIfNeeded]; -} - -- (void)stopAnimation:(nonnull NSNumber *)animationId -{ - for (id driver in _activeAnimations) { - if ([driver.animationId isEqual:animationId]) { - [driver stopAnimation]; - [_activeAnimations removeObject:driver]; - break; - } - } -} - -- (void)stopAnimationsForNode:(nonnull RCTAnimatedNode *)node -{ - NSMutableArray> *discarded = [NSMutableArray new]; - for (id driver in _activeAnimations) { - if ([driver.valueNode isEqual:node]) { - [discarded addObject:driver]; - } - } - for (id driver in discarded) { - [driver stopAnimation]; - [_activeAnimations removeObject:driver]; - } -} - -#pragma mark -- Events - -- (void)addAnimatedEventToView:(nonnull NSNumber *)viewTag - eventName:(nonnull NSString *)eventName - eventMapping:(NSDictionary *)eventMapping -{ - NSNumber *nodeTag = [RCTConvert NSNumber:eventMapping[@"animatedValueTag"]]; - RCTAnimatedNode *node = _animationNodes[nodeTag]; - - if (!node) { - RCTLogError(@"Animated node with tag %@ does not exists", nodeTag); - return; - } - - if (![node isKindOfClass:[RCTValueAnimatedNode class]]) { - RCTLogError(@"Animated node connected to event should be of type RCTValueAnimatedNode"); - return; - } - - NSArray *eventPath = [RCTConvert NSStringArray:eventMapping[@"nativeEventPath"]]; - - RCTEventAnimation *driver = - [[RCTEventAnimation alloc] initWithEventPath:eventPath valueNode:(RCTValueAnimatedNode *)node]; - - NSString *key = [NSString stringWithFormat:@"%@%@", viewTag, eventName]; - if (_eventDrivers[key] != nil) { - [_eventDrivers[key] addObject:driver]; - } else { - NSMutableArray *drivers = [NSMutableArray new]; - [drivers addObject:driver]; - _eventDrivers[key] = drivers; - } -} - -- (void)removeAnimatedEventFromView:(nonnull NSNumber *)viewTag - eventName:(nonnull NSString *)eventName - animatedNodeTag:(nonnull NSNumber *)animatedNodeTag -{ - NSString *key = [NSString stringWithFormat:@"%@%@", viewTag, eventName]; - if (_eventDrivers[key] != nil) { - if (_eventDrivers[key].count == 1) { - [_eventDrivers removeObjectForKey:key]; - } else { - NSMutableArray *driversForKey = _eventDrivers[key]; - for (NSUInteger i = 0; i < driversForKey.count; i++) { - if (driversForKey[i].valueNode.nodeTag == animatedNodeTag) { - [driversForKey removeObjectAtIndex:i]; - break; - } - } - } - } -} - -- (void)handleAnimatedEvent:(id)event -{ - if (_eventDrivers.count == 0) { - return; - } - - NSString *key = [NSString stringWithFormat:@"%@%@", event.viewTag, event.eventName]; - NSMutableArray *driversForKey = _eventDrivers[key]; - if (driversForKey) { - for (RCTEventAnimation *driver in driversForKey) { - [self stopAnimationsForNode:driver.valueNode]; - [driver updateWithEvent:event]; - } - - [self updateAnimations]; - } -} - -#pragma mark -- Listeners - -- (void)startListeningToAnimatedNodeValue:(nonnull NSNumber *)tag - valueObserver:(id)valueObserver -{ - RCTAnimatedNode *node = _animationNodes[tag]; - if ([node isKindOfClass:[RCTValueAnimatedNode class]]) { - ((RCTValueAnimatedNode *)node).valueObserver = valueObserver; - } -} - -- (void)stopListeningToAnimatedNodeValue:(nonnull NSNumber *)tag -{ - RCTAnimatedNode *node = _animationNodes[tag]; - if ([node isKindOfClass:[RCTValueAnimatedNode class]]) { - ((RCTValueAnimatedNode *)node).valueObserver = nil; - } -} - - -#pragma mark -- Animation Loop - -- (void)startAnimationLoopIfNeeded -{ - if (!_displayLink && _activeAnimations.count > 0) { - _displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(stepAnimations:)]; - [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; - } -} - -- (void)stopAnimationLoopIfNeeded -{ - if (_activeAnimations.count == 0) { - [self stopAnimationLoop]; - } -} - -- (void)stopAnimationLoop -{ - if (_displayLink) { - [_displayLink invalidate]; - _displayLink = nil; - } -} - -- (void)stepAnimations:(CADisplayLink *)displaylink -{ - NSTimeInterval time = displaylink.timestamp; - for (id animationDriver in _activeAnimations) { - [animationDriver stepAnimationWithTime:time]; - } - - [self updateAnimations]; - - for (id animationDriver in [_activeAnimations copy]) { - if (animationDriver.animationHasFinished) { - [animationDriver stopAnimation]; - [_activeAnimations removeObject:animationDriver]; - } - } - - [self stopAnimationLoopIfNeeded]; -} - - -#pragma mark -- Updates - -- (void)updateAnimations -{ - [_animationNodes enumerateKeysAndObjectsUsingBlock:^(NSNumber *key, RCTAnimatedNode *node, BOOL *stop) { - if (node.needsUpdate) { - [node updateNodeIfNecessary]; - } - }]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/FormData.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/FormData.js deleted file mode 100644 index ff618c01..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/FormData.js +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -type FormDataValue = any; -type FormDataNameValuePair = [string, FormDataValue]; - -type Headers = {[name: string]: string}; -type FormDataPart = - | { - string: string, - headers: Headers, - } - | { - uri: string, - headers: Headers, - name?: string, - type?: string, - }; - -/** - * Polyfill for XMLHttpRequest2 FormData API, allowing multipart POST requests - * with mixed data (string, native files) to be submitted via XMLHttpRequest. - * - * Example: - * - * var photo = { - * uri: uriFromCameraRoll, - * type: 'image/jpeg', - * name: 'photo.jpg', - * }; - * - * var body = new FormData(); - * body.append('authToken', 'secret'); - * body.append('photo', photo); - * body.append('title', 'A beautiful photo!'); - * - * xhr.open('POST', serverURL); - * xhr.send(body); - */ -class FormData { - _parts: Array; - - constructor() { - this._parts = []; - } - - append(key: string, value: FormDataValue) { - // The XMLHttpRequest spec doesn't specify if duplicate keys are allowed. - // MDN says that any new values should be appended to existing values. - // In any case, major browsers allow duplicate keys, so that's what we'll do - // too. They'll simply get appended as additional form data parts in the - // request body, leaving the server to deal with them. - this._parts.push([key, value]); - } - - getParts(): Array { - return this._parts.map(([name, value]) => { - const contentDisposition = 'form-data; name="' + name + '"'; - - const headers: Headers = {'content-disposition': contentDisposition}; - - // The body part is a "blob", which in React Native just means - // an object with a `uri` attribute. Optionally, it can also - // have a `name` and `type` attribute to specify filename and - // content type (cf. web Blob interface.) - if (typeof value === 'object' && value) { - if (typeof value.name === 'string') { - headers['content-disposition'] += '; filename="' + value.name + '"'; - } - if (typeof value.type === 'string') { - headers['content-type'] = value.type; - } - return {...value, headers, fieldName: name}; - } - // Convert non-object values to strings as per FormData.append() spec - return {string: String(value), headers, fieldName: name}; - }); - } -} - -module.exports = FormData; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/NetInfo.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/NetInfo.js deleted file mode 100644 index cffb462e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/NetInfo.js +++ /dev/null @@ -1,240 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const NativeEventEmitter = require('NativeEventEmitter'); -const NativeModules = require('NativeModules'); -const Platform = require('Platform'); -const RCTNetInfo = NativeModules.NetInfo; - -const NetInfoEventEmitter = new NativeEventEmitter(RCTNetInfo); - -const DEVICE_CONNECTIVITY_EVENT = 'networkStatusDidChange'; - -type ChangeEventName = $Enum<{ - connectionChange: string, - change: string, -}>; - -type ReachabilityStateIOS = $Enum<{ - cell: string, - none: string, - unknown: string, - wifi: string, -}>; - -type ConnectivityStateAndroid = $Enum<{ - NONE: string, - MOBILE: string, - WIFI: string, - MOBILE_MMS: string, - MOBILE_SUPL: string, - MOBILE_DUN: string, - MOBILE_HIPRI: string, - WIMAX: string, - BLUETOOTH: string, - DUMMY: string, - ETHERNET: string, - MOBILE_FOTA: string, - MOBILE_IMS: string, - MOBILE_CBS: string, - WIFI_P2P: string, - MOBILE_IA: string, - MOBILE_EMERGENCY: string, - PROXY: string, - VPN: string, - UNKNOWN: string, -}>; - -const _subscriptions = new Map(); - -let _isConnectedDeprecated; -if (Platform.OS === 'ios') { - _isConnectedDeprecated = function( - reachability: ReachabilityStateIOS, - ): boolean { - return reachability !== 'none' && reachability !== 'unknown'; - }; -} else if (Platform.OS === 'android') { - _isConnectedDeprecated = function( - connectionType: ConnectivityStateAndroid, - ): boolean { - return connectionType !== 'NONE' && connectionType !== 'UNKNOWN'; - }; -} - -function _isConnected(connection) { - return connection.type !== 'none' && connection.type !== 'unknown'; -} - -const _isConnectedSubscriptions = new Map(); - -/** - * NetInfo exposes info about online/offline status. - * - * See https://facebook.github.io/react-native/docs/netinfo.html - */ -const NetInfo = { - /** - * Adds an event handler. - * - * See https://facebook.github.io/react-native/docs/netinfo.html#addeventlistener - */ - addEventListener( - eventName: ChangeEventName, - handler: Function, - ): {remove: () => void} { - let listener; - if (eventName === 'connectionChange') { - listener = NetInfoEventEmitter.addListener( - DEVICE_CONNECTIVITY_EVENT, - appStateData => { - handler({ - type: appStateData.connectionType, - effectiveType: appStateData.effectiveConnectionType, - }); - }, - ); - } else if (eventName === 'change') { - console.warn( - 'NetInfo\'s "change" event is deprecated. Listen to the "connectionChange" event instead.', - ); - - listener = NetInfoEventEmitter.addListener( - DEVICE_CONNECTIVITY_EVENT, - appStateData => { - handler(appStateData.network_info); - }, - ); - } else { - console.warn('Trying to subscribe to unknown event: "' + eventName + '"'); - return { - remove: () => {}, - }; - } - - _subscriptions.set(handler, listener); - return { - remove: () => NetInfo.removeEventListener(eventName, handler), - }; - }, - - /** - * Removes the listener for network status changes. - * - * See https://facebook.github.io/react-native/docs/netinfo.html#removeeventlistener - */ - removeEventListener(eventName: ChangeEventName, handler: Function): void { - const listener = _subscriptions.get(handler); - if (!listener) { - return; - } - listener.remove(); - _subscriptions.delete(handler); - }, - - /** - * This function is deprecated. Use `getConnectionInfo` instead. - * Returns a promise that resolves with one of the deprecated connectivity - * types: - * - * The following connectivity types are deprecated. They're used by the - * deprecated APIs `fetch` and the `change` event. - * - * iOS connectivity types (deprecated): - * - `none` - device is offline - * - `wifi` - device is online and connected via wifi, or is the iOS simulator - * - `cell` - device is connected via Edge, 3G, WiMax, or LTE - * - `unknown` - error case and the network status is unknown - * - * Android connectivity types (deprecated). - * - `NONE` - device is offline - * - `BLUETOOTH` - The Bluetooth data connection. - * - `DUMMY` - Dummy data connection. - * - `ETHERNET` - The Ethernet data connection. - * - `MOBILE` - The Mobile data connection. - * - `MOBILE_DUN` - A DUN-specific Mobile data connection. - * - `MOBILE_HIPRI` - A High Priority Mobile data connection. - * - `MOBILE_MMS` - An MMS-specific Mobile data connection. - * - `MOBILE_SUPL` - A SUPL-specific Mobile data connection. - * - `VPN` - A virtual network using one or more native bearers. Requires - * API Level 21 - * - `WIFI` - The WIFI data connection. - * - `WIMAX` - The WiMAX data connection. - * - `UNKNOWN` - Unknown data connection. - * - * The rest of the connectivity types are hidden by the Android API, but can - * be used if necessary. - */ - fetch(): Promise { - console.warn( - 'NetInfo.fetch() is deprecated. Use NetInfo.getConnectionInfo() instead.', - ); - return RCTNetInfo.getCurrentConnectivity().then(resp => resp.network_info); - }, - - /** - * See https://facebook.github.io/react-native/docs/netinfo.html#getconnectioninfo - */ - getConnectionInfo(): Promise { - return RCTNetInfo.getCurrentConnectivity().then(resp => { - return { - type: resp.connectionType, - effectiveType: resp.effectiveConnectionType, - }; - }); - }, - - /** - * An object with the same methods as above but the listener receives a - * boolean which represents the internet connectivity. - * - * See https://facebook.github.io/react-native/docs/netinfo.html#isconnected - */ - isConnected: { - addEventListener( - eventName: ChangeEventName, - handler: Function, - ): {remove: () => void} { - const listener = connection => { - if (eventName === 'change') { - handler(_isConnectedDeprecated(connection)); - } else if (eventName === 'connectionChange') { - handler(_isConnected(connection)); - } - }; - _isConnectedSubscriptions.set(handler, listener); - NetInfo.addEventListener(eventName, listener); - return { - remove: () => - NetInfo.isConnected.removeEventListener(eventName, handler), - }; - }, - - removeEventListener(eventName: ChangeEventName, handler: Function): void { - const listener = _isConnectedSubscriptions.get(handler); - NetInfo.removeEventListener(eventName, listener); - _isConnectedSubscriptions.delete(handler); - }, - - fetch(): Promise { - return NetInfo.getConnectionInfo().then(_isConnected); - }, - }, - - isConnectionExpensive(): Promise { - return Platform.OS === 'android' - ? RCTNetInfo.isConnectionMetered() - : Promise.reject(new Error('Currently not supported on iOS')); - }, -}; - -module.exports = NetInfo; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTDataRequestHandler.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTDataRequestHandler.h deleted file mode 100644 index 9beaa7e0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTDataRequestHandler.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -/** - * This is the default RCTURLRequestHandler implementation for data URL requests. - */ -@interface RCTDataRequestHandler : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTDataRequestHandler.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTDataRequestHandler.m deleted file mode 100644 index 2a7c42c6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTDataRequestHandler.m +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTDataRequestHandler.h" - -@implementation RCTDataRequestHandler -{ - NSOperationQueue *_queue; -} - -RCT_EXPORT_MODULE() - -- (void)invalidate -{ - [_queue cancelAllOperations]; - _queue = nil; -} - -- (BOOL)canHandleRequest:(NSURLRequest *)request -{ - return [request.URL.scheme caseInsensitiveCompare:@"data"] == NSOrderedSame; -} - -- (NSOperation *)sendRequest:(NSURLRequest *)request - withDelegate:(id)delegate -{ - // Lazy setup - if (!_queue) { - _queue = [NSOperationQueue new]; - _queue.maxConcurrentOperationCount = 2; - } - - __weak __block NSBlockOperation *weakOp; - __block NSBlockOperation *op = [NSBlockOperation blockOperationWithBlock:^{ - - // Get mime type - NSRange firstSemicolon = [request.URL.resourceSpecifier rangeOfString:@";"]; - NSString *mimeType = firstSemicolon.length ? [request.URL.resourceSpecifier substringToIndex:firstSemicolon.location] : nil; - - // Send response - NSURLResponse *response = [[NSURLResponse alloc] initWithURL:request.URL - MIMEType:mimeType - expectedContentLength:-1 - textEncodingName:nil]; - - [delegate URLRequest:weakOp didReceiveResponse:response]; - - // Load data - NSError *error; - NSData *data = [NSData dataWithContentsOfURL:request.URL - options:NSDataReadingMappedIfSafe - error:&error]; - if (data) { - [delegate URLRequest:weakOp didReceiveData:data]; - } - [delegate URLRequest:weakOp didCompleteWithError:error]; - }]; - - weakOp = op; - [_queue addOperation:op]; - return op; -} - -- (void)cancelRequest:(NSOperation *)op -{ - [op cancel]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTFileRequestHandler.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTFileRequestHandler.h deleted file mode 100644 index 843d0b12..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTFileRequestHandler.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -/** - * This is the default RCTURLRequestHandler implementation for file requests. - */ -@interface RCTFileRequestHandler : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTFileRequestHandler.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTFileRequestHandler.m deleted file mode 100644 index 00041a78..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTFileRequestHandler.m +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTFileRequestHandler.h" - -#import - -#import - -@implementation RCTFileRequestHandler -{ - NSOperationQueue *_fileQueue; -} - -RCT_EXPORT_MODULE() - -- (void)invalidate -{ - [_fileQueue cancelAllOperations]; - _fileQueue = nil; -} - -- (BOOL)canHandleRequest:(NSURLRequest *)request -{ - return - [request.URL.scheme caseInsensitiveCompare:@"file"] == NSOrderedSame - && !RCTIsBundleAssetURL(request.URL); -} - -- (NSOperation *)sendRequest:(NSURLRequest *)request - withDelegate:(id)delegate -{ - // Lazy setup - if (!_fileQueue) { - _fileQueue = [NSOperationQueue new]; - _fileQueue.maxConcurrentOperationCount = 4; - } - - __weak __block NSBlockOperation *weakOp; - __block NSBlockOperation *op = [NSBlockOperation blockOperationWithBlock:^{ - - // Get content length - NSError *error = nil; - NSFileManager *fileManager = [NSFileManager new]; - NSDictionary *fileAttributes = [fileManager attributesOfItemAtPath:request.URL.path error:&error]; - if (!fileAttributes) { - [delegate URLRequest:weakOp didCompleteWithError:error]; - return; - } - - // Get mime type - NSString *fileExtension = [request.URL pathExtension]; - NSString *UTI = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag( - kUTTagClassFilenameExtension, (__bridge CFStringRef)fileExtension, NULL); - NSString *contentType = (__bridge_transfer NSString *)UTTypeCopyPreferredTagWithClass( - (__bridge CFStringRef)UTI, kUTTagClassMIMEType); - - // Send response - NSURLResponse *response = [[NSURLResponse alloc] initWithURL:request.URL - MIMEType:contentType - expectedContentLength:[fileAttributes[NSFileSize] ?: @-1 integerValue] - textEncodingName:nil]; - - [delegate URLRequest:weakOp didReceiveResponse:response]; - - // Load data - NSData *data = [NSData dataWithContentsOfURL:request.URL - options:NSDataReadingMappedIfSafe - error:&error]; - if (data) { - [delegate URLRequest:weakOp didReceiveData:data]; - } - [delegate URLRequest:weakOp didCompleteWithError:error]; - }]; - - weakOp = op; - [_fileQueue addOperation:op]; - return op; -} - -- (void)cancelRequest:(NSOperation *)op -{ - [op cancel]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTHTTPRequestHandler.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTHTTPRequestHandler.h deleted file mode 100644 index 74d5fbd7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTHTTPRequestHandler.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -/** - * This is the default RCTURLRequestHandler implementation for HTTP requests. - */ -@interface RCTHTTPRequestHandler : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTHTTPRequestHandler.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTHTTPRequestHandler.mm deleted file mode 100644 index 2ddbb8a5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTHTTPRequestHandler.mm +++ /dev/null @@ -1,168 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTHTTPRequestHandler.h" - -#import - -#import "RCTNetworking.h" - -@interface RCTHTTPRequestHandler () - -@end - -@implementation RCTHTTPRequestHandler -{ - NSMapTable *_delegates; - NSURLSession *_session; - std::mutex _mutex; -} - -@synthesize bridge = _bridge; -@synthesize methodQueue = _methodQueue; - -RCT_EXPORT_MODULE() - -- (void)invalidate -{ - dispatch_async(self->_methodQueue, ^{ - [self->_session invalidateAndCancel]; - self->_session = nil; - }); -} - -- (BOOL)isValid -{ - // if session == nil and delegates != nil, we've been invalidated - return _session || !_delegates; -} - -#pragma mark - NSURLRequestHandler - -- (BOOL)canHandleRequest:(NSURLRequest *)request -{ - static NSSet *schemes = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - // technically, RCTHTTPRequestHandler can handle file:// as well, - // but it's less efficient than using RCTFileRequestHandler - schemes = [[NSSet alloc] initWithObjects:@"http", @"https", nil]; - }); - return [schemes containsObject:request.URL.scheme.lowercaseString]; -} - -- (NSURLSessionDataTask *)sendRequest:(NSURLRequest *)request - withDelegate:(id)delegate -{ - // Lazy setup - if (!_session && [self isValid]) { - NSOperationQueue *callbackQueue = [NSOperationQueue new]; - callbackQueue.maxConcurrentOperationCount = 1; - callbackQueue.underlyingQueue = [[_bridge networking] methodQueue]; - NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; - [configuration setHTTPShouldSetCookies:YES]; - [configuration setHTTPCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; - [configuration setHTTPCookieStorage:[NSHTTPCookieStorage sharedHTTPCookieStorage]]; - _session = [NSURLSession sessionWithConfiguration:configuration - delegate:self - delegateQueue:callbackQueue]; - - std::lock_guard lock(_mutex); - _delegates = [[NSMapTable alloc] initWithKeyOptions:NSPointerFunctionsStrongMemory - valueOptions:NSPointerFunctionsStrongMemory - capacity:0]; - } - __block NSURLSessionDataTask *task = nil; - dispatch_sync(self->_methodQueue, ^{ - task = [self->_session dataTaskWithRequest:request]; - }); - { - std::lock_guard lock(_mutex); - [_delegates setObject:delegate forKey:task]; - } - [task resume]; - return task; -} - -- (void)cancelRequest:(NSURLSessionDataTask *)task -{ - { - std::lock_guard lock(_mutex); - [_delegates removeObjectForKey:task]; - } - [task cancel]; -} - -#pragma mark - NSURLSession delegate - -- (void)URLSession:(NSURLSession *)session - task:(NSURLSessionTask *)task - didSendBodyData:(int64_t)bytesSent - totalBytesSent:(int64_t)totalBytesSent -totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend -{ - id delegate; - { - std::lock_guard lock(_mutex); - delegate = [_delegates objectForKey:task]; - } - [delegate URLRequest:task didSendDataWithProgress:totalBytesSent]; -} - -- (void)URLSession:(NSURLSession *)session - task:(NSURLSessionTask *)task -willPerformHTTPRedirection:(NSHTTPURLResponse *)response - newRequest:(NSURLRequest *)request - completionHandler:(void (^)(NSURLRequest *))completionHandler -{ - // Reset the cookies on redirect. - // This is necessary because we're not letting iOS handle cookies by itself - NSMutableURLRequest *nextRequest = [request mutableCopy]; - - NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:request.URL]; - nextRequest.allHTTPHeaderFields = [NSHTTPCookie requestHeaderFieldsWithCookies:cookies]; - completionHandler(nextRequest); -} - -- (void)URLSession:(NSURLSession *)session - dataTask:(NSURLSessionDataTask *)task -didReceiveResponse:(NSURLResponse *)response - completionHandler:(void (^)(NSURLSessionResponseDisposition))completionHandler -{ - id delegate; - { - std::lock_guard lock(_mutex); - delegate = [_delegates objectForKey:task]; - } - [delegate URLRequest:task didReceiveResponse:response]; - completionHandler(NSURLSessionResponseAllow); -} - -- (void)URLSession:(NSURLSession *)session - dataTask:(NSURLSessionDataTask *)task - didReceiveData:(NSData *)data -{ - id delegate; - { - std::lock_guard lock(_mutex); - delegate = [_delegates objectForKey:task]; - } - [delegate URLRequest:task didReceiveData:data]; -} - -- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error -{ - id delegate; - { - std::lock_guard lock(_mutex); - delegate = [_delegates objectForKey:task]; - [_delegates removeObjectForKey:task]; - } - [delegate URLRequest:task didCompleteWithError:error]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetInfo.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetInfo.h deleted file mode 100644 index 71a04eeb..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetInfo.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTNetInfo : RCTEventEmitter - -- (instancetype)initWithHost:(NSString *)host; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetInfo.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetInfo.m deleted file mode 100644 index f9441f16..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetInfo.m +++ /dev/null @@ -1,211 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTNetInfo.h" - -#if !TARGET_OS_TV - #import -#endif -#import -#import -#import - -// Based on the ConnectionType enum described in the W3C Network Information API spec -// (https://wicg.github.io/netinfo/). -static NSString *const RCTConnectionTypeUnknown = @"unknown"; -static NSString *const RCTConnectionTypeNone = @"none"; -static NSString *const RCTConnectionTypeWifi = @"wifi"; -static NSString *const RCTConnectionTypeCellular = @"cellular"; - -// Based on the EffectiveConnectionType enum described in the W3C Network Information API spec -// (https://wicg.github.io/netinfo/). -static NSString *const RCTEffectiveConnectionTypeUnknown = @"unknown"; -static NSString *const RCTEffectiveConnectionType2g = @"2g"; -static NSString *const RCTEffectiveConnectionType3g = @"3g"; -static NSString *const RCTEffectiveConnectionType4g = @"4g"; - -// The RCTReachabilityState* values are deprecated. -static NSString *const RCTReachabilityStateUnknown = @"unknown"; -static NSString *const RCTReachabilityStateNone = @"none"; -static NSString *const RCTReachabilityStateWifi = @"wifi"; -static NSString *const RCTReachabilityStateCell = @"cell"; - -@implementation RCTNetInfo -{ - SCNetworkReachabilityRef _firstTimeReachability; - SCNetworkReachabilityRef _reachability; - NSString *_connectionType; - NSString *_effectiveConnectionType; - NSString *_statusDeprecated; - NSString *_host; - BOOL _isObserving; - RCTPromiseResolveBlock _resolve; -} - -RCT_EXPORT_MODULE() - -static void RCTReachabilityCallback(__unused SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info) -{ - 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": connectionType, - @"effectiveConnectionType": effectiveConnectionType, - @"network_info": networkInfo}); - self->_firstTimeReachability = nil; - self->_resolve = nil; - } - - if (didSetReachabilityFlags && self->_isObserving) { - [self sendEventWithName:@"networkStatusDidChange" body:@{@"connectionType": connectionType, - @"effectiveConnectionType": effectiveConnectionType, - @"network_info": networkInfo}]; - } -} - -// We need RCTReachabilityCallback's and module methods to be called on the same thread so that we can have -// guarantees about when we mess with the reachability callbacks. -- (dispatch_queue_t)methodQueue -{ - return dispatch_get_main_queue(); -} - -#pragma mark - Lifecycle - -- (instancetype)initWithHost:(NSString *)host -{ - RCTAssertParam(host); - RCTAssert(![host hasPrefix:@"http"], @"Host value should just contain the domain, not the URL scheme."); - - if ((self = [self init])) { - _host = [host copy]; - } - return self; -} - -- (NSArray *)supportedEvents -{ - return @[@"networkStatusDidChange"]; -} - -- (void)startObserving -{ - _isObserving = YES; - _connectionType = RCTConnectionTypeUnknown; - _effectiveConnectionType = RCTEffectiveConnectionTypeUnknown; - _statusDeprecated = RCTReachabilityStateUnknown; - _reachability = [self getReachabilityRef]; -} - -- (void)stopObserving -{ - _isObserving = NO; - if (_reachability) { - SCNetworkReachabilityUnscheduleFromRunLoop(_reachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); - CFRelease(_reachability); - } -} - -- (void)dealloc -{ - if (_firstTimeReachability) { - SCNetworkReachabilityUnscheduleFromRunLoop(self->_firstTimeReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); - CFRelease(self->_firstTimeReachability); - _firstTimeReachability = nil; - _resolve = nil; - } -} - -- (SCNetworkReachabilityRef)getReachabilityRef -{ - SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, _host.UTF8String ?: "apple.com"); - SCNetworkReachabilityContext context = { 0, ( __bridge void *)self, NULL, NULL, NULL }; - SCNetworkReachabilitySetCallback(reachability, RCTReachabilityCallback, &context); - SCNetworkReachabilityScheduleWithRunLoop(reachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); - - return reachability; -} - -- (BOOL)setReachabilityStatus:(SCNetworkReachabilityFlags)flags -{ - NSString *connectionType = RCTConnectionTypeUnknown; - NSString *effectiveConnectionType = RCTEffectiveConnectionTypeUnknown; - NSString *status = RCTReachabilityStateUnknown; - if ((flags & kSCNetworkReachabilityFlagsReachable) == 0 || - (flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0) { - connectionType = RCTConnectionTypeNone; - status = RCTReachabilityStateNone; - } - -#if !TARGET_OS_TV - - else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) { - connectionType = RCTConnectionTypeCellular; - status = RCTReachabilityStateCell; - - CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init]; - if (netinfo) { - if ([netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyGPRS] || - [netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyEdge] || - [netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMA1x]) { - effectiveConnectionType = RCTEffectiveConnectionType2g; - } else if ([netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyWCDMA] || - [netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyHSDPA] || - [netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyHSUPA] || - [netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORev0] || - [netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORevA] || - [netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORevB] || - [netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyeHRPD]) { - effectiveConnectionType = RCTEffectiveConnectionType3g; - } else if ([netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyLTE]) { - effectiveConnectionType = RCTEffectiveConnectionType4g; - } - } - } - -#endif - - else { - connectionType = RCTConnectionTypeWifi; - status = RCTReachabilityStateWifi; - } - - if (![connectionType isEqualToString:self->_connectionType] || - ![effectiveConnectionType isEqualToString:self->_effectiveConnectionType] || - ![status isEqualToString:self->_statusDeprecated]) { - self->_connectionType = connectionType; - self->_effectiveConnectionType = effectiveConnectionType; - self->_statusDeprecated = status; - return YES; - } - - return NO; -} - -#pragma mark - Public API - -RCT_EXPORT_METHOD(getCurrentConnectivity:(RCTPromiseResolveBlock)resolve - reject:(__unused RCTPromiseRejectBlock)reject) -{ - if (_firstTimeReachability) { - SCNetworkReachabilityUnscheduleFromRunLoop(self->_firstTimeReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); - CFRelease(self->_firstTimeReachability); - _firstTimeReachability = nil; - _resolve = nil; - } - _firstTimeReachability = [self getReachabilityRef]; - _resolve = resolve; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetwork.xcodeproj/project.pbxproj b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetwork.xcodeproj/project.pbxproj deleted file mode 100644 index 20cf3cf1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetwork.xcodeproj/project.pbxproj +++ /dev/null @@ -1,371 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 134E969A1BCEB7F800AFFDA1 /* RCTDataRequestHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 134E96991BCEB7F800AFFDA1 /* RCTDataRequestHandler.m */; }; - 1372B7371AB03E7B00659ED6 /* RCTNetInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 1372B7361AB03E7B00659ED6 /* RCTNetInfo.m */; }; - 13D6D66A1B5FCF8200883BE9 /* RCTNetworkTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D6D6691B5FCF8200883BE9 /* RCTNetworkTask.m */; }; - 13EF800E1BCBE015003F47DD /* RCTFileRequestHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 13EF800D1BCBE015003F47DD /* RCTFileRequestHandler.m */; }; - 2D3B5F261D9B0EAB00451313 /* RCTNetworkTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D6D6691B5FCF8200883BE9 /* RCTNetworkTask.m */; }; - 2D3B5F271D9B0EB400451313 /* RCTHTTPRequestHandler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 352DA0B81B17855800AA15A8 /* RCTHTTPRequestHandler.mm */; }; - 2D3B5F281D9B0EB400451313 /* RCTFileRequestHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 13EF800D1BCBE015003F47DD /* RCTFileRequestHandler.m */; }; - 2D3B5F291D9B0EB400451313 /* RCTDataRequestHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 134E96991BCEB7F800AFFDA1 /* RCTDataRequestHandler.m */; }; - 2D3B5F2A1D9B0EB400451313 /* RCTNetInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 1372B7361AB03E7B00659ED6 /* RCTNetInfo.m */; }; - 2D3B5F2B1D9B0EB400451313 /* RCTNetworking.mm in Sources */ = {isa = PBXBuildFile; fileRef = 58B512071A9E6CE300147676 /* RCTNetworking.mm */; }; - 352DA0BA1B17855800AA15A8 /* RCTHTTPRequestHandler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 352DA0B81B17855800AA15A8 /* RCTHTTPRequestHandler.mm */; }; - 58B512081A9E6CE300147676 /* RCTNetworking.mm in Sources */ = {isa = PBXBuildFile; fileRef = 58B512071A9E6CE300147676 /* RCTNetworking.mm */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 134E96981BCEB7F800AFFDA1 /* RCTDataRequestHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDataRequestHandler.h; sourceTree = ""; }; - 134E96991BCEB7F800AFFDA1 /* RCTDataRequestHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDataRequestHandler.m; sourceTree = ""; }; - 1372B7351AB03E7B00659ED6 /* RCTNetInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTNetInfo.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 1372B7361AB03E7B00659ED6 /* RCTNetInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = RCTNetInfo.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - 13D6D6681B5FCF8200883BE9 /* RCTNetworkTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTNetworkTask.h; sourceTree = ""; }; - 13D6D6691B5FCF8200883BE9 /* RCTNetworkTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTNetworkTask.m; sourceTree = ""; }; - 13EF800C1BCBE015003F47DD /* RCTFileRequestHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTFileRequestHandler.h; sourceTree = ""; }; - 13EF800D1BCBE015003F47DD /* RCTFileRequestHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTFileRequestHandler.m; sourceTree = ""; }; - 2D2A28541D9B044C00D4039D /* libRCTNetwork-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTNetwork-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 352DA0B71B17855800AA15A8 /* RCTHTTPRequestHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTHTTPRequestHandler.h; sourceTree = ""; }; - 352DA0B81B17855800AA15A8 /* RCTHTTPRequestHandler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTHTTPRequestHandler.mm; sourceTree = ""; }; - 3D5FA63F1DE4B4790058FD77 /* RCTNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTNetworking.h; sourceTree = ""; }; - 58B511DB1A9E6C8500147676 /* libRCTNetwork.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTNetwork.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 58B512071A9E6CE300147676 /* RCTNetworking.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTNetworking.mm; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - 13D6D6681B5FCF8200883BE9 /* RCTNetworkTask.h */, - 13D6D6691B5FCF8200883BE9 /* RCTNetworkTask.m */, - 352DA0B71B17855800AA15A8 /* RCTHTTPRequestHandler.h */, - 352DA0B81B17855800AA15A8 /* RCTHTTPRequestHandler.mm */, - 13EF800C1BCBE015003F47DD /* RCTFileRequestHandler.h */, - 13EF800D1BCBE015003F47DD /* RCTFileRequestHandler.m */, - 134E96981BCEB7F800AFFDA1 /* RCTDataRequestHandler.h */, - 134E96991BCEB7F800AFFDA1 /* RCTDataRequestHandler.m */, - 1372B7351AB03E7B00659ED6 /* RCTNetInfo.h */, - 1372B7361AB03E7B00659ED6 /* RCTNetInfo.m */, - 3D5FA63F1DE4B4790058FD77 /* RCTNetworking.h */, - 58B512071A9E6CE300147676 /* RCTNetworking.mm */, - 58B511DC1A9E6C8500147676 /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 58B511DC1A9E6C8500147676 /* Products */ = { - isa = PBXGroup; - children = ( - 58B511DB1A9E6C8500147676 /* libRCTNetwork.a */, - 2D2A28541D9B044C00D4039D /* libRCTNetwork-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 2D2A28531D9B044C00D4039D /* RCTNetwork-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D2A285C1D9B044C00D4039D /* Build configuration list for PBXNativeTarget "RCTNetwork-tvOS" */; - buildPhases = ( - 2D2A28501D9B044C00D4039D /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTNetwork-tvOS"; - productName = "RCTNetwork-tvOS"; - productReference = 2D2A28541D9B044C00D4039D /* libRCTNetwork-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 58B511DA1A9E6C8500147676 /* RCTNetwork */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTNetwork" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTNetwork; - productName = RCTDataManager; - productReference = 58B511DB1A9E6C8500147676 /* libRCTNetwork.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 2D2A28531D9B044C00D4039D = { - CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Automatic; - }; - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTNetwork" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511DC1A9E6C8500147676 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B511DA1A9E6C8500147676 /* RCTNetwork */, - 2D2A28531D9B044C00D4039D /* RCTNetwork-tvOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 2D2A28501D9B044C00D4039D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D3B5F2A1D9B0EB400451313 /* RCTNetInfo.m in Sources */, - 2D3B5F261D9B0EAB00451313 /* RCTNetworkTask.m in Sources */, - 2D3B5F281D9B0EB400451313 /* RCTFileRequestHandler.m in Sources */, - 2D3B5F271D9B0EB400451313 /* RCTHTTPRequestHandler.mm in Sources */, - 2D3B5F2B1D9B0EB400451313 /* RCTNetworking.mm in Sources */, - 2D3B5F291D9B0EB400451313 /* RCTDataRequestHandler.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13D6D66A1B5FCF8200883BE9 /* RCTNetworkTask.m in Sources */, - 13EF800E1BCBE015003F47DD /* RCTFileRequestHandler.m in Sources */, - 134E969A1BCEB7F800AFFDA1 /* RCTDataRequestHandler.m in Sources */, - 1372B7371AB03E7B00659ED6 /* RCTNetInfo.m in Sources */, - 58B512081A9E6CE300147676 /* RCTNetworking.mm in Sources */, - 352DA0BA1B17855800AA15A8 /* RCTHTTPRequestHandler.mm in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 2D2A285A1D9B044C00D4039D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 2D2A285B1D9B044C00D4039D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTNetwork; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTNetwork; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2D2A285C1D9B044C00D4039D /* Build configuration list for PBXNativeTarget "RCTNetwork-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D2A285A1D9B044C00D4039D /* Debug */, - 2D2A285B1D9B044C00D4039D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTNetwork" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTNetwork" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetworkTask.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetworkTask.h deleted file mode 100644 index 430d5d01..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetworkTask.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -typedef void (^RCTURLRequestCompletionBlock)(NSURLResponse *response, NSData *data, NSError *error); -typedef void (^RCTURLRequestCancellationBlock)(void); -typedef void (^RCTURLRequestIncrementalDataBlock)(NSData *data, int64_t progress, int64_t total); -typedef void (^RCTURLRequestProgressBlock)(int64_t progress, int64_t total); -typedef void (^RCTURLRequestResponseBlock)(NSURLResponse *response); - -typedef NS_ENUM(NSInteger, RCTNetworkTaskStatus) { - RCTNetworkTaskPending = 0, - RCTNetworkTaskInProgress, - RCTNetworkTaskFinished, -}; - -@interface RCTNetworkTask : NSObject - -@property (nonatomic, readonly) NSURLRequest *request; -@property (nonatomic, readonly) NSNumber *requestID; -@property (nonatomic, readonly, weak) id requestToken; -@property (nonatomic, readonly) NSURLResponse *response; - -@property (nonatomic, copy) RCTURLRequestCompletionBlock completionBlock; -@property (nonatomic, copy) RCTURLRequestProgressBlock downloadProgressBlock; -@property (nonatomic, copy) RCTURLRequestIncrementalDataBlock incrementalDataBlock; -@property (nonatomic, copy) RCTURLRequestResponseBlock responseBlock; -@property (nonatomic, copy) RCTURLRequestProgressBlock uploadProgressBlock; - -@property (nonatomic, readonly) RCTNetworkTaskStatus status; - -- (instancetype)initWithRequest:(NSURLRequest *)request - handler:(id)handler - callbackQueue:(dispatch_queue_t)callbackQueue NS_DESIGNATED_INITIALIZER; - -- (void)start; -- (void)cancel; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetworkTask.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetworkTask.m deleted file mode 100644 index 65be2871..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetworkTask.m +++ /dev/null @@ -1,200 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import -#import - -@implementation RCTNetworkTask -{ - NSMutableData *_data; - id _handler; - dispatch_queue_t _callbackQueue; - - RCTNetworkTask *_selfReference; -} - -- (instancetype)initWithRequest:(NSURLRequest *)request - handler:(id)handler - callbackQueue:(dispatch_queue_t)callbackQueue -{ - RCTAssertParam(request); - RCTAssertParam(handler); - RCTAssertParam(callbackQueue); - - static NSUInteger requestID = 0; - - if ((self = [super init])) { - _requestID = @(requestID++); - _request = request; - _handler = handler; - _callbackQueue = callbackQueue; - _status = RCTNetworkTaskPending; - - dispatch_queue_set_specific(callbackQueue, (__bridge void *)self, (__bridge void *)self, NULL); - } - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (void)invalidate -{ - _selfReference = nil; - _completionBlock = nil; - _downloadProgressBlock = nil; - _incrementalDataBlock = nil; - _responseBlock = nil; - _uploadProgressBlock = nil; - _requestToken = nil; -} - -- (void)dispatchCallback:(dispatch_block_t)callback -{ - if (dispatch_get_specific((__bridge void *)self) == (__bridge void *)self) { - callback(); - } else { - dispatch_async(_callbackQueue, callback); - } -} - -- (void)start -{ - if (_status != RCTNetworkTaskPending) { - RCTLogError(@"RCTNetworkTask was already started or completed"); - return; - } - - if (_requestToken == nil) { - id token = [_handler sendRequest:_request withDelegate:self]; - if ([self validateRequestToken:token]) { - _selfReference = self; - _status = RCTNetworkTaskInProgress; - } - } -} - -- (void)cancel -{ - if (_status == RCTNetworkTaskFinished) { - return; - } - - _status = RCTNetworkTaskFinished; - id token = _requestToken; - if (token && [_handler respondsToSelector:@selector(cancelRequest:)]) { - [_handler cancelRequest:token]; - } - [self invalidate]; -} - -- (BOOL)validateRequestToken:(id)requestToken -{ - BOOL valid = YES; - if (_requestToken == nil) { - if (requestToken == nil) { - if (RCT_DEBUG) { - RCTLogError(@"Missing request token for request: %@", _request); - } - valid = NO; - } - _requestToken = requestToken; - } else if (![requestToken isEqual:_requestToken]) { - if (RCT_DEBUG) { - RCTLogError(@"Unrecognized request token: %@ expected: %@", requestToken, _requestToken); - } - valid = NO; - } - - if (!valid) { - _status = RCTNetworkTaskFinished; - if (_completionBlock) { - RCTURLRequestCompletionBlock completionBlock = _completionBlock; - [self dispatchCallback:^{ - completionBlock(self->_response, nil, RCTErrorWithMessage(@"Invalid request token.")); - }]; - } - [self invalidate]; - } - return valid; -} - -- (void)URLRequest:(id)requestToken didSendDataWithProgress:(int64_t)bytesSent -{ - if (![self validateRequestToken:requestToken]) { - return; - } - - if (_uploadProgressBlock) { - RCTURLRequestProgressBlock uploadProgressBlock = _uploadProgressBlock; - int64_t length = _request.HTTPBody.length; - [self dispatchCallback:^{ - uploadProgressBlock(bytesSent, length); - }]; - } -} - -- (void)URLRequest:(id)requestToken didReceiveResponse:(NSURLResponse *)response -{ - if (![self validateRequestToken:requestToken]) { - return; - } - - _response = response; - if (_responseBlock) { - RCTURLRequestResponseBlock responseBlock = _responseBlock; - [self dispatchCallback:^{ - responseBlock(response); - }]; - } -} - -- (void)URLRequest:(id)requestToken didReceiveData:(NSData *)data -{ - if (![self validateRequestToken:requestToken]) { - return; - } - - if (!_data) { - _data = [NSMutableData new]; - } - [_data appendData:data]; - - int64_t length = _data.length; - int64_t total = _response.expectedContentLength; - - if (_incrementalDataBlock) { - RCTURLRequestIncrementalDataBlock incrementalDataBlock = _incrementalDataBlock; - [self dispatchCallback:^{ - incrementalDataBlock(data, length, total); - }]; - } - if (_downloadProgressBlock && total > 0) { - RCTURLRequestProgressBlock downloadProgressBlock = _downloadProgressBlock; - [self dispatchCallback:^{ - downloadProgressBlock(length, total); - }]; - } -} - -- (void)URLRequest:(id)requestToken didCompleteWithError:(NSError *)error -{ - if (![self validateRequestToken:requestToken]) { - return; - } - - _status = RCTNetworkTaskFinished; - if (_completionBlock) { - RCTURLRequestCompletionBlock completionBlock = _completionBlock; - [self dispatchCallback:^{ - completionBlock(self->_response, self->_data, error); - }]; - } - [self invalidate]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetworking.android.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetworking.android.js deleted file mode 100644 index f58e00d5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetworking.android.js +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -// Do not require the native RCTNetworking module directly! Use this wrapper module instead. -// It will add the necessary requestId, so that you don't have to generate it yourself. -const MissingNativeEventEmitterShim = require('MissingNativeEventEmitterShim'); -const NativeEventEmitter = require('NativeEventEmitter'); -const RCTNetworkingNative = require('NativeModules').Networking; -const convertRequestBody = require('convertRequestBody'); - -import type {RequestBody} from 'convertRequestBody'; - -type Header = [string, string]; - -// Convert FormData headers to arrays, which are easier to consume in -// native on Android. -function convertHeadersMapToArray(headers: Object): Array
{ - const headerArray = []; - for (const name in headers) { - headerArray.push([name, headers[name]]); - } - return headerArray; -} - -let _requestId = 1; -function generateRequestId(): number { - return _requestId++; -} - -/** - * This class is a wrapper around the native RCTNetworking module. It adds a necessary unique - * requestId to each network request that can be used to abort that request later on. - */ -class RCTNetworking extends NativeEventEmitter { - isAvailable: boolean = true; - - constructor() { - super(RCTNetworkingNative); - } - - sendRequest( - method: string, - trackingName: string, - url: string, - headers: Object, - data: RequestBody, - responseType: 'text' | 'base64', - incrementalUpdates: boolean, - timeout: number, - callback: (requestId: number) => any, - withCredentials: boolean, - ) { - const body = convertRequestBody(data); - if (body && body.formData) { - body.formData = body.formData.map(part => ({ - ...part, - headers: convertHeadersMapToArray(part.headers), - })); - } - const requestId = generateRequestId(); - RCTNetworkingNative.sendRequest( - method, - url, - requestId, - convertHeadersMapToArray(headers), - {...body, trackingName}, - responseType, - incrementalUpdates, - timeout, - withCredentials, - ); - callback(requestId); - } - - abortRequest(requestId: number) { - RCTNetworkingNative.abortRequest(requestId); - } - - clearCookies(callback: (result: boolean) => any) { - RCTNetworkingNative.clearCookies(callback); - } -} - -if (__DEV__ && !RCTNetworkingNative) { - class MissingNativeRCTNetworkingShim extends MissingNativeEventEmitterShim { - constructor() { - super('RCTNetworking', 'Networking'); - } - - sendRequest(...args: Array) { - this.throwMissingNativeModule(); - } - - abortRequest(...args: Array) { - this.throwMissingNativeModule(); - } - - clearCookies(...args: Array) { - this.throwMissingNativeModule(); - } - } - - // This module depends on the native `RCTNetworkingNative` module. If you don't include it, - // `RCTNetworking.isAvailable` will return `false`, and any method calls will throw. - // We reassign the class variable to keep the autodoc generator happy. - RCTNetworking = new MissingNativeRCTNetworkingShim(); -} else { - RCTNetworking = new RCTNetworking(); -} - -module.exports = RCTNetworking; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetworking.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetworking.h deleted file mode 100644 index 1783d3af..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetworking.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -@protocol RCTNetworkingRequestHandler - -// @lint-ignore FBOBJCUNTYPEDCOLLECTION1 -- (BOOL)canHandleNetworkingRequest:(NSDictionary *)data; -// @lint-ignore FBOBJCUNTYPEDCOLLECTION1 -- (NSDictionary *)handleNetworkingRequest:(NSDictionary *)data; - -@end - -@protocol RCTNetworkingResponseHandler - -- (BOOL)canHandleNetworkingResponse:(NSString *)responseType; -- (id)handleNetworkingResponse:(NSURLResponse *)response data:(NSData *)data; - -@end - -@interface RCTNetworking : RCTEventEmitter - -/** - * Does a handler exist for the specified request? - */ -- (BOOL)canHandleRequest:(NSURLRequest *)request; - -/** - * Return an RCTNetworkTask for the specified request. This is useful for - * invoking the React Native networking stack from within native code. - */ -- (RCTNetworkTask *)networkTaskWithRequest:(NSURLRequest *)request - completionBlock:(RCTURLRequestCompletionBlock)completionBlock; - -- (void)addRequestHandler:(id)handler; - -- (void)addResponseHandler:(id)handler; - -- (void)removeRequestHandler:(id)handler; - -- (void)removeResponseHandler:(id)handler; - -@end - -@interface RCTBridge (RCTNetworking) - -@property (nonatomic, readonly) RCTNetworking *networking; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetworking.ios.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetworking.ios.js deleted file mode 100644 index b41e63cd..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetworking.ios.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const MissingNativeEventEmitterShim = require('MissingNativeEventEmitterShim'); -const NativeEventEmitter = require('NativeEventEmitter'); -const RCTNetworkingNative = require('NativeModules').Networking; -const convertRequestBody = require('convertRequestBody'); - -import type {RequestBody} from 'convertRequestBody'; - -import type {NativeResponseType} from './XMLHttpRequest'; - -class RCTNetworking extends NativeEventEmitter { - isAvailable: boolean = true; - - constructor() { - super(RCTNetworkingNative); - } - - sendRequest( - method: string, - trackingName: string, - url: string, - headers: Object, - data: RequestBody, - responseType: NativeResponseType, - incrementalUpdates: boolean, - timeout: number, - callback: (requestId: number) => any, - withCredentials: boolean, - ) { - const body = convertRequestBody(data); - RCTNetworkingNative.sendRequest( - { - method, - url, - data: {...body, trackingName}, - headers, - responseType, - incrementalUpdates, - timeout, - withCredentials, - }, - callback, - ); - } - - abortRequest(requestId: number) { - RCTNetworkingNative.abortRequest(requestId); - } - - clearCookies(callback: (result: boolean) => any) { - RCTNetworkingNative.clearCookies(callback); - } -} - -if (__DEV__ && !RCTNetworkingNative) { - class MissingNativeRCTNetworkingShim extends MissingNativeEventEmitterShim { - constructor() { - super('RCTNetworking', 'Networking'); - } - - sendRequest(...args: Array) { - this.throwMissingNativeModule(); - } - - abortRequest(...args: Array) { - this.throwMissingNativeModule(); - } - - clearCookies(...args: Array) { - this.throwMissingNativeModule(); - } - } - - // This module depends on the native `RCTNetworkingNative` module. If you don't include it, - // `RCTNetworking.isAvailable` will return `false`, and any method calls will throw. - // We reassign the class variable to keep the autodoc generator happy. - RCTNetworking = new MissingNativeRCTNetworkingShim(); -} else { - RCTNetworking = new RCTNetworking(); -} - -module.exports = RCTNetworking; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetworking.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetworking.mm deleted file mode 100644 index e153fbda..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/RCTNetworking.mm +++ /dev/null @@ -1,684 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - -#import - -#import -#import -#import -#import -#import -#import -#import -#import - -#import "RCTHTTPRequestHandler.h" - -typedef RCTURLRequestCancellationBlock (^RCTHTTPQueryResult)(NSError *error, NSDictionary *result); - -@interface RCTNetworking () - -- (RCTURLRequestCancellationBlock)processDataForHTTPQuery:(NSDictionary *)data - callback:(RCTHTTPQueryResult)callback; -@end - -/** - * Helper to convert FormData payloads into multipart/formdata requests. - */ -@interface RCTHTTPFormDataHelper : NSObject - -@property (nonatomic, weak) RCTNetworking *networker; - -@end - -@implementation RCTHTTPFormDataHelper -{ - NSMutableArray *> *_parts; - NSMutableData *_multipartBody; - RCTHTTPQueryResult _callback; - NSString *_boundary; -} - -static NSString *RCTGenerateFormBoundary() -{ - const size_t boundaryLength = 70; - const char *boundaryChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_."; - - char *bytes = (char*)malloc(boundaryLength); - if (!bytes) { - // CWE - 391 : Unchecked error condition - // https://www.cvedetails.com/cwe-details/391/Unchecked-Error-Condition.html - // https://eli.thegreenplace.net/2009/10/30/handling-out-of-memory-conditions-in-c - abort(); - } - size_t charCount = strlen(boundaryChars); - for (int i = 0; i < boundaryLength; i++) { - bytes[i] = boundaryChars[arc4random_uniform((u_int32_t)charCount)]; - } - return [[NSString alloc] initWithBytesNoCopy:bytes length:boundaryLength encoding:NSUTF8StringEncoding freeWhenDone:YES]; -} - -- (RCTURLRequestCancellationBlock)process:(NSArray *)formData - callback:(RCTHTTPQueryResult)callback -{ - RCTAssertThread(_networker.methodQueue, @"process: must be called on method queue"); - - if (formData.count == 0) { - return callback(nil, nil); - } - - _parts = [formData mutableCopy]; - _callback = callback; - _multipartBody = [NSMutableData new]; - _boundary = RCTGenerateFormBoundary(); - - return [_networker processDataForHTTPQuery:_parts[0] callback:^(NSError *error, NSDictionary *result) { - return [self handleResult:result error:error]; - }]; -} - -- (RCTURLRequestCancellationBlock)handleResult:(NSDictionary *)result - error:(NSError *)error -{ - RCTAssertThread(_networker.methodQueue, @"handleResult: must be called on method queue"); - - if (error) { - return _callback(error, nil); - } - - // Start with boundary. - [_multipartBody appendData:[[NSString stringWithFormat:@"--%@\r\n", _boundary] - dataUsingEncoding:NSUTF8StringEncoding]]; - - // Print headers. - NSMutableDictionary *headers = [_parts[0][@"headers"] mutableCopy]; - NSString *partContentType = result[@"contentType"]; - if (partContentType != nil) { - headers[@"content-type"] = partContentType; - } - [headers enumerateKeysAndObjectsUsingBlock:^(NSString *parameterKey, NSString *parameterValue, BOOL *stop) { - [self->_multipartBody appendData:[[NSString stringWithFormat:@"%@: %@\r\n", parameterKey, parameterValue] - dataUsingEncoding:NSUTF8StringEncoding]]; - }]; - - // Add the body. - [_multipartBody appendData:[@"\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; - [_multipartBody appendData:result[@"body"]]; - [_multipartBody appendData:[@"\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; - - [_parts removeObjectAtIndex:0]; - if (_parts.count) { - return [_networker processDataForHTTPQuery:_parts[0] callback:^(NSError *err, NSDictionary *res) { - return [self handleResult:res error:err]; - }]; - } - - // We've processed the last item. Finish and return. - [_multipartBody appendData:[[NSString stringWithFormat:@"--%@--\r\n", _boundary] - dataUsingEncoding:NSUTF8StringEncoding]]; - NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", _boundary]; - return _callback(nil, @{@"body": _multipartBody, @"contentType": contentType}); -} - -@end - -/** - * Bridge module that provides the JS interface to the network stack. - */ -@implementation RCTNetworking -{ - NSMutableDictionary *_tasksByRequestID; - std::mutex _handlersLock; - NSArray> *_handlers; - NSMutableArray> *_requestHandlers; - NSMutableArray> *_responseHandlers; -} - -@synthesize methodQueue = _methodQueue; - -RCT_EXPORT_MODULE() - -- (void)invalidate -{ - for (NSNumber *requestID in _tasksByRequestID) { - [_tasksByRequestID[requestID] cancel]; - } - [_tasksByRequestID removeAllObjects]; - _handlers = nil; - _requestHandlers = nil; - _responseHandlers = nil; -} - -- (NSArray *)supportedEvents -{ - return @[@"didCompleteNetworkResponse", - @"didReceiveNetworkResponse", - @"didSendNetworkData", - @"didReceiveNetworkIncrementalData", - @"didReceiveNetworkDataProgress", - @"didReceiveNetworkData"]; -} - -- (id)handlerForRequest:(NSURLRequest *)request -{ - if (!request.URL) { - return nil; - } - - { - std::lock_guard lock(_handlersLock); - - if (!_handlers) { - // Get handlers, sorted in reverse priority order (highest priority first) - _handlers = [[self.bridge modulesConformingToProtocol:@protocol(RCTURLRequestHandler)] sortedArrayUsingComparator:^NSComparisonResult(id a, id b) { - float priorityA = [a respondsToSelector:@selector(handlerPriority)] ? [a handlerPriority] : 0; - float priorityB = [b respondsToSelector:@selector(handlerPriority)] ? [b handlerPriority] : 0; - if (priorityA > priorityB) { - return NSOrderedAscending; - } else if (priorityA < priorityB) { - return NSOrderedDescending; - } else { - return NSOrderedSame; - } - }]; - } - } - - if (RCT_DEBUG) { - // Check for handler conflicts - float previousPriority = 0; - id previousHandler = nil; - for (id handler in _handlers) { - float priority = [handler respondsToSelector:@selector(handlerPriority)] ? [handler handlerPriority] : 0; - if (previousHandler && priority < previousPriority) { - return previousHandler; - } - if ([handler canHandleRequest:request]) { - if (previousHandler) { - if (priority == previousPriority) { - RCTLogError(@"The RCTURLRequestHandlers %@ and %@ both reported that" - " they can handle the request %@, and have equal priority" - " (%g). This could result in non-deterministic behavior.", - handler, previousHandler, request, priority); - } - } else { - previousHandler = handler; - previousPriority = priority; - } - } - } - return previousHandler; - } - - // Normal code path - for (id handler in _handlers) { - if ([handler canHandleRequest:request]) { - return handler; - } - } - return nil; -} - -- (NSDictionary *)stripNullsInRequestHeaders:(NSDictionary *)headers -{ - NSMutableDictionary *result = [NSMutableDictionary dictionaryWithCapacity:headers.count]; - for (NSString *key in headers.allKeys) { - id val = headers[key]; - if (val != [NSNull null]) { - result[key] = val; - } - } - - return result; -} - -- (RCTURLRequestCancellationBlock)buildRequest:(NSDictionary *)query - completionBlock:(void (^)(NSURLRequest *request))block -{ - RCTAssertThread(_methodQueue, @"buildRequest: must be called on method queue"); - - NSURL *URL = [RCTConvert NSURL:query[@"url"]]; // this is marked as nullable in JS, but should not be null - NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL]; - request.HTTPMethod = [RCTConvert NSString:RCTNilIfNull(query[@"method"])].uppercaseString ?: @"GET"; - - // Load and set the cookie header. - NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:URL]; - request.allHTTPHeaderFields = [NSHTTPCookie requestHeaderFieldsWithCookies:cookies]; - - // Set supplied headers. - NSDictionary *headers = [RCTConvert NSDictionary:query[@"headers"]]; - [headers enumerateKeysAndObjectsUsingBlock:^(NSString *key, id value, BOOL *stop) { - if (value) { - [request addValue:[RCTConvert NSString:value] forHTTPHeaderField:key]; - } - }]; - - request.timeoutInterval = [RCTConvert NSTimeInterval:query[@"timeout"]]; - request.HTTPShouldHandleCookies = [RCTConvert BOOL:query[@"withCredentials"]]; - NSDictionary *data = [RCTConvert NSDictionary:RCTNilIfNull(query[@"data"])]; - NSString *trackingName = data[@"trackingName"]; - if (trackingName) { - [NSURLProtocol setProperty:trackingName - forKey:@"trackingName" - inRequest:request]; - } - return [self processDataForHTTPQuery:data callback:^(NSError *error, NSDictionary *result) { - if (error) { - RCTLogError(@"Error processing request body: %@", error); - // Ideally we'd circle back to JS here and notify an error/abort on the request. - return (RCTURLRequestCancellationBlock)nil; - } - request.HTTPBody = result[@"body"]; - NSString *dataContentType = result[@"contentType"]; - NSString *requestContentType = [request valueForHTTPHeaderField:@"Content-Type"]; - BOOL isMultipart = [dataContentType hasPrefix:@"multipart"]; - - // For multipart requests we need to override caller-specified content type with one - // from the data object, because it contains the boundary string - if (dataContentType && ([requestContentType length] == 0 || isMultipart)) { - [request setValue:dataContentType forHTTPHeaderField:@"Content-Type"]; - } - - // Gzip the request body - if ([request.allHTTPHeaderFields[@"Content-Encoding"] isEqualToString:@"gzip"]) { - request.HTTPBody = RCTGzipData(request.HTTPBody, -1 /* default */); - [request setValue:(@(request.HTTPBody.length)).description forHTTPHeaderField:@"Content-Length"]; - } - - dispatch_async(self->_methodQueue, ^{ - block(request); - }); - - return (RCTURLRequestCancellationBlock)nil; - }]; -} - -- (BOOL)canHandleRequest:(NSURLRequest *)request -{ - return [self handlerForRequest:request] != nil; -} - -/** - * Process the 'data' part of an HTTP query. - * - * 'data' can be a JSON value of the following forms: - * - * - {"string": "..."}: a simple JS string that will be UTF-8 encoded and sent as the body - * - * - {"uri": "some-uri://..."}: reference to a system resource, e.g. an image in the asset library - * - * - {"formData": [...]}: list of data payloads that will be combined into a multipart/form-data request - * - * - {"blob": {...}}: an object representing a blob - * - * If successful, the callback be called with a result dictionary containing the following (optional) keys: - * - * - @"body" (NSData): the body of the request - * - * - @"contentType" (NSString): the content type header of the request - * - */ -- (RCTURLRequestCancellationBlock)processDataForHTTPQuery:(nullable NSDictionary *)query callback: -(RCTURLRequestCancellationBlock (^)(NSError *error, NSDictionary *result))callback -{ - RCTAssertThread(_methodQueue, @"processDataForHTTPQuery: must be called on method queue"); - - if (!query) { - return callback(nil, nil); - } - for (id handler in _requestHandlers) { - if ([handler canHandleNetworkingRequest:query]) { - // @lint-ignore FBOBJCUNTYPEDCOLLECTION1 - NSDictionary *body = [handler handleNetworkingRequest:query]; - if (body) { - return callback(nil, body); - } - } - } - NSData *body = [RCTConvert NSData:query[@"string"]]; - if (body) { - return callback(nil, @{@"body": body}); - } - NSString *base64String = [RCTConvert NSString:query[@"base64"]]; - if (base64String) { - NSData *data = [[NSData alloc] initWithBase64EncodedString:base64String options:0]; - return callback(nil, @{@"body": data}); - } - NSURLRequest *request = [RCTConvert NSURLRequest:query[@"uri"]]; - if (request) { - - __block RCTURLRequestCancellationBlock cancellationBlock = nil; - RCTNetworkTask *task = [self networkTaskWithRequest:request completionBlock:^(NSURLResponse *response, NSData *data, NSError *error) { - dispatch_async(self->_methodQueue, ^{ - cancellationBlock = callback(error, data ? @{@"body": data, @"contentType": RCTNullIfNil(response.MIMEType)} : nil); - }); - }]; - - [task start]; - - __weak RCTNetworkTask *weakTask = task; - return ^{ - [weakTask cancel]; - if (cancellationBlock) { - cancellationBlock(); - } - }; - } - NSArray *formData = [RCTConvert NSDictionaryArray:query[@"formData"]]; - if (formData) { - RCTHTTPFormDataHelper *formDataHelper = [RCTHTTPFormDataHelper new]; - formDataHelper.networker = self; - return [formDataHelper process:formData callback:callback]; - } - // Nothing in the data payload, at least nothing we could understand anyway. - // Ignore and treat it as if it were null. - return callback(nil, nil); -} - -+ (NSString *)decodeTextData:(NSData *)data fromResponse:(NSURLResponse *)response withCarryData:(NSMutableData *)inputCarryData -{ - NSStringEncoding encoding = NSUTF8StringEncoding; - if (response.textEncodingName) { - CFStringEncoding cfEncoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef)response.textEncodingName); - encoding = CFStringConvertEncodingToNSStringEncoding(cfEncoding); - } - - NSMutableData *currentCarryData = inputCarryData ?: [NSMutableData new]; - [currentCarryData appendData:data]; - - // Attempt to decode text - NSString *encodedResponse = [[NSString alloc] initWithData:currentCarryData encoding:encoding]; - - if (!encodedResponse && data.length > 0) { - if (encoding == NSUTF8StringEncoding && inputCarryData) { - // If decode failed, we attempt to trim broken character bytes from the data. - // At this time, only UTF-8 support is enabled. Multibyte encodings, such as UTF-16 and UTF-32, require a lot of additional work - // to determine wether BOM was included in the first data packet. If so, save it, and attach it to each new data packet. If not, - // an encoding has to be selected with a suitable byte order (for ARM iOS, it would be little endianness). - - CFStringEncoding cfEncoding = CFStringConvertNSStringEncodingToEncoding(encoding); - // Taking a single unichar is not good enough, due to Unicode combining character sequences or characters outside the BMP. - // See https://www.objc.io/issues/9-strings/unicode/#common-pitfalls - // We'll attempt with a sequence of two characters, the most common combining character sequence and characters outside the BMP (emojis). - CFIndex maxCharLength = CFStringGetMaximumSizeForEncoding(2, cfEncoding); - - NSUInteger removedBytes = 1; - - while (removedBytes < maxCharLength) { - encodedResponse = [[NSString alloc] initWithData:[currentCarryData subdataWithRange:NSMakeRange(0, currentCarryData.length - removedBytes)] - encoding:encoding]; - - if (encodedResponse != nil) { - break; - } - - removedBytes += 1; - } - } else { - // We don't have an encoding, or the encoding is incorrect, so now we try to guess - [NSString stringEncodingForData:data - encodingOptions:@{ NSStringEncodingDetectionSuggestedEncodingsKey: @[ @(encoding) ] } - convertedString:&encodedResponse - usedLossyConversion:NULL]; - } - } - - if (inputCarryData) { - NSUInteger encodedResponseLength = [encodedResponse dataUsingEncoding:encoding].length; - - // Ensure a valid subrange exists within currentCarryData - if (currentCarryData.length >= encodedResponseLength) { - NSData *newCarryData = [currentCarryData subdataWithRange:NSMakeRange(encodedResponseLength, currentCarryData.length - encodedResponseLength)]; - [inputCarryData setData:newCarryData]; - } else { - [inputCarryData setLength:0]; - } - } - - return encodedResponse; -} - -- (void)sendData:(NSData *)data - responseType:(NSString *)responseType - response:(NSURLResponse *)response - forTask:(RCTNetworkTask *)task -{ - RCTAssertThread(_methodQueue, @"sendData: must be called on method queue"); - - id responseData = nil; - for (id handler in _responseHandlers) { - if ([handler canHandleNetworkingResponse:responseType]) { - responseData = [handler handleNetworkingResponse:response data:data]; - break; - } - } - - if (!responseData) { - if (data.length == 0) { - return; - } - - if ([responseType isEqualToString:@"text"]) { - // No carry storage is required here because the entire data has been loaded. - responseData = [RCTNetworking decodeTextData:data fromResponse:task.response withCarryData:nil]; - if (!responseData) { - RCTLogWarn(@"Received data was not a string, or was not a recognised encoding."); - return; - } - } else if ([responseType isEqualToString:@"base64"]) { - responseData = [data base64EncodedStringWithOptions:0]; - } else { - RCTLogWarn(@"Invalid responseType: %@", responseType); - return; - } - } - - [self sendEventWithName:@"didReceiveNetworkData" body:@[task.requestID, responseData]]; -} - -- (void)sendRequest:(NSURLRequest *)request - responseType:(NSString *)responseType - incrementalUpdates:(BOOL)incrementalUpdates - responseSender:(RCTResponseSenderBlock)responseSender -{ - RCTAssertThread(_methodQueue, @"sendRequest: must be called on method queue"); - __weak __typeof(self) weakSelf = self; - __block RCTNetworkTask *task; - RCTURLRequestProgressBlock uploadProgressBlock = ^(int64_t progress, int64_t total) { - NSArray *responseJSON = @[task.requestID, @((double)progress), @((double)total)]; - [weakSelf sendEventWithName:@"didSendNetworkData" body:responseJSON]; - }; - - RCTURLRequestResponseBlock responseBlock = ^(NSURLResponse *response) { - NSDictionary *headers; - NSInteger status; - if ([response isKindOfClass:[NSHTTPURLResponse class]]) { // Might be a local file request - NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; - headers = httpResponse.allHeaderFields ?: @{}; - status = httpResponse.statusCode; - } else { - headers = response.MIMEType ? @{@"Content-Type": response.MIMEType} : @{}; - status = 200; - } - id responseURL = response.URL ? response.URL.absoluteString : [NSNull null]; - NSArray *responseJSON = @[task.requestID, @(status), headers, responseURL]; - [weakSelf sendEventWithName:@"didReceiveNetworkResponse" body:responseJSON]; - }; - - // XHR does not allow you to peek at xhr.response before the response is - // finished. Only when xhr.responseType is set to ''/'text', consumers may - // peek at xhr.responseText. So unless the requested responseType is 'text', - // we only send progress updates and not incremental data updates to JS here. - RCTURLRequestIncrementalDataBlock incrementalDataBlock = nil; - RCTURLRequestProgressBlock downloadProgressBlock = nil; - if (incrementalUpdates) { - if ([responseType isEqualToString:@"text"]) { - - // We need this to carry over bytes, which could not be decoded into text (such as broken UTF-8 characters). - // The incremental data block holds the ownership of this object, and will be released upon release of the block. - NSMutableData *incrementalDataCarry = [NSMutableData new]; - - incrementalDataBlock = ^(NSData *data, int64_t progress, int64_t total) { - NSUInteger initialCarryLength = incrementalDataCarry.length; - - NSString *responseString = [RCTNetworking decodeTextData:data - fromResponse:task.response - withCarryData:incrementalDataCarry]; - if (!responseString) { - RCTLogWarn(@"Received data was not a string, or was not a recognised encoding."); - return; - } - - // Update progress to include the previous carry length and reduce the current carry length. - NSArray *responseJSON = @[task.requestID, - responseString, - @(progress + initialCarryLength - incrementalDataCarry.length), - @(total)]; - - [weakSelf sendEventWithName:@"didReceiveNetworkIncrementalData" body:responseJSON]; - }; - } else { - downloadProgressBlock = ^(int64_t progress, int64_t total) { - NSArray *responseJSON = @[task.requestID, @(progress), @(total)]; - [weakSelf sendEventWithName:@"didReceiveNetworkDataProgress" body:responseJSON]; - }; - } - } - - RCTURLRequestCompletionBlock completionBlock = - ^(NSURLResponse *response, NSData *data, NSError *error) { - __typeof(self) strongSelf = weakSelf; - if (!strongSelf) { - return; - } - - // Unless we were sending incremental (text) chunks to JS, all along, now - // is the time to send the request body to JS. - if (!(incrementalUpdates && [responseType isEqualToString:@"text"])) { - [strongSelf sendData:data - responseType:responseType - response:response - forTask:task]; - } - NSArray *responseJSON = @[task.requestID, - RCTNullIfNil(error.localizedDescription), - error.code == kCFURLErrorTimedOut ? @YES : @NO - ]; - - [strongSelf sendEventWithName:@"didCompleteNetworkResponse" body:responseJSON]; - [strongSelf->_tasksByRequestID removeObjectForKey:task.requestID]; - }; - - task = [self networkTaskWithRequest:request completionBlock:completionBlock]; - task.downloadProgressBlock = downloadProgressBlock; - task.incrementalDataBlock = incrementalDataBlock; - task.responseBlock = responseBlock; - task.uploadProgressBlock = uploadProgressBlock; - - if (task.requestID) { - if (!_tasksByRequestID) { - _tasksByRequestID = [NSMutableDictionary new]; - } - _tasksByRequestID[task.requestID] = task; - responseSender(@[task.requestID]); - } - - [task start]; -} - -#pragma mark - Public API - -- (void)addRequestHandler:(id)handler -{ - if (!_requestHandlers) { - _requestHandlers = [NSMutableArray new]; - } - [_requestHandlers addObject:handler]; -} - -- (void)addResponseHandler:(id)handler -{ - if (!_responseHandlers) { - _responseHandlers = [NSMutableArray new]; - } - [_responseHandlers addObject:handler]; -} - -- (void)removeRequestHandler:(id)handler -{ - [_requestHandlers removeObject:handler]; -} - -- (void)removeResponseHandler:(id)handler -{ - [_responseHandlers removeObject:handler]; -} - -- (RCTNetworkTask *)networkTaskWithRequest:(NSURLRequest *)request completionBlock:(RCTURLRequestCompletionBlock)completionBlock -{ - id handler = [self handlerForRequest:request]; - if (!handler) { - RCTLogError(@"No suitable URL request handler found for %@", request.URL); - return nil; - } - - RCTNetworkTask *task = [[RCTNetworkTask alloc] initWithRequest:request - handler:handler - callbackQueue:_methodQueue]; - task.completionBlock = completionBlock; - return task; -} - -#pragma mark - JS API - -RCT_EXPORT_METHOD(sendRequest:(NSDictionary *)query - responseSender:(RCTResponseSenderBlock)responseSender) -{ - // TODO: buildRequest returns a cancellation block, but there's currently - // no way to invoke it, if, for example the request is cancelled while - // loading a large file to build the request body - [self buildRequest:query completionBlock:^(NSURLRequest *request) { - NSString *responseType = [RCTConvert NSString:query[@"responseType"]]; - BOOL incrementalUpdates = [RCTConvert BOOL:query[@"incrementalUpdates"]]; - [self sendRequest:request - responseType:responseType - incrementalUpdates:incrementalUpdates - responseSender:responseSender]; - }]; -} - -RCT_EXPORT_METHOD(abortRequest:(nonnull NSNumber *)requestID) -{ - [_tasksByRequestID[requestID] cancel]; - [_tasksByRequestID removeObjectForKey:requestID]; -} - -RCT_EXPORT_METHOD(clearCookies:(RCTResponseSenderBlock)responseSender) -{ - NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; - if (!storage.cookies.count) { - responseSender(@[@NO]); - return; - } - - for (NSHTTPCookie *cookie in storage.cookies) { - [storage deleteCookie:cookie]; - } - responseSender(@[@YES]); -} - -@end - -@implementation RCTBridge (RCTNetworking) - -- (RCTNetworking *)networking -{ - return [self moduleForClass:[RCTNetworking class]]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/XHRInterceptor.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/XHRInterceptor.js deleted file mode 100644 index f2ad1193..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/XHRInterceptor.js +++ /dev/null @@ -1,166 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const XMLHttpRequest = require('XMLHttpRequest'); -const originalXHROpen = XMLHttpRequest.prototype.open; -const originalXHRSend = XMLHttpRequest.prototype.send; -const originalXHRSetRequestHeader = XMLHttpRequest.prototype.setRequestHeader; - -let openCallback; -let sendCallback; -let requestHeaderCallback; -let headerReceivedCallback; -let responseCallback; - -let isInterceptorEnabled = false; - -/** - * A network interceptor which monkey-patches XMLHttpRequest methods - * to gather all network requests/responses, in order to show their - * information in the React Native inspector development tool. - * This supports interception with XMLHttpRequest API, including Fetch API - * and any other third party libraries that depend on XMLHttpRequest. - */ -const XHRInterceptor = { - /** - * Invoked before XMLHttpRequest.open(...) is called. - */ - setOpenCallback(callback) { - openCallback = callback; - }, - - /** - * Invoked before XMLHttpRequest.send(...) is called. - */ - setSendCallback(callback) { - sendCallback = callback; - }, - - /** - * Invoked after xhr's readyState becomes xhr.HEADERS_RECEIVED. - */ - setHeaderReceivedCallback(callback) { - headerReceivedCallback = callback; - }, - - /** - * Invoked after xhr's readyState becomes xhr.DONE. - */ - setResponseCallback(callback) { - responseCallback = callback; - }, - - /** - * Invoked before XMLHttpRequest.setRequestHeader(...) is called. - */ - setRequestHeaderCallback(callback) { - requestHeaderCallback = callback; - }, - - isInterceptorEnabled() { - return isInterceptorEnabled; - }, - - enableInterception() { - if (isInterceptorEnabled) { - return; - } - // Override `open` method for all XHR requests to intercept the request - // method and url, then pass them through the `openCallback`. - XMLHttpRequest.prototype.open = function(method, url) { - if (openCallback) { - openCallback(method, url, this); - } - originalXHROpen.apply(this, arguments); - }; - - // Override `setRequestHeader` method for all XHR requests to intercept - // the request headers, then pass them through the `requestHeaderCallback`. - XMLHttpRequest.prototype.setRequestHeader = function(header, value) { - if (requestHeaderCallback) { - requestHeaderCallback(header, value, this); - } - originalXHRSetRequestHeader.apply(this, arguments); - }; - - // Override `send` method of all XHR requests to intercept the data sent, - // register listeners to intercept the response, and invoke the callbacks. - XMLHttpRequest.prototype.send = function(data) { - if (sendCallback) { - sendCallback(data, this); - } - if (this.addEventListener) { - this.addEventListener( - 'readystatechange', - () => { - if (!isInterceptorEnabled) { - return; - } - if (this.readyState === this.HEADERS_RECEIVED) { - const contentTypeString = this.getResponseHeader('Content-Type'); - const contentLengthString = this.getResponseHeader( - 'Content-Length', - ); - let responseContentType, responseSize; - if (contentTypeString) { - responseContentType = contentTypeString.split(';')[0]; - } - if (contentLengthString) { - responseSize = parseInt(contentLengthString, 10); - } - if (headerReceivedCallback) { - headerReceivedCallback( - responseContentType, - responseSize, - this.getAllResponseHeaders(), - this, - ); - } - } - if (this.readyState === this.DONE) { - if (responseCallback) { - responseCallback( - this.status, - this.timeout, - this.response, - this.responseURL, - this.responseType, - this, - ); - } - } - }, - false, - ); - } - originalXHRSend.apply(this, arguments); - }; - isInterceptorEnabled = true; - }, - - // Unpatch XMLHttpRequest methods and remove the callbacks. - disableInterception() { - if (!isInterceptorEnabled) { - return; - } - isInterceptorEnabled = false; - XMLHttpRequest.prototype.send = originalXHRSend; - XMLHttpRequest.prototype.open = originalXHROpen; - XMLHttpRequest.prototype.setRequestHeader = originalXHRSetRequestHeader; - responseCallback = null; - openCallback = null; - sendCallback = null; - headerReceivedCallback = null; - requestHeaderCallback = null; - }, -}; - -module.exports = XHRInterceptor; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/XMLHttpRequest.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/XMLHttpRequest.js deleted file mode 100644 index 2b6059f8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/XMLHttpRequest.js +++ /dev/null @@ -1,602 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const EventTarget = require('event-target-shim'); -const RCTNetworking = require('RCTNetworking'); - -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ -const base64 = require('base64-js'); -const invariant = require('invariant'); -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ -const warning = require('fbjs/lib/warning'); -const BlobManager = require('BlobManager'); - -export type NativeResponseType = 'base64' | 'blob' | 'text'; -export type ResponseType = - | '' - | 'arraybuffer' - | 'blob' - | 'document' - | 'json' - | 'text'; -export type Response = ?Object | string; - -type XHRInterceptor = { - requestSent(id: number, url: string, method: string, headers: Object): void, - responseReceived( - id: number, - url: string, - status: number, - headers: Object, - ): void, - dataReceived(id: number, data: string): void, - loadingFinished(id: number, encodedDataLength: number): void, - loadingFailed(id: number, error: string): void, -}; - -// The native blob module is optional so inject it here if available. -if (BlobManager.isAvailable) { - BlobManager.addNetworkingHandler(); -} - -const UNSENT = 0; -const OPENED = 1; -const HEADERS_RECEIVED = 2; -const LOADING = 3; -const DONE = 4; - -const SUPPORTED_RESPONSE_TYPES = { - arraybuffer: typeof global.ArrayBuffer === 'function', - blob: typeof global.Blob === 'function', - document: false, - json: true, - text: true, - '': true, -}; - -const REQUEST_EVENTS = [ - 'abort', - 'error', - 'load', - 'loadstart', - 'progress', - 'timeout', - 'loadend', -]; - -const XHR_EVENTS = REQUEST_EVENTS.concat('readystatechange'); - -class XMLHttpRequestEventTarget extends EventTarget(...REQUEST_EVENTS) { - onload: ?Function; - onloadstart: ?Function; - onprogress: ?Function; - ontimeout: ?Function; - onerror: ?Function; - onabort: ?Function; - onloadend: ?Function; -} - -/** - * Shared base for platform-specific XMLHttpRequest implementations. - */ -class XMLHttpRequest extends EventTarget(...XHR_EVENTS) { - static UNSENT: number = UNSENT; - static OPENED: number = OPENED; - static HEADERS_RECEIVED: number = HEADERS_RECEIVED; - static LOADING: number = LOADING; - static DONE: number = DONE; - - static _interceptor: ?XHRInterceptor = null; - - UNSENT: number = UNSENT; - OPENED: number = OPENED; - HEADERS_RECEIVED: number = HEADERS_RECEIVED; - LOADING: number = LOADING; - DONE: number = DONE; - - // EventTarget automatically initializes these to `null`. - onload: ?Function; - onloadstart: ?Function; - onprogress: ?Function; - ontimeout: ?Function; - onerror: ?Function; - onabort: ?Function; - onloadend: ?Function; - onreadystatechange: ?Function; - - readyState: number = UNSENT; - responseHeaders: ?Object; - status: number = 0; - timeout: number = 0; - responseURL: ?string; - withCredentials: boolean = true; - - upload: XMLHttpRequestEventTarget = new XMLHttpRequestEventTarget(); - - _requestId: ?number; - _subscriptions: Array<*>; - - _aborted: boolean = false; - _cachedResponse: Response; - _hasError: boolean = false; - _headers: Object; - _lowerCaseResponseHeaders: Object; - _method: ?string = null; - _response: string | ?Object; - _responseType: ResponseType; - _response: string = ''; - _sent: boolean; - _url: ?string = null; - _timedOut: boolean = false; - _trackingName: string = 'unknown'; - _incrementalEvents: boolean = false; - - static setInterceptor(interceptor: ?XHRInterceptor) { - XMLHttpRequest._interceptor = interceptor; - } - - constructor() { - super(); - this._reset(); - } - - _reset(): void { - this.readyState = this.UNSENT; - this.responseHeaders = undefined; - this.status = 0; - delete this.responseURL; - - this._requestId = null; - - this._cachedResponse = undefined; - this._hasError = false; - this._headers = {}; - this._response = ''; - this._responseType = ''; - this._sent = false; - this._lowerCaseResponseHeaders = {}; - - this._clearSubscriptions(); - this._timedOut = false; - } - - get responseType(): ResponseType { - return this._responseType; - } - - set responseType(responseType: ResponseType): void { - if (this._sent) { - throw new Error( - "Failed to set the 'responseType' property on 'XMLHttpRequest': The " + - 'response type cannot be set after the request has been sent.', - ); - } - if (!SUPPORTED_RESPONSE_TYPES.hasOwnProperty(responseType)) { - warning( - false, - `The provided value '${responseType}' is not a valid 'responseType'.`, - ); - return; - } - - // redboxes early, e.g. for 'arraybuffer' on ios 7 - invariant( - SUPPORTED_RESPONSE_TYPES[responseType] || responseType === 'document', - `The provided value '${responseType}' is unsupported in this environment.`, - ); - - if (responseType === 'blob') { - invariant( - BlobManager.isAvailable, - 'Native module BlobModule is required for blob support', - ); - } - this._responseType = responseType; - } - - get responseText(): string { - if (this._responseType !== '' && this._responseType !== 'text') { - throw new Error( - "The 'responseText' property is only available if 'responseType' " + - `is set to '' or 'text', but it is '${this._responseType}'.`, - ); - } - if (this.readyState < LOADING) { - return ''; - } - return this._response; - } - - get response(): Response { - const {responseType} = this; - if (responseType === '' || responseType === 'text') { - return this.readyState < LOADING || this._hasError ? '' : this._response; - } - - if (this.readyState !== DONE) { - return null; - } - - if (this._cachedResponse !== undefined) { - return this._cachedResponse; - } - - switch (responseType) { - case 'document': - this._cachedResponse = null; - break; - - case 'arraybuffer': - this._cachedResponse = base64.toByteArray(this._response).buffer; - break; - - case 'blob': - if (typeof this._response === 'object' && this._response) { - this._cachedResponse = BlobManager.createFromOptions(this._response); - } else if (this._response === '') { - this._cachedResponse = null; - } else { - throw new Error(`Invalid response for blob: ${this._response}`); - } - break; - - case 'json': - try { - this._cachedResponse = JSON.parse(this._response); - } catch (_) { - this._cachedResponse = null; - } - break; - - default: - this._cachedResponse = null; - } - - return this._cachedResponse; - } - - // exposed for testing - __didCreateRequest(requestId: number): void { - this._requestId = requestId; - - XMLHttpRequest._interceptor && - XMLHttpRequest._interceptor.requestSent( - requestId, - this._url || '', - this._method || 'GET', - this._headers, - ); - } - - // exposed for testing - __didUploadProgress( - requestId: number, - progress: number, - total: number, - ): void { - if (requestId === this._requestId) { - this.upload.dispatchEvent({ - type: 'progress', - lengthComputable: true, - loaded: progress, - total, - }); - } - } - - __didReceiveResponse( - requestId: number, - status: number, - responseHeaders: ?Object, - responseURL: ?string, - ): void { - if (requestId === this._requestId) { - this.status = status; - this.setResponseHeaders(responseHeaders); - this.setReadyState(this.HEADERS_RECEIVED); - if (responseURL || responseURL === '') { - this.responseURL = responseURL; - } else { - delete this.responseURL; - } - - XMLHttpRequest._interceptor && - XMLHttpRequest._interceptor.responseReceived( - requestId, - responseURL || this._url || '', - status, - responseHeaders || {}, - ); - } - } - - __didReceiveData(requestId: number, response: string): void { - if (requestId !== this._requestId) { - return; - } - this._response = response; - this._cachedResponse = undefined; // force lazy recomputation - this.setReadyState(this.LOADING); - - XMLHttpRequest._interceptor && - XMLHttpRequest._interceptor.dataReceived(requestId, response); - } - - __didReceiveIncrementalData( - requestId: number, - responseText: string, - progress: number, - total: number, - ) { - if (requestId !== this._requestId) { - return; - } - if (!this._response) { - this._response = responseText; - } else { - this._response += responseText; - } - - XMLHttpRequest._interceptor && - XMLHttpRequest._interceptor.dataReceived(requestId, responseText); - - this.setReadyState(this.LOADING); - this.__didReceiveDataProgress(requestId, progress, total); - } - - __didReceiveDataProgress( - requestId: number, - loaded: number, - total: number, - ): void { - if (requestId !== this._requestId) { - return; - } - this.dispatchEvent({ - type: 'progress', - lengthComputable: total >= 0, - loaded, - total, - }); - } - - // exposed for testing - __didCompleteResponse( - requestId: number, - error: string, - timeOutError: boolean, - ): void { - if (requestId === this._requestId) { - if (error) { - if (this._responseType === '' || this._responseType === 'text') { - this._response = error; - } - this._hasError = true; - if (timeOutError) { - this._timedOut = true; - } - } - this._clearSubscriptions(); - this._requestId = null; - this.setReadyState(this.DONE); - - if (error) { - XMLHttpRequest._interceptor && - XMLHttpRequest._interceptor.loadingFailed(requestId, error); - } else { - XMLHttpRequest._interceptor && - XMLHttpRequest._interceptor.loadingFinished( - requestId, - this._response.length, - ); - } - } - } - - _clearSubscriptions(): void { - (this._subscriptions || []).forEach(sub => { - if (sub) { - sub.remove(); - } - }); - this._subscriptions = []; - } - - getAllResponseHeaders(): ?string { - if (!this.responseHeaders) { - // according to the spec, return null if no response has been received - return null; - } - const headers = this.responseHeaders || {}; - return Object.keys(headers) - .map(headerName => { - return headerName + ': ' + headers[headerName]; - }) - .join('\r\n'); - } - - getResponseHeader(header: string): ?string { - const value = this._lowerCaseResponseHeaders[header.toLowerCase()]; - return value !== undefined ? value : null; - } - - setRequestHeader(header: string, value: any): void { - if (this.readyState !== this.OPENED) { - throw new Error('Request has not been opened'); - } - this._headers[header.toLowerCase()] = String(value); - } - - /** - * Custom extension for tracking origins of request. - */ - setTrackingName(trackingName: string): XMLHttpRequest { - this._trackingName = trackingName; - return this; - } - - open(method: string, url: string, async: ?boolean): void { - /* Other optional arguments are not supported yet */ - if (this.readyState !== this.UNSENT) { - throw new Error('Cannot open, already sending'); - } - if (async !== undefined && !async) { - // async is default - throw new Error('Synchronous http requests are not supported'); - } - if (!url) { - throw new Error('Cannot load an empty url'); - } - this._method = method.toUpperCase(); - this._url = url; - this._aborted = false; - this.setReadyState(this.OPENED); - } - - send(data: any): void { - if (this.readyState !== this.OPENED) { - throw new Error('Request has not been opened'); - } - if (this._sent) { - throw new Error('Request has already been sent'); - } - this._sent = true; - const incrementalEvents = - this._incrementalEvents || !!this.onreadystatechange || !!this.onprogress; - - this._subscriptions.push( - RCTNetworking.addListener('didSendNetworkData', args => - this.__didUploadProgress(...args), - ), - ); - this._subscriptions.push( - RCTNetworking.addListener('didReceiveNetworkResponse', args => - this.__didReceiveResponse(...args), - ), - ); - this._subscriptions.push( - RCTNetworking.addListener('didReceiveNetworkData', args => - this.__didReceiveData(...args), - ), - ); - this._subscriptions.push( - RCTNetworking.addListener('didReceiveNetworkIncrementalData', args => - this.__didReceiveIncrementalData(...args), - ), - ); - this._subscriptions.push( - RCTNetworking.addListener('didReceiveNetworkDataProgress', args => - this.__didReceiveDataProgress(...args), - ), - ); - this._subscriptions.push( - RCTNetworking.addListener('didCompleteNetworkResponse', args => - this.__didCompleteResponse(...args), - ), - ); - - let nativeResponseType: NativeResponseType = 'text'; - if (this._responseType === 'arraybuffer') { - nativeResponseType = 'base64'; - } - if (this._responseType === 'blob') { - nativeResponseType = 'blob'; - } - - invariant(this._method, 'Request method needs to be defined.'); - invariant(this._url, 'Request URL needs to be defined.'); - RCTNetworking.sendRequest( - this._method, - this._trackingName, - this._url, - this._headers, - data, - /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found - * when making Flow check .android.js files. */ - nativeResponseType, - incrementalEvents, - this.timeout, - this.__didCreateRequest.bind(this), - this.withCredentials, - ); - } - - abort(): void { - this._aborted = true; - if (this._requestId) { - RCTNetworking.abortRequest(this._requestId); - } - // only call onreadystatechange if there is something to abort, - // below logic is per spec - if ( - !( - this.readyState === this.UNSENT || - (this.readyState === this.OPENED && !this._sent) || - this.readyState === this.DONE - ) - ) { - this._reset(); - this.setReadyState(this.DONE); - } - // Reset again after, in case modified in handler - this._reset(); - } - - setResponseHeaders(responseHeaders: ?Object): void { - this.responseHeaders = responseHeaders || null; - const headers = responseHeaders || {}; - this._lowerCaseResponseHeaders = Object.keys(headers).reduce( - (lcaseHeaders, headerName) => { - lcaseHeaders[headerName.toLowerCase()] = headers[headerName]; - return lcaseHeaders; - }, - {}, - ); - } - - setReadyState(newState: number): void { - this.readyState = newState; - this.dispatchEvent({type: 'readystatechange'}); - if (newState === this.DONE) { - if (this._aborted) { - this.dispatchEvent({type: 'abort'}); - } else if (this._hasError) { - if (this._timedOut) { - this.dispatchEvent({type: 'timeout'}); - } else { - this.dispatchEvent({type: 'error'}); - } - } else { - this.dispatchEvent({type: 'load'}); - } - this.dispatchEvent({type: 'loadend'}); - } - } - - /* global EventListener */ - addEventListener(type: string, listener: EventListener): void { - // If we dont' have a 'readystatechange' event handler, we don't - // have to send repeated LOADING events with incremental updates - // to responseText, which will avoid a bunch of native -> JS - // bridge traffic. - if (type === 'readystatechange' || type === 'progress') { - this._incrementalEvents = true; - } - super.addEventListener(type, listener); - } -} - -module.exports = XMLHttpRequest; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/convertRequestBody.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/convertRequestBody.js deleted file mode 100644 index ef6129bb..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/convertRequestBody.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ -'use strict'; - -const binaryToBase64 = require('binaryToBase64'); - -const Blob = require('Blob'); -const FormData = require('FormData'); - -export type RequestBody = - | string - | Blob - | FormData - | {uri: string} - | ArrayBuffer - | $ArrayBufferView; - -function convertRequestBody(body: RequestBody): Object { - if (typeof body === 'string') { - return {string: body}; - } - if (body instanceof Blob) { - return {blob: body.data}; - } - if (body instanceof FormData) { - return {formData: body.getParts()}; - } - if (body instanceof ArrayBuffer || ArrayBuffer.isView(body)) { - // $FlowFixMe: no way to assert that 'body' is indeed an ArrayBufferView - return {base64: binaryToBase64(body)}; - } - return body; -} - -module.exports = convertRequestBody; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/fetch.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/fetch.js deleted file mode 100644 index 66687e70..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Network/fetch.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -/* globals Headers, Request, Response */ - -'use strict'; - -const whatwg = require('whatwg-fetch'); - -if (whatwg && whatwg.fetch) { - module.exports = whatwg; -} else { - module.exports = {fetch, Headers, Request, Response}; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/PushNotificationIOS/PushNotificationIOS.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/PushNotificationIOS/PushNotificationIOS.js deleted file mode 100644 index 88a4409c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/PushNotificationIOS/PushNotificationIOS.js +++ /dev/null @@ -1,455 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const NativeEventEmitter = require('NativeEventEmitter'); -const RCTPushNotificationManager = require('NativeModules') - .PushNotificationManager; -const invariant = require('invariant'); - -const PushNotificationEmitter = new NativeEventEmitter( - RCTPushNotificationManager, -); - -const _notifHandlers = new Map(); - -const DEVICE_NOTIF_EVENT = 'remoteNotificationReceived'; -const NOTIF_REGISTER_EVENT = 'remoteNotificationsRegistered'; -const NOTIF_REGISTRATION_ERROR_EVENT = 'remoteNotificationRegistrationError'; -const DEVICE_LOCAL_NOTIF_EVENT = 'localNotificationReceived'; - -export type ContentAvailable = 1 | null | void; - -export type FetchResult = { - NewData: string, - NoData: string, - ResultFailed: string, -}; - -/** - * An event emitted by PushNotificationIOS. - */ -export type PushNotificationEventName = $Enum<{ - /** - * Fired when a remote notification is received. The handler will be invoked - * with an instance of `PushNotificationIOS`. - */ - notification: string, - /** - * Fired when a local notification is received. The handler will be invoked - * with an instance of `PushNotificationIOS`. - */ - localNotification: string, - /** - * Fired when the user registers for remote notifications. The handler will be - * invoked with a hex string representing the deviceToken. - */ - register: string, - /** - * Fired when the user fails to register for remote notifications. Typically - * occurs when APNS is having issues, or the device is a simulator. The - * handler will be invoked with {message: string, code: number, details: any}. - */ - registrationError: string, -}>; - -/** - * - * Handle push notifications for your app, including permission handling and - * icon badge number. - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html - */ -class PushNotificationIOS { - _data: Object; - _alert: string | Object; - _sound: string; - _category: string; - _contentAvailable: ContentAvailable; - _badgeCount: number; - _notificationId: string; - _isRemote: boolean; - _remoteNotificationCompleteCallbackCalled: boolean; - _threadID: string; - - static FetchResult: FetchResult = { - NewData: 'UIBackgroundFetchResultNewData', - NoData: 'UIBackgroundFetchResultNoData', - ResultFailed: 'UIBackgroundFetchResultFailed', - }; - - /** - * Schedules the localNotification for immediate presentation. - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#presentlocalnotification - */ - static presentLocalNotification(details: Object) { - RCTPushNotificationManager.presentLocalNotification(details); - } - - /** - * Schedules the localNotification for future presentation. - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#schedulelocalnotification - */ - static scheduleLocalNotification(details: Object) { - RCTPushNotificationManager.scheduleLocalNotification(details); - } - - /** - * Cancels all scheduled localNotifications. - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#cancelalllocalnotifications - */ - static cancelAllLocalNotifications() { - RCTPushNotificationManager.cancelAllLocalNotifications(); - } - - /** - * Remove all delivered notifications from Notification Center. - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#removealldeliverednotifications - */ - static removeAllDeliveredNotifications(): void { - RCTPushNotificationManager.removeAllDeliveredNotifications(); - } - - /** - * Provides you with a list of the app’s notifications that are still displayed in Notification Center. - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#getdeliverednotifications - */ - static getDeliveredNotifications( - callback: (notifications: Array) => void, - ): void { - RCTPushNotificationManager.getDeliveredNotifications(callback); - } - - /** - * Removes the specified notifications from Notification Center - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#removedeliverednotifications - */ - static removeDeliveredNotifications(identifiers: Array): void { - RCTPushNotificationManager.removeDeliveredNotifications(identifiers); - } - - /** - * Sets the badge number for the app icon on the home screen. - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#setapplicationiconbadgenumber - */ - static setApplicationIconBadgeNumber(number: number) { - RCTPushNotificationManager.setApplicationIconBadgeNumber(number); - } - - /** - * Gets the current badge number for the app icon on the home screen. - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#getapplicationiconbadgenumber - */ - static getApplicationIconBadgeNumber(callback: Function) { - RCTPushNotificationManager.getApplicationIconBadgeNumber(callback); - } - - /** - * Cancel local notifications. - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#cancellocalnotification - */ - static cancelLocalNotifications(userInfo: Object) { - RCTPushNotificationManager.cancelLocalNotifications(userInfo); - } - - /** - * Gets the local notifications that are currently scheduled. - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#getscheduledlocalnotifications - */ - static getScheduledLocalNotifications(callback: Function) { - RCTPushNotificationManager.getScheduledLocalNotifications(callback); - } - - /** - * Attaches a listener to remote or local notification events while the app - * is running in the foreground or the background. - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#addeventlistener - */ - static addEventListener(type: PushNotificationEventName, handler: Function) { - invariant( - type === 'notification' || - type === 'register' || - type === 'registrationError' || - type === 'localNotification', - 'PushNotificationIOS only supports `notification`, `register`, `registrationError`, and `localNotification` events', - ); - let listener; - if (type === 'notification') { - listener = PushNotificationEmitter.addListener( - DEVICE_NOTIF_EVENT, - notifData => { - handler(new PushNotificationIOS(notifData)); - }, - ); - } else if (type === 'localNotification') { - listener = PushNotificationEmitter.addListener( - DEVICE_LOCAL_NOTIF_EVENT, - notifData => { - handler(new PushNotificationIOS(notifData)); - }, - ); - } else if (type === 'register') { - listener = PushNotificationEmitter.addListener( - NOTIF_REGISTER_EVENT, - registrationInfo => { - handler(registrationInfo.deviceToken); - }, - ); - } else if (type === 'registrationError') { - listener = PushNotificationEmitter.addListener( - NOTIF_REGISTRATION_ERROR_EVENT, - errorInfo => { - handler(errorInfo); - }, - ); - } - _notifHandlers.set(type, listener); - } - - /** - * Removes the event listener. Do this in `componentWillUnmount` to prevent - * memory leaks. - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#removeeventlistener - */ - static removeEventListener( - type: PushNotificationEventName, - handler: Function, - ) { - invariant( - type === 'notification' || - type === 'register' || - type === 'registrationError' || - type === 'localNotification', - 'PushNotificationIOS only supports `notification`, `register`, `registrationError`, and `localNotification` events', - ); - const listener = _notifHandlers.get(type); - if (!listener) { - return; - } - listener.remove(); - _notifHandlers.delete(type); - } - - /** - * Requests notification permissions from iOS, prompting the user's - * dialog box. By default, it will request all notification permissions, but - * a subset of these can be requested by passing a map of requested - * permissions. - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#requestpermissions - */ - static requestPermissions(permissions?: { - alert?: boolean, - badge?: boolean, - sound?: boolean, - }): Promise<{ - alert: boolean, - badge: boolean, - sound: boolean, - }> { - let requestedPermissions = {}; - if (permissions) { - requestedPermissions = { - alert: !!permissions.alert, - badge: !!permissions.badge, - sound: !!permissions.sound, - }; - } else { - requestedPermissions = { - alert: true, - badge: true, - sound: true, - }; - } - return RCTPushNotificationManager.requestPermissions(requestedPermissions); - } - - /** - * Unregister for all remote notifications received via Apple Push Notification service. - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#abandonpermissions - */ - static abandonPermissions() { - RCTPushNotificationManager.abandonPermissions(); - } - - /** - * See what push permissions are currently enabled. `callback` will be - * invoked with a `permissions` object. - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#checkpermissions - */ - static checkPermissions(callback: Function) { - invariant(typeof callback === 'function', 'Must provide a valid callback'); - RCTPushNotificationManager.checkPermissions(callback); - } - - /** - * This method returns a promise that resolves to either the notification - * object if the app was launched by a push notification, or `null` otherwise. - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#getinitialnotification - */ - static getInitialNotification(): Promise { - return RCTPushNotificationManager.getInitialNotification().then( - notification => { - return notification && new PushNotificationIOS(notification); - }, - ); - } - - /** - * You will never need to instantiate `PushNotificationIOS` yourself. - * Listening to the `notification` event and invoking - * `getInitialNotification` is sufficient - * - */ - constructor(nativeNotif: Object) { - this._data = {}; - this._remoteNotificationCompleteCallbackCalled = false; - this._isRemote = nativeNotif.remote; - if (this._isRemote) { - this._notificationId = nativeNotif.notificationId; - } - - if (nativeNotif.remote) { - // Extract data from Apple's `aps` dict as defined: - // https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html - Object.keys(nativeNotif).forEach(notifKey => { - const notifVal = nativeNotif[notifKey]; - if (notifKey === 'aps') { - this._alert = notifVal.alert; - this._sound = notifVal.sound; - this._badgeCount = notifVal.badge; - this._category = notifVal.category; - this._contentAvailable = notifVal['content-available']; - this._threadID = notifVal['thread-id']; - } else { - this._data[notifKey] = notifVal; - } - }); - } else { - // Local notifications aren't being sent down with `aps` dict. - this._badgeCount = nativeNotif.applicationIconBadgeNumber; - this._sound = nativeNotif.soundName; - this._alert = nativeNotif.alertBody; - this._data = nativeNotif.userInfo; - this._category = nativeNotif.category; - } - } - - /** - * This method is available for remote notifications that have been received via: - * `application:didReceiveRemoteNotification:fetchCompletionHandler:` - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#finish - */ - finish(fetchResult: string) { - if ( - !this._isRemote || - !this._notificationId || - this._remoteNotificationCompleteCallbackCalled - ) { - return; - } - this._remoteNotificationCompleteCallbackCalled = true; - - RCTPushNotificationManager.onFinishRemoteNotification( - this._notificationId, - fetchResult, - ); - } - - /** - * An alias for `getAlert` to get the notification's main message string - */ - getMessage(): ?string | ?Object { - // alias because "alert" is an ambiguous name - return this._alert; - } - - /** - * Gets the sound string from the `aps` object - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#getsound - */ - getSound(): ?string { - return this._sound; - } - - /** - * Gets the category string from the `aps` object - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#getcategory - */ - getCategory(): ?string { - return this._category; - } - - /** - * Gets the notification's main message from the `aps` object - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#getalert - */ - getAlert(): ?string | ?Object { - return this._alert; - } - - /** - * Gets the content-available number from the `aps` object - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#getcontentavailable - */ - getContentAvailable(): ContentAvailable { - return this._contentAvailable; - } - - /** - * Gets the badge count number from the `aps` object - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#getbadgecount - */ - getBadgeCount(): ?number { - return this._badgeCount; - } - - /** - * Gets the data object on the notif - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#getdata - */ - getData(): ?Object { - return this._data; - } - - /** - * Gets the thread ID on the notif - * - * See https://facebook.github.io/react-native/docs/pushnotificationios.html#getthreadid - */ - getThreadID(): ?string { - return this._threadID; - } -} - -module.exports = PushNotificationIOS; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/PushNotificationIOS/RCTPushNotification.xcodeproj/project.pbxproj b/ios/ElectrodeApiImpl/Libraries/ReactNative/PushNotificationIOS/RCTPushNotification.xcodeproj/project.pbxproj deleted file mode 100644 index 7bca7034..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/PushNotificationIOS/RCTPushNotification.xcodeproj/project.pbxproj +++ /dev/null @@ -1,376 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 148699CF1ABD045300480536 /* RCTPushNotificationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 148699CE1ABD045300480536 /* RCTPushNotificationManager.m */; }; - 3D0574931DE6009C00184BB4 /* RCTPushNotificationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 148699CE1ABD045300480536 /* RCTPushNotificationManager.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 3D05745D1DE6004600184BB4 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 58B511D91A9E6C8500147676 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libRCTPushNotification.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTPushNotification.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 148699CD1ABD045300480536 /* RCTPushNotificationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTPushNotificationManager.h; sourceTree = ""; }; - 148699CE1ABD045300480536 /* RCTPushNotificationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPushNotificationManager.m; sourceTree = ""; }; - 3D05745F1DE6004600184BB4 /* libRCTPushNotification-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTPushNotification-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 3D05745C1DE6004600184BB4 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 58B511D81A9E6C8500147676 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 134814211AA4EA7D00B7C361 /* Products */ = { - isa = PBXGroup; - children = ( - 134814201AA4EA6300B7C361 /* libRCTPushNotification.a */, - ); - name = Products; - sourceTree = ""; - }; - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - 148699CD1ABD045300480536 /* RCTPushNotificationManager.h */, - 148699CE1ABD045300480536 /* RCTPushNotificationManager.m */, - 134814211AA4EA7D00B7C361 /* Products */, - 3D05745F1DE6004600184BB4 /* libRCTPushNotification-tvOS.a */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 3D05745E1DE6004600184BB4 /* RCTPushNotification-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3D0574671DE6004600184BB4 /* Build configuration list for PBXNativeTarget "RCTPushNotification-tvOS" */; - buildPhases = ( - 3D05745B1DE6004600184BB4 /* Sources */, - 3D05745C1DE6004600184BB4 /* Frameworks */, - 3D05745D1DE6004600184BB4 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTPushNotification-tvOS"; - productName = "RCTPushNotification-tvOS"; - productReference = 3D05745F1DE6004600184BB4 /* libRCTPushNotification-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 58B511DA1A9E6C8500147676 /* RCTPushNotification */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTPushNotification" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - 58B511D81A9E6C8500147676 /* Frameworks */, - 58B511D91A9E6C8500147676 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTPushNotification; - productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libRCTPushNotification.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 3D05745E1DE6004600184BB4 = { - CreatedOnToolsVersion = 8.1; - ProvisioningStyle = Automatic; - }; - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTPushNotification" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511D21A9E6C8500147676; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B511DA1A9E6C8500147676 /* RCTPushNotification */, - 3D05745E1DE6004600184BB4 /* RCTPushNotification-tvOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 3D05745B1DE6004600184BB4 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3D0574931DE6009C00184BB4 /* RCTPushNotificationManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 148699CF1ABD045300480536 /* RCTPushNotificationManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 3D0574651DE6004600184BB4 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 3D0574661DE6004600184BB4 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTPushNotification; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTPushNotification; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 3D0574671DE6004600184BB4 /* Build configuration list for PBXNativeTarget "RCTPushNotification-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3D0574651DE6004600184BB4 /* Debug */, - 3D0574661DE6004600184BB4 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTPushNotification" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTPushNotification" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/PushNotificationIOS/RCTPushNotificationManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/PushNotificationIOS/RCTPushNotificationManager.h deleted file mode 100644 index dc16ab48..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/PushNotificationIOS/RCTPushNotificationManager.h +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -extern NSString *const RCTRemoteNotificationReceived; - -@interface RCTPushNotificationManager : RCTEventEmitter - -typedef void (^RCTRemoteNotificationCallback)(UIBackgroundFetchResult result); - -#if !TARGET_OS_TV -+ (void)didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings; -+ (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken; -+ (void)didReceiveRemoteNotification:(NSDictionary *)notification; -+ (void)didReceiveRemoteNotification:(NSDictionary *)notification fetchCompletionHandler:(RCTRemoteNotificationCallback)completionHandler; -+ (void)didReceiveLocalNotification:(UILocalNotification *)notification; -+ (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error; -#endif - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/PushNotificationIOS/RCTPushNotificationManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/PushNotificationIOS/RCTPushNotificationManager.m deleted file mode 100644 index b0280744..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/PushNotificationIOS/RCTPushNotificationManager.m +++ /dev/null @@ -1,476 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTPushNotificationManager.h" - -#import - -#import -#import -#import -#import - -NSString *const RCTRemoteNotificationReceived = @"RemoteNotificationReceived"; - -static NSString *const kLocalNotificationReceived = @"LocalNotificationReceived"; -static NSString *const kRemoteNotificationsRegistered = @"RemoteNotificationsRegistered"; -static NSString *const kRegisterUserNotificationSettings = @"RegisterUserNotificationSettings"; -static NSString *const kRemoteNotificationRegistrationFailed = @"RemoteNotificationRegistrationFailed"; - -static NSString *const kErrorUnableToRequestPermissions = @"E_UNABLE_TO_REQUEST_PERMISSIONS"; - -#if !TARGET_OS_TV -@implementation RCTConvert (NSCalendarUnit) - -RCT_ENUM_CONVERTER(NSCalendarUnit, - (@{ - @"year": @(NSCalendarUnitYear), - @"month": @(NSCalendarUnitMonth), - @"week": @(NSCalendarUnitWeekOfYear), - @"day": @(NSCalendarUnitDay), - @"hour": @(NSCalendarUnitHour), - @"minute": @(NSCalendarUnitMinute) - }), - 0, - integerValue) - -@end - -@interface RCTPushNotificationManager () -@property (nonatomic, strong) NSMutableDictionary *remoteNotificationCallbacks; -@end - -@implementation RCTConvert (UILocalNotification) - -+ (UILocalNotification *)UILocalNotification:(id)json -{ - NSDictionary *details = [self NSDictionary:json]; - BOOL isSilent = [RCTConvert BOOL:details[@"isSilent"]]; - UILocalNotification *notification = [UILocalNotification new]; - notification.alertTitle = [RCTConvert NSString:details[@"alertTitle"]]; - notification.fireDate = [RCTConvert NSDate:details[@"fireDate"]] ?: [NSDate date]; - notification.alertBody = [RCTConvert NSString:details[@"alertBody"]]; - notification.alertAction = [RCTConvert NSString:details[@"alertAction"]]; - notification.userInfo = [RCTConvert NSDictionary:details[@"userInfo"]]; - notification.category = [RCTConvert NSString:details[@"category"]]; - notification.repeatInterval = [RCTConvert NSCalendarUnit:details[@"repeatInterval"]]; - if (details[@"applicationIconBadgeNumber"]) { - notification.applicationIconBadgeNumber = [RCTConvert NSInteger:details[@"applicationIconBadgeNumber"]]; - } - if (!isSilent) { - notification.soundName = [RCTConvert NSString:details[@"soundName"]] ?: UILocalNotificationDefaultSoundName; - } - return notification; -} - -RCT_ENUM_CONVERTER(UIBackgroundFetchResult, (@{ - @"UIBackgroundFetchResultNewData": @(UIBackgroundFetchResultNewData), - @"UIBackgroundFetchResultNoData": @(UIBackgroundFetchResultNoData), - @"UIBackgroundFetchResultFailed": @(UIBackgroundFetchResultFailed), -}), UIBackgroundFetchResultNoData, integerValue) - -@end -#endif //TARGET_OS_TV - -@implementation RCTPushNotificationManager -{ - RCTPromiseResolveBlock _requestPermissionsResolveBlock; -} - -#if !TARGET_OS_TV - -static NSDictionary *RCTFormatLocalNotification(UILocalNotification *notification) -{ - NSMutableDictionary *formattedLocalNotification = [NSMutableDictionary dictionary]; - if (notification.fireDate) { - NSDateFormatter *formatter = [NSDateFormatter new]; - [formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"]; - NSString *fireDateString = [formatter stringFromDate:notification.fireDate]; - formattedLocalNotification[@"fireDate"] = fireDateString; - } - formattedLocalNotification[@"alertAction"] = RCTNullIfNil(notification.alertAction); - formattedLocalNotification[@"alertBody"] = RCTNullIfNil(notification.alertBody); - formattedLocalNotification[@"applicationIconBadgeNumber"] = @(notification.applicationIconBadgeNumber); - formattedLocalNotification[@"category"] = RCTNullIfNil(notification.category); - formattedLocalNotification[@"soundName"] = RCTNullIfNil(notification.soundName); - formattedLocalNotification[@"userInfo"] = RCTNullIfNil(RCTJSONClean(notification.userInfo)); - formattedLocalNotification[@"remote"] = @NO; - return formattedLocalNotification; -} - -static NSDictionary *RCTFormatUNNotification(UNNotification *notification) -{ - NSMutableDictionary *formattedNotification = [NSMutableDictionary dictionary]; - UNNotificationContent *content = notification.request.content; - - formattedNotification[@"identifier"] = notification.request.identifier; - - if (notification.date) { - NSDateFormatter *formatter = [NSDateFormatter new]; - [formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"]; - NSString *dateString = [formatter stringFromDate:notification.date]; - formattedNotification[@"date"] = dateString; - } - - formattedNotification[@"title"] = RCTNullIfNil(content.title); - formattedNotification[@"body"] = RCTNullIfNil(content.body); - formattedNotification[@"category"] = RCTNullIfNil(content.categoryIdentifier); - formattedNotification[@"thread-id"] = RCTNullIfNil(content.threadIdentifier); - formattedNotification[@"userInfo"] = RCTNullIfNil(RCTJSONClean(content.userInfo)); - - return formattedNotification; -} - -#endif //TARGET_OS_TV - -RCT_EXPORT_MODULE() - -- (dispatch_queue_t)methodQueue -{ - return dispatch_get_main_queue(); -} - -#if !TARGET_OS_TV -- (void)startObserving -{ - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleLocalNotificationReceived:) - name:kLocalNotificationReceived - object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleRemoteNotificationReceived:) - name:RCTRemoteNotificationReceived - object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleRegisterUserNotificationSettings:) - name:kRegisterUserNotificationSettings - object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleRemoteNotificationsRegistered:) - name:kRemoteNotificationsRegistered - object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleRemoteNotificationRegistrationError:) - name:kRemoteNotificationRegistrationFailed - object:nil]; -} - -- (void)stopObserving -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (NSArray *)supportedEvents -{ - return @[@"localNotificationReceived", - @"remoteNotificationReceived", - @"remoteNotificationsRegistered", - @"remoteNotificationRegistrationError"]; -} - -+ (void)didRegisterUserNotificationSettings:(__unused UIUserNotificationSettings *)notificationSettings -{ - if ([UIApplication instancesRespondToSelector:@selector(registerForRemoteNotifications)]) { - [RCTSharedApplication() registerForRemoteNotifications]; - [[NSNotificationCenter defaultCenter] postNotificationName:kRegisterUserNotificationSettings - object:self - userInfo:@{@"notificationSettings": notificationSettings}]; - } -} - -+ (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken -{ - NSMutableString *hexString = [NSMutableString string]; - NSUInteger deviceTokenLength = deviceToken.length; - const unsigned char *bytes = deviceToken.bytes; - for (NSUInteger i = 0; i < deviceTokenLength; i++) { - [hexString appendFormat:@"%02x", bytes[i]]; - } - [[NSNotificationCenter defaultCenter] postNotificationName:kRemoteNotificationsRegistered - object:self - userInfo:@{@"deviceToken" : [hexString copy]}]; -} - -+ (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error -{ - [[NSNotificationCenter defaultCenter] postNotificationName:kRemoteNotificationRegistrationFailed - object:self - userInfo:@{@"error": error}]; -} - -+ (void)didReceiveRemoteNotification:(NSDictionary *)notification -{ - NSDictionary *userInfo = @{@"notification": notification}; - [[NSNotificationCenter defaultCenter] postNotificationName:RCTRemoteNotificationReceived - object:self - userInfo:userInfo]; -} - -+ (void)didReceiveRemoteNotification:(NSDictionary *)notification - fetchCompletionHandler:(RCTRemoteNotificationCallback)completionHandler -{ - NSDictionary *userInfo = @{@"notification": notification, @"completionHandler": completionHandler}; - [[NSNotificationCenter defaultCenter] postNotificationName:RCTRemoteNotificationReceived - object:self - userInfo:userInfo]; -} - -+ (void)didReceiveLocalNotification:(UILocalNotification *)notification -{ - [[NSNotificationCenter defaultCenter] postNotificationName:kLocalNotificationReceived - object:self - userInfo:RCTFormatLocalNotification(notification)]; -} - -- (void)handleLocalNotificationReceived:(NSNotification *)notification -{ - [self sendEventWithName:@"localNotificationReceived" body:notification.userInfo]; -} - -- (void)handleRemoteNotificationReceived:(NSNotification *)notification -{ - NSMutableDictionary *remoteNotification = [NSMutableDictionary dictionaryWithDictionary:notification.userInfo[@"notification"]]; - RCTRemoteNotificationCallback completionHandler = notification.userInfo[@"completionHandler"]; - NSString *notificationId = [[NSUUID UUID] UUIDString]; - remoteNotification[@"notificationId"] = notificationId; - remoteNotification[@"remote"] = @YES; - if (completionHandler) { - if (!self.remoteNotificationCallbacks) { - // Lazy initialization - self.remoteNotificationCallbacks = [NSMutableDictionary dictionary]; - } - self.remoteNotificationCallbacks[notificationId] = completionHandler; - } - - [self sendEventWithName:@"remoteNotificationReceived" body:remoteNotification]; -} - -- (void)handleRemoteNotificationsRegistered:(NSNotification *)notification -{ - [self sendEventWithName:@"remoteNotificationsRegistered" body:notification.userInfo]; -} - -- (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification -{ - NSError *error = notification.userInfo[@"error"]; - NSDictionary *errorDetails = @{ - @"message": error.localizedDescription, - @"code": @(error.code), - @"details": error.userInfo, - }; - [self sendEventWithName:@"remoteNotificationRegistrationError" body:errorDetails]; -} - -- (void)handleRegisterUserNotificationSettings:(NSNotification *)notification -{ - if (_requestPermissionsResolveBlock == nil) { - return; - } - - UIUserNotificationSettings *notificationSettings = notification.userInfo[@"notificationSettings"]; - NSDictionary *notificationTypes = @{ - @"alert": @((notificationSettings.types & UIUserNotificationTypeAlert) > 0), - @"sound": @((notificationSettings.types & UIUserNotificationTypeSound) > 0), - @"badge": @((notificationSettings.types & UIUserNotificationTypeBadge) > 0), - }; - - _requestPermissionsResolveBlock(notificationTypes); - // Clean up listener added in requestPermissions - [self removeListeners:1]; - _requestPermissionsResolveBlock = nil; -} - -RCT_EXPORT_METHOD(onFinishRemoteNotification:(NSString *)notificationId fetchResult:(UIBackgroundFetchResult)result) { - RCTRemoteNotificationCallback completionHandler = self.remoteNotificationCallbacks[notificationId]; - if (!completionHandler) { - RCTLogError(@"There is no completion handler with notification id: %@", notificationId); - return; - } - completionHandler(result); - [self.remoteNotificationCallbacks removeObjectForKey:notificationId]; -} - -/** - * Update the application icon badge number on the home screen - */ -RCT_EXPORT_METHOD(setApplicationIconBadgeNumber:(NSInteger)number) -{ - RCTSharedApplication().applicationIconBadgeNumber = number; -} - -/** - * Get the current application icon badge number on the home screen - */ -RCT_EXPORT_METHOD(getApplicationIconBadgeNumber:(RCTResponseSenderBlock)callback) -{ - callback(@[@(RCTSharedApplication().applicationIconBadgeNumber)]); -} - -RCT_EXPORT_METHOD(requestPermissions:(NSDictionary *)permissions - resolver:(RCTPromiseResolveBlock)resolve - rejecter:(RCTPromiseRejectBlock)reject) -{ - if (RCTRunningInAppExtension()) { - reject(kErrorUnableToRequestPermissions, nil, RCTErrorWithMessage(@"Requesting push notifications is currently unavailable in an app extension")); - return; - } - - if (_requestPermissionsResolveBlock != nil) { - RCTLogError(@"Cannot call requestPermissions twice before the first has returned."); - return; - } - - // Add a listener to make sure that startObserving has been called - [self addListener:@"remoteNotificationsRegistered"]; - _requestPermissionsResolveBlock = resolve; - - UIUserNotificationType types = UIUserNotificationTypeNone; - if (permissions) { - if ([RCTConvert BOOL:permissions[@"alert"]]) { - types |= UIUserNotificationTypeAlert; - } - if ([RCTConvert BOOL:permissions[@"badge"]]) { - types |= UIUserNotificationTypeBadge; - } - if ([RCTConvert BOOL:permissions[@"sound"]]) { - types |= UIUserNotificationTypeSound; - } - } else { - types = UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound; - } - - UIUserNotificationSettings *notificationSettings = - [UIUserNotificationSettings settingsForTypes:types categories:nil]; - [RCTSharedApplication() registerUserNotificationSettings:notificationSettings]; -} - -RCT_EXPORT_METHOD(abandonPermissions) -{ - [RCTSharedApplication() unregisterForRemoteNotifications]; -} - -RCT_EXPORT_METHOD(checkPermissions:(RCTResponseSenderBlock)callback) -{ - if (RCTRunningInAppExtension()) { - callback(@[@{@"alert": @NO, @"badge": @NO, @"sound": @NO}]); - return; - } - - NSUInteger types = [RCTSharedApplication() currentUserNotificationSettings].types; - callback(@[@{ - @"alert": @((types & UIUserNotificationTypeAlert) > 0), - @"badge": @((types & UIUserNotificationTypeBadge) > 0), - @"sound": @((types & UIUserNotificationTypeSound) > 0), - }]); -} - -RCT_EXPORT_METHOD(presentLocalNotification:(UILocalNotification *)notification) -{ - [RCTSharedApplication() presentLocalNotificationNow:notification]; -} - -RCT_EXPORT_METHOD(scheduleLocalNotification:(UILocalNotification *)notification) -{ - [RCTSharedApplication() scheduleLocalNotification:notification]; -} - -RCT_EXPORT_METHOD(cancelAllLocalNotifications) -{ - [RCTSharedApplication() cancelAllLocalNotifications]; -} - -RCT_EXPORT_METHOD(cancelLocalNotifications:(NSDictionary *)userInfo) -{ - for (UILocalNotification *notification in RCTSharedApplication().scheduledLocalNotifications) { - __block BOOL matchesAll = YES; - NSDictionary *notificationInfo = notification.userInfo; - // Note: we do this with a loop instead of just `isEqualToDictionary:` - // because we only require that all specified userInfo values match the - // notificationInfo values - notificationInfo may contain additional values - // which we don't care about. - [userInfo enumerateKeysAndObjectsUsingBlock:^(NSString *key, id obj, BOOL *stop) { - if (![notificationInfo[key] isEqual:obj]) { - matchesAll = NO; - *stop = YES; - } - }]; - if (matchesAll) { - [RCTSharedApplication() cancelLocalNotification:notification]; - } - } -} - -RCT_EXPORT_METHOD(getInitialNotification:(RCTPromiseResolveBlock)resolve - reject:(__unused RCTPromiseRejectBlock)reject) -{ - NSMutableDictionary *initialNotification = - [self.bridge.launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey] mutableCopy]; - - UILocalNotification *initialLocalNotification = - self.bridge.launchOptions[UIApplicationLaunchOptionsLocalNotificationKey]; - - if (initialNotification) { - initialNotification[@"remote"] = @YES; - resolve(initialNotification); - } else if (initialLocalNotification) { - resolve(RCTFormatLocalNotification(initialLocalNotification)); - } else { - resolve((id)kCFNull); - } -} - -RCT_EXPORT_METHOD(getScheduledLocalNotifications:(RCTResponseSenderBlock)callback) -{ - NSArray *scheduledLocalNotifications = RCTSharedApplication().scheduledLocalNotifications; - NSMutableArray *formattedScheduledLocalNotifications = [NSMutableArray new]; - for (UILocalNotification *notification in scheduledLocalNotifications) { - [formattedScheduledLocalNotifications addObject:RCTFormatLocalNotification(notification)]; - } - callback(@[formattedScheduledLocalNotifications]); -} - -RCT_EXPORT_METHOD(removeAllDeliveredNotifications) -{ - if ([UNUserNotificationCenter class]) { - UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; - [center removeAllDeliveredNotifications]; - } -} - -RCT_EXPORT_METHOD(removeDeliveredNotifications:(NSArray *)identifiers) -{ - if ([UNUserNotificationCenter class]) { - UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; - [center removeDeliveredNotificationsWithIdentifiers:identifiers]; - } -} - -RCT_EXPORT_METHOD(getDeliveredNotifications:(RCTResponseSenderBlock)callback) -{ - if ([UNUserNotificationCenter class]) { - UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; - [center getDeliveredNotificationsWithCompletionHandler:^(NSArray *_Nonnull notifications) { - NSMutableArray *formattedNotifications = [NSMutableArray new]; - - for (UNNotification *notification in notifications) { - [formattedNotifications addObject:RCTFormatUNNotification(notification)]; - } - callback(@[formattedNotifications]); - }]; - } -} - -#else //TARGET_OS_TV - -- (NSArray *)supportedEvents -{ - return @[]; -} - -#endif //TARGET_OS_TV - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTAssert.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTAssert.h deleted file mode 100644 index 13661051..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTAssert.h +++ /dev/null @@ -1,159 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#if __has_include() -#import -#elif __has_include("RCTDefines.h") -#import "RCTDefines.h" -#else -#import "React/RCTDefines.h" -#endif - -/* - * Defined in RCTUtils.m - */ -RCT_EXTERN BOOL RCTIsMainQueue(void); - -/** - * This is the main assert macro that you should use. Asserts should be compiled out - * in production builds. You can customize the assert behaviour by setting a custom - * assert handler through `RCTSetAssertFunction`. - */ -#ifndef NS_BLOCK_ASSERTIONS -#define RCTAssert(condition, ...) do { \ - if ((condition) == 0) { \ - _RCTAssertFormat(#condition, __FILE__, __LINE__, __func__, __VA_ARGS__); \ - if (RCT_NSASSERT) { \ - [[NSAssertionHandler currentHandler] handleFailureInFunction:(NSString * _Nonnull)@(__func__) \ - file:(NSString * _Nonnull)@(__FILE__) lineNumber:__LINE__ description:__VA_ARGS__]; \ - } \ - } \ -} while (false) -#else -#define RCTAssert(condition, ...) do {} while (false) -#endif -RCT_EXTERN void _RCTAssertFormat( - const char *, const char *, int, const char *, NSString *, ... -) NS_FORMAT_FUNCTION(5,6); - -/** - * Report a fatal condition when executing. These calls will _NOT_ be compiled out - * in production, and crash the app by default. You can customize the fatal behaviour - * by setting a custom fatal handler through `RCTSetFatalHandler`. - */ -RCT_EXTERN void RCTFatal(NSError *error); - -/** - * The default error domain to be used for React errors. - */ -RCT_EXTERN NSString *const RCTErrorDomain; - -/** - * JS Stack trace provided as part of an NSError's userInfo - */ -RCT_EXTERN NSString *const RCTJSStackTraceKey; - -/** - * Raw JS Stack trace string provided as part of an NSError's userInfo - */ -RCT_EXTERN NSString *const RCTJSRawStackTraceKey; - -/** - * Name of fatal exceptions generated by RCTFatal - */ -RCT_EXTERN NSString *const RCTFatalExceptionName; - -/** - * A block signature to be used for custom assertion handling. - */ -typedef void (^RCTAssertFunction)(NSString *condition, - NSString *fileName, - NSNumber *lineNumber, - NSString *function, - NSString *message); - -typedef void (^RCTFatalHandler)(NSError *error); - -/** - * Convenience macro for asserting that a parameter is non-nil/non-zero. - */ -#define RCTAssertParam(name) RCTAssert(name, @"'%s' is a required parameter", #name) - -/** - * Convenience macro for asserting that we're running on main queue. - */ -#define RCTAssertMainQueue() RCTAssert(RCTIsMainQueue(), \ - @"This function must be called on the main queue") - -/** - * Convenience macro for asserting that we're running off the main queue. - */ -#define RCTAssertNotMainQueue() RCTAssert(!RCTIsMainQueue(), \ -@"This function must not be called on the main queue") - -/** - * These methods get and set the current assert function called by the RCTAssert - * macros. You can use these to replace the standard behavior with custom assert - * functionality. - */ -RCT_EXTERN void RCTSetAssertFunction(RCTAssertFunction assertFunction); -RCT_EXTERN RCTAssertFunction RCTGetAssertFunction(void); - -/** - * This appends additional code to the existing assert function, without - * replacing the existing functionality. Useful if you just want to forward - * assert info to an extra service without changing the default behavior. - */ -RCT_EXTERN void RCTAddAssertFunction(RCTAssertFunction assertFunction); - -/** - * This method temporarily overrides the assert function while performing the - * specified block. This is useful for testing purposes (to detect if a given - * function asserts something) or to suppress or override assertions temporarily. - */ -RCT_EXTERN void RCTPerformBlockWithAssertFunction(void (^block)(void), RCTAssertFunction assertFunction); - -/** - These methods get and set the current fatal handler called by the RCTFatal method. - */ -RCT_EXTERN void RCTSetFatalHandler(RCTFatalHandler fatalHandler); -RCT_EXTERN RCTFatalHandler RCTGetFatalHandler(void); - -/** - * Get the current thread's name (or the current queue, if in debug mode) - */ -RCT_EXTERN NSString *RCTCurrentThreadName(void); - -/** - * Helper to get generate exception message from NSError - */ -RCT_EXTERN NSString *RCTFormatError(NSString *message, NSArray *> *stacktrace, NSUInteger maxMessageLength); - -/** - * Convenience macro to assert which thread is currently running (DEBUG mode only) - */ -#if DEBUG - -#define RCTAssertThread(thread, format...) \ -_Pragma("clang diagnostic push") \ -_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \ -RCTAssert( \ - [(id)thread isKindOfClass:[NSString class]] ? \ - [RCTCurrentThreadName() isEqualToString:(NSString *)thread] : \ - [(id)thread isKindOfClass:[NSThread class]] ? \ - [NSThread currentThread] == (NSThread *)thread : \ - dispatch_get_current_queue() == (dispatch_queue_t)thread, \ - format); \ -_Pragma("clang diagnostic pop") - -#else - -#define RCTAssertThread(thread, format...) do { } while (0) - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTAssert.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTAssert.m deleted file mode 100644 index cec11448..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTAssert.m +++ /dev/null @@ -1,189 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAssert.h" -#import "RCTLog.h" - -NSString *const RCTErrorDomain = @"RCTErrorDomain"; -NSString *const RCTJSStackTraceKey = @"RCTJSStackTraceKey"; -NSString *const RCTJSRawStackTraceKey = @"RCTJSRawStackTraceKey"; -NSString *const RCTFatalExceptionName = @"RCTFatalException"; -NSString *const RCTUntruncatedMessageKey = @"RCTUntruncatedMessageKey"; - -static NSString *const RCTAssertFunctionStack = @"RCTAssertFunctionStack"; - -RCTAssertFunction RCTCurrentAssertFunction = nil; -RCTFatalHandler RCTCurrentFatalHandler = nil; - -NSException *_RCTNotImplementedException(SEL, Class); -NSException *_RCTNotImplementedException(SEL cmd, Class cls) -{ - NSString *msg = [NSString stringWithFormat:@"%s is not implemented " - "for the class %@", sel_getName(cmd), cls]; - return [NSException exceptionWithName:@"RCTNotDesignatedInitializerException" - reason:msg userInfo:nil]; -} - -void RCTSetAssertFunction(RCTAssertFunction assertFunction) -{ - RCTCurrentAssertFunction = assertFunction; -} - -RCTAssertFunction RCTGetAssertFunction(void) -{ - return RCTCurrentAssertFunction; -} - -void RCTAddAssertFunction(RCTAssertFunction assertFunction) -{ - RCTAssertFunction existing = RCTCurrentAssertFunction; - if (existing) { - RCTCurrentAssertFunction = ^(NSString *condition, - NSString *fileName, - NSNumber *lineNumber, - NSString *function, - NSString *message) { - - existing(condition, fileName, lineNumber, function, message); - assertFunction(condition, fileName, lineNumber, function, message); - }; - } else { - RCTCurrentAssertFunction = assertFunction; - } -} - -/** - * returns the topmost stacked assert function for the current thread, which - * may not be the same as the current value of RCTCurrentAssertFunction. - */ -static RCTAssertFunction RCTGetLocalAssertFunction() -{ - NSMutableDictionary *threadDictionary = [NSThread currentThread].threadDictionary; - NSArray *functionStack = threadDictionary[RCTAssertFunctionStack]; - RCTAssertFunction assertFunction = functionStack.lastObject; - if (assertFunction) { - return assertFunction; - } - return RCTCurrentAssertFunction; -} - -void RCTPerformBlockWithAssertFunction(void (^block)(void), RCTAssertFunction assertFunction) -{ - NSMutableDictionary *threadDictionary = [NSThread currentThread].threadDictionary; - NSMutableArray *functionStack = threadDictionary[RCTAssertFunctionStack]; - if (!functionStack) { - functionStack = [NSMutableArray new]; - threadDictionary[RCTAssertFunctionStack] = functionStack; - } - [functionStack addObject:assertFunction]; - block(); - [functionStack removeLastObject]; -} - -NSString *RCTCurrentThreadName(void) -{ - NSThread *thread = [NSThread currentThread]; - NSString *threadName = RCTIsMainQueue() || thread.isMainThread ? @"main" : thread.name; - if (threadName.length == 0) { - const char *label = dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL); - if (label && strlen(label) > 0) { - threadName = @(label); - } else { - threadName = [NSString stringWithFormat:@"%p", thread]; - } - } - return threadName; -} - -void _RCTAssertFormat( - const char *condition, - const char *fileName, - int lineNumber, - const char *function, - NSString *format, ...) -{ - RCTAssertFunction assertFunction = RCTGetLocalAssertFunction(); - if (assertFunction) { - va_list args; - va_start(args, format); - NSString *message = [[NSString alloc] initWithFormat:format arguments:args]; - va_end(args); - - assertFunction(@(condition), @(fileName), @(lineNumber), @(function), message); - } -} - -void RCTFatal(NSError *error) -{ - _RCTLogNativeInternal(RCTLogLevelFatal, NULL, 0, @"%@", error.localizedDescription); - - RCTFatalHandler fatalHandler = RCTGetFatalHandler(); - if (fatalHandler) { - fatalHandler(error); - } else { -#if DEBUG - @try { -#endif - NSString *name = [NSString stringWithFormat:@"%@: %@", RCTFatalExceptionName, error.localizedDescription]; - - // Truncate the localized description to 175 characters to avoid wild screen overflows - NSString *message = RCTFormatError(error.localizedDescription, error.userInfo[RCTJSStackTraceKey], 175); - - // Attach an untruncated copy of the description to the userInfo, in case it is needed - NSMutableDictionary *userInfo = [error.userInfo mutableCopy]; - [userInfo setObject:RCTFormatError(error.localizedDescription, error.userInfo[RCTJSStackTraceKey], -1) - forKey:RCTUntruncatedMessageKey]; - - // Expected resulting exception information: - // name: RCTFatalException: - // reason: - // userInfo: - @throw [[NSException alloc] initWithName:name reason:message userInfo:userInfo]; -#if DEBUG - } @catch (NSException *e) {} -#endif - } -} - -void RCTSetFatalHandler(RCTFatalHandler fatalhandler) -{ - RCTCurrentFatalHandler = fatalhandler; -} - -RCTFatalHandler RCTGetFatalHandler(void) -{ - return RCTCurrentFatalHandler; -} - -NSString *RCTFormatError(NSString *message, NSArray *> *stackTrace, NSUInteger maxMessageLength) -{ - if (maxMessageLength > 0 && message.length > maxMessageLength) { - message = [[message substringToIndex:maxMessageLength] stringByAppendingString:@"..."]; - } - - NSMutableString *prettyStack = [NSMutableString string]; - if (stackTrace) { - [prettyStack appendString:@", stack:\n"]; - - NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"\\b((?:seg-\\d+(?:_\\d+)?|\\d+)\\.js)" - options:NSRegularExpressionCaseInsensitive - error:NULL]; - for (NSDictionary *frame in stackTrace) { - NSString *fileName = [frame[@"file"] lastPathComponent]; - NSTextCheckingResult *match = fileName != nil ? [regex firstMatchInString:fileName options:0 range:NSMakeRange(0, fileName.length)] : nil; - if (match) { - fileName = [NSString stringWithFormat:@"%@:", [fileName substringWithRange:match.range]]; - } else { - fileName = @""; - } - - [prettyStack appendFormat:@"%@@%@%@:%@\n", frame[@"methodName"], fileName, frame[@"lineNumber"], frame[@"column"]]; - } - } - - return [NSString stringWithFormat:@"%@%@", message, prettyStack]; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBridge+Private.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBridge+Private.h deleted file mode 100644 index 2996d379..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBridge+Private.h +++ /dev/null @@ -1,156 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@class RCTModuleData; -@protocol RCTJavaScriptExecutor; - -RCT_EXTERN NSArray *RCTGetModuleClasses(void); - -#if RCT_DEBUG -RCT_EXTERN void RCTVerifyAllModulesExported(NSArray *extraModules); -#endif - -RCT_EXTERN void RCTRegisterModule(Class); - -@interface RCTBridge () - -// Private designated initializer -- (instancetype)initWithDelegate:(id)delegate - bundleURL:(NSURL *)bundleURL - moduleProvider:(RCTBridgeModuleListProvider)block - launchOptions:(NSDictionary *)launchOptions NS_DESIGNATED_INITIALIZER; - -// Used for the profiler flow events between JS and native -@property (nonatomic, assign) int64_t flowID; -@property (nonatomic, assign) CFMutableDictionaryRef flowIDMap; -@property (nonatomic, strong) NSLock *flowIDMapLock; - -// Used by RCTDevMenu -@property (nonatomic, copy) NSString *bridgeDescription; - -+ (instancetype)currentBridge; -+ (void)setCurrentBridge:(RCTBridge *)bridge; - -/** - * Bridge setup code - creates an instance of RCTBachedBridge. Exposed for - * test only - */ -- (void)setUp; - -/** - * This method is used to invoke a callback that was registered in the - * JavaScript application context. Safe to call from any thread. - */ -- (void)enqueueCallback:(NSNumber *)cbID args:(NSArray *)args; - -/** - * This property is mostly used on the main thread, but may be touched from - * a background thread if the RCTBridge happens to deallocate on a background - * thread. Therefore, we want all writes to it to be seen atomically. - */ -@property (atomic, strong) RCTBridge *batchedBridge; - -/** - * The block that creates the modules' instances to be added to the bridge. - * Exposed for RCTCxxBridge - */ -@property (nonatomic, copy, readonly) RCTBridgeModuleListProvider moduleProvider; - -/** - * Used by RCTDevMenu to override the `hot` param of the current bundleURL. - */ -@property (nonatomic, strong, readwrite) NSURL *bundleURL; - -@end - -@interface RCTBridge (RCTCxxBridge) - -/** - * Used by RCTModuleData - */ - -@property (nonatomic, weak, readonly) RCTBridge *parentBridge; - -/** - * Used by RCTModuleData - */ -@property (nonatomic, assign, readonly) BOOL moduleSetupComplete; - -/** - * Called on the child bridge to run the executor and start loading. - */ -- (void)start; - -/** - * Used by RCTModuleData to register the module for frame updates after it is - * lazily initialized. - */ -- (void)registerModuleForFrameUpdates:(id)module - withModuleData:(RCTModuleData *)moduleData; - -/** - * Dispatch work to a module's queue - this is also suports the fake RCTJSThread - * queue. Exposed for the RCTProfiler - */ -- (void)dispatchBlock:(dispatch_block_t)block queue:(dispatch_queue_t)queue; - -/** - * Get the module data for a given module name. Used by UIManager to implement - * the `dispatchViewManagerCommand` method. - */ -- (RCTModuleData *)moduleDataForName:(NSString *)moduleName; - -/** - * Registers additional classes with the ModuleRegistry. - */ -- (void)registerAdditionalModuleClasses:(NSArray *)newModules; - -/** - * Updates the ModuleRegistry with a pre-initialized instance. - */ -- (void)updateModuleWithInstance:(id)instance; - -/** - * Systrace profiler toggling methods exposed for the RCTDevMenu - */ -- (void)startProfiling; -- (void)stopProfiling:(void (^)(NSData *))callback; - -/** - * Synchronously call a specific native module's method and return the result - */ -- (id)callNativeModule:(NSUInteger)moduleID - method:(NSUInteger)methodID - params:(NSArray *)params; - -/** - * Hook exposed for RCTLog to send logs to JavaScript when not running in JSC - */ -- (void)logMessage:(NSString *)message level:(NSString *)level; - -/** - * Allow super fast, one time, timers to skip the queue and be directly executed - */ -- (void)_immediatelyCallTimer:(NSNumber *)timer; - -@end - -@interface RCTBridge (Inspector) - -@property (nonatomic, readonly, getter=isInspectable) BOOL inspectable; - -@end - -@interface RCTCxxBridge : RCTBridge - -@property (nonatomic) void *runtime; - -- (instancetype)initWithParentBridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBridge.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBridge.h deleted file mode 100644 index 67e41362..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBridge.h +++ /dev/null @@ -1,268 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#if __has_include() -#import -#elif __has_include("RCTBridgeDelegate.h") -#import "RCTBridgeDelegate.h" -#else -#import "React/RCTBridgeDelegate.h" -#endif -#if __has_include() -#import -#elif __has_include("RCTBridgeModule.h") -#import "RCTBridgeModule.h" -#else -#import "React/RCTBridgeModule.h" -#endif -#if __has_include() -#import -#elif __has_include("RCTDefines.h") -#import "RCTDefines.h" -#else -#import "React/RCTDefines.h" -#endif -#if __has_include() -#import -#elif __has_include("RCTFrameUpdate.h") -#import "RCTFrameUpdate.h" -#else -#import "React/RCTFrameUpdate.h" -#endif -#if __has_include() -#import -#elif __has_include("RCTInvalidating.h") -#import "RCTInvalidating.h" -#else -#import "React/RCTInvalidating.h" -#endif - -@class JSValue; -@class RCTBridge; -@class RCTEventDispatcher; -@class RCTPerformanceLogger; - -/** - * This notification fires when the bridge initializes. - */ -RCT_EXTERN NSString *const RCTJavaScriptWillStartLoadingNotification; - - -/** - * This notification fires when the bridge starts executing the JS bundle. - */ -RCT_EXTERN NSString *const RCTJavaScriptWillStartExecutingNotification; - -/** - * This notification fires when the bridge has finished loading the JS bundle. - */ -RCT_EXTERN NSString *const RCTJavaScriptDidLoadNotification; - -/** - * This notification fires when the bridge failed to load the JS bundle. The - * `error` key can be used to determine the error that occurred. - */ -RCT_EXTERN NSString *const RCTJavaScriptDidFailToLoadNotification; - -/** - * This notification fires each time a native module is instantiated. The - * `module` key will contain a reference to the newly-created module instance. - * Note that this notification may be fired before the module is available via - * the `[bridge moduleForClass:]` method. - */ -RCT_EXTERN NSString *const RCTDidInitializeModuleNotification; - -/** - * This notification fires just before the bridge starts processing a request to - * reload. - */ -RCT_EXTERN NSString *const RCTBridgeWillReloadNotification; - -/** - * This notification fires just before the bridge begins downloading a script - * from the packager. - */ -RCT_EXTERN NSString *const RCTBridgeWillDownloadScriptNotification; - -/** - * This notification fires just after the bridge finishes downloading a script - * from the packager. - */ -RCT_EXTERN NSString *const RCTBridgeDidDownloadScriptNotification; - -/** - * Key for the RCTSource object in the RCTBridgeDidDownloadScriptNotification - * userInfo dictionary. - */ -RCT_EXTERN NSString *const RCTBridgeDidDownloadScriptNotificationSourceKey; - -/** - * Key for the bridge description (NSString_ in the - * RCTBridgeDidDownloadScriptNotification userInfo dictionary. - */ -RCT_EXTERN NSString *const RCTBridgeDidDownloadScriptNotificationBridgeDescriptionKey; - -/** - * This block can be used to instantiate modules that require additional - * init parameters, or additional configuration prior to being used. - * The bridge will call this block to instatiate the modules, and will - * be responsible for invalidating/releasing them when the bridge is destroyed. - * For this reason, the block should always return new module instances, and - * module instances should not be shared between bridges. - */ -typedef NSArray> *(^RCTBridgeModuleListProvider)(void); - -/** - * This function returns the module name for a given class. - */ -RCT_EXTERN NSString *RCTBridgeModuleNameForClass(Class bridgeModuleClass); - -/** - * Experimental. - * Check/set if JSI-bound NativeModule is enabled. By default it's off. - */ -RCT_EXTERN BOOL RCTTurboModuleEnabled(void); -RCT_EXTERN void RCTEnableTurboModule(BOOL enabled); - -/** - * Async batched bridge used to communicate with the JavaScript application. - */ -@interface RCTBridge : NSObject - -/** - * Creates a new bridge with a custom RCTBridgeDelegate. - * - * All the interaction with the JavaScript context should be done using the bridge - * instance of the RCTBridgeModules. Modules will be automatically instantiated - * using the default contructor, but you can optionally pass in an array of - * pre-initialized module instances if they require additional init parameters - * or configuration. - */ -- (instancetype)initWithDelegate:(id)delegate - launchOptions:(NSDictionary *)launchOptions; - -/** - * DEPRECATED: Use initWithDelegate:launchOptions: instead - * - * The designated initializer. This creates a new bridge on top of the specified - * executor. The bridge should then be used for all subsequent communication - * with the JavaScript code running in the executor. Modules will be automatically - * instantiated using the default contructor, but you can optionally pass in an - * array of pre-initialized module instances if they require additional init - * parameters or configuration. - */ -- (instancetype)initWithBundleURL:(NSURL *)bundleURL - moduleProvider:(RCTBridgeModuleListProvider)block - launchOptions:(NSDictionary *)launchOptions; - -/** - * This method is used to call functions in the JavaScript application context. - * It is primarily intended for use by modules that require two-way communication - * with the JavaScript code. Safe to call from any thread. - */ -- (void)enqueueJSCall:(NSString *)moduleDotMethod args:(NSArray *)args; -- (void)enqueueJSCall:(NSString *)module method:(NSString *)method args:(NSArray *)args completion:(dispatch_block_t)completion; - -/** - * This method registers the file path of an additional JS segment by its ID. - * - * @experimental - */ -- (void)registerSegmentWithId:(NSUInteger)segmentId path:(NSString *)path; - -/** - * Retrieve a bridge module instance by name or class. Note that modules are - * lazily instantiated, so calling these methods for the first time with a given - * module name/class may cause the class to be sychronously instantiated, - * potentially blocking both the calling thread and main thread for a short time. - * - * Note: This method does NOT lazily load the particular module if it's not yet loaded. - */ -- (id)moduleForName:(NSString *)moduleName; -- (id)moduleForName:(NSString *)moduleName lazilyLoadIfNecessary:(BOOL)lazilyLoad; -// Note: This method lazily load the module as necessary. -- (id)moduleForClass:(Class)moduleClass; - -/** - * When a NativeModule performs a lookup for a TurboModule, we need to query - * the lookupDelegate. - */ -- (void)setRCTTurboModuleLookupDelegate:(id)turboModuleLookupDelegate; - -/** - * Convenience method for retrieving all modules conforming to a given protocol. - * Modules will be sychronously instantiated if they haven't already been, - * potentially blocking both the calling thread and main thread for a short time. - */ -- (NSArray *)modulesConformingToProtocol:(Protocol *)protocol; - -/** - * Test if a module has been initialized. Use this prior to calling - * `moduleForClass:` or `moduleForName:` if you do not want to cause the module - * to be instantiated if it hasn't been already. - */ -- (BOOL)moduleIsInitialized:(Class)moduleClass; - -/** - * All registered bridge module classes. - */ -@property (nonatomic, copy, readonly) NSArray *moduleClasses; - -/** - * URL of the script that was loaded into the bridge. - */ -@property (nonatomic, strong, readonly) NSURL *bundleURL; - -/** - * The class of the executor currently being used. Changes to this value will - * take effect after the bridge is reloaded. - */ -@property (nonatomic, strong) Class executorClass; - -/** - * The delegate provided during the bridge initialization - */ -@property (nonatomic, weak, readonly) id delegate; - -/** - * The launch options that were used to initialize the bridge. - */ -@property (nonatomic, copy, readonly) NSDictionary *launchOptions; - -/** - * Use this to check if the bridge is currently loading. - */ -@property (nonatomic, readonly, getter=isLoading) BOOL loading; - -/** - * Use this to check if the bridge has been invalidated. - */ -@property (nonatomic, readonly, getter=isValid) BOOL valid; - -/** - * Link to the Performance Logger that logs React Native perf events. - */ -@property (nonatomic, readonly, strong) RCTPerformanceLogger *performanceLogger; - -/** - * Reload the bundle and reset executor & modules. Safe to call from any thread. - */ -- (void)reload; - -/** - * Inform the bridge, and anything subscribing to it, that it should reload. - */ -- (void)requestReload __deprecated_msg("Call reload instead"); - -/** - * Says whether bridge has started receiving calls from javascript. - */ -- (BOOL)isBatchActive; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBridge.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBridge.m deleted file mode 100644 index 0ff789cf..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBridge.m +++ /dev/null @@ -1,406 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTBridge.h" -#import "RCTBridge+Private.h" - -#import - -#import "RCTConvert.h" -#import "RCTEventDispatcher.h" -#if RCT_ENABLE_INSPECTOR -#import "RCTInspectorDevServerHelper.h" -#endif -#import "RCTLog.h" -#import "RCTModuleData.h" -#import "RCTPerformanceLogger.h" -#import "RCTProfile.h" -#import "RCTReloadCommand.h" -#import "RCTUtils.h" - -NSString *const RCTJavaScriptWillStartLoadingNotification = @"RCTJavaScriptWillStartLoadingNotification"; -NSString *const RCTJavaScriptWillStartExecutingNotification = @"RCTJavaScriptWillStartExecutingNotification"; -NSString *const RCTJavaScriptDidLoadNotification = @"RCTJavaScriptDidLoadNotification"; -NSString *const RCTJavaScriptDidFailToLoadNotification = @"RCTJavaScriptDidFailToLoadNotification"; -NSString *const RCTDidInitializeModuleNotification = @"RCTDidInitializeModuleNotification"; -NSString *const RCTBridgeWillReloadNotification = @"RCTBridgeWillReloadNotification"; -NSString *const RCTBridgeWillDownloadScriptNotification = @"RCTBridgeWillDownloadScriptNotification"; -NSString *const RCTBridgeDidDownloadScriptNotification = @"RCTBridgeDidDownloadScriptNotification"; -NSString *const RCTBridgeDidDownloadScriptNotificationSourceKey = @"source"; -NSString *const RCTBridgeDidDownloadScriptNotificationBridgeDescriptionKey = @"bridgeDescription"; - -static NSMutableArray *RCTModuleClasses; -static dispatch_queue_t RCTModuleClassesSyncQueue; -NSArray *RCTGetModuleClasses(void) -{ - __block NSArray *result; - dispatch_sync(RCTModuleClassesSyncQueue, ^{ - result = [RCTModuleClasses copy]; - }); - return result; -} - -/** - * Register the given class as a bridge module. All modules must be registered - * prior to the first bridge initialization. - */ -void RCTRegisterModule(Class); -void RCTRegisterModule(Class moduleClass) -{ - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - RCTModuleClasses = [NSMutableArray new]; - RCTModuleClassesSyncQueue = dispatch_queue_create("com.facebook.react.ModuleClassesSyncQueue", DISPATCH_QUEUE_CONCURRENT); - }); - - RCTAssert([moduleClass conformsToProtocol:@protocol(RCTBridgeModule)], - @"%@ does not conform to the RCTBridgeModule protocol", - moduleClass); - - // Register module - dispatch_barrier_async(RCTModuleClassesSyncQueue, ^{ - [RCTModuleClasses addObject:moduleClass]; - }); -} - -/** - * This function returns the module name for a given class. - */ -NSString *RCTBridgeModuleNameForClass(Class cls) -{ -#if RCT_DEBUG - RCTAssert([cls conformsToProtocol:@protocol(RCTBridgeModule)], - @"Bridge module `%@` does not conform to RCTBridgeModule", cls); -#endif - - NSString *name = [cls moduleName]; - if (name.length == 0) { - name = NSStringFromClass(cls); - } - - return RCTDropReactPrefixes(name); -} - -static BOOL turboModuleEnabled = NO; -BOOL RCTTurboModuleEnabled(void) -{ - return turboModuleEnabled; -} - -void RCTEnableTurboModule(BOOL enabled) { - turboModuleEnabled = enabled; -} - -#if RCT_DEBUG -void RCTVerifyAllModulesExported(NSArray *extraModules) -{ - // Check for unexported modules - unsigned int classCount; - Class *classes = objc_copyClassList(&classCount); - - NSMutableSet *moduleClasses = [NSMutableSet new]; - [moduleClasses addObjectsFromArray:RCTGetModuleClasses()]; - [moduleClasses addObjectsFromArray:[extraModules valueForKeyPath:@"class"]]; - - for (unsigned int i = 0; i < classCount; i++) { - Class cls = classes[i]; - if (strncmp(class_getName(cls), "RCTCxxModule", strlen("RCTCxxModule")) == 0) { - continue; - } - Class superclass = cls; - while (superclass) { - if (class_conformsToProtocol(superclass, @protocol(RCTBridgeModule))) { - if ([moduleClasses containsObject:cls]) { - break; - } - - // Verify it's not a super-class of one of our moduleClasses - BOOL isModuleSuperClass = NO; - for (Class moduleClass in moduleClasses) { - if ([moduleClass isSubclassOfClass:cls]) { - isModuleSuperClass = YES; - break; - } - } - if (isModuleSuperClass) { - break; - } - - // Note: Some modules may be lazily loaded and not exported up front, so this message is no longer a warning. - RCTLogInfo(@"Class %@ was not exported. Did you forget to use RCT_EXPORT_MODULE()?", cls); - break; - } - superclass = class_getSuperclass(superclass); - } - } - - free(classes); -} -#endif - -@interface RCTBridge () -@end - -@implementation RCTBridge -{ - NSURL *_delegateBundleURL; -} - -dispatch_queue_t RCTJSThread; - -+ (void)initialize -{ - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - - // Set up JS thread - RCTJSThread = (id)kCFNull; - }); -} - -static RCTBridge *RCTCurrentBridgeInstance = nil; - -/** - * The last current active bridge instance. This is set automatically whenever - * the bridge is accessed. It can be useful for static functions or singletons - * that need to access the bridge for purposes such as logging, but should not - * be relied upon to return any particular instance, due to race conditions. - */ -+ (instancetype)currentBridge -{ - return RCTCurrentBridgeInstance; -} - -+ (void)setCurrentBridge:(RCTBridge *)currentBridge -{ - RCTCurrentBridgeInstance = currentBridge; -} - -- (instancetype)initWithDelegate:(id)delegate - launchOptions:(NSDictionary *)launchOptions -{ - return [self initWithDelegate:delegate - bundleURL:nil - moduleProvider:nil - launchOptions:launchOptions]; -} - -- (instancetype)initWithBundleURL:(NSURL *)bundleURL - moduleProvider:(RCTBridgeModuleListProvider)block - launchOptions:(NSDictionary *)launchOptions -{ - return [self initWithDelegate:nil - bundleURL:bundleURL - moduleProvider:block - launchOptions:launchOptions]; -} - -- (instancetype)initWithDelegate:(id)delegate - bundleURL:(NSURL *)bundleURL - moduleProvider:(RCTBridgeModuleListProvider)block - launchOptions:(NSDictionary *)launchOptions -{ - if (self = [super init]) { - _delegate = delegate; - _bundleURL = bundleURL; - _moduleProvider = block; - _launchOptions = [launchOptions copy]; - - [self setUp]; - } - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (void)dealloc -{ - /** - * This runs only on the main thread, but crashes the subclass - * RCTAssertMainQueue(); - */ - [self invalidate]; -} - -- (void)setRCTTurboModuleLookupDelegate:(id)turboModuleLookupDelegate -{ - [self.batchedBridge setRCTTurboModuleLookupDelegate:turboModuleLookupDelegate]; -} - -- (void)didReceiveReloadCommand -{ - [self reload]; -} - -- (NSArray *)moduleClasses -{ - return self.batchedBridge.moduleClasses; -} - -- (id)moduleForName:(NSString *)moduleName -{ - return [self.batchedBridge moduleForName:moduleName]; -} - -- (id)moduleForName:(NSString *)moduleName lazilyLoadIfNecessary:(BOOL)lazilyLoad -{ - return [self.batchedBridge moduleForName:moduleName lazilyLoadIfNecessary:lazilyLoad]; -} - -- (id)moduleForClass:(Class)moduleClass -{ - id module = [self.batchedBridge moduleForClass:moduleClass]; - if (!module) { - module = [self moduleForName:RCTBridgeModuleNameForClass(moduleClass)]; - } - return module; -} - -- (NSArray *)modulesConformingToProtocol:(Protocol *)protocol -{ - NSMutableArray *modules = [NSMutableArray new]; - for (Class moduleClass in [self.moduleClasses copy]) { - if ([moduleClass conformsToProtocol:protocol]) { - id module = [self moduleForClass:moduleClass]; - if (module) { - [modules addObject:module]; - } - } - } - return [modules copy]; -} - -- (BOOL)moduleIsInitialized:(Class)moduleClass -{ - return [self.batchedBridge moduleIsInitialized:moduleClass]; -} - -- (void)reload -{ - #if RCT_ENABLE_INSPECTOR - // Disable debugger to resume the JsVM & avoid thread locks while reloading - [RCTInspectorDevServerHelper disableDebugger]; - #endif - - [[NSNotificationCenter defaultCenter] postNotificationName:RCTBridgeWillReloadNotification object:self]; - - /** - * Any thread - */ - dispatch_async(dispatch_get_main_queue(), ^{ - // WARNING: Invalidation is async, so it may not finish before re-setting up the bridge, - // causing some issues. TODO: revisit this post-Fabric/TurboModule. - [self invalidate]; - // Reload is a special case, do not preserve launchOptions and treat reload as a fresh start - self->_launchOptions = nil; - [self setUp]; - }); -} - -- (void)requestReload -{ - [self reload]; -} - -- (Class)bridgeClass -{ - return [RCTCxxBridge class]; -} - -- (void)setUp -{ - RCT_PROFILE_BEGIN_EVENT(0, @"-[RCTBridge setUp]", nil); - - _performanceLogger = [RCTPerformanceLogger new]; - [_performanceLogger markStartForTag:RCTPLBridgeStartup]; - [_performanceLogger markStartForTag:RCTPLTTI]; - - Class bridgeClass = self.bridgeClass; - - #if RCT_DEV - RCTExecuteOnMainQueue(^{ - RCTRegisterReloadCommandListener(self); - }); - #endif - - // Only update bundleURL from delegate if delegate bundleURL has changed - NSURL *previousDelegateURL = _delegateBundleURL; - _delegateBundleURL = [self.delegate sourceURLForBridge:self]; - if (_delegateBundleURL && ![_delegateBundleURL isEqual:previousDelegateURL]) { - _bundleURL = _delegateBundleURL; - } - - // Sanitize the bundle URL - _bundleURL = [RCTConvert NSURL:_bundleURL.absoluteString]; - - self.batchedBridge = [[bridgeClass alloc] initWithParentBridge:self]; - [self.batchedBridge start]; - - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); -} - -- (BOOL)isLoading -{ - return self.batchedBridge.loading; -} - -- (BOOL)isValid -{ - return self.batchedBridge.valid; -} - -- (BOOL)isBatchActive -{ - return [_batchedBridge isBatchActive]; -} - -- (void)invalidate -{ - RCTBridge *batchedBridge = self.batchedBridge; - self.batchedBridge = nil; - - if (batchedBridge) { - RCTExecuteOnMainQueue(^{ - [batchedBridge invalidate]; - }); - } -} - -- (void)updateModuleWithInstance:(id)instance -{ - [self.batchedBridge updateModuleWithInstance:instance]; -} - -- (void)registerAdditionalModuleClasses:(NSArray *)modules -{ - [self.batchedBridge registerAdditionalModuleClasses:modules]; -} - -- (void)enqueueJSCall:(NSString *)moduleDotMethod args:(NSArray *)args -{ - NSArray *ids = [moduleDotMethod componentsSeparatedByString:@"."]; - NSString *module = ids[0]; - NSString *method = ids[1]; - [self enqueueJSCall:module method:method args:args completion:NULL]; -} - -- (void)enqueueJSCall:(NSString *)module method:(NSString *)method args:(NSArray *)args completion:(dispatch_block_t)completion -{ - [self.batchedBridge enqueueJSCall:module method:method args:args completion:completion]; -} - -- (void)enqueueCallback:(NSNumber *)cbID args:(NSArray *)args -{ - [self.batchedBridge enqueueCallback:cbID args:args]; -} - -- (void)registerSegmentWithId:(NSUInteger)segmentId path:(NSString *)path -{ - [self.batchedBridge registerSegmentWithId:segmentId path:path]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBridgeDelegate.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBridgeDelegate.h deleted file mode 100644 index 5af680e1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBridgeDelegate.h +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#if __has_include() -#import -#elif __has_include("RCTJavaScriptLoader.h") -#import "RCTJavaScriptLoader.h" -#else -#import "React/RCTJavaScriptLoader.h" -#endif - -@class RCTBridge; -@protocol RCTBridgeModule; - -@protocol RCTBridgeDelegate - -/** - * The location of the JavaScript source file. When running from the packager - * this should be an absolute URL, e.g. `http://localhost:8081/index.ios.bundle`. - * When running from a locally bundled JS file, this should be a `file://` url - * pointing to a path inside the app resources, e.g. `file://.../main.jsbundle`. - */ -- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge; - -@optional - -/** - * The bridge initializes any registered RCTBridgeModules automatically, however - * if you wish to instantiate your own module instances, you can return them - * from this method. - * - * Note: You should always return a new instance for each call, rather than - * returning the same instance each time the bridge is reloaded. Module instances - * should not be shared between bridges, and this may cause unexpected behavior. - * - * It is also possible to override standard modules with your own implementations - * by returning a class with the same `moduleName` from this method, but this is - * not recommended in most cases - if the module methods and behavior do not - * match exactly, it may lead to bugs or crashes. - */ -- (NSArray> *)extraModulesForBridge:(RCTBridge *)bridge; - -/** - * Configure whether the JSCExecutor created should use the system JSC API or - * alternative hooks provided. When returning YES from this method, you must have - * previously called facebook::react::setCustomJSCWrapper. - * - * @experimental - */ -- (BOOL)shouldBridgeUseCustomJSC:(RCTBridge *)bridge; - -/** -* The bridge will call this method when a module been called from JS -* cannot be found among registered modules. -* It should return YES if the module with name 'moduleName' was registered -* in the implementation, and the system must attempt to look for it again among registered. -* If the module was not registered, return NO to prevent further searches. -*/ -- (BOOL)bridge:(RCTBridge *)bridge didNotFindModule:(NSString *)moduleName; - -/** - * The bridge will automatically attempt to load the JS source code from the - * location specified by the `sourceURLForBridge:` method, however, if you want - * to handle loading the JS yourself, you can do so by implementing this method. - */ -- (void)loadSourceForBridge:(RCTBridge *)bridge - onProgress:(RCTSourceLoadProgressBlock)onProgress - onComplete:(RCTSourceLoadBlock)loadCallback; - -/** - * Similar to loadSourceForBridge:onProgress:onComplete: but without progress - * reporting. - */ -- (void)loadSourceForBridge:(RCTBridge *)bridge - withBlock:(RCTSourceLoadBlock)loadCallback; - -/** - * Retrieve the list of lazy-native-modules names for the given bridge. - */ -- (NSDictionary *)extraLazyModuleClassesForBridge:(RCTBridge *)bridge; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBridgeMethod.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBridgeMethod.h deleted file mode 100644 index c67799e0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBridgeMethod.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@class RCTBridge; - -typedef NS_ENUM(NSUInteger, RCTFunctionType) { - RCTFunctionTypeNormal, - RCTFunctionTypePromise, - RCTFunctionTypeSync, -}; - -static inline const char *RCTFunctionDescriptorFromType(RCTFunctionType type) { - switch (type) { - case RCTFunctionTypeNormal: - return "async"; - case RCTFunctionTypePromise: - return "promise"; - case RCTFunctionTypeSync: - return "sync"; - } -}; - -@protocol RCTBridgeMethod - -@property (nonatomic, readonly) const char *JSMethodName; -@property (nonatomic, readonly) RCTFunctionType functionType; - -- (id)invokeWithBridge:(RCTBridge *)bridge - module:(id)module - arguments:(NSArray *)arguments; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBridgeModule.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBridgeModule.h deleted file mode 100644 index 167be706..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBridgeModule.h +++ /dev/null @@ -1,368 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#if __has_include() -#import -#elif __has_include("RCTDefines.h") -#import "RCTDefines.h" -#else -#import "React/RCTDefines.h" -#endif - -@class RCTBridge; -@protocol RCTBridgeMethod; - -/** - * The type of a block that is capable of sending a response to a bridged - * operation. Use this for returning callback methods to JS. - */ -typedef void (^RCTResponseSenderBlock)(NSArray *response); - -/** - * The type of a block that is capable of sending an error response to a - * bridged operation. Use this for returning error information to JS. - */ -typedef void (^RCTResponseErrorBlock)(NSError *error); - -/** - * Block that bridge modules use to resolve the JS promise waiting for a result. - * Nil results are supported and are converted to JS's undefined value. - */ -typedef void (^RCTPromiseResolveBlock)(id result); - -/** - * Block that bridge modules use to reject the JS promise waiting for a result. - * The error may be nil but it is preferable to pass an NSError object for more - * precise error messages. - */ -typedef void (^RCTPromiseRejectBlock)(NSString *code, NSString *message, NSError *error); - -/** - * This constant can be returned from +methodQueue to force module - * methods to be called on the JavaScript thread. This can have serious - * implications for performance, so only use this if you're sure it's what - * you need. - * - * NOTE: RCTJSThread is not a real libdispatch queue - */ -RCT_EXTERN dispatch_queue_t RCTJSThread; - -RCT_EXTERN_C_BEGIN - -typedef struct RCTMethodInfo { - const char *const jsName; - const char *const objcName; - const BOOL isSync; -} RCTMethodInfo; - -RCT_EXTERN_C_END - -/** - * Provides the interface needed to register a bridge module. - */ -@protocol RCTBridgeModule - -/** - * Place this macro in your class implementation to automatically register - * your module with the bridge when it loads. The optional js_name argument - * will be used as the JS module name. If omitted, the JS module name will - * match the Objective-C class name. - */ -#define RCT_EXPORT_MODULE(js_name) \ -RCT_EXTERN void RCTRegisterModule(Class); \ -+ (NSString *)moduleName { return @#js_name; } \ -+ (void)load { RCTRegisterModule(self); } - -/** - * Same as RCT_EXPORT_MODULE, but uses __attribute__((constructor)) for module - * registration. Useful for registering swift classes that forbids use of load - * Used in RCT_EXTERN_REMAP_MODULE - */ -#define RCT_EXPORT_MODULE_NO_LOAD(js_name, objc_name) \ -RCT_EXTERN void RCTRegisterModule(Class); \ -+ (NSString *)moduleName { return @#js_name; } \ -__attribute__((constructor)) static void \ -RCT_CONCAT(initialize_, objc_name)() { RCTRegisterModule([objc_name class]); } - -/** - * To improve startup performance users may want to generate their module lists - * at build time and hook the delegate to merge with the runtime list. This - * macro takes the place of the above for those cases by omitting the +load - * generation. - * - */ -#define RCT_EXPORT_PRE_REGISTERED_MODULE(js_name) \ -+ (NSString *)moduleName { return @#js_name; } - -// Implemented by RCT_EXPORT_MODULE -+ (NSString *)moduleName; - -@optional - -/** - * A reference to the RCTBridge. Useful for modules that require access - * to bridge features, such as sending events or making JS calls. This - * will be set automatically by the bridge when it initializes the module. - * To implement this in your module, just add `@synthesize bridge = _bridge;` - * If using Swift, add `@objc var bridge: RCTBridge!` to your module. - */ -@property (nonatomic, weak, readonly) RCTBridge *bridge; - -/** - * The queue that will be used to call all exported methods. If omitted, this - * will call on a default background queue, which is avoids blocking the main - * thread. - * - * If the methods in your module need to interact with UIKit methods, they will - * probably need to call those on the main thread, as most of UIKit is main- - * thread-only. You can tell React Native to call your module methods on the - * main thread by returning a reference to the main queue, like this: - * - * - (dispatch_queue_t)methodQueue - * { - * return dispatch_get_main_queue(); - * } - * - * If you don't want to specify the queue yourself, but you need to use it - * inside your class (e.g. if you have internal methods that need to dispatch - * onto that queue), you can just add `@synthesize methodQueue = _methodQueue;` - * and the bridge will populate the methodQueue property for you automatically - * when it initializes the module. - */ -@property (nonatomic, strong, readonly) dispatch_queue_t methodQueue; - -/** - * Wrap the parameter line of your method implementation with this macro to - * expose it to JS. By default the exposed method will match the first part of - * the Objective-C method selector name (up to the first colon). Use - * RCT_REMAP_METHOD to specify the JS name of the method. - * - * For example, in ModuleName.m: - * - * - (void)doSomething:(NSString *)aString withA:(NSInteger)a andB:(NSInteger)b - * { ... } - * - * becomes - * - * RCT_EXPORT_METHOD(doSomething:(NSString *)aString - * withA:(NSInteger)a - * andB:(NSInteger)b) - * { ... } - * - * and is exposed to JavaScript as `NativeModules.ModuleName.doSomething`. - * - * ## Promises - * - * Bridge modules can also define methods that are exported to JavaScript as - * methods that return a Promise, and are compatible with JS async functions. - * - * Declare the last two parameters of your native method to be a resolver block - * and a rejecter block. The resolver block must precede the rejecter block. - * - * For example: - * - * RCT_EXPORT_METHOD(doSomethingAsync:(NSString *)aString - * resolver:(RCTPromiseResolveBlock)resolve - * rejecter:(RCTPromiseRejectBlock)reject - * { ... } - * - * Calling `NativeModules.ModuleName.doSomethingAsync(aString)` from - * JavaScript will return a promise that is resolved or rejected when your - * native method implementation calls the respective block. - * - */ -#define RCT_EXPORT_METHOD(method) \ - RCT_REMAP_METHOD(, method) - -/** - * Same as RCT_EXPORT_METHOD but the method is called from JS - * synchronously **on the JS thread**, possibly returning a result. - * - * WARNING: in the vast majority of cases, you should use RCT_EXPORT_METHOD which - * allows your native module methods to be called asynchronously: calling - * methods synchronously can have strong performance penalties and introduce - * threading-related bugs to your native modules. - * - * The return type must be of object type (id) and should be serializable - * to JSON. This means that the hook can only return nil or JSON values - * (e.g. NSNumber, NSString, NSArray, NSDictionary). - * - * Calling these methods when running under the websocket executor - * is currently not supported. - */ -#define RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(method) \ - RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(id, method) - -#define RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(returnType, method) \ - RCT_REMAP_BLOCKING_SYNCHRONOUS_METHOD(, returnType, method) - - -/** - * Similar to RCT_EXPORT_METHOD but lets you set the JS name of the exported - * method. Example usage: - * - * RCT_REMAP_METHOD(executeQueryWithParameters, - * executeQuery:(NSString *)query parameters:(NSDictionary *)parameters) - * { ... } - */ -#define RCT_REMAP_METHOD(js_name, method) \ - _RCT_EXTERN_REMAP_METHOD(js_name, method, NO) \ - - (void)method RCT_DYNAMIC; - -/** - * Similar to RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD but lets you set - * the JS name of the exported method. Example usage: - * - * RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(executeQueryWithParameters, - * executeQuery:(NSString *)query parameters:(NSDictionary *)parameters) - * { ... } - */ -#define RCT_REMAP_BLOCKING_SYNCHRONOUS_METHOD(js_name, returnType, method) \ - _RCT_EXTERN_REMAP_METHOD(js_name, method, YES) \ - - (returnType)method RCT_DYNAMIC; - -/** - * Use this macro in a private Objective-C implementation file to automatically - * register an external module with the bridge when it loads. This allows you to - * register Swift or private Objective-C classes with the bridge. - * - * For example if one wanted to export a Swift class to the bridge: - * - * MyModule.swift: - * - * @objc(MyModule) class MyModule: NSObject { - * - * @objc func doSomething(string: String! withFoo a: Int, bar b: Int) { ... } - * - * } - * - * MyModuleExport.m: - * - * #import - * - * @interface RCT_EXTERN_MODULE(MyModule, NSObject) - * - * RCT_EXTERN_METHOD(doSomething:(NSString *)string withFoo:(NSInteger)a bar:(NSInteger)b) - * - * @end - * - * This will now expose MyModule and the method to JavaScript via - * `NativeModules.MyModule.doSomething` - */ -#define RCT_EXTERN_MODULE(objc_name, objc_supername) \ - RCT_EXTERN_REMAP_MODULE(, objc_name, objc_supername) - -/** - * Like RCT_EXTERN_MODULE, but allows setting a custom JavaScript name. - */ -#define RCT_EXTERN_REMAP_MODULE(js_name, objc_name, objc_supername) \ - objc_name : objc_supername \ - @end \ - @interface objc_name (RCTExternModule) \ - @end \ - @implementation objc_name (RCTExternModule) \ - RCT_EXPORT_MODULE_NO_LOAD(js_name, objc_name) - -/** - * Use this macro in accordance with RCT_EXTERN_MODULE to export methods - * of an external module. - */ -#define RCT_EXTERN_METHOD(method) \ - _RCT_EXTERN_REMAP_METHOD(, method, NO) - -/** - * Use this macro in accordance with RCT_EXTERN_MODULE to export methods - * of an external module that should be invoked synchronously. - */ -#define RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(method) \ - _RCT_EXTERN_REMAP_METHOD(, method, YES) - -/** - * Like RCT_EXTERN_REMAP_METHOD, but allows setting a custom JavaScript name - * and also whether this method is synchronous. - */ -#define _RCT_EXTERN_REMAP_METHOD(js_name, method, is_blocking_synchronous_method) \ - + (const RCTMethodInfo *)RCT_CONCAT(__rct_export__, RCT_CONCAT(js_name, RCT_CONCAT(__LINE__, __COUNTER__))) { \ - static RCTMethodInfo config = {#js_name, #method, is_blocking_synchronous_method}; \ - return &config; \ - } - -/** - * Most modules can be used from any thread. All of the modules exported non-sync method will be called on its - * methodQueue, and the module will be constructed lazily when its first invoked. Some modules have main need to access - * information that's main queue only (e.g. most UIKit classes). Since we don't want to dispatch synchronously to the - * main thread to this safely, we construct these moduels and export their constants ahead-of-time. - * - * Note that when set to false, the module constructor will be called from any thread. - * - * This requirement is currently inferred by checking if the module has a custom initializer or if there's exported - * constants. In the future, we'll stop automatically inferring this and instead only rely on this method. - */ -+ (BOOL)requiresMainQueueSetup; - -/** - * Injects methods into JS. Entries in this array are used in addition to any - * methods defined using the macros above. This method is called only once, - * before registration. - */ -- (NSArray> *)methodsToExport; - -/** - * Injects constants into JS. These constants are made accessible via NativeModules.ModuleName.X. It is only called once - * for the lifetime of the bridge, so it is not suitable for returning dynamic values, but may be used for long-lived - * values such as session keys, that are regenerated only as part of a reload of the entire React application. - * - * If you implement this method and do not implement `requiresMainQueueSetup`, you will trigger deprecated logic - * that eagerly initializes your module on bridge startup. In the future, this behaviour will be changed to default - * to initializing lazily, and even modules with constants will be initialized lazily. - */ -- (NSDictionary *)constantsToExport; - -/** - * Notifies the module that a batch of JS method invocations has just completed. - */ -- (void)batchDidComplete; - -/** - * Notifies the module that the active batch of JS method invocations has been - * partially flushed. - * - * This occurs before -batchDidComplete, and more frequently. - */ -- (void)partialBatchDidFlush; - -@end - -/** - * A protocol that allows TurboModules to do lookup on other TurboModules. - * Calling these methods may cause a module to be synchronously instantiated. - */ - @protocol RCTTurboModuleLookupDelegate - - (id)moduleForName:(const char *)moduleName; - - /** - * Rationale: - * When TurboModules lookup other modules by name, we first check the TurboModule - * registry to see if a TurboModule exists with the respective name. In this case, - * we don't want a RedBox to be raised if the TurboModule isn't found. - * - * This method is deprecated and will be deleted after the migration from - * TurboModules to TurboModules is complete. - */ - - (id)moduleForName:(const char *)moduleName warnOnLookupFailure:(BOOL)warnOnLookupFailure; - - (BOOL)moduleIsInitialized:(const char *)moduleName; - @end - -/** - * Experimental. - * A protocol to declare that a class supports TurboModule. - * This may be removed in the future. - * See RCTTurboModule.h for actual signature. - */ -@protocol RCTTurboModule; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBundleURLProvider.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBundleURLProvider.h deleted file mode 100644 index 75be4f73..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBundleURLProvider.h +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#if defined(__cplusplus) -extern "C" { -#endif - -extern NSString *const RCTBundleURLProviderUpdatedNotification; - -extern const NSUInteger kRCTBundleURLProviderDefaultPort; - -#if defined(__cplusplus) -} -#endif - -@interface RCTBundleURLProvider : NSObject - -/** - * Set default settings on NSUserDefaults. - */ -- (void)setDefaults; - -/** - * Reset every settings to default. - */ -- (void)resetToDefaults; - -/** - * Returns the jsBundleURL for a given bundle entrypoint and - * the fallback offline JS bundle if the packager is not running. - * if resourceName or extension are nil, "main" and "jsbundle" will be - * used, respectively. - */ -- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot - fallbackResource:(NSString *)resourceName - fallbackExtension:(NSString *)extension; - -/** - * Returns the jsBundleURL for a given bundle entrypoint and - * the fallback offline JS bundle if the packager is not running. - */ -- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot - fallbackResource:(NSString *)resourceName; - -/** - * Returns the jsBundleURL for a given bundle entrypoint and - * the fallback offline JS bundle. If resourceName or extension - * are nil, "main" and "jsbundle" will be used, respectively. - */ -- (NSURL *)jsBundleURLForFallbackResource:(NSString *)resourceName - fallbackExtension:(NSString *)extension; - -/** - * Returns the resourceURL for a given bundle entrypoint and - * the fallback offline resource file if the packager is not running. - */ -- (NSURL *)resourceURLForResourceRoot:(NSString *)root - resourceName:(NSString *)name - resourceExtension:(NSString *)extension - offlineBundle:(NSBundle *)offlineBundle; - -/** - * The IP address or hostname of the packager. - */ -@property (nonatomic, copy) NSString *jsLocation; - -@property (nonatomic, assign) BOOL enableLiveReload; -@property (nonatomic, assign) BOOL enableMinification; -@property (nonatomic, assign) BOOL enableDev; - -+ (instancetype)sharedSettings; - -/** - Given a hostname for the packager and a bundle root, returns the URL to the js bundle. Generally you should use the - instance method -jsBundleURLForBundleRoot:fallbackResource: which includes logic to guess if the packager is running - and fall back to a pre-packaged bundle if it is not. - */ -+ (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot - packagerHost:(NSString *)packagerHost - enableDev:(BOOL)enableDev - enableMinification:(BOOL)enableMinification; - -/** - * Given a hostname for the packager and a resource path (including "/"), return the URL to the resource. - * In general, please use the instance method to decide if the packager is running and fallback to the pre-packaged - * resource if it is not: -resourceURLForResourceRoot:resourceName:resourceExtension:offlineBundle: - */ -+ (NSURL *)resourceURLForResourcePath:(NSString *)path - packagerHost:(NSString *)packagerHost - query:(NSString *)query; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBundleURLProvider.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBundleURLProvider.m deleted file mode 100644 index c3142bae..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTBundleURLProvider.m +++ /dev/null @@ -1,235 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTBundleURLProvider.h" - -#import "RCTConvert.h" -#import "RCTDefines.h" - -NSString *const RCTBundleURLProviderUpdatedNotification = @"RCTBundleURLProviderUpdatedNotification"; - -const NSUInteger kRCTBundleURLProviderDefaultPort = RCT_METRO_PORT; - -static NSString *const kRCTJsLocationKey = @"RCT_jsLocation"; -static NSString *const kRCTEnableLiveReloadKey = @"RCT_enableLiveReload"; -static NSString *const kRCTEnableDevKey = @"RCT_enableDev"; -static NSString *const kRCTEnableMinificationKey = @"RCT_enableMinification"; - -@implementation RCTBundleURLProvider - -- (instancetype)init -{ - self = [super init]; - if (self) { - [self setDefaults]; - } - return self; -} - -- (NSDictionary *)defaults -{ - return @{ - kRCTEnableLiveReloadKey: @NO, - kRCTEnableDevKey: @YES, - kRCTEnableMinificationKey: @NO, - }; -} - -- (void)settingsUpdated -{ - [[NSNotificationCenter defaultCenter] postNotificationName:RCTBundleURLProviderUpdatedNotification object:self]; -} - -- (void)setDefaults -{ - [[NSUserDefaults standardUserDefaults] registerDefaults:[self defaults]]; -} - -- (void)resetToDefaults -{ - for (NSString *key in [[self defaults] allKeys]) { - [[NSUserDefaults standardUserDefaults] removeObjectForKey:key]; - } - [self setDefaults]; - [self settingsUpdated]; -} - -static NSURL *serverRootWithHost(NSString *host) -{ - return [NSURL URLWithString: - [NSString stringWithFormat:@"http://%@:%lu/", - host, (unsigned long)kRCTBundleURLProviderDefaultPort]]; -} - -#if RCT_DEV -- (BOOL)isPackagerRunning:(NSString *)host -{ - NSURL *url = [serverRootWithHost(host) URLByAppendingPathComponent:@"status"]; - NSURLRequest *request = [NSURLRequest requestWithURL:url]; - NSURLResponse *response; - NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:NULL]; - NSString *status = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - return [status isEqualToString:@"packager-status:running"]; -} - -- (NSString *)guessPackagerHost -{ - static NSString *ipGuess; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - NSString *ipPath = [[NSBundle mainBundle] pathForResource:@"ip" ofType:@"txt"]; - ipGuess = [[NSString stringWithContentsOfFile:ipPath encoding:NSUTF8StringEncoding error:nil] - stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]]; - }); - - NSString *host = ipGuess ?: @"localhost"; - if ([self isPackagerRunning:host]) { - return host; - } - return nil; -} -#endif - -- (NSString *)packagerServerHost -{ - NSString *location = [self jsLocation]; - if (location != nil) { - return location; - } -#if RCT_DEV - NSString *host = [self guessPackagerHost]; - if (host) { - return host; - } -#endif - return nil; -} - -- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot fallbackResource:(NSString *)resourceName fallbackExtension:(NSString *)extension -{ - NSString *packagerServerHost = [self packagerServerHost]; - if (!packagerServerHost) { - return [self jsBundleURLForFallbackResource:resourceName fallbackExtension:extension]; - } else { - return [RCTBundleURLProvider jsBundleURLForBundleRoot:bundleRoot - packagerHost:packagerServerHost - enableDev:[self enableDev] - enableMinification:[self enableMinification]]; - } -} - -- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot fallbackResource:(NSString *)resourceName -{ - return [self jsBundleURLForBundleRoot:bundleRoot fallbackResource:resourceName fallbackExtension:nil]; -} - -- (NSURL *)jsBundleURLForFallbackResource:(NSString *)resourceName - fallbackExtension:(NSString *)extension -{ - resourceName = resourceName ?: @"main"; - extension = extension ?: @"jsbundle"; - return [[NSBundle mainBundle] URLForResource:resourceName withExtension:extension]; -} - -- (NSURL *)resourceURLForResourceRoot:(NSString *)root - resourceName:(NSString *)name - resourceExtension:(NSString *)extension - offlineBundle:(NSBundle *)offlineBundle -{ - NSString *packagerServerHost = [self packagerServerHost]; - if (!packagerServerHost) { - // Serve offline bundle (local file) - NSBundle *bundle = offlineBundle ?: [NSBundle mainBundle]; - return [bundle URLForResource:name withExtension:extension]; - } - NSString *path = [NSString stringWithFormat:@"/%@/%@.%@", root, name, extension]; - return [[self class] resourceURLForResourcePath:path packagerHost:packagerServerHost query:nil]; -} - -+ (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot - packagerHost:(NSString *)packagerHost - enableDev:(BOOL)enableDev - enableMinification:(BOOL)enableMinification -{ - NSString *path = [NSString stringWithFormat:@"/%@.bundle", bundleRoot]; - // When we support only iOS 8 and above, use queryItems for a better API. - NSString *query = [NSString stringWithFormat:@"platform=ios&dev=%@&minify=%@", - enableDev ? @"true" : @"false", - enableMinification ? @"true": @"false"]; - return [[self class] resourceURLForResourcePath:path packagerHost:packagerHost query:query]; -} - -+ (NSURL *)resourceURLForResourcePath:(NSString *)path - packagerHost:(NSString *)packagerHost - query:(NSString *)query -{ - NSURLComponents *components = [NSURLComponents componentsWithURL:serverRootWithHost(packagerHost) resolvingAgainstBaseURL:NO]; - components.path = path; - if (query != nil) { - components.query = query; - } - return components.URL; -} - -- (void)updateValue:(id)object forKey:(NSString *)key -{ - [[NSUserDefaults standardUserDefaults] setObject:object forKey:key]; - [[NSUserDefaults standardUserDefaults] synchronize]; - [self settingsUpdated]; -} - -- (BOOL)enableDev -{ - return [[NSUserDefaults standardUserDefaults] boolForKey:kRCTEnableDevKey]; -} - -- (BOOL)enableLiveReload -{ - return [[NSUserDefaults standardUserDefaults] boolForKey:kRCTEnableLiveReloadKey]; -} - -- (BOOL)enableMinification -{ - return [[NSUserDefaults standardUserDefaults] boolForKey:kRCTEnableMinificationKey]; -} - -- (NSString *)jsLocation -{ - return [[NSUserDefaults standardUserDefaults] stringForKey:kRCTJsLocationKey]; -} - -- (void)setEnableDev:(BOOL)enableDev -{ - [self updateValue:@(enableDev) forKey:kRCTEnableDevKey]; -} - -- (void)setEnableLiveReload:(BOOL)enableLiveReload -{ - [self updateValue:@(enableLiveReload) forKey:kRCTEnableLiveReloadKey]; -} - -- (void)setJsLocation:(NSString *)jsLocation -{ - [self updateValue:jsLocation forKey:kRCTJsLocationKey]; -} - -- (void)setEnableMinification:(BOOL)enableMinification -{ - [self updateValue:@(enableMinification) forKey:kRCTEnableMinificationKey]; -} - -+ (instancetype)sharedSettings -{ - static RCTBundleURLProvider *sharedInstance; - static dispatch_once_t once_token; - dispatch_once(&once_token, ^{ - sharedInstance = [RCTBundleURLProvider new]; - }); - return sharedInstance; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTConvert.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTConvert.h deleted file mode 100644 index 219a06a7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTConvert.h +++ /dev/null @@ -1,266 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -#import -#import -#import -#import -#import -#import -#import -#if TARGET_OS_IPHONE && WEBKIT_IOS_10_APIS_AVAILABLE -#import -#endif - -/** - * This class provides a collection of conversion functions for mapping - * JSON objects to native types and classes. These are useful when writing - * custom RCTViewManager setter methods. - */ -@interface RCTConvert : NSObject - -+ (id)id:(id)json; - -+ (BOOL)BOOL:(id)json; -+ (double)double:(id)json; -+ (float)float:(id)json; -+ (int)int:(id)json; - -+ (int64_t)int64_t:(id)json; -+ (uint64_t)uint64_t:(id)json; - -+ (NSInteger)NSInteger:(id)json; -+ (NSUInteger)NSUInteger:(id)json; - -+ (NSArray *)NSArray:(id)json; -+ (NSDictionary *)NSDictionary:(id)json; -+ (NSString *)NSString:(id)json; -+ (NSNumber *)NSNumber:(id)json; - -+ (NSSet *)NSSet:(id)json; -+ (NSData *)NSData:(id)json; -+ (NSIndexSet *)NSIndexSet:(id)json; - -+ (NSURLRequestCachePolicy)NSURLRequestCachePolicy:(id)json; -+ (NSURL *)NSURL:(id)json; -+ (NSURLRequest *)NSURLRequest:(id)json; - -typedef NSURL RCTFileURL; -+ (RCTFileURL *)RCTFileURL:(id)json; - -+ (NSDate *)NSDate:(id)json; -+ (NSLocale *)NSLocale:(id)json; -+ (NSTimeZone *)NSTimeZone:(id)json; -+ (NSTimeInterval)NSTimeInterval:(id)json; - -+ (NSLineBreakMode)NSLineBreakMode:(id)json; -+ (NSTextAlignment)NSTextAlignment:(id)json; -+ (NSUnderlineStyle)NSUnderlineStyle:(id)json; -+ (NSWritingDirection)NSWritingDirection:(id)json; -+ (UITextAutocapitalizationType)UITextAutocapitalizationType:(id)json; -+ (UITextFieldViewMode)UITextFieldViewMode:(id)json; -+ (UIKeyboardType)UIKeyboardType:(id)json; -+ (UIKeyboardAppearance)UIKeyboardAppearance:(id)json; -+ (UIReturnKeyType)UIReturnKeyType:(id)json; -#if !TARGET_OS_TV -+ (UIDataDetectorTypes)UIDataDetectorTypes:(id)json; -#endif - -#if TARGET_OS_IPHONE && WEBKIT_IOS_10_APIS_AVAILABLE -+ (WKDataDetectorTypes)WKDataDetectorTypes:(id)json; -#endif - -+ (UIViewContentMode)UIViewContentMode:(id)json; -#if !TARGET_OS_TV -+ (UIBarStyle)UIBarStyle:(id)json; -#endif - -+ (CGFloat)CGFloat:(id)json; -+ (CGPoint)CGPoint:(id)json; -+ (CGSize)CGSize:(id)json; -+ (CGRect)CGRect:(id)json; -+ (UIEdgeInsets)UIEdgeInsets:(id)json; - -+ (CGLineCap)CGLineCap:(id)json; -+ (CGLineJoin)CGLineJoin:(id)json; - -+ (CGAffineTransform)CGAffineTransform:(id)json; - -+ (UIColor *)UIColor:(id)json; -+ (CGColorRef)CGColor:(id)json CF_RETURNS_NOT_RETAINED; - -+ (YGValue)YGValue:(id)json; - -+ (NSArray *)NSArrayArray:(id)json; -+ (NSArray *)NSStringArray:(id)json; -+ (NSArray *> *)NSStringArrayArray:(id)json; -+ (NSArray *)NSDictionaryArray:(id)json; -+ (NSArray *)NSURLArray:(id)json; -+ (NSArray *)RCTFileURLArray:(id)json; -+ (NSArray *)NSNumberArray:(id)json; -+ (NSArray *)UIColorArray:(id)json; - -typedef NSArray CGColorArray; -+ (CGColorArray *)CGColorArray:(id)json; - -/** - * Convert a JSON object to a Plist-safe equivalent by stripping null values. - */ -typedef id NSPropertyList; -+ (NSPropertyList)NSPropertyList:(id)json; - -typedef BOOL css_backface_visibility_t; -+ (YGOverflow)YGOverflow:(id)json; -+ (YGDisplay)YGDisplay:(id)json; -+ (css_backface_visibility_t)css_backface_visibility_t:(id)json; -+ (YGFlexDirection)YGFlexDirection:(id)json; -+ (YGJustify)YGJustify:(id)json; -+ (YGAlign)YGAlign:(id)json; -+ (YGPositionType)YGPositionType:(id)json; -+ (YGWrap)YGWrap:(id)json; -+ (YGDirection)YGDirection:(id)json; - -+ (RCTPointerEvents)RCTPointerEvents:(id)json; -+ (RCTAnimationType)RCTAnimationType:(id)json; -+ (RCTBorderStyle)RCTBorderStyle:(id)json; -+ (RCTTextDecorationLineType)RCTTextDecorationLineType:(id)json; - -@end - -@interface RCTConvert (Deprecated) - -/** - * Use lightweight generics syntax instead, e.g. NSArray - */ -typedef NSArray NSArrayArray __deprecated_msg("Use NSArray"); -typedef NSArray NSStringArray __deprecated_msg("Use NSArray"); -typedef NSArray NSStringArrayArray __deprecated_msg("Use NSArray *>"); -typedef NSArray NSDictionaryArray __deprecated_msg("Use NSArray"); -typedef NSArray NSURLArray __deprecated_msg("Use NSArray"); -typedef NSArray RCTFileURLArray __deprecated_msg("Use NSArray"); -typedef NSArray NSNumberArray __deprecated_msg("Use NSArray"); -typedef NSArray UIColorArray __deprecated_msg("Use NSArray"); - -/** - * Synchronous image loading is generally a bad idea for performance reasons. - * If you need to pass image references, try to use `RCTImageSource` and then - * `RCTImageLoader` instead of converting directly to a UIImage. - */ -+ (UIImage *)UIImage:(id)json; -+ (CGImageRef)CGImage:(id)json CF_RETURNS_NOT_RETAINED; - -@end - -/** - * Underlying implementations of RCT_XXX_CONVERTER macros. Ignore these. - */ -RCT_EXTERN NSNumber *RCTConvertEnumValue(const char *, NSDictionary *, NSNumber *, id); -RCT_EXTERN NSNumber *RCTConvertMultiEnumValue(const char *, NSDictionary *, NSNumber *, id); -RCT_EXTERN NSArray *RCTConvertArrayValue(SEL, id); - -/** - * This macro is used for logging conversion errors. This is just used to - * avoid repeating the same boilerplate for every error message. - */ -#define RCTLogConvertError(json, typeName) \ -RCTLogError(@"JSON value '%@' of type %@ cannot be converted to %@", \ -json, [json classForCoder], typeName) - -/** - * This macro is used for creating simple converter functions that just call - * the specified getter method on the json value. - */ -#define RCT_CONVERTER(type, name, getter) \ -RCT_CUSTOM_CONVERTER(type, name, [json getter]) - -/** - * This macro is used for creating converter functions with arbitrary logic. - */ -#define RCT_CUSTOM_CONVERTER(type, name, code) \ -+ (type)name:(id)json RCT_DYNAMIC \ -{ \ - if (!RCT_DEBUG) { \ - return code; \ - } else { \ - @try { \ - return code; \ - } \ - @catch (__unused NSException *e) { \ - RCTLogConvertError(json, @#type); \ - json = nil; \ - return code; \ - } \ - } \ -} - -/** - * This macro is similar to RCT_CONVERTER, but specifically geared towards - * numeric types. It will handle string input correctly, and provides more - * detailed error reporting if an invalid value is passed in. - */ -#define RCT_NUMBER_CONVERTER(type, getter) \ -RCT_CUSTOM_CONVERTER(type, type, [RCT_DEBUG ? [self NSNumber:json] : json getter]) - -/** - * When using RCT_ENUM_CONVERTER in ObjC, the compiler is OK with us returning - * the underlying NSInteger/NSUInteger. In ObjC++, this is a type mismatch and - * we need to explicitly cast the return value to expected enum return type. - */ -#ifdef __cplusplus -#define _RCT_CAST(type, expr) static_cast(expr) -#else -#define _RCT_CAST(type, expr) expr -#endif - -/** - * This macro is used for creating converters for enum types. - */ -#define RCT_ENUM_CONVERTER(type, values, default, getter) \ -+ (type)type:(id)json RCT_DYNAMIC \ -{ \ - static NSDictionary *mapping; \ - static dispatch_once_t onceToken; \ - dispatch_once(&onceToken, ^{ \ - mapping = values; \ - }); \ - return _RCT_CAST(type, [RCTConvertEnumValue(#type, mapping, @(default), json) getter]); \ -} - -/** - * This macro is used for creating converters for enum types for - * multiple enum values combined with | operator - */ -#define RCT_MULTI_ENUM_CONVERTER(type, values, default, getter) \ -+ (type)type:(id)json RCT_DYNAMIC \ -{ \ - static NSDictionary *mapping; \ - static dispatch_once_t onceToken; \ - dispatch_once(&onceToken, ^{ \ - mapping = values; \ - }); \ - return _RCT_CAST(type, [RCTConvertMultiEnumValue(#type, mapping, @(default), json) getter]); \ -} - -/** - * This macro is used for creating explicitly-named converter functions - * for typed arrays. - */ -#define RCT_ARRAY_CONVERTER_NAMED(type, name) \ -+ (NSArray *)name##Array:(id)json RCT_DYNAMIC \ -{ \ - return RCTConvertArrayValue(@selector(name:), json); \ -} - -/** - * This macro is used for creating converter functions for typed arrays. - * RCT_ARRAY_CONVERTER_NAMED may be used when type contains characters - * which are disallowed in selector names. - */ -#define RCT_ARRAY_CONVERTER(type) RCT_ARRAY_CONVERTER_NAMED(type, type) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTConvert.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTConvert.m deleted file mode 100644 index fcb8ec16..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTConvert.m +++ /dev/null @@ -1,810 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTConvert.h" - -#import - -#import - -#import "RCTDefines.h" -#import "RCTImageSource.h" -#import "RCTParserUtils.h" -#import "RCTUtils.h" - -@implementation RCTConvert - -RCT_CONVERTER(id, id, self) - -RCT_CONVERTER(BOOL, BOOL, boolValue) -RCT_NUMBER_CONVERTER(double, doubleValue) -RCT_NUMBER_CONVERTER(float, floatValue) -RCT_NUMBER_CONVERTER(int, intValue) - -RCT_NUMBER_CONVERTER(int64_t, longLongValue); -RCT_NUMBER_CONVERTER(uint64_t, unsignedLongLongValue); - -RCT_NUMBER_CONVERTER(NSInteger, integerValue) -RCT_NUMBER_CONVERTER(NSUInteger, unsignedIntegerValue) - -/** - * This macro is used for creating converter functions for directly - * representable json values that require no conversion. - */ -#if RCT_DEBUG -#define RCT_JSON_CONVERTER(type) \ -+ (type *)type:(id)json \ -{ \ - if ([json isKindOfClass:[type class]]) { \ - return json; \ - } else if (json) { \ - RCTLogConvertError(json, @#type); \ - } \ - return nil; \ -} -#else -#define RCT_JSON_CONVERTER(type) \ -+ (type *)type:(id)json { return json; } -#endif - -RCT_JSON_CONVERTER(NSArray) -RCT_JSON_CONVERTER(NSDictionary) -RCT_JSON_CONVERTER(NSString) -RCT_JSON_CONVERTER(NSNumber) - -RCT_CUSTOM_CONVERTER(NSSet *, NSSet, [NSSet setWithArray:json]) -RCT_CUSTOM_CONVERTER(NSData *, NSData, [json dataUsingEncoding:NSUTF8StringEncoding]) - -+ (NSIndexSet *)NSIndexSet:(id)json -{ - json = [self NSNumberArray:json]; - NSMutableIndexSet *indexSet = [NSMutableIndexSet new]; - for (NSNumber *number in json) { - NSInteger index = number.integerValue; - if (RCT_DEBUG && index < 0) { - RCTLogError(@"Invalid index value %lld. Indices must be positive.", (long long)index); - } - [indexSet addIndex:index]; - } - return indexSet; -} - -+ (NSURL *)NSURL:(id)json -{ - NSString *path = [self NSString:json]; - if (!path) { - return nil; - } - - @try { // NSURL has a history of crashing with bad input, so let's be safe - - NSURL *URL = [NSURL URLWithString:path]; - if (URL.scheme) { // Was a well-formed absolute URL - return URL; - } - - // Check if it has a scheme - if ([path rangeOfString:@":"].location != NSNotFound) { - NSMutableCharacterSet *urlAllowedCharacterSet = [NSMutableCharacterSet new]; - [urlAllowedCharacterSet formUnionWithCharacterSet:[NSCharacterSet URLUserAllowedCharacterSet]]; - [urlAllowedCharacterSet formUnionWithCharacterSet:[NSCharacterSet URLPasswordAllowedCharacterSet]]; - [urlAllowedCharacterSet formUnionWithCharacterSet:[NSCharacterSet URLHostAllowedCharacterSet]]; - [urlAllowedCharacterSet formUnionWithCharacterSet:[NSCharacterSet URLPathAllowedCharacterSet]]; - [urlAllowedCharacterSet formUnionWithCharacterSet:[NSCharacterSet URLQueryAllowedCharacterSet]]; - [urlAllowedCharacterSet formUnionWithCharacterSet:[NSCharacterSet URLFragmentAllowedCharacterSet]]; - path = [path stringByAddingPercentEncodingWithAllowedCharacters:urlAllowedCharacterSet]; - URL = [NSURL URLWithString:path]; - if (URL) { - return URL; - } - } - - // Assume that it's a local path - path = path.stringByRemovingPercentEncoding; - if ([path hasPrefix:@"~"]) { - // Path is inside user directory - path = path.stringByExpandingTildeInPath; - } else if (!path.absolutePath) { - // Assume it's a resource path - path = [[NSBundle mainBundle].resourcePath stringByAppendingPathComponent:path]; - } - if (!(URL = [NSURL fileURLWithPath:path])) { - RCTLogConvertError(json, @"a valid URL"); - } - return URL; - } - @catch (__unused NSException *e) { - RCTLogConvertError(json, @"a valid URL"); - return nil; - } -} - -RCT_ENUM_CONVERTER(NSURLRequestCachePolicy, (@{ - @"default": @(NSURLRequestUseProtocolCachePolicy), - @"reload": @(NSURLRequestReloadIgnoringLocalCacheData), - @"force-cache": @(NSURLRequestReturnCacheDataElseLoad), - @"only-if-cached": @(NSURLRequestReturnCacheDataDontLoad), - }), NSURLRequestUseProtocolCachePolicy, integerValue) - - -+ (NSURLRequest *)NSURLRequest:(id)json -{ - if ([json isKindOfClass:[NSString class]]) { - NSURL *URL = [self NSURL:json]; - return URL ? [NSURLRequest requestWithURL:URL] : nil; - } - if ([json isKindOfClass:[NSDictionary class]]) { - NSString *URLString = json[@"uri"] ?: json[@"url"]; - - NSURL *URL; - NSString *bundleName = json[@"bundle"]; - if (bundleName) { - URLString = [NSString stringWithFormat:@"%@.bundle/%@", bundleName, URLString]; - } - - URL = [self NSURL:URLString]; - if (!URL) { - return nil; - } - - NSData *body = [self NSData:json[@"body"]]; - NSString *method = [self NSString:json[@"method"]].uppercaseString ?: @"GET"; - NSURLRequestCachePolicy cachePolicy = [self NSURLRequestCachePolicy:json[@"cache"]]; - NSDictionary *headers = [self NSDictionary:json[@"headers"]]; - if ([method isEqualToString:@"GET"] && headers == nil && body == nil && cachePolicy == NSURLRequestUseProtocolCachePolicy) { - return [NSURLRequest requestWithURL:URL]; - } - - if (headers) { - __block BOOL allHeadersAreStrings = YES; - [headers enumerateKeysAndObjectsUsingBlock:^(NSString *key, id header, BOOL *stop) { - if (![header isKindOfClass:[NSString class]]) { - RCTLogError(@"Values of HTTP headers passed must be of type string. " - "Value of header '%@' is not a string.", key); - allHeadersAreStrings = NO; - *stop = YES; - } - }]; - if (!allHeadersAreStrings) { - // Set headers to nil here to avoid crashing later. - headers = nil; - } - } - - NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL]; - request.HTTPBody = body; - request.HTTPMethod = method; - request.cachePolicy = cachePolicy; - request.allHTTPHeaderFields = headers; - return [request copy]; - } - if (json) { - RCTLogConvertError(json, @"a valid URLRequest"); - } - return nil; -} - -+ (RCTFileURL *)RCTFileURL:(id)json -{ - NSURL *fileURL = [self NSURL:json]; - if (!fileURL.fileURL) { - RCTLogError(@"URI must be a local file, '%@' isn't.", fileURL); - return nil; - } - if (![[NSFileManager defaultManager] fileExistsAtPath:fileURL.path]) { - RCTLogError(@"File '%@' could not be found.", fileURL); - return nil; - } - return fileURL; -} - -+ (NSDate *)NSDate:(id)json -{ - if ([json isKindOfClass:[NSNumber class]]) { - return [NSDate dateWithTimeIntervalSince1970:[self NSTimeInterval:json]]; - } else if ([json isKindOfClass:[NSString class]]) { - static NSDateFormatter *formatter; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - formatter = [NSDateFormatter new]; - formatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"; - formatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]; - formatter.timeZone = [NSTimeZone timeZoneWithName:@"UTC"]; - }); - NSDate *date = [formatter dateFromString:json]; - if (!date) { - RCTLogError(@"JSON String '%@' could not be interpreted as a date. " - "Expected format: YYYY-MM-DD'T'HH:mm:ss.sssZ", json); - } - return date; - } else if (json) { - RCTLogConvertError(json, @"a date"); - } - return nil; -} - -+ (NSLocale *)NSLocale:(id)json -{ - if ([json isKindOfClass:[NSString class]]) { - NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:json]; - if (!locale) { - RCTLogError(@"JSON String '%@' could not be interpreted as a valid locale. ", json); - } - return locale; - } else if (json) { - RCTLogConvertError(json, @"a locale"); - } - return nil; -} - -// JS Standard for time is milliseconds -RCT_CUSTOM_CONVERTER(NSTimeInterval, NSTimeInterval, [self double:json] / 1000.0) - -// JS standard for time zones is minutes. -RCT_CUSTOM_CONVERTER(NSTimeZone *, NSTimeZone, [NSTimeZone timeZoneForSecondsFromGMT:[self double:json] * 60.0]) - -NSNumber *RCTConvertEnumValue(const char *typeName, NSDictionary *mapping, NSNumber *defaultValue, id json) -{ - if (!json) { - return defaultValue; - } - if ([json isKindOfClass:[NSNumber class]]) { - NSArray *allValues = mapping.allValues; - if ([allValues containsObject:json] || [json isEqual:defaultValue]) { - return json; - } - RCTLogError(@"Invalid %s '%@'. should be one of: %@", typeName, json, allValues); - return defaultValue; - } - if (RCT_DEBUG && ![json isKindOfClass:[NSString class]]) { - RCTLogError(@"Expected NSNumber or NSString for %s, received %@: %@", - typeName, [json classForCoder], json); - } - id value = mapping[json]; - if (RCT_DEBUG && !value && [json description].length > 0) { - RCTLogError(@"Invalid %s '%@'. should be one of: %@", typeName, json, [[mapping allKeys] sortedArrayUsingSelector: @selector(caseInsensitiveCompare:)]); - } - return value ?: defaultValue; -} - -NSNumber *RCTConvertMultiEnumValue(const char *typeName, NSDictionary *mapping, NSNumber *defaultValue, id json) -{ - if ([json isKindOfClass:[NSArray class]]) { - if ([json count] == 0) { - return defaultValue; - } - long long result = 0; - for (id arrayElement in json) { - NSNumber *value = RCTConvertEnumValue(typeName, mapping, defaultValue, arrayElement); - result |= value.longLongValue; - } - return @(result); - } - return RCTConvertEnumValue(typeName, mapping, defaultValue, json); -} - -RCT_ENUM_CONVERTER(NSLineBreakMode, (@{ - @"clip": @(NSLineBreakByClipping), - @"head": @(NSLineBreakByTruncatingHead), - @"tail": @(NSLineBreakByTruncatingTail), - @"middle": @(NSLineBreakByTruncatingMiddle), - @"wordWrapping": @(NSLineBreakByWordWrapping), -}), NSLineBreakByTruncatingTail, integerValue) - -RCT_ENUM_CONVERTER(NSTextAlignment, (@{ - @"auto": @(NSTextAlignmentNatural), - @"left": @(NSTextAlignmentLeft), - @"center": @(NSTextAlignmentCenter), - @"right": @(NSTextAlignmentRight), - @"justify": @(NSTextAlignmentJustified), -}), NSTextAlignmentNatural, integerValue) - -RCT_ENUM_CONVERTER(NSUnderlineStyle, (@{ - @"solid": @(NSUnderlineStyleSingle), - @"double": @(NSUnderlineStyleDouble), - @"dotted": @(NSUnderlinePatternDot | NSUnderlineStyleSingle), - @"dashed": @(NSUnderlinePatternDash | NSUnderlineStyleSingle), -}), NSUnderlineStyleSingle, integerValue) - -RCT_ENUM_CONVERTER(RCTBorderStyle, (@{ - @"solid": @(RCTBorderStyleSolid), - @"dotted": @(RCTBorderStyleDotted), - @"dashed": @(RCTBorderStyleDashed), -}), RCTBorderStyleSolid, integerValue) - -RCT_ENUM_CONVERTER(RCTTextDecorationLineType, (@{ - @"none": @(RCTTextDecorationLineTypeNone), - @"underline": @(RCTTextDecorationLineTypeUnderline), - @"line-through": @(RCTTextDecorationLineTypeStrikethrough), - @"underline line-through": @(RCTTextDecorationLineTypeUnderlineStrikethrough), -}), RCTTextDecorationLineTypeNone, integerValue) - -RCT_ENUM_CONVERTER(NSWritingDirection, (@{ - @"auto": @(NSWritingDirectionNatural), - @"ltr": @(NSWritingDirectionLeftToRight), - @"rtl": @(NSWritingDirectionRightToLeft), -}), NSWritingDirectionNatural, integerValue) - -RCT_ENUM_CONVERTER(UITextAutocapitalizationType, (@{ - @"none": @(UITextAutocapitalizationTypeNone), - @"words": @(UITextAutocapitalizationTypeWords), - @"sentences": @(UITextAutocapitalizationTypeSentences), - @"characters": @(UITextAutocapitalizationTypeAllCharacters) -}), UITextAutocapitalizationTypeSentences, integerValue) - -RCT_ENUM_CONVERTER(UITextFieldViewMode, (@{ - @"never": @(UITextFieldViewModeNever), - @"while-editing": @(UITextFieldViewModeWhileEditing), - @"unless-editing": @(UITextFieldViewModeUnlessEditing), - @"always": @(UITextFieldViewModeAlways), -}), UITextFieldViewModeNever, integerValue) - -RCT_ENUM_CONVERTER(UIKeyboardType, (@{ - @"default": @(UIKeyboardTypeDefault), - @"ascii-capable": @(UIKeyboardTypeASCIICapable), - @"numbers-and-punctuation": @(UIKeyboardTypeNumbersAndPunctuation), - @"url": @(UIKeyboardTypeURL), - @"number-pad": @(UIKeyboardTypeNumberPad), - @"phone-pad": @(UIKeyboardTypePhonePad), - @"name-phone-pad": @(UIKeyboardTypeNamePhonePad), - @"email-address": @(UIKeyboardTypeEmailAddress), - @"decimal-pad": @(UIKeyboardTypeDecimalPad), - @"twitter": @(UIKeyboardTypeTwitter), - @"web-search": @(UIKeyboardTypeWebSearch), - // Added for Android compatibility - @"numeric": @(UIKeyboardTypeDecimalPad), -}), UIKeyboardTypeDefault, integerValue) - -#if !TARGET_OS_TV -RCT_MULTI_ENUM_CONVERTER(UIDataDetectorTypes, (@{ - @"phoneNumber": @(UIDataDetectorTypePhoneNumber), - @"link": @(UIDataDetectorTypeLink), - @"address": @(UIDataDetectorTypeAddress), - @"calendarEvent": @(UIDataDetectorTypeCalendarEvent), - @"none": @(UIDataDetectorTypeNone), - @"all": @(UIDataDetectorTypeAll), -}), UIDataDetectorTypePhoneNumber, unsignedLongLongValue) - -#if WEBKIT_IOS_10_APIS_AVAILABLE -RCT_MULTI_ENUM_CONVERTER(WKDataDetectorTypes, (@{ - @"phoneNumber": @(WKDataDetectorTypePhoneNumber), - @"link": @(WKDataDetectorTypeLink), - @"address": @(WKDataDetectorTypeAddress), - @"calendarEvent": @(WKDataDetectorTypeCalendarEvent), - @"trackingNumber": @(WKDataDetectorTypeTrackingNumber), - @"flightNumber": @(WKDataDetectorTypeFlightNumber), - @"lookupSuggestion": @(WKDataDetectorTypeLookupSuggestion), - @"none": @(WKDataDetectorTypeNone), - @"all": @(WKDataDetectorTypeAll), - }), WKDataDetectorTypePhoneNumber, unsignedLongLongValue) - #endif // WEBKIT_IOS_10_APIS_AVAILABLE - - #endif // !TARGET_OS_TV - -RCT_ENUM_CONVERTER(UIKeyboardAppearance, (@{ - @"default": @(UIKeyboardAppearanceDefault), - @"light": @(UIKeyboardAppearanceLight), - @"dark": @(UIKeyboardAppearanceDark), -}), UIKeyboardAppearanceDefault, integerValue) - -RCT_ENUM_CONVERTER(UIReturnKeyType, (@{ - @"default": @(UIReturnKeyDefault), - @"go": @(UIReturnKeyGo), - @"google": @(UIReturnKeyGoogle), - @"join": @(UIReturnKeyJoin), - @"next": @(UIReturnKeyNext), - @"route": @(UIReturnKeyRoute), - @"search": @(UIReturnKeySearch), - @"send": @(UIReturnKeySend), - @"yahoo": @(UIReturnKeyYahoo), - @"done": @(UIReturnKeyDone), - @"emergency-call": @(UIReturnKeyEmergencyCall), -}), UIReturnKeyDefault, integerValue) - -RCT_ENUM_CONVERTER(UIViewContentMode, (@{ - @"scale-to-fill": @(UIViewContentModeScaleToFill), - @"scale-aspect-fit": @(UIViewContentModeScaleAspectFit), - @"scale-aspect-fill": @(UIViewContentModeScaleAspectFill), - @"redraw": @(UIViewContentModeRedraw), - @"center": @(UIViewContentModeCenter), - @"top": @(UIViewContentModeTop), - @"bottom": @(UIViewContentModeBottom), - @"left": @(UIViewContentModeLeft), - @"right": @(UIViewContentModeRight), - @"top-left": @(UIViewContentModeTopLeft), - @"top-right": @(UIViewContentModeTopRight), - @"bottom-left": @(UIViewContentModeBottomLeft), - @"bottom-right": @(UIViewContentModeBottomRight), - // Cross-platform values - @"cover": @(UIViewContentModeScaleAspectFill), - @"contain": @(UIViewContentModeScaleAspectFit), - @"stretch": @(UIViewContentModeScaleToFill), -}), UIViewContentModeScaleAspectFill, integerValue) - -#if !TARGET_OS_TV -RCT_ENUM_CONVERTER(UIBarStyle, (@{ - @"default": @(UIBarStyleDefault), - @"black": @(UIBarStyleBlack), - @"blackOpaque": @(UIBarStyleBlackOpaque), - @"blackTranslucent": @(UIBarStyleBlackTranslucent), -}), UIBarStyleDefault, integerValue) -#endif - -static void convertCGStruct(const char *type, NSArray *fields, CGFloat *result, id json) -{ - NSUInteger count = fields.count; - if ([json isKindOfClass:[NSArray class]]) { - if (RCT_DEBUG && [json count] != count) { - RCTLogError(@"Expected array with count %llu, but count is %llu: %@", (unsigned long long)count, (unsigned long long)[json count], json); - } else { - for (NSUInteger i = 0; i < count; i++) { - result[i] = [RCTConvert CGFloat:RCTNilIfNull(json[i])]; - } - } - } else if ([json isKindOfClass:[NSDictionary class]]) { - for (NSUInteger i = 0; i < count; i++) { - result[i] = [RCTConvert CGFloat:RCTNilIfNull(json[fields[i]])]; - } - } else if (json) { - RCTLogConvertError(json, @(type)); - } -} - -/** - * This macro is used for creating converter functions for structs that consist - * of a number of CGFloat properties, such as CGPoint, CGRect, etc. - */ -#define RCT_CGSTRUCT_CONVERTER(type, values) \ -+ (type)type:(id)json \ -{ \ - static NSArray *fields; \ - static dispatch_once_t onceToken; \ - dispatch_once(&onceToken, ^{ \ - fields = values; \ - }); \ - type result; \ - convertCGStruct(#type, fields, (CGFloat *)&result, json); \ - return result; \ -} - -RCT_CUSTOM_CONVERTER(CGFloat, CGFloat, [self double:json]) - -RCT_CGSTRUCT_CONVERTER(CGPoint, (@[@"x", @"y"])) -RCT_CGSTRUCT_CONVERTER(CGSize, (@[@"width", @"height"])) -RCT_CGSTRUCT_CONVERTER(CGRect, (@[@"x", @"y", @"width", @"height"])) -RCT_CGSTRUCT_CONVERTER(UIEdgeInsets, (@[@"top", @"left", @"bottom", @"right"])) - -RCT_ENUM_CONVERTER(CGLineJoin, (@{ - @"miter": @(kCGLineJoinMiter), - @"round": @(kCGLineJoinRound), - @"bevel": @(kCGLineJoinBevel), -}), kCGLineJoinMiter, intValue) - -RCT_ENUM_CONVERTER(CGLineCap, (@{ - @"butt": @(kCGLineCapButt), - @"round": @(kCGLineCapRound), - @"square": @(kCGLineCapSquare), -}), kCGLineCapButt, intValue) - -RCT_CGSTRUCT_CONVERTER(CGAffineTransform, (@[ - @"a", @"b", @"c", @"d", @"tx", @"ty" -])) - -+ (UIColor *)UIColor:(id)json -{ - if (!json) { - return nil; - } - if ([json isKindOfClass:[NSArray class]]) { - NSArray *components = [self NSNumberArray:json]; - CGFloat alpha = components.count > 3 ? [self CGFloat:components[3]] : 1.0; - return [UIColor colorWithRed:[self CGFloat:components[0]] - green:[self CGFloat:components[1]] - blue:[self CGFloat:components[2]] - alpha:alpha]; - } else if ([json isKindOfClass:[NSNumber class]]) { - NSUInteger argb = [self NSUInteger:json]; - CGFloat a = ((argb >> 24) & 0xFF) / 255.0; - CGFloat r = ((argb >> 16) & 0xFF) / 255.0; - CGFloat g = ((argb >> 8) & 0xFF) / 255.0; - CGFloat b = (argb & 0xFF) / 255.0; - return [UIColor colorWithRed:r green:g blue:b alpha:a]; - } else { - RCTLogConvertError(json, @"a UIColor. Did you forget to call processColor() on the JS side?"); - return nil; - } -} - -+ (CGColorRef)CGColor:(id)json -{ - return [self UIColor:json].CGColor; -} - -+ (YGValue)YGValue:(id)json -{ - if (!json) { - return YGValueUndefined; - } else if ([json isKindOfClass:[NSNumber class]]) { - return (YGValue) { [json floatValue], YGUnitPoint }; - } else if ([json isKindOfClass:[NSString class]]) { - NSString *s = (NSString *) json; - if ([s isEqualToString:@"auto"]) { - return (YGValue) { YGUndefined, YGUnitAuto }; - } else if ([s hasSuffix:@"%"]) { - return (YGValue) { [[s substringToIndex:s.length] floatValue], YGUnitPercent }; - } else { - RCTLogConvertError(json, @"a YGValue. Did you forget the % or pt suffix?"); - } - } else { - RCTLogConvertError(json, @"a YGValue."); - } - return YGValueUndefined; -} - -NSArray *RCTConvertArrayValue(SEL type, id json) -{ - __block BOOL copy = NO; - __block NSArray *values = json = [RCTConvert NSArray:json]; - [json enumerateObjectsUsingBlock:^(id jsonValue, NSUInteger idx, __unused BOOL *stop) { - id value = ((id(*)(Class, SEL, id))objc_msgSend)([RCTConvert class], type, jsonValue); - if (copy) { - if (value) { - [(NSMutableArray *)values addObject:value]; - } - } else if (value != jsonValue) { - // Converted value is different, so we'll need to copy the array - values = [[NSMutableArray alloc] initWithCapacity:values.count]; - for (NSUInteger i = 0; i < idx; i++) { - [(NSMutableArray *)values addObject:json[i]]; - } - if (value) { - [(NSMutableArray *)values addObject:value]; - } - copy = YES; - } - }]; - return values; -} - -RCT_ARRAY_CONVERTER(NSURL) -RCT_ARRAY_CONVERTER(RCTFileURL) -RCT_ARRAY_CONVERTER(UIColor) - -/** - * This macro is used for creating converter functions for directly - * representable json array values that require no conversion. - */ -#if RCT_DEBUG -#define RCT_JSON_ARRAY_CONVERTER_NAMED(type, name) RCT_ARRAY_CONVERTER_NAMED(type, name) -#else -#define RCT_JSON_ARRAY_CONVERTER_NAMED(type, name) + (NSArray *)name##Array:(id)json { return json; } -#endif -#define RCT_JSON_ARRAY_CONVERTER(type) RCT_JSON_ARRAY_CONVERTER_NAMED(type, type) - -RCT_JSON_ARRAY_CONVERTER(NSArray) -RCT_JSON_ARRAY_CONVERTER(NSString) -RCT_JSON_ARRAY_CONVERTER_NAMED(NSArray, NSStringArray) -RCT_JSON_ARRAY_CONVERTER(NSDictionary) -RCT_JSON_ARRAY_CONVERTER(NSNumber) - -// Can't use RCT_ARRAY_CONVERTER due to bridged cast -+ (NSArray *)CGColorArray:(id)json -{ - NSMutableArray *colors = [NSMutableArray new]; - for (id value in [self NSArray:json]) { - [colors addObject:(__bridge id)[self CGColor:value]]; - } - return colors; -} - -static id RCTConvertPropertyListValue(id json) -{ - if (!json || json == (id)kCFNull) { - return nil; - } - - if ([json isKindOfClass:[NSDictionary class]]) { - __block BOOL copy = NO; - NSMutableDictionary *values = [[NSMutableDictionary alloc] initWithCapacity:[json count]]; - [json enumerateKeysAndObjectsUsingBlock:^(NSString *key, id jsonValue, __unused BOOL *stop) { - id value = RCTConvertPropertyListValue(jsonValue); - if (value) { - values[key] = value; - } - copy |= value != jsonValue; - }]; - return copy ? values : json; - } - - if ([json isKindOfClass:[NSArray class]]) { - __block BOOL copy = NO; - __block NSArray *values = json; - [json enumerateObjectsUsingBlock:^(id jsonValue, NSUInteger idx, __unused BOOL *stop) { - id value = RCTConvertPropertyListValue(jsonValue); - if (copy) { - if (value) { - [(NSMutableArray *)values addObject:value]; - } - } else if (value != jsonValue) { - // Converted value is different, so we'll need to copy the array - values = [[NSMutableArray alloc] initWithCapacity:values.count]; - for (NSUInteger i = 0; i < idx; i++) { - [(NSMutableArray *)values addObject:json[i]]; - } - if (value) { - [(NSMutableArray *)values addObject:value]; - } - copy = YES; - } - }]; - return values; - } - - // All other JSON types are supported by property lists - return json; -} - -+ (NSPropertyList)NSPropertyList:(id)json -{ - return RCTConvertPropertyListValue(json); -} - -RCT_ENUM_CONVERTER(css_backface_visibility_t, (@{ - @"hidden": @NO, - @"visible": @YES -}), YES, boolValue) - -RCT_ENUM_CONVERTER(YGOverflow, (@{ - @"hidden": @(YGOverflowHidden), - @"visible": @(YGOverflowVisible), - @"scroll": @(YGOverflowScroll), -}), YGOverflowVisible, intValue) - -RCT_ENUM_CONVERTER(YGDisplay, (@{ - @"flex": @(YGDisplayFlex), - @"none": @(YGDisplayNone), -}), YGDisplayFlex, intValue) - -RCT_ENUM_CONVERTER(YGFlexDirection, (@{ - @"row": @(YGFlexDirectionRow), - @"row-reverse": @(YGFlexDirectionRowReverse), - @"column": @(YGFlexDirectionColumn), - @"column-reverse": @(YGFlexDirectionColumnReverse) -}), YGFlexDirectionColumn, intValue) - -RCT_ENUM_CONVERTER(YGJustify, (@{ - @"flex-start": @(YGJustifyFlexStart), - @"flex-end": @(YGJustifyFlexEnd), - @"center": @(YGJustifyCenter), - @"space-between": @(YGJustifySpaceBetween), - @"space-around": @(YGJustifySpaceAround), - @"space-evenly": @(YGJustifySpaceEvenly) -}), YGJustifyFlexStart, intValue) - -RCT_ENUM_CONVERTER(YGAlign, (@{ - @"flex-start": @(YGAlignFlexStart), - @"flex-end": @(YGAlignFlexEnd), - @"center": @(YGAlignCenter), - @"auto": @(YGAlignAuto), - @"stretch": @(YGAlignStretch), - @"baseline": @(YGAlignBaseline), - @"space-between": @(YGAlignSpaceBetween), - @"space-around": @(YGAlignSpaceAround) -}), YGAlignFlexStart, intValue) - -RCT_ENUM_CONVERTER(YGDirection, (@{ - @"inherit": @(YGDirectionInherit), - @"ltr": @(YGDirectionLTR), - @"rtl": @(YGDirectionRTL), -}), YGDirectionInherit, intValue) - -RCT_ENUM_CONVERTER(YGPositionType, (@{ - @"absolute": @(YGPositionTypeAbsolute), - @"relative": @(YGPositionTypeRelative) -}), YGPositionTypeRelative, intValue) - -RCT_ENUM_CONVERTER(YGWrap, (@{ - @"wrap": @(YGWrapWrap), - @"nowrap": @(YGWrapNoWrap), - @"wrap-reverse": @(YGWrapWrapReverse) -}), YGWrapNoWrap, intValue) - -RCT_ENUM_CONVERTER(RCTPointerEvents, (@{ - @"none": @(RCTPointerEventsNone), - @"box-only": @(RCTPointerEventsBoxOnly), - @"box-none": @(RCTPointerEventsBoxNone), - @"auto": @(RCTPointerEventsUnspecified) -}), RCTPointerEventsUnspecified, integerValue) - -RCT_ENUM_CONVERTER(RCTAnimationType, (@{ - @"spring": @(RCTAnimationTypeSpring), - @"linear": @(RCTAnimationTypeLinear), - @"easeIn": @(RCTAnimationTypeEaseIn), - @"easeOut": @(RCTAnimationTypeEaseOut), - @"easeInEaseOut": @(RCTAnimationTypeEaseInEaseOut), - @"keyboard": @(RCTAnimationTypeKeyboard), -}), RCTAnimationTypeEaseInEaseOut, integerValue) - -@end - -@interface RCTImageSource (Packager) - -@property (nonatomic, assign) BOOL packagerAsset; - -@end - -@implementation RCTConvert (Deprecated) - -/* This method is only used when loading images synchronously, e.g. for tabbar icons */ -+ (UIImage *)UIImage:(id)json -{ - if (!json) { - return nil; - } - - RCTImageSource *imageSource = [self RCTImageSource:json]; - if (!imageSource) { - return nil; - } - - __block UIImage *image; - if (!RCTIsMainQueue()) { - // It seems that none of the UIImage loading methods can be guaranteed - // thread safe, so we'll pick the lesser of two evils here and block rather - // than run the risk of crashing - RCTLogWarn(@"Calling [RCTConvert UIImage:] on a background thread is not recommended"); - RCTUnsafeExecuteOnMainQueueSync(^{ - image = [self UIImage:json]; - }); - return image; - } - - NSURL *URL = imageSource.request.URL; - NSString *scheme = URL.scheme.lowercaseString; - if ([scheme isEqualToString:@"file"]) { - image = RCTImageFromLocalAssetURL(URL); - if (!image) { - RCTLogConvertError(json, @"an image. File not found."); - } - } else if ([scheme isEqualToString:@"data"]) { - image = [UIImage imageWithData:[NSData dataWithContentsOfURL:URL]]; - } else if ([scheme isEqualToString:@"http"] && imageSource.packagerAsset) { - image = [UIImage imageWithData:[NSData dataWithContentsOfURL:URL]]; - } else { - RCTLogConvertError(json, @"an image. Only local files or data URIs are supported."); - return nil; - } - - CGFloat scale = imageSource.scale; - if (!scale && imageSource.size.width) { - // If no scale provided, set scale to image width / source width - scale = CGImageGetWidth(image.CGImage) / imageSource.size.width; - } - - if (scale) { - image = [UIImage imageWithCGImage:image.CGImage - scale:scale - orientation:image.imageOrientation]; - } - - if (!CGSizeEqualToSize(imageSource.size, CGSizeZero) && - !CGSizeEqualToSize(imageSource.size, image.size)) { - RCTLogError(@"Image source %@ size %@ does not match loaded image size %@.", - URL.path.lastPathComponent, - NSStringFromCGSize(imageSource.size), - NSStringFromCGSize(image.size)); - } - - return image; -} - -+ (CGImageRef)CGImage:(id)json -{ - return [self UIImage:json].CGImage; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTCxxConvert.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTCxxConvert.h deleted file mode 100644 index 65c156ff..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTCxxConvert.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -/** - * This class provides a collection of conversion functions for mapping - * JSON objects to cxx types. Extensible via categories. - * Convert methods are expected to return cxx objects wraped in RCTManagedPointer. - */ - -@interface RCTCxxConvert : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTCxxConvert.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTCxxConvert.m deleted file mode 100644 index b27359b3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTCxxConvert.m +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTCxxConvert.h" - -@implementation RCTCxxConvert - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTDefines.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTDefines.h deleted file mode 100644 index 9a860ed7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTDefines.h +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#if __OBJC__ -# import -#endif - -/** - * Make global functions usable in C++ - */ -#if defined(__cplusplus) -#define RCT_EXTERN extern "C" __attribute__((visibility("default"))) -#define RCT_EXTERN_C_BEGIN extern "C" { -#define RCT_EXTERN_C_END } -#else -#define RCT_EXTERN extern __attribute__((visibility("default"))) -#define RCT_EXTERN_C_BEGIN -#define RCT_EXTERN_C_END -#endif - -/** - * The RCT_DEBUG macro can be used to exclude error checking and logging code - * from release builds to improve performance and reduce binary size. - */ -#ifndef RCT_DEBUG -#if DEBUG -#define RCT_DEBUG 1 -#else -#define RCT_DEBUG 0 -#endif -#endif - -/** - * The RCT_DEV macro can be used to enable or disable development tools - * such as the debug executors, dev menu, red box, etc. - */ -#ifndef RCT_DEV -#if DEBUG -#define RCT_DEV 1 -#else -#define RCT_DEV 0 -#endif -#endif - -#ifndef RCT_ENABLE_INSPECTOR -#if RCT_DEV && __has_include() -#define RCT_ENABLE_INSPECTOR 1 -#else -#define RCT_ENABLE_INSPECTOR 0 -#endif -#endif - -#ifndef ENABLE_PACKAGER_CONNECTION -#if RCT_DEV && __has_include() -#define ENABLE_PACKAGER_CONNECTION 1 -#else -#define ENABLE_PACKAGER_CONNECTION 0 -#endif -#endif - -#if RCT_DEV -#define RCT_IF_DEV(...) __VA_ARGS__ -#else -#define RCT_IF_DEV(...) -#endif - -#ifndef RCT_PROFILE -#define RCT_PROFILE RCT_DEV -#endif - -/** - * Add the default Metro packager port number - */ -#ifndef RCT_METRO_PORT -#define RCT_METRO_PORT 8081 -#else -// test if RCT_METRO_PORT is empty -#define RCT_METRO_PORT_DO_EXPAND(VAL) VAL ## 1 -#define RCT_METRO_PORT_EXPAND(VAL) RCT_METRO_PORT_DO_EXPAND(VAL) -#if !defined(RCT_METRO_PORT) || (RCT_METRO_PORT_EXPAND(RCT_METRO_PORT) == 1) -// Only here if RCT_METRO_PORT is not defined -// OR RCT_METRO_PORT is the empty string -#undef RCT_METRO_PORT -#define RCT_METRO_PORT 8081 -#endif -#endif - -/** - * By default, only raise an NSAssertion in debug mode - * (custom assert functions will still be called). - */ -#ifndef RCT_NSASSERT -#define RCT_NSASSERT RCT_DEBUG -#endif - -/** - * Concat two literals. Supports macro expansions, - * e.g. RCT_CONCAT(foo, __FILE__). - */ -#define RCT_CONCAT2(A, B) A ## B -#define RCT_CONCAT(A, B) RCT_CONCAT2(A, B) - -/** - * This attribute is used for static analysis. - */ -#if !defined RCT_DYNAMIC -#if __has_attribute(objc_dynamic) -#define RCT_DYNAMIC __attribute__((objc_dynamic)) -#else -#define RCT_DYNAMIC -#endif -#endif - -/** - * Throw an assertion for unimplemented methods. - */ -#define RCT_NOT_IMPLEMENTED(method) \ -_Pragma("clang diagnostic push") \ -_Pragma("clang diagnostic ignored \"-Wmissing-method-return-type\"") \ -_Pragma("clang diagnostic ignored \"-Wunused-parameter\"") \ -RCT_EXTERN NSException *_RCTNotImplementedException(SEL, Class); \ -method NS_UNAVAILABLE { @throw _RCTNotImplementedException(_cmd, [self class]); } \ -_Pragma("clang diagnostic pop") - -/** - * Check if WebKit iOS 10.0 APIs are available. - */ -#define WEBKIT_IOS_10_APIS_AVAILABLE __has_include() diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTDisplayLink.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTDisplayLink.h deleted file mode 100644 index b64146dc..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTDisplayLink.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@protocol RCTBridgeModule; -@class RCTModuleData; - -@interface RCTDisplayLink : NSObject - -- (instancetype)init; -- (void)invalidate; -- (void)registerModuleForFrameUpdates:(id)module - withModuleData:(RCTModuleData *)moduleData; -- (void)addToRunLoop:(NSRunLoop *)runLoop; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTDisplayLink.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTDisplayLink.m deleted file mode 100644 index d1448d29..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTDisplayLink.m +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTDisplayLink.h" - -#import -#import - -#import "RCTAssert.h" -#import "RCTBridgeModule.h" -#import "RCTFrameUpdate.h" -#import "RCTModuleData.h" -#import "RCTProfile.h" - -#define RCTAssertRunLoop() \ - RCTAssert(_runLoop == [NSRunLoop currentRunLoop], \ - @"This method must be called on the CADisplayLink run loop") - -@implementation RCTDisplayLink -{ - CADisplayLink *_jsDisplayLink; - NSMutableSet *_frameUpdateObservers; - NSRunLoop *_runLoop; -} - -- (instancetype)init -{ - if ((self = [super init])) { - _frameUpdateObservers = [NSMutableSet new]; - _jsDisplayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(_jsThreadUpdate:)]; - } - - return self; -} - -- (void)registerModuleForFrameUpdates:(id)module - withModuleData:(RCTModuleData *)moduleData -{ - if (![moduleData.moduleClass conformsToProtocol:@protocol(RCTFrameUpdateObserver)] || - [_frameUpdateObservers containsObject:moduleData]) { - return; - } - - [_frameUpdateObservers addObject:moduleData]; - - // Don't access the module instance via moduleData, as this will cause deadlock - id observer = (id)module; - __weak typeof(self) weakSelf = self; - observer.pauseCallback = ^{ - typeof(self) strongSelf = weakSelf; - if (!strongSelf) { - return; - } - - CFRunLoopRef cfRunLoop = [strongSelf->_runLoop getCFRunLoop]; - if (!cfRunLoop) { - return; - } - - if ([NSRunLoop currentRunLoop] == strongSelf->_runLoop) { - [weakSelf updateJSDisplayLinkState]; - } else { - CFRunLoopPerformBlock(cfRunLoop, kCFRunLoopDefaultMode, ^{ - [weakSelf updateJSDisplayLinkState]; - }); - CFRunLoopWakeUp(cfRunLoop); - } - }; - - // Assuming we're paused right now, we only need to update the display link's state - // when the new observer is not paused. If it not paused, the observer will immediately - // start receiving updates anyway. - if (![observer isPaused] && _runLoop) { - CFRunLoopPerformBlock([_runLoop getCFRunLoop], kCFRunLoopDefaultMode, ^{ - [self updateJSDisplayLinkState]; - }); - } -} - -- (void)addToRunLoop:(NSRunLoop *)runLoop -{ - _runLoop = runLoop; - [_jsDisplayLink addToRunLoop:runLoop forMode:NSRunLoopCommonModes]; -} - -- (void)invalidate -{ - [_jsDisplayLink invalidate]; -} - -- (void)dispatchBlock:(dispatch_block_t)block - queue:(dispatch_queue_t)queue -{ - if (queue == RCTJSThread) { - block(); - } else if (queue) { - dispatch_async(queue, block); - } -} - -- (void)_jsThreadUpdate:(CADisplayLink *)displayLink -{ - RCTAssertRunLoop(); - - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[RCTDisplayLink _jsThreadUpdate:]", nil); - - RCTFrameUpdate *frameUpdate = [[RCTFrameUpdate alloc] initWithDisplayLink:displayLink]; - for (RCTModuleData *moduleData in _frameUpdateObservers) { - id observer = (id)moduleData.instance; - if (!observer.paused) { - RCTProfileBeginFlowEvent(); - - [self dispatchBlock:^{ - RCTProfileEndFlowEvent(); - [observer didUpdateFrame:frameUpdate]; - } queue:moduleData.methodQueue]; - } - } - - [self updateJSDisplayLinkState]; - - RCTProfileImmediateEvent(RCTProfileTagAlways, @"JS Thread Tick", displayLink.timestamp, 'g'); - - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"objc_call"); -} - -- (void)updateJSDisplayLinkState -{ - RCTAssertRunLoop(); - - BOOL pauseDisplayLink = YES; - for (RCTModuleData *moduleData in _frameUpdateObservers) { - id observer = (id)moduleData.instance; - if (!observer.paused) { - pauseDisplayLink = NO; - break; - } - } - - _jsDisplayLink.paused = pauseDisplayLink; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTErrorCustomizer.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTErrorCustomizer.h deleted file mode 100644 index d47ac8d1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTErrorCustomizer.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@class RCTErrorInfo; - -/** - * Provides an interface to customize React Native error messages and stack - * traces from exceptions. - */ -@protocol RCTErrorCustomizer - -/** - * Customizes the given error, returning the passed info argument if no - * customization is required. - */ -- (nonnull RCTErrorInfo *)customizeErrorInfo:(nonnull RCTErrorInfo *)info; -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTErrorInfo.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTErrorInfo.h deleted file mode 100644 index 129ef2c4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTErrorInfo.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@class RCTJSStackFrame; - -/** - * An ObjC wrapper for React Native errors. - */ -@interface RCTErrorInfo : NSObject -@property (nonatomic, copy, readonly) NSString *errorMessage; -@property (nonatomic, copy, readonly) NSArray *stack; - - -- (instancetype)initWithErrorMessage:(NSString *)errorMessage - stack:(NSArray *)stack; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTErrorInfo.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTErrorInfo.m deleted file mode 100644 index d6628c5c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTErrorInfo.m +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTErrorInfo.h" - -#import "RCTJSStackFrame.h" - -@implementation RCTErrorInfo - -- (instancetype)initWithErrorMessage:(NSString *)errorMessage - stack:(NSArray *)stack { - self = [super init]; - if (self) { - _errorMessage = [errorMessage copy]; - _stack = [stack copy]; - } - return self; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTEventDispatcher.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTEventDispatcher.h deleted file mode 100644 index ff6e7504..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTEventDispatcher.h +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -typedef NS_ENUM(NSInteger, RCTTextEventType) -{ - RCTTextEventTypeFocus, - RCTTextEventTypeBlur, - RCTTextEventTypeChange, - RCTTextEventTypeSubmit, - RCTTextEventTypeEnd, - RCTTextEventTypeKeyPress -}; - -/** - * The threshold at which text inputs will start warning that the JS thread - * has fallen behind (resulting in poor input performance, missed keys, etc.) - */ -RCT_EXTERN const NSInteger RCTTextUpdateLagWarningThreshold; - -/** - * Takes an input event name and normalizes it to the form that is required - * by the events system (currently that means starting with the "top" prefix, - * but that's an implementation detail that may change in future). - */ -RCT_EXTERN NSString *RCTNormalizeInputEventName(NSString *eventName); - -@protocol RCTEvent -@required - -@property (nonatomic, strong, readonly) NSNumber *viewTag; -@property (nonatomic, copy, readonly) NSString *eventName; -@property (nonatomic, assign, readonly) uint16_t coalescingKey; - -- (BOOL)canCoalesce; -- (id)coalesceWithEvent:(id)newEvent; - -// used directly for doing a JS call -+ (NSString *)moduleDotMethod; -// must contain only JSON compatible values -- (NSArray *)arguments; - -@end - -/** - * This protocol allows observing events dispatched by RCTEventDispatcher. - */ -@protocol RCTEventDispatcherObserver - -/** - * Called before dispatching an event, on the same thread the event was - * dispatched from. - */ -- (void)eventDispatcherWillDispatchEvent:(id)event; - -@end - - -/** - * This class wraps the -[RCTBridge enqueueJSCall:args:] method, and - * provides some convenience methods for generating event calls. - */ -@interface RCTEventDispatcher : NSObject - -/** - * Deprecated, do not use. - */ -- (void)sendAppEventWithName:(NSString *)name body:(id)body -__deprecated_msg("Subclass RCTEventEmitter instead"); - -/** - * Deprecated, do not use. - */ -- (void)sendDeviceEventWithName:(NSString *)name body:(id)body -__deprecated_msg("Subclass RCTEventEmitter instead"); - -/** - * Deprecated, do not use. - */ -- (void)sendInputEventWithName:(NSString *)name body:(NSDictionary *)body -__deprecated_msg("Use RCTDirectEventBlock or RCTBubblingEventBlock instead"); - -/** - * Send a text input/focus event. For internal use only. - */ -- (void)sendTextEventWithType:(RCTTextEventType)type - reactTag:(NSNumber *)reactTag - text:(NSString *)text - key:(NSString *)key - eventCount:(NSInteger)eventCount; - -/** - * Send a pre-prepared event object. - * - * Events are sent to JS as soon as the thread is free to process them. - * If an event can be coalesced and there is another compatible event waiting, the coalescing will happen immediately. - */ -- (void)sendEvent:(id)event; - -/** - * Add an event dispatcher observer. - */ -- (void)addDispatchObserver:(id)observer; - -/** - * Remove an event dispatcher observer. - */ -- (void)removeDispatchObserver:(id)observer; - -@end - -@interface RCTBridge (RCTEventDispatcher) - -- (RCTEventDispatcher *)eventDispatcher; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTEventDispatcher.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTEventDispatcher.m deleted file mode 100644 index 4e05e2b4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTEventDispatcher.m +++ /dev/null @@ -1,233 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTEventDispatcher.h" - -#import "RCTAssert.h" -#import "RCTBridge.h" -#import "RCTBridge+Private.h" -#import "RCTUtils.h" -#import "RCTProfile.h" - -const NSInteger RCTTextUpdateLagWarningThreshold = 3; - -NSString *RCTNormalizeInputEventName(NSString *eventName) -{ - if ([eventName hasPrefix:@"on"]) { - eventName = [eventName stringByReplacingCharactersInRange:(NSRange){0, 2} withString:@"top"]; - } else if (![eventName hasPrefix:@"top"]) { - eventName = [[@"top" stringByAppendingString:[eventName substringToIndex:1].uppercaseString] - stringByAppendingString:[eventName substringFromIndex:1]]; - } - return eventName; -} - -static NSNumber *RCTGetEventID(id event) -{ - return @( - event.viewTag.intValue | - (((uint64_t)event.eventName.hash & 0xFFFF) << 32) | - (((uint64_t)event.coalescingKey) << 48) - ); -} - -@implementation RCTEventDispatcher -{ - // We need this lock to protect access to _events, _eventQueue and _eventsDispatchScheduled. It's filled in on main thread and consumed on js thread. - NSLock *_eventQueueLock; - // We have this id -> event mapping so we coalesce effectively. - NSMutableDictionary> *_events; - // This array contains ids of events in order they come in, so we can emit them to JS in the exact same order. - NSMutableArray *_eventQueue; - BOOL _eventsDispatchScheduled; - NSHashTable> *_observers; - NSLock *_observersLock; -} - -@synthesize bridge = _bridge; - -RCT_EXPORT_MODULE() - -- (void)setBridge:(RCTBridge *)bridge -{ - _bridge = bridge; - _events = [NSMutableDictionary new]; - _eventQueue = [NSMutableArray new]; - _eventQueueLock = [NSLock new]; - _eventsDispatchScheduled = NO; - _observers = [NSHashTable weakObjectsHashTable]; - _observersLock = [NSLock new]; -} - -- (void)sendAppEventWithName:(NSString *)name body:(id)body -{ - [_bridge enqueueJSCall:@"RCTNativeAppEventEmitter" - method:@"emit" - args:body ? @[name, body] : @[name] - completion:NULL]; -} - -- (void)sendDeviceEventWithName:(NSString *)name body:(id)body -{ - [_bridge enqueueJSCall:@"RCTDeviceEventEmitter" - method:@"emit" - args:body ? @[name, body] : @[name] - completion:NULL]; -} - -- (void)sendInputEventWithName:(NSString *)name body:(NSDictionary *)body -{ - if (RCT_DEBUG) { - RCTAssert([body[@"target"] isKindOfClass:[NSNumber class]], - @"Event body dictionary must include a 'target' property containing a React tag"); - } - - name = RCTNormalizeInputEventName(name); - [_bridge enqueueJSCall:@"RCTEventEmitter" - method:@"receiveEvent" - args:body ? @[body[@"target"], name, body] : @[body[@"target"], name] - completion:NULL]; -} - -- (void)sendTextEventWithType:(RCTTextEventType)type - reactTag:(NSNumber *)reactTag - text:(NSString *)text - key:(NSString *)key - eventCount:(NSInteger)eventCount -{ - static NSString *events[] = { - @"focus", - @"blur", - @"change", - @"submitEditing", - @"endEditing", - @"keyPress" - }; - - NSMutableDictionary *body = [[NSMutableDictionary alloc] initWithDictionary:@{ - @"eventCount": @(eventCount), - @"target": reactTag - }]; - - if (text) { - body[@"text"] = text; - } - - if (key) { - if (key.length == 0) { - key = @"Backspace"; // backspace - } else { - switch ([key characterAtIndex:0]) { - case '\t': - key = @"Tab"; - break; - case '\n': - key = @"Enter"; - default: - break; - } - } - body[@"key"] = key; - } - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [self sendInputEventWithName:events[type] body:body]; -#pragma clang diagnostic pop -} - -- (void)sendEvent:(id)event -{ - [_observersLock lock]; - - for (id observer in _observers) { - [observer eventDispatcherWillDispatchEvent:event]; - } - - [_observersLock unlock]; - - [_eventQueueLock lock]; - - NSNumber *eventID = RCTGetEventID(event); - - id previousEvent = _events[eventID]; - if (previousEvent) { - RCTAssert([event canCoalesce], @"Got event %@ which cannot be coalesced, but has the same eventID %@ as the previous event %@", event, eventID, previousEvent); - event = [previousEvent coalesceWithEvent:event]; - } else { - [_eventQueue addObject:eventID]; - } - _events[eventID] = event; - - BOOL scheduleEventsDispatch = NO; - if (!_eventsDispatchScheduled) { - _eventsDispatchScheduled = YES; - scheduleEventsDispatch = YES; - } - - // We have to release the lock before dispatching block with events, - // since dispatchBlock: can be executed synchronously on the same queue. - // (This is happening when chrome debugging is turned on.) - [_eventQueueLock unlock]; - - if (scheduleEventsDispatch) { - [_bridge dispatchBlock:^{ - [self flushEventsQueue]; - } queue:RCTJSThread]; - } -} - -- (void)addDispatchObserver:(id)observer -{ - [_observersLock lock]; - [_observers addObject:observer]; - [_observersLock unlock]; -} - -- (void)removeDispatchObserver:(id)observer -{ - [_observersLock lock]; - [_observers removeObject:observer]; - [_observersLock unlock]; -} - -- (void)dispatchEvent:(id)event -{ - [_bridge enqueueJSCall:[[event class] moduleDotMethod] args:[event arguments]]; -} - -- (dispatch_queue_t)methodQueue -{ - return RCTJSThread; -} - -// js thread only (which surprisingly can be the main thread, depends on used JS executor) -- (void)flushEventsQueue -{ - [_eventQueueLock lock]; - NSDictionary *events = _events; - _events = [NSMutableDictionary new]; - NSMutableArray *eventQueue = _eventQueue; - _eventQueue = [NSMutableArray new]; - _eventsDispatchScheduled = NO; - [_eventQueueLock unlock]; - - for (NSNumber *eventId in eventQueue) { - [self dispatchEvent:events[eventId]]; - } -} - -@end - -@implementation RCTBridge (RCTEventDispatcher) - -- (RCTEventDispatcher *)eventDispatcher -{ - return [self moduleForClass:[RCTEventDispatcher class]]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTFrameUpdate.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTFrameUpdate.h deleted file mode 100644 index 1e934915..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTFrameUpdate.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@class CADisplayLink; - -/** - * Interface containing the information about the last screen refresh. - */ -@interface RCTFrameUpdate : NSObject - -/** - * Timestamp for the actual screen refresh - */ -@property (nonatomic, readonly) NSTimeInterval timestamp; - -/** - * Time since the last frame update ( >= 16.6ms ) - */ -@property (nonatomic, readonly) NSTimeInterval deltaTime; - -- (instancetype)initWithDisplayLink:(CADisplayLink *)displayLink NS_DESIGNATED_INITIALIZER; - -@end - -/** - * Protocol that must be implemented for subscribing to display refreshes (DisplayLink updates) - */ -@protocol RCTFrameUpdateObserver - -/** - * Method called on every screen refresh (if paused != YES) - */ -- (void)didUpdateFrame:(RCTFrameUpdate *)update; - -/** - * Synthesize and set to true to pause the calls to -[didUpdateFrame:] - */ -@property (nonatomic, readonly, getter=isPaused) BOOL paused; - -/** - * Callback for pause/resume observer. - * Observer should call it when paused property is changed. - */ -@property (nonatomic, copy) dispatch_block_t pauseCallback; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTFrameUpdate.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTFrameUpdate.m deleted file mode 100644 index 0d3e9d0a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTFrameUpdate.m +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "RCTFrameUpdate.h" - -#import "RCTUtils.h" - -@implementation RCTFrameUpdate - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (instancetype)initWithDisplayLink:(CADisplayLink *)displayLink -{ - if ((self = [super init])) { - _timestamp = displayLink.timestamp; - _deltaTime = displayLink.duration; - } - return self; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTImageSource.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTImageSource.h deleted file mode 100644 index f989111b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTImageSource.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -/** - * Object containing an image URL and associated metadata. - */ -@interface RCTImageSource : NSObject - -@property (nonatomic, copy, readonly) NSURLRequest *request; -@property (nonatomic, assign, readonly) CGSize size; -@property (nonatomic, assign, readonly) CGFloat scale; - -/** - * Create a new image source object. - * Pass a size of CGSizeZero if you do not know or wish to specify the image - * size. Pass a scale of zero if you do not know or wish to specify the scale. - */ -- (instancetype)initWithURLRequest:(NSURLRequest *)request - size:(CGSize)size - scale:(CGFloat)scale; - -/** - * Create a copy of the image source with the specified size and scale. - */ -- (instancetype)imageSourceWithSize:(CGSize)size scale:(CGFloat)scale; - -@end - -@interface RCTConvert (ImageSource) - -+ (RCTImageSource *)RCTImageSource:(id)json; -+ (NSArray *)RCTImageSourceArray:(id)json; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTImageSource.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTImageSource.m deleted file mode 100644 index 0916a4d5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTImageSource.m +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTImageSource.h" -#import "RCTUtils.h" - -@interface RCTImageSource () - -@property (nonatomic, assign) BOOL packagerAsset; - -@end - -@implementation RCTImageSource - -- (instancetype)initWithURLRequest:(NSURLRequest *)request size:(CGSize)size scale:(CGFloat)scale -{ - if ((self = [super init])) { - _request = [request copy]; - _size = size; - _scale = scale; - } - return self; -} - -- (instancetype)imageSourceWithSize:(CGSize)size scale:(CGFloat)scale -{ - RCTImageSource *imageSource = [[RCTImageSource alloc] initWithURLRequest:_request - size:size - scale:scale]; - imageSource.packagerAsset = _packagerAsset; - return imageSource; -} - -- (BOOL)isEqual:(RCTImageSource *)object -{ - if (![object isKindOfClass:[RCTImageSource class]]) { - return NO; - } - return [_request isEqual:object.request] && _scale == object.scale && - (CGSizeEqualToSize(_size, object.size) || CGSizeEqualToSize(object.size, CGSizeZero)); -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"", - self, _request.URL, NSStringFromCGSize(_size), _scale]; -} - -@end - -@implementation RCTConvert (ImageSource) - -+ (RCTImageSource *)RCTImageSource:(id)json -{ - if (!json) { - return nil; - } - - NSURLRequest *request; - CGSize size = CGSizeZero; - CGFloat scale = 1.0; - BOOL packagerAsset = NO; - if ([json isKindOfClass:[NSDictionary class]]) { - if (!(request = [self NSURLRequest:json])) { - return nil; - } - size = [self CGSize:json]; - scale = [self CGFloat:json[@"scale"]] ?: [self BOOL:json[@"deprecated"]] ? 0.0 : 1.0; - packagerAsset = [self BOOL:json[@"__packager_asset"]]; - } else if ([json isKindOfClass:[NSString class]]) { - request = [self NSURLRequest:json]; - } else { - RCTLogConvertError(json, @"an image. Did you forget to call resolveAssetSource() on the JS side?"); - return nil; - } - - RCTImageSource *imageSource = [[RCTImageSource alloc] initWithURLRequest:request - size:size - scale:scale]; - imageSource.packagerAsset = packagerAsset; - return imageSource; -} - -RCT_ARRAY_CONVERTER(RCTImageSource) - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTInvalidating.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTInvalidating.h deleted file mode 100644 index 02e8938f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTInvalidating.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@protocol RCTInvalidating - -- (void)invalidate; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTJSStackFrame.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTJSStackFrame.h deleted file mode 100644 index ee46def2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTJSStackFrame.h +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTJSStackFrame : NSObject - -@property (nonatomic, copy, readonly) NSString *methodName; -@property (nonatomic, copy, readonly) NSString *file; -@property (nonatomic, readonly) NSInteger lineNumber; -@property (nonatomic, readonly) NSInteger column; - -- (instancetype)initWithMethodName:(NSString *)methodName file:(NSString *)file lineNumber:(NSInteger)lineNumber column:(NSInteger)column; -- (NSDictionary *)toDictionary; - -+ (instancetype)stackFrameWithLine:(NSString *)line; -+ (instancetype)stackFrameWithDictionary:(NSDictionary *)dict; -+ (NSArray *)stackFramesWithLines:(NSString *)lines; -+ (NSArray *)stackFramesWithDictionaries:(NSArray *)dicts; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTJSStackFrame.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTJSStackFrame.m deleted file mode 100644 index ed2ea22e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTJSStackFrame.m +++ /dev/null @@ -1,139 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTJSStackFrame.h" - -#import "RCTLog.h" -#import "RCTUtils.h" - -/** -* The RegEx used to parse Error.stack. -* -* JavaScriptCore has the following format: -* -* Exception: Error: argh -* func1@/path/to/file.js:2:18 -* func2@/path/to/file.js:6:8 -* eval@[native code] -* global code@/path/to/file.js:13:5 -* -* Another supported format: -* -* Error: argh -* at func1 (/path/to/file.js:2:18) -* at func2 (/path/to/file.js:6:8) -* at eval (native) -* at global (/path/to/file.js:13:5) -*/ -static NSRegularExpression *RCTJSStackFrameRegex() -{ - static dispatch_once_t onceToken; - static NSRegularExpression *_regex; - dispatch_once(&onceToken, ^{ - NSString *pattern = - @"\\s*(?:at)?\\s*" // Skip leading "at" and whitespace, noncapturing - @"(.+?)" // Capture the function name (group 1) - @"\\s*[@(]" // Skip whitespace, then @ or ( - @"(.*):" // Capture the file name (group 2), then colon - @"(\\d+):(\\d+)" // Line and column number (groups 3 and 4) - @"\\)?$" // Optional closing paren and EOL - ; - NSError *regexError; - _regex = [NSRegularExpression regularExpressionWithPattern:pattern options:0 error:®exError]; - if (regexError) { - RCTLogError(@"Failed to build regex: %@", [regexError localizedDescription]); - } - }); - return _regex; -} - -@implementation RCTJSStackFrame - -- (instancetype)initWithMethodName:(NSString *)methodName file:(NSString *)file lineNumber:(NSInteger)lineNumber column:(NSInteger)column -{ - if (self = [super init]) { - _methodName = methodName; - _file = file; - _lineNumber = lineNumber; - _column = column; - } - return self; -} - -- (NSDictionary *)toDictionary -{ - return @{ - @"methodName": RCTNullIfNil(self.methodName), - @"file": RCTNullIfNil(self.file), - @"lineNumber": @(self.lineNumber), - @"column": @(self.column) - }; -} - -+ (instancetype)stackFrameWithLine:(NSString *)line -{ - NSTextCheckingResult *match = [RCTJSStackFrameRegex() firstMatchInString:line options:0 range:NSMakeRange(0, line.length)]; - if (!match) { - return nil; - } - - // methodName may not be present for e.g. anonymous functions - const NSRange methodNameRange = [match rangeAtIndex:1]; - NSString *methodName = methodNameRange.location == NSNotFound ? nil : [line substringWithRange:methodNameRange]; - NSString *file = [line substringWithRange:[match rangeAtIndex:2]]; - NSString *lineNumber = [line substringWithRange:[match rangeAtIndex:3]]; - NSString *column = [line substringWithRange:[match rangeAtIndex:4]]; - - return [[self alloc] initWithMethodName:methodName - file:file - lineNumber:[lineNumber integerValue] - column:[column integerValue]]; -} - -+ (instancetype)stackFrameWithDictionary:(NSDictionary *)dict -{ - return [[self alloc] initWithMethodName:RCTNilIfNull(dict[@"methodName"]) - file:dict[@"file"] - lineNumber:[RCTNilIfNull(dict[@"lineNumber"]) integerValue] - column:[RCTNilIfNull(dict[@"column"]) integerValue]]; -} - -+ (NSArray *)stackFramesWithLines:(NSString *)lines -{ - NSMutableArray *stack = [NSMutableArray new]; - for (NSString *line in [lines componentsSeparatedByString:@"\n"]) { - RCTJSStackFrame *frame = [self stackFrameWithLine:line]; - if (frame) { - [stack addObject:frame]; - } - } - return stack; -} - -+ (NSArray *)stackFramesWithDictionaries:(NSArray *)dicts -{ - NSMutableArray *stack = [NSMutableArray new]; - for (NSDictionary *dict in dicts) { - RCTJSStackFrame *frame = [self stackFrameWithDictionary:dict]; - if (frame) { - [stack addObject:frame]; - } - } - return stack; -} - -- (NSString *)description { - return [NSString stringWithFormat:@"<%@: %p method name: %@; file name: %@; line: %ld; column: %ld>", - self.class, - self, - self.methodName, - self.file, - (long)self.lineNumber, - (long)self.column]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTJavaScriptExecutor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTJavaScriptExecutor.h deleted file mode 100644 index d3739cb6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTJavaScriptExecutor.h +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -typedef void (^RCTJavaScriptCompleteBlock)(NSError *error); -typedef void (^RCTJavaScriptCallback)(id result, NSError *error); - -/** - * Abstracts away a JavaScript execution context - we may be running code in a - * web view (for debugging purposes), or may be running code in a `JSContext`. - */ -@protocol RCTJavaScriptExecutor - -/** - * Used to set up the executor after the bridge has been fully initialized. - * Do any expensive setup in this method instead of `-init`. - */ -- (void)setUp; - -/** - * Whether the executor has been invalidated - */ -@property (nonatomic, readonly, getter=isValid) BOOL valid; - -/** - * Executes BatchedBridge.flushedQueue on JS thread and calls the given callback - * with JSValue, containing the next queue, and JSContext. - */ -- (void)flushedQueue:(RCTJavaScriptCallback)onComplete; - -/** - * Executes BatchedBridge.callFunctionReturnFlushedQueue with the module name, - * method name and optional additional arguments on the JS thread and calls the - * given callback with JSValue, containing the next queue, and JSContext. - */ -- (void)callFunctionOnModule:(NSString *)module - method:(NSString *)method - arguments:(NSArray *)args - callback:(RCTJavaScriptCallback)onComplete; - -/** - * Executes BatchedBridge.invokeCallbackAndReturnFlushedQueue with the cbID, - * and optional additional arguments on the JS thread and calls the - * given callback with JSValue, containing the next queue, and JSContext. - */ -- (void)invokeCallbackID:(NSNumber *)cbID - arguments:(NSArray *)args - callback:(RCTJavaScriptCallback)onComplete; - -/** - * Runs an application script, and notifies of the script load being complete via `onComplete`. - */ -- (void)executeApplicationScript:(NSData *)script - sourceURL:(NSURL *)sourceURL - onComplete:(RCTJavaScriptCompleteBlock)onComplete; - -- (void)injectJSONText:(NSString *)script - asGlobalObjectNamed:(NSString *)objectName - callback:(RCTJavaScriptCompleteBlock)onComplete; - -/** - * Enqueue a block to run in the executors JS thread. Fallback to `dispatch_async` - * on the main queue if the executor doesn't own a thread. - */ -- (void)executeBlockOnJavaScriptQueue:(dispatch_block_t)block; - -/** - * Special case for Timers + ContextExecutor - instead of the default - * if jsthread then call else dispatch call on jsthread - * ensure the call is made async on the jsthread - */ -- (void)executeAsyncBlockOnJavaScriptQueue:(dispatch_block_t)block; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTJavaScriptLoader.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTJavaScriptLoader.h deleted file mode 100644 index 86022500..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTJavaScriptLoader.h +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#if __has_include() -#import -#elif __has_include("RCTDefines.h") -#import "RCTDefines.h" -#else -#import "React/RCTDefines.h" -#endif - -extern NSString *const RCTJavaScriptLoaderErrorDomain; - -NS_ENUM(NSInteger) { - RCTJavaScriptLoaderErrorNoScriptURL = 1, - RCTJavaScriptLoaderErrorFailedOpeningFile = 2, - RCTJavaScriptLoaderErrorFailedReadingFile = 3, - RCTJavaScriptLoaderErrorFailedStatingFile = 3, - RCTJavaScriptLoaderErrorURLLoadFailed = 3, - RCTJavaScriptLoaderErrorBCVersion = 4, - RCTJavaScriptLoaderErrorBCNotSupported = 4, - - RCTJavaScriptLoaderErrorCannotBeLoadedSynchronously = 1000, -}; - -NS_ENUM(NSInteger) { - RCTSourceFilesChangedCountNotBuiltByBundler = -2, - RCTSourceFilesChangedCountRebuiltFromScratch = -1, -}; - -@interface RCTLoadingProgress : NSObject - -@property (nonatomic, copy) NSString *status; -@property (strong, nonatomic) NSNumber *done; -@property (strong, nonatomic) NSNumber *total; - -@end - -@interface RCTSource : NSObject - -/** - * URL of the source object. - */ -@property (strong, nonatomic, readonly) NSURL *url; - -/** - * JS source (or simply the binary header in the case of a RAM bundle). - */ -@property (strong, nonatomic, readonly) NSData *data; - -/** - * Length of the entire JS bundle. Note that self.length != self.data.length in the case of certain bundle formats. For - * instance, when using RAM bundles: - * - * - self.data will point to the bundle header - * - self.data.length is the length of the bundle header, i.e. sizeof(facebook::react::BundleHeader) - * - self.length is the length of the entire bundle file (header + contents) - */ -@property (nonatomic, readonly) NSUInteger length; - -/** - * Returns number of files changed when building this bundle: - * - * - RCTSourceFilesChangedCountNotBuiltByBundler if the source wasn't built by the bundler (e.g. read from disk) - * - RCTSourceFilesChangedCountRebuiltFromScratch if the source was rebuilt from scratch by the bundler - * - Otherwise, the number of files changed when incrementally rebuilding the source - */ -@property (nonatomic, readonly) NSInteger filesChangedCount; - -@end - -typedef void (^RCTSourceLoadProgressBlock)(RCTLoadingProgress *progressData); -typedef void (^RCTSourceLoadBlock)(NSError *error, RCTSource *source); - -@interface RCTJavaScriptLoader : NSObject - -+ (void)loadBundleAtURL:(NSURL *)scriptURL onProgress:(RCTSourceLoadProgressBlock)onProgress onComplete:(RCTSourceLoadBlock)onComplete; - -/** - * @experimental - * Attempts to synchronously load the script at the given URL. The following two conditions must be met: - * 1. It must be a file URL. - * 2. It must not point to a text/javascript file. - * If the URL does not meet those conditions, this method will return nil and supply an error with the domain - * RCTJavaScriptLoaderErrorDomain and the code RCTJavaScriptLoaderErrorCannotBeLoadedSynchronously. - */ -+ (NSData *)attemptSynchronousLoadOfBundleAtURL:(NSURL *)scriptURL - runtimeBCVersion:(int32_t)runtimeBCVersion - sourceLength:(int64_t *)sourceLength - error:(NSError **)error; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTJavaScriptLoader.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTJavaScriptLoader.mm deleted file mode 100644 index 5f14bd22..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTJavaScriptLoader.mm +++ /dev/null @@ -1,366 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTJavaScriptLoader.h" - -#import - -#import - -#import "RCTBridge.h" -#import "RCTConvert.h" -#import "RCTMultipartDataTask.h" -#import "RCTPerformanceLogger.h" -#import "RCTUtils.h" - -NSString *const RCTJavaScriptLoaderErrorDomain = @"RCTJavaScriptLoaderErrorDomain"; - -static const int32_t JSNoBytecodeFileFormatVersion = -1; - -@interface RCTSource() -{ -@public - NSURL *_url; - NSData *_data; - NSUInteger _length; - NSInteger _filesChangedCount; -} - -@end - -@implementation RCTSource - -static RCTSource *RCTSourceCreate(NSURL *url, NSData *data, int64_t length) NS_RETURNS_RETAINED -{ - RCTSource *source = [RCTSource new]; - source->_url = url; - source->_data = data; - source->_length = length; - source->_filesChangedCount = RCTSourceFilesChangedCountNotBuiltByBundler; - return source; -} - -@end - -@implementation RCTLoadingProgress - -- (NSString *)description -{ - NSMutableString *desc = [NSMutableString new]; - [desc appendString:_status ?: @"Loading"]; - - if ([_total integerValue] > 0) { - [desc appendFormat:@" %ld%% (%@/%@)", (long)(100 * [_done integerValue] / [_total integerValue]), _done, _total]; - } - [desc appendString:@"\u2026"]; - return desc; -} - -@end - -@implementation RCTJavaScriptLoader - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -+ (void)loadBundleAtURL:(NSURL *)scriptURL onProgress:(RCTSourceLoadProgressBlock)onProgress onComplete:(RCTSourceLoadBlock)onComplete -{ - int64_t sourceLength; - NSError *error; - NSData *data = [self attemptSynchronousLoadOfBundleAtURL:scriptURL - runtimeBCVersion:JSNoBytecodeFileFormatVersion - sourceLength:&sourceLength - error:&error]; - if (data) { - onComplete(nil, RCTSourceCreate(scriptURL, data, sourceLength)); - return; - } - - const BOOL isCannotLoadSyncError = - [error.domain isEqualToString:RCTJavaScriptLoaderErrorDomain] - && error.code == RCTJavaScriptLoaderErrorCannotBeLoadedSynchronously; - - if (isCannotLoadSyncError) { - attemptAsynchronousLoadOfBundleAtURL(scriptURL, onProgress, onComplete); - } else { - onComplete(error, nil); - } -} - -+ (NSData *)attemptSynchronousLoadOfBundleAtURL:(NSURL *)scriptURL - runtimeBCVersion:(int32_t)runtimeBCVersion - sourceLength:(int64_t *)sourceLength - error:(NSError **)error -{ - NSString *unsanitizedScriptURLString = scriptURL.absoluteString; - // Sanitize the script URL - scriptURL = sanitizeURL(scriptURL); - - if (!scriptURL) { - if (error) { - *error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain - code:RCTJavaScriptLoaderErrorNoScriptURL - userInfo:@{NSLocalizedDescriptionKey: - [NSString stringWithFormat:@"No script URL provided. Make sure the packager is " - @"running or you have embedded a JS bundle in your application bundle.\n\n" - @"unsanitizedScriptURLString = %@", unsanitizedScriptURLString]}]; - } - return nil; - } - - // Load local script file - if (!scriptURL.fileURL) { - if (error) { - *error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain - code:RCTJavaScriptLoaderErrorCannotBeLoadedSynchronously - userInfo:@{NSLocalizedDescriptionKey: - [NSString stringWithFormat:@"Cannot load %@ URLs synchronously", - scriptURL.scheme]}]; - } - return nil; - } - - // Load the first 4 bytes to check if the bundle is regular or RAM ("Random Access Modules" bundle). - // The RAM bundle has a magic number in the 4 first bytes `(0xFB0BD1E5)`. - // The benefit of RAM bundle over a regular bundle is that we can lazily inject - // modules into JSC as they're required. - FILE *bundle = fopen(scriptURL.path.UTF8String, "r"); - if (!bundle) { - if (error) { - *error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain - code:RCTJavaScriptLoaderErrorFailedOpeningFile - userInfo:@{NSLocalizedDescriptionKey: - [NSString stringWithFormat:@"Error opening bundle %@", scriptURL.path]}]; - } - return nil; - } - - facebook::react::BundleHeader header; - size_t readResult = fread(&header, sizeof(header), 1, bundle); - fclose(bundle); - if (readResult != 1) { - if (error) { - *error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain - code:RCTJavaScriptLoaderErrorFailedReadingFile - userInfo:@{NSLocalizedDescriptionKey: - [NSString stringWithFormat:@"Error reading bundle %@", scriptURL.path]}]; - } - return nil; - } - - facebook::react::ScriptTag tag = facebook::react::parseTypeFromHeader(header); - switch (tag) { - case facebook::react::ScriptTag::RAMBundle: - break; - - case facebook::react::ScriptTag::String: { -#if RCT_ENABLE_INSPECTOR - NSData *source = [NSData dataWithContentsOfFile:scriptURL.path - options:NSDataReadingMappedIfSafe - error:error]; - if (sourceLength && source != nil) { - *sourceLength = source.length; - } - return source; -#else - if (error) { - *error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain - code:RCTJavaScriptLoaderErrorCannotBeLoadedSynchronously - userInfo:@{NSLocalizedDescriptionKey: - @"Cannot load text/javascript files synchronously"}]; - } - return nil; -#endif - } - case facebook::react::ScriptTag::BCBundle: - if (runtimeBCVersion == JSNoBytecodeFileFormatVersion || runtimeBCVersion < 0) { - if (error) { - *error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain - code:RCTJavaScriptLoaderErrorBCNotSupported - userInfo:@{NSLocalizedDescriptionKey: - @"Bytecode bundles are not supported by this runtime."}]; - } - return nil; - } - else if ((uint32_t)runtimeBCVersion != header.version) { - if (error) { - NSString *errDesc = - [NSString stringWithFormat:@"BC Version Mismatch. Expect: %d, Actual: %u", - runtimeBCVersion, header.version]; - - *error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain - code:RCTJavaScriptLoaderErrorBCVersion - userInfo:@{NSLocalizedDescriptionKey: errDesc}]; - } - return nil; - } - break; - } - - struct stat statInfo; - if (stat(scriptURL.path.UTF8String, &statInfo) != 0) { - if (error) { - *error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain - code:RCTJavaScriptLoaderErrorFailedStatingFile - userInfo:@{NSLocalizedDescriptionKey: - [NSString stringWithFormat:@"Error stating bundle %@", scriptURL.path]}]; - } - return nil; - } - if (sourceLength) { - *sourceLength = statInfo.st_size; - } - return [NSData dataWithBytes:&header length:sizeof(header)]; -} - -static void parseHeaders(NSDictionary *headers, RCTSource *source) { - source->_filesChangedCount = [headers[@"X-Metro-Files-Changed-Count"] integerValue]; -} - -static void attemptAsynchronousLoadOfBundleAtURL(NSURL *scriptURL, RCTSourceLoadProgressBlock onProgress, RCTSourceLoadBlock onComplete) -{ - scriptURL = sanitizeURL(scriptURL); - - if (scriptURL.fileURL) { - // Reading in a large bundle can be slow. Dispatch to the background queue to do it. - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - NSError *error = nil; - NSData *source = [NSData dataWithContentsOfFile:scriptURL.path - options:NSDataReadingMappedIfSafe - error:&error]; - onComplete(error, RCTSourceCreate(scriptURL, source, source.length)); - }); - return; - } - - RCTMultipartDataTask *task = [[RCTMultipartDataTask alloc] initWithURL:scriptURL partHandler:^(NSInteger statusCode, NSDictionary *headers, NSData *data, NSError *error, BOOL done) { - if (!done) { - if (onProgress) { - onProgress(progressEventFromData(data)); - } - return; - } - - // Handle general request errors - if (error) { - if ([error.domain isEqualToString:NSURLErrorDomain]) { - error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain - code:RCTJavaScriptLoaderErrorURLLoadFailed - userInfo: - @{ - NSLocalizedDescriptionKey: - [@"Could not connect to development server.\n\n" - "Ensure the following:\n" - "- Node server is running and available on the same network - run 'npm start' from react-native root\n" - "- Node server URL is correctly set in AppDelegate\n" - "- WiFi is enabled and connected to the same network as the Node Server\n\n" - "URL: " stringByAppendingString:scriptURL.absoluteString], - NSLocalizedFailureReasonErrorKey: error.localizedDescription, - NSUnderlyingErrorKey: error, - }]; - } - onComplete(error, nil); - return; - } - - // For multipart responses packager sets X-Http-Status header in case HTTP status code - // is different from 200 OK - NSString *statusCodeHeader = headers[@"X-Http-Status"]; - if (statusCodeHeader) { - statusCode = [statusCodeHeader integerValue]; - } - - if (statusCode != 200) { - error = [NSError errorWithDomain:@"JSServer" - code:statusCode - userInfo:userInfoForRawResponse([[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding])]; - onComplete(error, nil); - return; - } - - // Validate that the packager actually returned javascript. - NSString *contentType = headers[@"Content-Type"]; - NSString *mimeType = [[contentType componentsSeparatedByString:@";"] firstObject]; - if (![mimeType isEqualToString:@"application/javascript"] && - ![mimeType isEqualToString:@"text/javascript"]) { - NSString *description = [NSString stringWithFormat:@"Expected MIME-Type to be 'application/javascript' or 'text/javascript', but got '%@'.", mimeType]; - error = [NSError errorWithDomain:@"JSServer" - code:NSURLErrorCannotParseResponse - userInfo:@{ - NSLocalizedDescriptionKey: description, - @"headers": headers, - @"data": data - }]; - onComplete(error, nil); - return; - } - - RCTSource *source = RCTSourceCreate(scriptURL, data, data.length); - parseHeaders(headers, source); - onComplete(nil, source); - } progressHandler:^(NSDictionary *headers, NSNumber *loaded, NSNumber *total) { - // Only care about download progress events for the javascript bundle part. - if ([headers[@"Content-Type"] isEqualToString:@"application/javascript"]) { - onProgress(progressEventFromDownloadProgress(loaded, total)); - } - }]; - - [task startTask]; -} - -static NSURL *sanitizeURL(NSURL *url) -{ - // Why we do this is lost to time. We probably shouldn't; passing a valid URL is the caller's responsibility not ours. - return [RCTConvert NSURL:url.absoluteString]; -} - -static RCTLoadingProgress *progressEventFromData(NSData *rawData) -{ - NSString *text = [[NSString alloc] initWithData:rawData encoding:NSUTF8StringEncoding]; - id info = RCTJSONParse(text, nil); - if (!info || ![info isKindOfClass:[NSDictionary class]]) { - return nil; - } - - RCTLoadingProgress *progress = [RCTLoadingProgress new]; - progress.status = info[@"status"]; - progress.done = info[@"done"]; - progress.total = info[@"total"]; - return progress; -} - -static RCTLoadingProgress *progressEventFromDownloadProgress(NSNumber *total, NSNumber *done) -{ - RCTLoadingProgress *progress = [RCTLoadingProgress new]; - progress.status = @"Downloading JavaScript bundle"; - // Progress values are in bytes transform them to kilobytes for smaller numbers. - progress.done = done != nil ? @([done integerValue] / 1024) : nil; - progress.total = total != nil ? @([total integerValue] / 1024) : nil; - return progress; -} - -static NSDictionary *userInfoForRawResponse(NSString *rawText) -{ - NSDictionary *parsedResponse = RCTJSONParse(rawText, nil); - if (![parsedResponse isKindOfClass:[NSDictionary class]]) { - return @{NSLocalizedDescriptionKey: rawText}; - } - NSArray *errors = parsedResponse[@"errors"]; - if (![errors isKindOfClass:[NSArray class]]) { - return @{NSLocalizedDescriptionKey: rawText}; - } - NSMutableArray *fakeStack = [NSMutableArray new]; - for (NSDictionary *err in errors) { - [fakeStack addObject: @{ - @"methodName": err[@"description"] ?: @"", - @"file": err[@"filename"] ?: @"", - @"lineNumber": err[@"lineNumber"] ?: @0 - }]; - } - return @{NSLocalizedDescriptionKey: parsedResponse[@"message"] ?: @"No message provided", @"stack": [fakeStack copy]}; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTKeyCommands.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTKeyCommands.h deleted file mode 100644 index 4c9c1fed..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTKeyCommands.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTKeyCommands : NSObject - -+ (instancetype)sharedInstance; - -/** - * Register a single-press keyboard command. - */ -- (void)registerKeyCommandWithInput:(NSString *)input - modifierFlags:(UIKeyModifierFlags)flags - action:(void (^)(UIKeyCommand *command))block; - -/** - * Unregister a single-press keyboard command. - */ -- (void)unregisterKeyCommandWithInput:(NSString *)input - modifierFlags:(UIKeyModifierFlags)flags; - -/** - * Check if a single-press command is registered. - */ -- (BOOL)isKeyCommandRegisteredForInput:(NSString *)input - modifierFlags:(UIKeyModifierFlags)flags; - -/** - * Register a double-press keyboard command. - */ -- (void)registerDoublePressKeyCommandWithInput:(NSString *)input - modifierFlags:(UIKeyModifierFlags)flags - action:(void (^)(UIKeyCommand *command))block; - -/** - * Unregister a double-press keyboard command. - */ -- (void)unregisterDoublePressKeyCommandWithInput:(NSString *)input - modifierFlags:(UIKeyModifierFlags)flags; - -/** - * Check if a double-press command is registered. - */ -- (BOOL)isDoublePressKeyCommandRegisteredForInput:(NSString *)input - modifierFlags:(UIKeyModifierFlags)flags; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTKeyCommands.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTKeyCommands.m deleted file mode 100644 index 4bde8957..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTKeyCommands.m +++ /dev/null @@ -1,394 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTKeyCommands.h" - -#import - -#import "RCTDefines.h" -#import "RCTUtils.h" - -#if RCT_DEV - -static BOOL RCTIsIOS8OrEarlier() -{ - return [UIDevice currentDevice].systemVersion.floatValue < 9; -} - -@interface RCTKeyCommand : NSObject - -@property (nonatomic, strong) UIKeyCommand *keyCommand; -@property (nonatomic, copy) void (^block)(UIKeyCommand *); - -@end - -@implementation RCTKeyCommand - -- (instancetype)initWithKeyCommand:(UIKeyCommand *)keyCommand - block:(void (^)(UIKeyCommand *))block -{ - if ((self = [super init])) { - _keyCommand = keyCommand; - _block = block; - } - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (id)copyWithZone:(__unused NSZone *)zone -{ - return self; -} - -- (NSUInteger)hash -{ - return _keyCommand.input.hash ^ _keyCommand.modifierFlags; -} - -- (BOOL)isEqual:(RCTKeyCommand *)object -{ - if (![object isKindOfClass:[RCTKeyCommand class]]) { - return NO; - } - return [self matchesInput:object.keyCommand.input - flags:object.keyCommand.modifierFlags]; -} - -- (BOOL)matchesInput:(NSString *)input flags:(UIKeyModifierFlags)flags -{ - return [_keyCommand.input isEqual:input] && _keyCommand.modifierFlags == flags; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"<%@:%p input=\"%@\" flags=%lld hasBlock=%@>", - [self class], self, _keyCommand.input, (long long)_keyCommand.modifierFlags, - _block ? @"YES" : @"NO"]; -} - -@end - -@interface RCTKeyCommands () - -@property (nonatomic, strong) NSMutableSet *commands; - -@end - -@implementation UIResponder (RCTKeyCommands) - -+ (UIResponder *)RCT_getFirstResponder:(UIResponder *)view -{ - UIResponder *firstResponder = nil; - - if (view.isFirstResponder) { - return view; - } else if ([view isKindOfClass:[UIViewController class]]) { - if ([(UIViewController *)view parentViewController]) { - firstResponder = [UIResponder RCT_getFirstResponder: [(UIViewController *)view parentViewController]]; - } - return firstResponder ? firstResponder : [UIResponder RCT_getFirstResponder: [(UIViewController *)view view]]; - } else if ([view isKindOfClass:[UIView class]]) { - for (UIView *subview in [(UIView *)view subviews]) { - firstResponder = [UIResponder RCT_getFirstResponder: subview]; - if (firstResponder) { - return firstResponder; - } - } - } - - return firstResponder; -} - -- (NSArray *)RCT_keyCommands -{ - NSSet *commands = [RCTKeyCommands sharedInstance].commands; - return [[commands valueForKeyPath:@"keyCommand"] allObjects]; -} - -/** - * Single Press Key Command Response - * Command + KeyEvent (Command + R/D, etc.) - */ -- (void)RCT_handleKeyCommand:(UIKeyCommand *)key -{ - // NOTE: throttle the key handler because on iOS 9 the handleKeyCommand: - // method gets called repeatedly if the command key is held down. - static NSTimeInterval lastCommand = 0; - if (RCTIsIOS8OrEarlier() || CACurrentMediaTime() - lastCommand > 0.5) { - for (RCTKeyCommand *command in [RCTKeyCommands sharedInstance].commands) { - if ([command.keyCommand.input isEqualToString:key.input] && - command.keyCommand.modifierFlags == key.modifierFlags) { - if (command.block) { - command.block(key); - lastCommand = CACurrentMediaTime(); - } - } - } - } -} - -/** - * Double Press Key Command Response - * Double KeyEvent (Double R, etc.) - */ -- (void)RCT_handleDoublePressKeyCommand:(UIKeyCommand *)key -{ - static BOOL firstPress = YES; - static NSTimeInterval lastCommand = 0; - static NSTimeInterval lastDoubleCommand = 0; - static NSString *lastInput = nil; - static UIKeyModifierFlags lastModifierFlags = 0; - - if (firstPress) { - for (RCTKeyCommand *command in [RCTKeyCommands sharedInstance].commands) { - if ([command.keyCommand.input isEqualToString:key.input] && - command.keyCommand.modifierFlags == key.modifierFlags && - command.block) { - - firstPress = NO; - lastCommand = CACurrentMediaTime(); - lastInput = key.input; - lastModifierFlags = key.modifierFlags; - return; - } - } - } else { - // Second keyevent within 0.2 second, - // with the same key as the first one. - if (CACurrentMediaTime() - lastCommand < 0.2 && - lastInput == key.input && - lastModifierFlags == key.modifierFlags) { - - for (RCTKeyCommand *command in [RCTKeyCommands sharedInstance].commands) { - if ([command.keyCommand.input isEqualToString:key.input] && - command.keyCommand.modifierFlags == key.modifierFlags && - command.block) { - - // NOTE: throttle the key handler because on iOS 9 the handleKeyCommand: - // method gets called repeatedly if the command key is held down. - if (RCTIsIOS8OrEarlier() || CACurrentMediaTime() - lastDoubleCommand > 0.5) { - command.block(key); - lastDoubleCommand = CACurrentMediaTime(); - } - firstPress = YES; - return; - } - } - } - - lastCommand = CACurrentMediaTime(); - lastInput = key.input; - lastModifierFlags = key.modifierFlags; - } -} - -@end - -@implementation UIApplication (RCTKeyCommands) - -// Required for iOS 8.x -- (BOOL)RCT_sendAction:(SEL)action to:(id)target from:(id)sender forEvent:(UIEvent *)event -{ - if (action == @selector(RCT_handleKeyCommand:)) { - [self RCT_handleKeyCommand:sender]; - return YES; - } else if (action == @selector(RCT_handleDoublePressKeyCommand:)) { - [self RCT_handleDoublePressKeyCommand:sender]; - return YES; - } - return [self RCT_sendAction:action to:target from:sender forEvent:event]; -} - -@end - -@implementation RCTKeyCommands - -+ (void)initialize -{ - if (RCTIsIOS8OrEarlier()) { - - // swizzle UIApplication - RCTSwapInstanceMethods([UIApplication class], - @selector(keyCommands), - @selector(RCT_keyCommands)); - - RCTSwapInstanceMethods([UIApplication class], - @selector(sendAction:to:from:forEvent:), - @selector(RCT_sendAction:to:from:forEvent:)); - } else { - - // swizzle UIResponder - RCTSwapInstanceMethods([UIResponder class], - @selector(keyCommands), - @selector(RCT_keyCommands)); - } -} - -+ (instancetype)sharedInstance -{ - static RCTKeyCommands *sharedInstance; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedInstance = [self new]; - }); - - return sharedInstance; -} - -- (instancetype)init -{ - if ((self = [super init])) { - _commands = [NSMutableSet new]; - } - return self; -} - -- (void)registerKeyCommandWithInput:(NSString *)input - modifierFlags:(UIKeyModifierFlags)flags - action:(void (^)(UIKeyCommand *))block -{ - RCTAssertMainQueue(); - - if (input.length && flags && RCTIsIOS8OrEarlier()) { - - // Workaround around the first cmd not working: http://openradar.appspot.com/19613391 - // You can register just the cmd key and do nothing. This ensures that - // command-key modified commands will work first time. Fixed in iOS 9. - - [self registerKeyCommandWithInput:@"" - modifierFlags:flags - action:nil]; - } - - UIKeyCommand *command = [UIKeyCommand keyCommandWithInput:input - modifierFlags:flags - action:@selector(RCT_handleKeyCommand:)]; - - RCTKeyCommand *keyCommand = [[RCTKeyCommand alloc] initWithKeyCommand:command block:block]; - [_commands removeObject:keyCommand]; - [_commands addObject:keyCommand]; -} - -- (void)unregisterKeyCommandWithInput:(NSString *)input - modifierFlags:(UIKeyModifierFlags)flags -{ - RCTAssertMainQueue(); - - for (RCTKeyCommand *command in _commands.allObjects) { - if ([command matchesInput:input flags:flags]) { - [_commands removeObject:command]; - break; - } - } -} - -- (BOOL)isKeyCommandRegisteredForInput:(NSString *)input - modifierFlags:(UIKeyModifierFlags)flags -{ - RCTAssertMainQueue(); - - for (RCTKeyCommand *command in _commands) { - if ([command matchesInput:input flags:flags]) { - return YES; - } - } - return NO; -} - -- (void)registerDoublePressKeyCommandWithInput:(NSString *)input - modifierFlags:(UIKeyModifierFlags)flags - action:(void (^)(UIKeyCommand *))block -{ - RCTAssertMainQueue(); - - if (input.length && flags && RCTIsIOS8OrEarlier()) { - - // Workaround around the first cmd not working: http://openradar.appspot.com/19613391 - // You can register just the cmd key and do nothing. This ensures that - // command-key modified commands will work first time. Fixed in iOS 9. - - [self registerDoublePressKeyCommandWithInput:@"" - modifierFlags:flags - action:nil]; - } - - UIKeyCommand *command = [UIKeyCommand keyCommandWithInput:input - modifierFlags:flags - action:@selector(RCT_handleDoublePressKeyCommand:)]; - - RCTKeyCommand *keyCommand = [[RCTKeyCommand alloc] initWithKeyCommand:command block:block]; - [_commands removeObject:keyCommand]; - [_commands addObject:keyCommand]; -} - -- (void)unregisterDoublePressKeyCommandWithInput:(NSString *)input - modifierFlags:(UIKeyModifierFlags)flags -{ - RCTAssertMainQueue(); - - for (RCTKeyCommand *command in _commands.allObjects) { - if ([command matchesInput:input flags:flags]) { - [_commands removeObject:command]; - break; - } - } -} - -- (BOOL)isDoublePressKeyCommandRegisteredForInput:(NSString *)input - modifierFlags:(UIKeyModifierFlags)flags -{ - RCTAssertMainQueue(); - - for (RCTKeyCommand *command in _commands) { - if ([command matchesInput:input flags:flags]) { - return YES; - } - } - return NO; -} - -@end - -#else - -@implementation RCTKeyCommands - -+ (instancetype)sharedInstance -{ - return nil; -} - -- (void)registerKeyCommandWithInput:(NSString *)input - modifierFlags:(UIKeyModifierFlags)flags - action:(void (^)(UIKeyCommand *))block {} - -- (void)unregisterKeyCommandWithInput:(NSString *)input - modifierFlags:(UIKeyModifierFlags)flags {} - -- (BOOL)isKeyCommandRegisteredForInput:(NSString *)input - modifierFlags:(UIKeyModifierFlags)flags -{ - return NO; -} - -- (void)registerDoublePressKeyCommandWithInput:(NSString *)input - modifierFlags:(UIKeyModifierFlags)flags - action:(void (^)(UIKeyCommand *))block {} - -- (void)unregisterDoublePressKeyCommandWithInput:(NSString *)input - modifierFlags:(UIKeyModifierFlags)flags {} - -- (BOOL)isDoublePressKeyCommandRegisteredForInput:(NSString *)input - modifierFlags:(UIKeyModifierFlags)flags -{ - return NO; -} - -@end - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTLog.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTLog.h deleted file mode 100644 index 0a2e4b29..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTLog.h +++ /dev/null @@ -1,151 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#if __has_include() -#import -#elif __has_include("RCTAssert.h") -#import "RCTAssert.h" -#else -#import "React/RCTAssert.h" -#endif -#if __has_include() -#import -#elif __has_include("RCTDefines.h") -#import "RCTDefines.h" -#else -#import "React/RCTDefines.h" -#endif -#if __has_include() -#import -#elif __has_include("RCTUtils.h") -#import "RCTUtils.h" -#else -#import "React/RCTUtils.h" -#endif - -#ifndef RCTLOG_ENABLED -#define RCTLOG_ENABLED 1 -#endif - -/** - * Thresholds for logs to display a redbox. You can override these values when debugging - * in order to tweak the default logging behavior. - */ -#ifndef RCTLOG_REDBOX_LEVEL -#define RCTLOG_REDBOX_LEVEL RCTLogLevelError -#endif - -/** - * Logging macros. Use these to log information, warnings and errors in your - * own code. - */ -#define RCTLog(...) _RCTLog(RCTLogLevelInfo, __VA_ARGS__) -#define RCTLogTrace(...) _RCTLog(RCTLogLevelTrace, __VA_ARGS__) -#define RCTLogInfo(...) _RCTLog(RCTLogLevelInfo, __VA_ARGS__) -#define RCTLogAdvice(string, ...) RCTLogWarn([@"(ADVICE) " stringByAppendingString:(NSString *)string], __VA_ARGS__) -#define RCTLogWarn(...) _RCTLog(RCTLogLevelWarning, __VA_ARGS__) -#define RCTLogError(...) _RCTLog(RCTLogLevelError, __VA_ARGS__) - -/** - * An enum representing the severity of the log message. - */ -typedef NS_ENUM(NSInteger, RCTLogLevel) { - RCTLogLevelTrace = 0, - RCTLogLevelInfo = 1, - RCTLogLevelWarning = 2, - RCTLogLevelError = 3, - RCTLogLevelFatal = 4 -}; - -/** - * An enum representing the source of a log message. - */ -typedef NS_ENUM(NSInteger, RCTLogSource) { - RCTLogSourceNative = 1, - RCTLogSourceJavaScript = 2 -}; - -/** - * A block signature to be used for custom logging functions. In most cases you - * will want to pass these arguments to the RCTFormatLog function in order to - * generate a string. - */ -typedef void (^RCTLogFunction)( - RCTLogLevel level, - RCTLogSource source, - NSString *fileName, - NSNumber *lineNumber, - NSString *message -); - -/** - * A method to generate a string from a collection of log data. To omit any - * particular data from the log, just pass nil or zero for the argument. - */ -RCT_EXTERN NSString *RCTFormatLog( - NSDate *timestamp, - RCTLogLevel level, - NSString *fileName, - NSNumber *lineNumber, - NSString *message -); - -/** - * The default logging function used by RCTLogXX. - */ -extern RCTLogFunction RCTDefaultLogFunction; - -/** - * These methods get and set the global logging threshold. This is the level - * below which logs will be ignored. Default is RCTLogLevelInfo for debug and - * RCTLogLevelError for production. - */ -RCT_EXTERN void RCTSetLogThreshold(RCTLogLevel threshold); -RCT_EXTERN RCTLogLevel RCTGetLogThreshold(void); - -/** - * These methods get and set the global logging function called by the RCTLogXX - * macros. You can use these to replace the standard behavior with custom log - * functionality. - */ -RCT_EXTERN void RCTSetLogFunction(RCTLogFunction logFunction); -RCT_EXTERN RCTLogFunction RCTGetLogFunction(void); - -/** - * This appends additional code to the existing log function, without replacing - * the existing functionality. Useful if you just want to forward logs to an - * extra service without changing the default behavior. - */ -RCT_EXTERN void RCTAddLogFunction(RCTLogFunction logFunction); - -/** - * This method temporarily overrides the log function while performing the - * specified block. This is useful for testing purposes (to detect if a given - * function logs something) or to suppress or override logging temporarily. - */ -RCT_EXTERN void RCTPerformBlockWithLogFunction(void (^block)(void), RCTLogFunction logFunction); - -/** - * This method adds a conditional prefix to any messages logged within the scope - * of the passed block. This is useful for adding additional context to log - * messages. The block will be performed synchronously on the current thread. - */ -RCT_EXTERN void RCTPerformBlockWithLogPrefix(void (^block)(void), NSString *prefix); - -/** - * Private logging function - ignore this. - */ -#if RCTLOG_ENABLED -#define _RCTLog(lvl, ...) _RCTLogNativeInternal(lvl, __FILE__, __LINE__, __VA_ARGS__) -#else -#define _RCTLog(lvl, ...) do { } while (0) -#endif - -RCT_EXTERN void _RCTLogNativeInternal(RCTLogLevel, const char *, int, NSString *, ...) NS_FORMAT_FUNCTION(4,5); -RCT_EXTERN void _RCTLogJavaScriptInternal(RCTLogLevel, NSString *); diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTLog.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTLog.mm deleted file mode 100644 index dd11bc38..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTLog.mm +++ /dev/null @@ -1,276 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTLog.h" - -#include -#include - -#import "RCTAssert.h" -#import "RCTBridge+Private.h" -#import "RCTBridge.h" -#import "RCTDefines.h" -#import "RCTRedBox.h" -#import "RCTUtils.h" - -static NSString *const RCTLogFunctionStack = @"RCTLogFunctionStack"; - -const char *RCTLogLevels[] = { - "trace", - "info", - "warn", - "error", - "fatal", -}; - -#if RCT_DEBUG -static const RCTLogLevel RCTDefaultLogThreshold = (RCTLogLevel)(RCTLogLevelInfo - 1); -#else -static const RCTLogLevel RCTDefaultLogThreshold = RCTLogLevelError; -#endif - -static RCTLogFunction RCTCurrentLogFunction; -static RCTLogLevel RCTCurrentLogThreshold = RCTDefaultLogThreshold; - -RCTLogLevel RCTGetLogThreshold() -{ - return RCTCurrentLogThreshold; -} - -void RCTSetLogThreshold(RCTLogLevel threshold) { - RCTCurrentLogThreshold = threshold; -} - -RCTLogFunction RCTDefaultLogFunction = ^( - RCTLogLevel level, - __unused RCTLogSource source, - NSString *fileName, - NSNumber *lineNumber, - NSString *message -) -{ - NSString *log = RCTFormatLog([NSDate date], level, fileName, lineNumber, message); - fprintf(stderr, "%s\n", log.UTF8String); - fflush(stderr); - - int aslLevel; - switch(level) { - case RCTLogLevelTrace: - aslLevel = ASL_LEVEL_DEBUG; - break; - case RCTLogLevelInfo: - aslLevel = ASL_LEVEL_NOTICE; - break; - case RCTLogLevelWarning: - aslLevel = ASL_LEVEL_WARNING; - break; - case RCTLogLevelError: - aslLevel = ASL_LEVEL_ERR; - break; - case RCTLogLevelFatal: - aslLevel = ASL_LEVEL_CRIT; - break; - } - asl_log(NULL, NULL, aslLevel, "%s", message.UTF8String); -}; - -void RCTSetLogFunction(RCTLogFunction logFunction) -{ - RCTCurrentLogFunction = logFunction; -} - -RCTLogFunction RCTGetLogFunction() -{ - if (!RCTCurrentLogFunction) { - RCTCurrentLogFunction = RCTDefaultLogFunction; - } - return RCTCurrentLogFunction; -} - -void RCTAddLogFunction(RCTLogFunction logFunction) -{ - RCTLogFunction existing = RCTGetLogFunction(); - if (existing) { - RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { - existing(level, source, fileName, lineNumber, message); - logFunction(level, source, fileName, lineNumber, message); - }); - } else { - RCTSetLogFunction(logFunction); - } -} - -/** - * returns the topmost stacked log function for the current thread, which - * may not be the same as the current value of RCTCurrentLogFunction. - */ -static RCTLogFunction RCTGetLocalLogFunction() -{ - NSMutableDictionary *threadDictionary = [NSThread currentThread].threadDictionary; - NSArray *functionStack = threadDictionary[RCTLogFunctionStack]; - RCTLogFunction logFunction = functionStack.lastObject; - if (logFunction) { - return logFunction; - } - return RCTGetLogFunction(); -} - -void RCTPerformBlockWithLogFunction(void (^block)(void), RCTLogFunction logFunction) -{ - NSMutableDictionary *threadDictionary = [NSThread currentThread].threadDictionary; - NSMutableArray *functionStack = threadDictionary[RCTLogFunctionStack]; - if (!functionStack) { - functionStack = [NSMutableArray new]; - threadDictionary[RCTLogFunctionStack] = functionStack; - } - [functionStack addObject:logFunction]; - block(); - [functionStack removeLastObject]; -} - -void RCTPerformBlockWithLogPrefix(void (^block)(void), NSString *prefix) -{ - RCTLogFunction logFunction = RCTGetLocalLogFunction(); - if (logFunction) { - RCTPerformBlockWithLogFunction(block, ^(RCTLogLevel level, RCTLogSource source, - NSString *fileName, NSNumber *lineNumber, - NSString *message) { - logFunction(level, source, fileName, lineNumber, [prefix stringByAppendingString:message]); - }); - } -} - -NSString *RCTFormatLog( - NSDate *timestamp, - RCTLogLevel level, - NSString *fileName, - NSNumber *lineNumber, - NSString *message -) -{ - NSMutableString *log = [NSMutableString new]; - if (timestamp) { - static NSDateFormatter *formatter; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - formatter = [NSDateFormatter new]; - formatter.dateFormat = formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss.SSS "; - }); - [log appendString:[formatter stringFromDate:timestamp]]; - } - if (level) { - [log appendFormat:@"[%s]", RCTLogLevels[level]]; - } - - [log appendFormat:@"[tid:%@]", RCTCurrentThreadName()]; - - if (fileName) { - fileName = fileName.lastPathComponent; - if (lineNumber) { - [log appendFormat:@"[%@:%@]", fileName, lineNumber]; - } else { - [log appendFormat:@"[%@]", fileName]; - } - } - if (message) { - [log appendString:@" "]; - [log appendString:message]; - } - return log; -} - -static NSRegularExpression *nativeStackFrameRegex() -{ - static dispatch_once_t onceToken; - static NSRegularExpression *_regex; - dispatch_once(&onceToken, ^{ - NSError *regexError; - _regex = [NSRegularExpression regularExpressionWithPattern:@"0x[0-9a-f]+ (.*) \\+ (\\d+)$" options:0 error:®exError]; - if (regexError) { - RCTLogError(@"Failed to build regex: %@", [regexError localizedDescription]); - } - }); - return _regex; -} - -void _RCTLogNativeInternal(RCTLogLevel level, const char *fileName, int lineNumber, NSString *format, ...) -{ - RCTLogFunction logFunction = RCTGetLocalLogFunction(); - BOOL log = RCT_DEBUG || (logFunction != nil); - if (log && level >= RCTGetLogThreshold()) { - // Get message - va_list args; - va_start(args, format); - NSString *message = [[NSString alloc] initWithFormat:format arguments:args]; - va_end(args); - - // Call log function - if (logFunction) { - logFunction(level, RCTLogSourceNative, fileName ? @(fileName) : nil, lineNumber > 0 ? @(lineNumber) : nil, message); - } - -#if RCT_DEBUG - - // Log to red box in debug mode. - if (RCTSharedApplication() && level >= RCTLOG_REDBOX_LEVEL) { - NSArray *stackSymbols = [NSThread callStackSymbols]; - NSMutableArray *stack = - [NSMutableArray arrayWithCapacity:(stackSymbols.count - 1)]; - [stackSymbols enumerateObjectsUsingBlock:^(NSString *frameSymbols, NSUInteger idx, __unused BOOL *stop) { - if (idx == 0) { - // don't include the current frame - return; - } - - NSRange range = NSMakeRange(0, frameSymbols.length); - NSTextCheckingResult *match = [nativeStackFrameRegex() firstMatchInString:frameSymbols options:0 range:range]; - if (!match) { - return; - } - - NSString *methodName = [frameSymbols substringWithRange:[match rangeAtIndex:1]]; - char *demangledName = abi::__cxa_demangle([methodName UTF8String], NULL, NULL, NULL); - if (demangledName) { - methodName = @(demangledName); - free(demangledName); - } - - if (idx == 1 && fileName) { - NSString *file = [@(fileName) componentsSeparatedByString:@"/"].lastObject; - [stack addObject:@{@"methodName": methodName, @"file": file, @"lineNumber": @(lineNumber)}]; - } else { - [stack addObject:@{@"methodName": methodName}]; - } - }]; - - dispatch_async(dispatch_get_main_queue(), ^{ - // red box is thread safe, but by deferring to main queue we avoid a startup - // race condition that causes the module to be accessed before it has loaded - [[RCTBridge currentBridge].redBox showErrorMessage:message withStack:stack]; - }); - } - - if (!RCTRunningInTestEnvironment()) { - // Log to JS executor - [[RCTBridge currentBridge] logMessage:message level:level ? @(RCTLogLevels[level]) : @"info"]; - } - -#endif - - } -} - -void _RCTLogJavaScriptInternal(RCTLogLevel level, NSString *message) -{ - RCTLogFunction logFunction = RCTGetLocalLogFunction(); - BOOL log = RCT_DEBUG || (logFunction != nil); - if (log && level >= RCTGetLogThreshold()) { - if (logFunction) { - logFunction(level, RCTLogSourceJavaScript, nil, nil, message); - } - } -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTManagedPointer.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTManagedPointer.h deleted file mode 100644 index 03859078..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTManagedPointer.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#ifdef __cplusplus - -#include - -#import - -/** - * Type erased wrapper over any cxx value that can be passed as an argument - * to native method. - */ - -@interface RCTManagedPointer: NSObject - -@property (nonatomic, readonly) void *voidPointer; - -- (instancetype)initWithPointer:(std::shared_ptr)pointer; - -@end - -namespace facebook { -namespace react { - -template -RCTManagedPointer *managedPointer(P initializer) -{ - auto ptr = std::shared_ptr(new T(initializer)); - return [[RCTManagedPointer alloc] initWithPointer:std::move(ptr)]; -} - -} } - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTManagedPointer.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTManagedPointer.mm deleted file mode 100644 index 0d0c19c3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTManagedPointer.mm +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTManagedPointer.h" - -@implementation RCTManagedPointer { - std::shared_ptr _pointer; -} - -- (instancetype)initWithPointer:(std::shared_ptr)pointer { - if (self = [super init]) { - _pointer = std::move(pointer); - } - return self; -} - -- (void *)voidPointer { - return _pointer.get(); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTModuleData.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTModuleData.h deleted file mode 100644 index a0602501..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTModuleData.h +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@protocol RCTBridgeMethod; -@protocol RCTBridgeModule; -@class RCTBridge; - -typedef id(^RCTBridgeModuleProvider)(void); - -@interface RCTModuleData : NSObject - -- (instancetype)initWithModuleClass:(Class)moduleClass - bridge:(RCTBridge *)bridge; - -- (instancetype)initWithModuleClass:(Class)moduleClass - moduleProvider:(RCTBridgeModuleProvider)moduleProvider - bridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER; - -- (instancetype)initWithModuleInstance:(id)instance - bridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER; - -/** - * Calls `constantsToExport` on the module and stores the result. Note that - * this will init the module if it has not already been created. This method - * can be called on any thread, but may block the main thread briefly if the - * module implements `constantsToExport`. - */ -- (void)gatherConstants; - -@property (nonatomic, strong, readonly) Class moduleClass; -@property (nonatomic, copy, readonly) NSString *name; - -/** - * Returns the module methods. Note that this will gather the methods the first - * time it is called and then memoize the results. - */ -@property (nonatomic, copy, readonly) NSArray> *methods; - -/** - * Returns the module's constants, if it exports any - */ -@property (nonatomic, copy, readonly) NSDictionary *exportedConstants; - -/** - * Returns YES if module instance has already been initialized; NO otherwise. - */ -@property (nonatomic, assign, readonly) BOOL hasInstance; - -/** - * Returns YES if module instance must be created on the main thread. - */ -@property (nonatomic, assign) BOOL requiresMainQueueSetup; - -/** - * Returns YES if module has constants to export. - */ -@property (nonatomic, assign, readonly) BOOL hasConstantsToExport; - -/** - * Returns the current module instance. Note that this will init the instance - * if it has not already been created. To check if the module instance exists - * without causing it to be created, use `hasInstance` instead. - */ -@property (nonatomic, strong, readwrite) id instance; - -/** - * Returns the module method dispatch queue. Note that this will init both the - * queue and the module itself if they have not already been created. - */ -@property (nonatomic, strong, readonly) dispatch_queue_t methodQueue; - -/** - * Whether the receiver has a valid `instance` which implements -batchDidComplete. - */ -@property (nonatomic, assign, readonly) BOOL implementsBatchDidComplete; - -/** - * Whether the receiver has a valid `instance` which implements - * -partialBatchDidFlush. - */ -@property (nonatomic, assign, readonly) BOOL implementsPartialBatchDidFlush; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTModuleData.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTModuleData.mm deleted file mode 100644 index ba2dbd51..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTModuleData.mm +++ /dev/null @@ -1,349 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTModuleData.h" - -#import -#include - -#import "RCTBridge+Private.h" -#import "RCTBridge.h" -#import "RCTLog.h" -#import "RCTModuleMethod.h" -#import "RCTProfile.h" -#import "RCTUtils.h" - -@implementation RCTModuleData -{ - NSDictionary *_constantsToExport; - NSString *_queueName; - __weak RCTBridge *_bridge; - RCTBridgeModuleProvider _moduleProvider; - std::mutex _instanceLock; - BOOL _setupComplete; -} - -@synthesize methods = _methods; -@synthesize instance = _instance; -@synthesize methodQueue = _methodQueue; - -- (void)setUp -{ - _implementsBatchDidComplete = [_moduleClass instancesRespondToSelector:@selector(batchDidComplete)]; - _implementsPartialBatchDidFlush = [_moduleClass instancesRespondToSelector:@selector(partialBatchDidFlush)]; - - // If a module overrides `constantsToExport` and doesn't implement `requiresMainQueueSetup`, then we must assume - // that it must be called on the main thread, because it may need to access UIKit. - _hasConstantsToExport = [_moduleClass instancesRespondToSelector:@selector(constantsToExport)]; - - const BOOL implementsRequireMainQueueSetup = [_moduleClass respondsToSelector:@selector(requiresMainQueueSetup)]; - if (implementsRequireMainQueueSetup) { - _requiresMainQueueSetup = [_moduleClass requiresMainQueueSetup]; - } else { - static IMP objectInitMethod; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - objectInitMethod = [NSObject instanceMethodForSelector:@selector(init)]; - }); - - // If a module overrides `init` then we must assume that it expects to be - // initialized on the main thread, because it may need to access UIKit. - const BOOL hasCustomInit = !_instance && [_moduleClass instanceMethodForSelector:@selector(init)] != objectInitMethod; - - _requiresMainQueueSetup = _hasConstantsToExport || hasCustomInit; - if (_requiresMainQueueSetup) { - const char *methodName = ""; - if (_hasConstantsToExport) { - methodName = "constantsToExport"; - } else if (hasCustomInit) { - methodName = "init"; - } - RCTLogWarn(@"Module %@ requires main queue setup since it overrides `%s` but doesn't implement " - "`requiresMainQueueSetup`. In a future release React Native will default to initializing all native modules " - "on a background thread unless explicitly opted-out of.", _moduleClass, methodName); - } - } -} - -- (instancetype)initWithModuleClass:(Class)moduleClass - bridge:(RCTBridge *)bridge -{ - return [self initWithModuleClass:moduleClass - moduleProvider:^id{ return [moduleClass new]; } - bridge:bridge]; -} - -- (instancetype)initWithModuleClass:(Class)moduleClass - moduleProvider:(RCTBridgeModuleProvider)moduleProvider - bridge:(RCTBridge *)bridge -{ - if (self = [super init]) { - _bridge = bridge; - _moduleClass = moduleClass; - _moduleProvider = [moduleProvider copy]; - [self setUp]; - } - return self; -} - -- (instancetype)initWithModuleInstance:(id)instance - bridge:(RCTBridge *)bridge -{ - if (self = [super init]) { - _bridge = bridge; - _instance = instance; - _moduleClass = [instance class]; - [self setUp]; - } - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init); - -#pragma mark - private setup methods - -- (void)setUpInstanceAndBridge -{ - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"[RCTModuleData setUpInstanceAndBridge]", @{ - @"moduleClass": NSStringFromClass(_moduleClass) - }); - { - std::unique_lock lock(_instanceLock); - - if (!_setupComplete && _bridge.valid) { - if (!_instance) { - if (RCT_DEBUG && _requiresMainQueueSetup) { - RCTAssertMainQueue(); - } - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"[RCTModuleData setUpInstanceAndBridge] Create module", nil); - _instance = _moduleProvider ? _moduleProvider() : nil; - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - if (!_instance) { - // Module init returned nil, probably because automatic instantatiation - // of the module is not supported, and it is supposed to be passed in to - // the bridge constructor. Mark setup complete to avoid doing more work. - _setupComplete = YES; - RCTLogWarn(@"The module %@ is returning nil from its constructor. You " - "may need to instantiate it yourself and pass it into the " - "bridge.", _moduleClass); - } - } - - if (_instance && RCTProfileIsProfiling()) { - RCTProfileHookInstance(_instance); - } - - // Bridge must be set before methodQueue is set up, as methodQueue - // initialization requires it (View Managers get their queue by calling - // self.bridge.uiManager.methodQueue) - [self setBridgeForInstance]; - } - - [self setUpMethodQueue]; - } - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - - // This is called outside of the lock in order to prevent deadlock issues - // because the logic in `finishSetupForInstance` can cause - // `moduleData.instance` to be accessed re-entrantly. - if (_bridge.moduleSetupComplete) { - [self finishSetupForInstance]; - } else { - // If we're here, then the module is completely initialized, - // except for what finishSetupForInstance does. When the instance - // method is called after moduleSetupComplete, - // finishSetupForInstance will run. If _requiresMainQueueSetup - // is true, getting the instance will block waiting for the main - // thread, which could take a while if the main thread is busy - // (I've seen 50ms in testing). So we clear that flag, since - // nothing in finishSetupForInstance needs to be run on the main - // thread. - _requiresMainQueueSetup = NO; - } -} - -- (void)setBridgeForInstance -{ - if ([_instance respondsToSelector:@selector(bridge)] && _instance.bridge != _bridge) { - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"[RCTModuleData setBridgeForInstance]", nil); - @try { - [(id)_instance setValue:_bridge forKey:@"bridge"]; - } - @catch (NSException *exception) { - RCTLogError(@"%@ has no setter or ivar for its bridge, which is not " - "permitted. You must either @synthesize the bridge property, " - "or provide your own setter method.", self.name); - } - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - } -} - -- (void)finishSetupForInstance -{ - if (!_setupComplete && _instance) { - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"[RCTModuleData finishSetupForInstance]", nil); - _setupComplete = YES; - [_bridge registerModuleForFrameUpdates:_instance withModuleData:self]; - [[NSNotificationCenter defaultCenter] postNotificationName:RCTDidInitializeModuleNotification - object:_bridge - userInfo:@{@"module": _instance, @"bridge": RCTNullIfNil(_bridge.parentBridge)}]; - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - } -} - -- (void)setUpMethodQueue -{ - if (_instance && !_methodQueue && _bridge.valid) { - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"[RCTModuleData setUpMethodQueue]", nil); - BOOL implementsMethodQueue = [_instance respondsToSelector:@selector(methodQueue)]; - if (implementsMethodQueue && _bridge.valid) { - _methodQueue = _instance.methodQueue; - } - if (!_methodQueue && _bridge.valid) { - // Create new queue (store queueName, as it isn't retained by dispatch_queue) - _queueName = [NSString stringWithFormat:@"com.facebook.react.%@Queue", self.name]; - _methodQueue = dispatch_queue_create(_queueName.UTF8String, DISPATCH_QUEUE_SERIAL); - - // assign it to the module - if (implementsMethodQueue) { - @try { - [(id)_instance setValue:_methodQueue forKey:@"methodQueue"]; - } - @catch (NSException *exception) { - RCTLogError(@"%@ is returning nil for its methodQueue, which is not " - "permitted. You must either return a pre-initialized " - "queue, or @synthesize the methodQueue to let the bridge " - "create a queue for you.", self.name); - } - } - } - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - } -} - -#pragma mark - public getters - -- (BOOL)hasInstance -{ - std::unique_lock lock(_instanceLock); - return _instance != nil; -} - -- (id)instance -{ - if (!_setupComplete) { - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, ([NSString stringWithFormat:@"[RCTModuleData instanceForClass:%@]", _moduleClass]), nil); - if (_requiresMainQueueSetup) { - // The chances of deadlock here are low, because module init very rarely - // calls out to other threads, however we can't control when a module might - // get accessed by client code during bridge setup, and a very low risk of - // deadlock is better than a fairly high risk of an assertion being thrown. - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"[RCTModuleData instance] main thread setup", nil); - - if (!RCTIsMainQueue()) { - RCTLogWarn(@"RCTBridge required dispatch_sync to load %@. This may lead to deadlocks", _moduleClass); - } - - RCTUnsafeExecuteOnMainQueueSync(^{ - [self setUpInstanceAndBridge]; - }); - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - } else { - [self setUpInstanceAndBridge]; - } - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - } - return _instance; -} - -- (NSString *)name -{ - return RCTBridgeModuleNameForClass(_moduleClass); -} - -- (NSArray> *)methods -{ - if (!_methods) { - NSMutableArray> *moduleMethods = [NSMutableArray new]; - - if ([_moduleClass instancesRespondToSelector:@selector(methodsToExport)]) { - [moduleMethods addObjectsFromArray:[self.instance methodsToExport]]; - } - - unsigned int methodCount; - Class cls = _moduleClass; - while (cls && cls != [NSObject class] && cls != [NSProxy class]) { - Method *methods = class_copyMethodList(object_getClass(cls), &methodCount); - - for (unsigned int i = 0; i < methodCount; i++) { - Method method = methods[i]; - SEL selector = method_getName(method); - if ([NSStringFromSelector(selector) hasPrefix:@"__rct_export__"]) { - IMP imp = method_getImplementation(method); - auto exportedMethod = ((const RCTMethodInfo *(*)(id, SEL))imp)(_moduleClass, selector); - id moduleMethod = [[RCTModuleMethod alloc] initWithExportedMethod:exportedMethod - moduleClass:_moduleClass]; - [moduleMethods addObject:moduleMethod]; - } - } - - free(methods); - cls = class_getSuperclass(cls); - } - - _methods = [moduleMethods copy]; - } - return _methods; -} - -- (void)gatherConstants -{ - if (_hasConstantsToExport && !_constantsToExport) { - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, ([NSString stringWithFormat:@"[RCTModuleData gatherConstants] %@", _moduleClass]), nil); - (void)[self instance]; - if (_requiresMainQueueSetup) { - if (!RCTIsMainQueue()) { - RCTLogWarn(@"Required dispatch_sync to load constants for %@. This may lead to deadlocks", _moduleClass); - } - - RCTUnsafeExecuteOnMainQueueSync(^{ - self->_constantsToExport = [self->_instance constantsToExport] ?: @{}; - }); - } else { - _constantsToExport = [_instance constantsToExport] ?: @{}; - } - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - } -} - -- (NSDictionary *)exportedConstants -{ - [self gatherConstants]; - NSDictionary *constants = _constantsToExport; - _constantsToExport = nil; // Not needed anymore - return constants; -} - -- (dispatch_queue_t)methodQueue -{ - (void)[self instance]; - RCTAssert(_methodQueue != nullptr, @"Module %@ has no methodQueue (instance: %@, bridge.valid: %d)", - self, _instance, _bridge.valid); - return _methodQueue; -} - -- (void)invalidate -{ - _methodQueue = nil; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"<%@: %p; name=\"%@\">", [self class], self, self.name]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTModuleMethod.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTModuleMethod.h deleted file mode 100644 index 472b755a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTModuleMethod.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import - -@class RCTBridge; - -@interface RCTMethodArgument : NSObject - -@property (nonatomic, copy, readonly) NSString *type; -@property (nonatomic, readonly) RCTNullability nullability; -@property (nonatomic, readonly) BOOL unused; - -@end - -@interface RCTModuleMethod : NSObject - -@property (nonatomic, readonly) Class moduleClass; -@property (nonatomic, readonly) SEL selector; - -- (instancetype)initWithExportedMethod:(const RCTMethodInfo *)exportMethod - moduleClass:(Class)moduleClass NS_DESIGNATED_INITIALIZER; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTModuleMethod.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTModuleMethod.mm deleted file mode 100644 index e9a36575..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTModuleMethod.mm +++ /dev/null @@ -1,578 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTModuleMethod.h" - -#import - -#import "RCTAssert.h" -#import "RCTBridge+Private.h" -#import "RCTBridge.h" -#import "RCTConvert.h" -#import "RCTCxxConvert.h" -#import "RCTLog.h" -#import "RCTManagedPointer.h" -#import "RCTParserUtils.h" -#import "RCTProfile.h" -#import "RCTUtils.h" - -typedef BOOL (^RCTArgumentBlock)(RCTBridge *, NSUInteger, id); - -/** - * Get the converter function for the specified type - */ -static SEL selectorForType(NSString *type) -{ - const char *input = type.UTF8String; - return NSSelectorFromString([RCTParseType(&input) stringByAppendingString:@":"]); -} - -@implementation RCTMethodArgument - -- (instancetype)initWithType:(NSString *)type - nullability:(RCTNullability)nullability - unused:(BOOL)unused -{ - if (self = [super init]) { - _type = [type copy]; - _nullability = nullability; - _unused = unused; - } - return self; -} - -@end - -@implementation RCTModuleMethod -{ - Class _moduleClass; - const RCTMethodInfo *_methodInfo; - NSString *_JSMethodName; - - SEL _selector; - NSInvocation *_invocation; - NSArray *_argumentBlocks; - NSMutableArray *_retainedObjects; -} - -static void RCTLogArgumentError(RCTModuleMethod *method, NSUInteger index, - id valueOrType, const char *issue) -{ - RCTLogError(@"Argument %tu (%@) of %@.%s %s", index, valueOrType, - RCTBridgeModuleNameForClass(method->_moduleClass), - method.JSMethodName, issue); -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -RCT_EXTERN_C_BEGIN - -// returns YES if the selector ends in a colon (indicating that there is at -// least one argument, and maybe more selector parts) or NO if it doesn't. -static BOOL RCTParseSelectorPart(const char **input, NSMutableString *selector) -{ - NSString *selectorPart; - if (RCTParseSelectorIdentifier(input, &selectorPart)) { - [selector appendString:selectorPart]; - } - RCTSkipWhitespace(input); - if (RCTReadChar(input, ':')) { - [selector appendString:@":"]; - RCTSkipWhitespace(input); - return YES; - } - return NO; -} - -static BOOL RCTParseUnused(const char **input) -{ - return RCTReadString(input, "__unused") || - RCTReadString(input, "__attribute__((unused))"); -} - -static RCTNullability RCTParseNullability(const char **input) -{ - if (RCTReadString(input, "nullable")) { - return RCTNullable; - } else if (RCTReadString(input, "nonnull")) { - return RCTNonnullable; - } - return RCTNullabilityUnspecified; -} - -static RCTNullability RCTParseNullabilityPostfix(const char **input) -{ - if (RCTReadString(input, "_Nullable")) { - return RCTNullable; - } else if (RCTReadString(input, "_Nonnull")) { - return RCTNonnullable; - } - return RCTNullabilityUnspecified; -} - -// returns YES if execution is safe to proceed (enqueue callback invocation), NO if callback has already been invoked -#if RCT_DEBUG -static BOOL checkCallbackMultipleInvocations(BOOL *didInvoke) { - if (*didInvoke) { - RCTFatal(RCTErrorWithMessage(@"Illegal callback invocation from native module. This callback type only permits a single invocation from native code.")); - return NO; - } else { - *didInvoke = YES; - return YES; - } -} -#endif - -extern NSString *RCTParseMethodSignature(const char *input, NSArray **arguments); -NSString *RCTParseMethodSignature(const char *input, NSArray **arguments) -{ - RCTSkipWhitespace(&input); - - NSMutableArray *args; - NSMutableString *selector = [NSMutableString new]; - while (RCTParseSelectorPart(&input, selector)) { - if (!args) { - args = [NSMutableArray new]; - } - - // Parse type - if (RCTReadChar(&input, '(')) { - RCTSkipWhitespace(&input); - - BOOL unused = RCTParseUnused(&input); - RCTSkipWhitespace(&input); - - RCTNullability nullability = RCTParseNullability(&input); - RCTSkipWhitespace(&input); - - NSString *type = RCTParseType(&input); - RCTSkipWhitespace(&input); - if (nullability == RCTNullabilityUnspecified) { - nullability = RCTParseNullabilityPostfix(&input); - } - [args addObject:[[RCTMethodArgument alloc] initWithType:type - nullability:nullability - unused:unused]]; - RCTSkipWhitespace(&input); - RCTReadChar(&input, ')'); - RCTSkipWhitespace(&input); - } else { - // Type defaults to id if unspecified - [args addObject:[[RCTMethodArgument alloc] initWithType:@"id" - nullability:RCTNullable - unused:NO]]; - } - - // Argument name - RCTParseArgumentIdentifier(&input, NULL); - RCTSkipWhitespace(&input); - } - - *arguments = [args copy]; - return selector; -} - -RCT_EXTERN_C_END - -- (instancetype)initWithExportedMethod:(const RCTMethodInfo *)exportedMethod - moduleClass:(Class)moduleClass -{ - if (self = [super init]) { - _moduleClass = moduleClass; - _methodInfo = exportedMethod; - } - return self; -} - -- (void)processMethodSignature -{ - NSArray *arguments; - _selector = NSSelectorFromString(RCTParseMethodSignature(_methodInfo->objcName, &arguments)); - RCTAssert(_selector, @"%s is not a valid selector", _methodInfo->objcName); - - // Create method invocation - NSMethodSignature *methodSignature = [_moduleClass instanceMethodSignatureForSelector:_selector]; - RCTAssert(methodSignature, @"%s is not a recognized Objective-C method.", sel_getName(_selector)); - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSignature]; - invocation.selector = _selector; - _invocation = invocation; - NSMutableArray *retainedObjects = [NSMutableArray array]; - _retainedObjects = retainedObjects; - - // Process arguments - NSUInteger numberOfArguments = methodSignature.numberOfArguments; - NSMutableArray *argumentBlocks = - [[NSMutableArray alloc] initWithCapacity:numberOfArguments - 2]; - -#if RCT_DEBUG - __weak RCTModuleMethod *weakSelf = self; -#endif - -#define RCT_RETAINED_ARG_BLOCK(_logic) \ -[argumentBlocks addObject:^(__unused __weak RCTBridge *bridge, NSUInteger index, id json) { \ - _logic \ - [invocation setArgument:&value atIndex:(index) + 2]; \ - if (value) { \ - [retainedObjects addObject:value]; \ - } \ - return YES; \ -}] - -#define __PRIMITIVE_CASE(_type, _nullable) { \ - isNullableType = _nullable; \ - _type (*convert)(id, SEL, id) = (__typeof__(convert))objc_msgSend; \ - [argumentBlocks addObject:^(__unused RCTBridge *bridge, NSUInteger index, id json) { \ - _type value = convert([RCTConvert class], selector, json); \ - [invocation setArgument:&value atIndex:(index) + 2]; \ - return YES; \ - }]; \ - break; \ -} - -#define PRIMITIVE_CASE(_type) __PRIMITIVE_CASE(_type, NO) -#define NULLABLE_PRIMITIVE_CASE(_type) __PRIMITIVE_CASE(_type, YES) - -// Explicitly copy the block -#define __COPY_BLOCK(block...) \ - id value = [block copy]; \ - if (value) { \ - [retainedObjects addObject:value]; \ - } \ - -#if RCT_DEBUG -#define BLOCK_CASE(_block_args, _block) RCT_RETAINED_ARG_BLOCK( \ - if (json && ![json isKindOfClass:[NSNumber class]]) { \ - RCTLogArgumentError(weakSelf, index, json, "should be a function"); \ - return NO; \ - } \ - __block BOOL didInvoke = NO; \ - __COPY_BLOCK(^_block_args { \ - if (checkCallbackMultipleInvocations(&didInvoke)) _block \ - }); \ -) -#else -#define BLOCK_CASE(_block_args, _block) \ - RCT_RETAINED_ARG_BLOCK( __COPY_BLOCK(^_block_args { _block }); ) -#endif - - for (NSUInteger i = 2; i < numberOfArguments; i++) { - const char *objcType = [methodSignature getArgumentTypeAtIndex:i]; - BOOL isNullableType = NO; - RCTMethodArgument *argument = arguments[i - 2]; - NSString *typeName = argument.type; - SEL selector = selectorForType(typeName); - if ([RCTConvert respondsToSelector:selector]) { - switch (objcType[0]) { - // Primitives - case _C_CHR: PRIMITIVE_CASE(char) - case _C_UCHR: PRIMITIVE_CASE(unsigned char) - case _C_SHT: PRIMITIVE_CASE(short) - case _C_USHT: PRIMITIVE_CASE(unsigned short) - case _C_INT: PRIMITIVE_CASE(int) - case _C_UINT: PRIMITIVE_CASE(unsigned int) - case _C_LNG: PRIMITIVE_CASE(long) - case _C_ULNG: PRIMITIVE_CASE(unsigned long) - case _C_LNG_LNG: PRIMITIVE_CASE(long long) - case _C_ULNG_LNG: PRIMITIVE_CASE(unsigned long long) - case _C_FLT: PRIMITIVE_CASE(float) - case _C_DBL: PRIMITIVE_CASE(double) - case _C_BOOL: PRIMITIVE_CASE(BOOL) - case _C_SEL: NULLABLE_PRIMITIVE_CASE(SEL) - case _C_CHARPTR: NULLABLE_PRIMITIVE_CASE(const char *) - case _C_PTR: NULLABLE_PRIMITIVE_CASE(void *) - - case _C_ID: { - isNullableType = YES; - id (*convert)(id, SEL, id) = (__typeof__(convert))objc_msgSend; - RCT_RETAINED_ARG_BLOCK( - id value = convert([RCTConvert class], selector, json); - ); - break; - } - - case _C_STRUCT_B: { - NSMethodSignature *typeSignature = [RCTConvert methodSignatureForSelector:selector]; - NSInvocation *typeInvocation = [NSInvocation invocationWithMethodSignature:typeSignature]; - typeInvocation.selector = selector; - typeInvocation.target = [RCTConvert class]; - - [argumentBlocks addObject:^(__unused RCTBridge *bridge, NSUInteger index, id json) { - void *returnValue = malloc(typeSignature.methodReturnLength); - if (!returnValue) { - // CWE - 391 : Unchecked error condition - // https://www.cvedetails.com/cwe-details/391/Unchecked-Error-Condition.html - // https://eli.thegreenplace.net/2009/10/30/handling-out-of-memory-conditions-in-c - abort(); - } - [typeInvocation setArgument:&json atIndex:2]; - [typeInvocation invoke]; - [typeInvocation getReturnValue:returnValue]; - [invocation setArgument:returnValue atIndex:index + 2]; - free(returnValue); - return YES; - }]; - break; - } - - default: { - static const char *blockType = @encode(__typeof__(^{})); - if (!strcmp(objcType, blockType)) { - BLOCK_CASE((NSArray *args), { - [bridge enqueueCallback:json args:args]; - }); - } else { - RCTLogError(@"Unsupported argument type '%@' in method %@.", - typeName, [self methodName]); - } - } - } - } else if ([typeName isEqualToString:@"RCTResponseSenderBlock"]) { - BLOCK_CASE((NSArray *args), { - [bridge enqueueCallback:json args:args]; - }); - } else if ([typeName isEqualToString:@"RCTResponseErrorBlock"]) { - BLOCK_CASE((NSError *error), { - [bridge enqueueCallback:json args:@[RCTJSErrorFromNSError(error)]]; - }); - } else if ([typeName isEqualToString:@"RCTPromiseResolveBlock"]) { - RCTAssert(i == numberOfArguments - 2, - @"The RCTPromiseResolveBlock must be the second to last parameter in %@", - [self methodName]); - BLOCK_CASE((id result), { - [bridge enqueueCallback:json args:result ? @[result] : @[]]; - }); - } else if ([typeName isEqualToString:@"RCTPromiseRejectBlock"]) { - RCTAssert(i == numberOfArguments - 1, - @"The RCTPromiseRejectBlock must be the last parameter in %@", - [self methodName]); - BLOCK_CASE((NSString *code, NSString *message, NSError *error), { - NSDictionary *errorJSON = RCTJSErrorFromCodeMessageAndNSError(code, message, error); - [bridge enqueueCallback:json args:@[errorJSON]]; - }); - } else if ([typeName hasPrefix:@"JS::"]) { - NSString *selectorNameForCxxType = - [[typeName stringByReplacingOccurrencesOfString:@"::" withString:@"_"] - stringByAppendingString:@":"]; - selector = NSSelectorFromString(selectorNameForCxxType); - - [argumentBlocks addObject:^(__unused RCTBridge *bridge, NSUInteger index, id json) { - RCTManagedPointer *(*convert)(id, SEL, id) = (__typeof__(convert))objc_msgSend; - RCTManagedPointer *box = convert([RCTCxxConvert class], selector, json); - - void *pointer = box.voidPointer; - [invocation setArgument:&pointer atIndex:index + 2]; - [retainedObjects addObject:box]; - - return YES; - }]; - } else { - // Unknown argument type - RCTLogError(@"Unknown argument type '%@' in method %@. Extend RCTConvert to support this type.", - typeName, [self methodName]); - } - -#if RCT_DEBUG - RCTNullability nullability = argument.nullability; - if (!isNullableType) { - if (nullability == RCTNullable) { - RCTLogArgumentError(weakSelf, i - 2, typeName, "is marked as " - "nullable, but is not a nullable type."); - } - nullability = RCTNonnullable; - } - - /** - * Special case - Numbers are not nullable in Android, so we - * don't support this for now. In future we may allow it. - */ - if ([typeName isEqualToString:@"NSNumber"]) { - BOOL unspecified = (nullability == RCTNullabilityUnspecified); - if (!argument.unused && (nullability == RCTNullable || unspecified)) { - RCTLogArgumentError(weakSelf, i - 2, typeName, - [unspecified ? @"has unspecified nullability" : @"is marked as nullable" - stringByAppendingString: @" but React requires that all NSNumber " - "arguments are explicitly marked as `nonnull` to ensure " - "compatibility with Android."].UTF8String); - } - nullability = RCTNonnullable; - } - - if (nullability == RCTNonnullable) { - RCTArgumentBlock oldBlock = argumentBlocks[i - 2]; - argumentBlocks[i - 2] = ^(RCTBridge *bridge, NSUInteger index, id json) { - if (json != nil) { - if (!oldBlock(bridge, index, json)) { - return NO; - } - if (isNullableType) { - // Check converted value wasn't null either, as method probably - // won't gracefully handle a nil vallue for a nonull argument - void *value; - [invocation getArgument:&value atIndex:index + 2]; - if (value == NULL) { - return NO; - } - } - return YES; - } - RCTLogArgumentError(weakSelf, index, typeName, "must not be null"); - return NO; - }; - } -#endif - } - -#if RCT_DEBUG - const char *objcType = _invocation.methodSignature.methodReturnType; - if (_methodInfo->isSync && objcType[0] != _C_ID) { - RCTLogError(@"Return type of %@.%s should be (id) as the method is \"sync\"", - RCTBridgeModuleNameForClass(_moduleClass), self.JSMethodName); - } -#endif - - _argumentBlocks = argumentBlocks; -} - -- (SEL)selector -{ - if (_selector == NULL) { - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"", (@{ @"module": NSStringFromClass(_moduleClass), - @"method": @(_methodInfo->objcName) })); - [self processMethodSignature]; - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - } - return _selector; -} - -- (const char *)JSMethodName -{ - NSString *methodName = _JSMethodName; - if (!methodName) { - const char *jsName = _methodInfo->jsName; - if (jsName && strlen(jsName) > 0) { - methodName = @(jsName); - } else { - methodName = @(_methodInfo->objcName); - NSRange colonRange = [methodName rangeOfString:@":"]; - if (colonRange.location != NSNotFound) { - methodName = [methodName substringToIndex:colonRange.location]; - } - methodName = [methodName stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - RCTAssert(methodName.length, @"%s is not a valid JS function name, please" - " supply an alternative using RCT_REMAP_METHOD()", _methodInfo->objcName); - } - _JSMethodName = methodName; - } - return methodName.UTF8String; -} - -- (RCTFunctionType)functionType -{ - if (strstr(_methodInfo->objcName, "RCTPromise") != NULL) { - RCTAssert(!_methodInfo->isSync, @"Promises cannot be used in sync functions"); - return RCTFunctionTypePromise; - } else if (_methodInfo->isSync) { - return RCTFunctionTypeSync; - } else { - return RCTFunctionTypeNormal; - } -} - -- (id)invokeWithBridge:(RCTBridge *)bridge - module:(id)module - arguments:(NSArray *)arguments -{ - if (_argumentBlocks == nil) { - [self processMethodSignature]; - } - -#if RCT_DEBUG - // Sanity check - RCTAssert([module class] == _moduleClass, @"Attempted to invoke method \ - %@ on a module of class %@", [self methodName], [module class]); - - // Safety check - if (arguments.count != _argumentBlocks.count) { - NSInteger actualCount = arguments.count; - NSInteger expectedCount = _argumentBlocks.count; - - // Subtract the implicit Promise resolver and rejecter functions for implementations of async functions - if (self.functionType == RCTFunctionTypePromise) { - actualCount -= 2; - expectedCount -= 2; - } - - RCTLogError(@"%@.%s was called with %lld arguments but expects %lld arguments. " - @"If you haven\'t changed this method yourself, this usually means that " - @"your versions of the native code and JavaScript code are out of sync. " - @"Updating both should make this error go away.", - RCTBridgeModuleNameForClass(_moduleClass), self.JSMethodName, - (long long)actualCount, (long long)expectedCount); - return nil; - } -#endif - - // Set arguments - NSUInteger index = 0; - for (id json in arguments) { - RCTArgumentBlock block = _argumentBlocks[index]; - if (!block(bridge, index, RCTNilIfNull(json))) { - // Invalid argument, abort - RCTLogArgumentError(self, index, json, "could not be processed. Aborting method call."); - return nil; - } - index++; - } - - // Invoke method -#ifdef RCT_MAIN_THREAD_WATCH_DOG_THRESHOLD - if (RCTIsMainQueue()) { - CFTimeInterval start = CACurrentMediaTime(); - [_invocation invokeWithTarget:module]; - CFTimeInterval duration = CACurrentMediaTime() - start; - if (duration > RCT_MAIN_THREAD_WATCH_DOG_THRESHOLD) { - RCTLogWarn( - @"Main Thread Watchdog: Invocation of %@ blocked the main thread for %dms. " - "Consider using background-threaded modules and asynchronous calls " - "to spend less time on the main thread and keep the app's UI responsive.", - [self methodName], - (int)(duration * 1000) - ); - } - } else { - [_invocation invokeWithTarget:module]; - } -#else - [_invocation invokeWithTarget:module]; -#endif - - index = 2; - [_retainedObjects removeAllObjects]; - - if (_methodInfo->isSync) { - void *returnValue; - [_invocation getReturnValue:&returnValue]; - return (__bridge id)returnValue; - } - return nil; -} - -- (NSString *)methodName -{ - if (!_selector) { - [self processMethodSignature]; - } - return [NSString stringWithFormat:@"-[%@ %s]", _moduleClass, sel_getName(_selector)]; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"<%@: %p; exports %@ as %s(); type: %s>", - [self class], self, [self methodName], self.JSMethodName, RCTFunctionDescriptorFromType(self.functionType)]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTMultipartDataTask.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTMultipartDataTask.h deleted file mode 100644 index 276d4175..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTMultipartDataTask.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -typedef void (^RCTMultipartDataTaskCallback)(NSInteger statusCode, NSDictionary *headers, NSData *content, NSError *error, BOOL done); - -@interface RCTMultipartDataTask : NSObject - -- (instancetype)initWithURL:(NSURL *)url - partHandler:(RCTMultipartDataTaskCallback)partHandler - progressHandler:(RCTMultipartProgressCallback)progressHandler; - -- (void)startTask; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTMultipartDataTask.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTMultipartDataTask.m deleted file mode 100644 index 3708a7d3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTMultipartDataTask.m +++ /dev/null @@ -1,131 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTMultipartDataTask.h" - -@interface RCTMultipartDataTask () - -@end - -// We need this ugly runtime check because [streamTask captureStreams] below fails on iOS version -// earlier than 9.0. Unfortunately none of the proper ways of checking worked: -// -// - NSURLSessionStreamTask class is available and is not Null on iOS 8 -// - [[NSURLSessionStreamTask new] respondsToSelector:@selector(captureStreams)] is always NO -// - The instance we get in URLSession:dataTask:didBecomeStreamTask: is of __NSCFURLLocalStreamTaskFromDataTask -// and it responds to captureStreams on iOS 9+ but doesn't on iOS 8. Which means we can't get direct access -// to the streams on iOS 8 and at that point it's too late to change the behavior back to dataTask -// - The compile-time #ifdef's can't be used because an app compiled for iOS8 can still run on iOS9 - -static BOOL isStreamTaskSupported() { - return [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){9,0,0}]; -} - -@implementation RCTMultipartDataTask { - NSURL *_url; - RCTMultipartDataTaskCallback _partHandler; - RCTMultipartProgressCallback _progressHandler; - NSInteger _statusCode; - NSDictionary *_headers; - NSString *_boundary; - NSMutableData *_data; -} - -- (instancetype)initWithURL:(NSURL *)url - partHandler:(RCTMultipartDataTaskCallback)partHandler - progressHandler:(RCTMultipartProgressCallback)progressHandler -{ - if (self = [super init]) { - _url = url; - _partHandler = [partHandler copy]; - _progressHandler = [progressHandler copy]; - } - return self; -} - -- (void)startTask -{ - NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] - delegate:self delegateQueue:nil]; - NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:_url]; - if (isStreamTaskSupported()) { - [request addValue:@"multipart/mixed" forHTTPHeaderField:@"Accept"]; - } - NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request]; - [dataTask resume]; - [session finishTasksAndInvalidate]; -} - -- (void)URLSession:(__unused NSURLSession *)session - dataTask:(__unused NSURLSessionDataTask *)dataTask -didReceiveResponse:(NSURLResponse *)response - completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler -{ - if ([response isKindOfClass:[NSHTTPURLResponse class]]) { - NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; - _headers = [httpResponse allHeaderFields]; - _statusCode = [httpResponse statusCode]; - - NSString *contentType = @""; - for (NSString *key in [_headers keyEnumerator]) { - if ([[key lowercaseString] isEqualToString:@"content-type"]) { - contentType = [_headers valueForKey:key]; - break; - } - } - - NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"multipart/mixed;.*boundary=\"([^\"]+)\"" options:0 error:nil]; - NSTextCheckingResult *match = [regex firstMatchInString:contentType options:0 range:NSMakeRange(0, contentType.length)]; - if (match) { - _boundary = [contentType substringWithRange:[match rangeAtIndex:1]]; - completionHandler(NSURLSessionResponseBecomeStream); - return; - } - } - - // In case the server doesn't support multipart/mixed responses, fallback to normal download - _data = [[NSMutableData alloc] initWithCapacity:1024 * 1024]; - completionHandler(NSURLSessionResponseAllow); -} - -- (void)URLSession:(__unused NSURLSession *)session task:(__unused NSURLSessionTask *)task didCompleteWithError:(NSError *)error -{ - if (_partHandler) { - _partHandler(_statusCode, _headers, _data, error, YES); - } -} - -- (void)URLSession:(__unused NSURLSession *)session dataTask:(__unused NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data -{ - [_data appendData:data]; -} - -- (void)URLSession:(__unused NSURLSession *)session dataTask:(__unused NSURLSessionDataTask *)dataTask didBecomeStreamTask:(NSURLSessionStreamTask *)streamTask -{ - [streamTask captureStreams]; -} - -- (void)URLSession:(__unused NSURLSession *)session - streamTask:(__unused NSURLSessionStreamTask *)streamTask -didBecomeInputStream:(NSInputStream *)inputStream - outputStream:(__unused NSOutputStream *)outputStream -{ - RCTMultipartStreamReader *reader = [[RCTMultipartStreamReader alloc] initWithInputStream:inputStream boundary:_boundary]; - RCTMultipartDataTaskCallback partHandler = _partHandler; - _partHandler = nil; - NSInteger statusCode = _statusCode; - - BOOL completed = [reader readAllPartsWithCompletionCallback:^(NSDictionary *headers, NSData *content, BOOL done) { - partHandler(statusCode, headers, content, nil, done); - } progressCallback:_progressHandler]; - if (!completed) { - partHandler(statusCode, nil, nil, [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled userInfo:nil], YES); - } -} - - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTMultipartStreamReader.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTMultipartStreamReader.h deleted file mode 100644 index 775c3ec6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTMultipartStreamReader.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -typedef void (^RCTMultipartCallback)(NSDictionary *headers, NSData *content, BOOL done); -typedef void (^RCTMultipartProgressCallback)(NSDictionary *headers, NSNumber *loaded, NSNumber *total); - - -// RCTMultipartStreamReader can be used to parse responses with Content-Type: multipart/mixed -// See https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html -@interface RCTMultipartStreamReader : NSObject - -- (instancetype)initWithInputStream:(NSInputStream *)stream boundary:(NSString *)boundary; -- (BOOL)readAllPartsWithCompletionCallback:(RCTMultipartCallback)callback - progressCallback:(RCTMultipartProgressCallback)progressCallback; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTMultipartStreamReader.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTMultipartStreamReader.m deleted file mode 100644 index 5c0e7c88..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTMultipartStreamReader.m +++ /dev/null @@ -1,165 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTMultipartStreamReader.h" - -#import - -#define CRLF @"\r\n" - -@implementation RCTMultipartStreamReader { - __strong NSInputStream *_stream; - __strong NSString *_boundary; - CFTimeInterval _lastDownloadProgress; -} - -- (instancetype)initWithInputStream:(NSInputStream *)stream boundary:(NSString *)boundary -{ - if (self = [super init]) { - _stream = stream; - _boundary = boundary; - _lastDownloadProgress = CACurrentMediaTime(); - } - return self; -} - -- (NSDictionary *)parseHeaders:(NSData *)data -{ - NSMutableDictionary *headers = [NSMutableDictionary new]; - NSString *text = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - NSArray *lines = [text componentsSeparatedByString:CRLF]; - for (NSString *line in lines) { - NSUInteger location = [line rangeOfString:@":"].location; - if (location == NSNotFound) { - continue; - } - NSString *key = [line substringToIndex:location]; - NSString *value = [[line substringFromIndex:location + 1] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - [headers setValue:value forKey:key]; - } - return headers; -} - -- (void)emitChunk:(NSData *)data headers:(NSDictionary *)headers callback:(RCTMultipartCallback)callback done:(BOOL)done -{ - NSData *marker = [CRLF CRLF dataUsingEncoding:NSUTF8StringEncoding]; - NSRange range = [data rangeOfData:marker options:0 range:NSMakeRange(0, data.length)]; - if (range.location == NSNotFound) { - callback(nil, data, done); - } else if (headers != nil) { - // If headers were parsed already just use that to avoid doing it twice. - NSInteger bodyStart = range.location + marker.length; - NSData *bodyData = [data subdataWithRange:NSMakeRange(bodyStart, data.length - bodyStart)]; - callback(headers, bodyData, done); - } else { - NSData *headersData = [data subdataWithRange:NSMakeRange(0, range.location)]; - NSInteger bodyStart = range.location + marker.length; - NSData *bodyData = [data subdataWithRange:NSMakeRange(bodyStart, data.length - bodyStart)]; - callback([self parseHeaders:headersData], bodyData, done); - } -} - -- (void)emitProgress:(NSDictionary *)headers - contentLength:(NSUInteger)contentLength - final:(BOOL)final - callback:(RCTMultipartProgressCallback)callback -{ - if (headers == nil) { - return; - } - // Throttle progress events so we don't send more that around 60 per second. - CFTimeInterval currentTime = CACurrentMediaTime(); - - NSInteger headersContentLength = headers[@"Content-Length"] != nil ? [headers[@"Content-Length"] integerValue] : 0; - if (callback && (currentTime - _lastDownloadProgress > 0.016 || final)) { - _lastDownloadProgress = currentTime; - callback(headers, @(headersContentLength), @(contentLength)); - } -} - -- (BOOL)readAllPartsWithCompletionCallback:(RCTMultipartCallback)callback - progressCallback:(RCTMultipartProgressCallback)progressCallback -{ - NSInteger chunkStart = 0; - NSInteger bytesSeen = 0; - - NSData *delimiter = [[NSString stringWithFormat:@"%@--%@%@", CRLF, _boundary, CRLF] dataUsingEncoding:NSUTF8StringEncoding]; - NSData *closeDelimiter = [[NSString stringWithFormat:@"%@--%@--%@", CRLF, _boundary, CRLF] dataUsingEncoding:NSUTF8StringEncoding]; - NSMutableData *content = [[NSMutableData alloc] initWithCapacity:1]; - NSDictionary *currentHeaders = nil; - NSUInteger currentHeadersLength = 0; - - const NSUInteger bufferLen = 4 * 1024; - uint8_t buffer[bufferLen]; - - [_stream open]; - while (true) { - BOOL isCloseDelimiter = NO; - // Search only a subset of chunk that we haven't seen before + few bytes - // to allow for the edge case when the delimiter is cut by read call - NSInteger searchStart = MAX(bytesSeen - (NSInteger)closeDelimiter.length, chunkStart); - NSRange remainingBufferRange = NSMakeRange(searchStart, content.length - searchStart); - - // Check for delimiters. - NSRange range = [content rangeOfData:delimiter options:0 range:remainingBufferRange]; - if (range.location == NSNotFound) { - isCloseDelimiter = YES; - range = [content rangeOfData:closeDelimiter options:0 range:remainingBufferRange]; - } - - if (range.location == NSNotFound) { - if (currentHeaders == nil) { - // Check for the headers delimiter. - NSData *headersMarker = [CRLF CRLF dataUsingEncoding:NSUTF8StringEncoding]; - NSRange headersRange = [content rangeOfData:headersMarker options:0 range:remainingBufferRange]; - if (headersRange.location != NSNotFound) { - NSData *headersData = [content subdataWithRange:NSMakeRange(chunkStart, headersRange.location - chunkStart)]; - currentHeadersLength = headersData.length; - currentHeaders = [self parseHeaders:headersData]; - } - } else { - // When headers are loaded start sending progress callbacks. - [self emitProgress:currentHeaders - contentLength:content.length - currentHeadersLength - final:NO - callback:progressCallback]; - } - - bytesSeen = content.length; - NSInteger bytesRead = [_stream read:buffer maxLength:bufferLen]; - if (bytesRead <= 0 || _stream.streamError) { - return NO; - } - [content appendBytes:buffer length:bytesRead]; - continue; - } - - NSInteger chunkEnd = range.location; - NSInteger length = chunkEnd - chunkStart; - bytesSeen = chunkEnd; - - // Ignore preamble - if (chunkStart > 0) { - NSData *chunk = [content subdataWithRange:NSMakeRange(chunkStart, length)]; - [self emitProgress:currentHeaders - contentLength:chunk.length - currentHeadersLength - final:YES - callback:progressCallback]; - [self emitChunk:chunk headers:currentHeaders callback:callback done:isCloseDelimiter]; - currentHeaders = nil; - currentHeadersLength = 0; - } - - if (isCloseDelimiter) { - return YES; - } - - chunkStart = chunkEnd + delimiter.length; - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTNullability.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTNullability.h deleted file mode 100644 index 436fafcc..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTNullability.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -typedef NS_ENUM(NSUInteger, RCTNullability) { - RCTNullabilityUnspecified, - RCTNullable, - RCTNonnullable, -}; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTParserUtils.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTParserUtils.h deleted file mode 100644 index 438ccfbb..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTParserUtils.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTParserUtils : NSObject - -/** - * Generic utility functions for parsing Objective-C source code. - */ -RCT_EXTERN BOOL RCTReadChar(const char **input, char c); -RCT_EXTERN BOOL RCTReadString(const char **input, const char *string); -RCT_EXTERN void RCTSkipWhitespace(const char **input); -RCT_EXTERN BOOL RCTParseSelectorIdentifier(const char **input, NSString **string); -RCT_EXTERN BOOL RCTParseArgumentIdentifier(const char **input, NSString **string); - -/** - * Parse an Objective-C type into a form that can be used by RCTConvert. - * This doesn't really belong here, but it's used by both RCTConvert and - * RCTModuleMethod, which makes it difficult to find a better home for it. - */ -RCT_EXTERN NSString *RCTParseType(const char **input); - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTParserUtils.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTParserUtils.m deleted file mode 100644 index 2a6fea6c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTParserUtils.m +++ /dev/null @@ -1,143 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTParserUtils.h" - -#import "RCTLog.h" - -@implementation RCTParserUtils - -BOOL RCTReadChar(const char **input, char c) -{ - if (**input == c) { - (*input)++; - return YES; - } - return NO; -} - -BOOL RCTReadString(const char **input, const char *string) -{ - int i; - for (i = 0; string[i] != 0; i++) { - if (string[i] != (*input)[i]) { - return NO; - } - } - *input += i; - return YES; -} - -void RCTSkipWhitespace(const char **input) -{ - while (isspace(**input)) { - (*input)++; - } -} - -static BOOL RCTIsIdentifierHead(const char c) -{ - return isalpha(c) || c == '_'; -} - -static BOOL RCTIsIdentifierTail(const char c) -{ - return isalnum(c) || c == '_'; -} - -BOOL RCTParseArgumentIdentifier(const char **input, NSString **string) -{ - const char *start = *input; - - do { - if (!RCTIsIdentifierHead(**input)) { - return NO; - } - (*input)++; - - while (RCTIsIdentifierTail(**input)) { - (*input)++; - } - - // allow namespace resolution operator - } while (RCTReadString(input, "::")); - - if (string) { - *string = [[NSString alloc] initWithBytes:start - length:(NSInteger)(*input - start) - encoding:NSASCIIStringEncoding]; - } - return YES; -} - -BOOL RCTParseSelectorIdentifier(const char **input, NSString **string) -{ - const char *start = *input; - if (!RCTIsIdentifierHead(**input)) { - return NO; - } - (*input)++; - while (RCTIsIdentifierTail(**input)) { - (*input)++; - } - if (string) { - *string = [[NSString alloc] initWithBytes:start - length:(NSInteger)(*input - start) - encoding:NSASCIIStringEncoding]; - } - return YES; -} - -static BOOL RCTIsCollectionType(NSString *type) -{ - static NSSet *collectionTypes; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - collectionTypes = [[NSSet alloc] initWithObjects: - @"NSArray", @"NSSet", @"NSDictionary", nil]; - }); - return [collectionTypes containsObject:type]; -} - -NSString *RCTParseType(const char **input) -{ - NSString *type; - RCTParseArgumentIdentifier(input, &type); - RCTSkipWhitespace(input); - if (RCTReadChar(input, '<')) { - RCTSkipWhitespace(input); - NSString *subtype = RCTParseType(input); - if (RCTIsCollectionType(type)) { - if ([type isEqualToString:@"NSDictionary"]) { - // Dictionaries have both a key *and* value type, but the key type has - // to be a string for JSON, so we only care about the value type - if (RCT_DEBUG && ![subtype isEqualToString:@"NSString"]) { - RCTLogError(@"%@ is not a valid key type for a JSON dictionary", subtype); - } - RCTSkipWhitespace(input); - RCTReadChar(input, ','); - RCTSkipWhitespace(input); - subtype = RCTParseType(input); - } - if (![subtype isEqualToString:@"id"]) { - type = [type stringByReplacingCharactersInRange:(NSRange){0, 2 /* "NS" */} - withString:subtype]; - } - } else { - // It's a protocol rather than a generic collection - ignore it - } - RCTSkipWhitespace(input); - RCTReadChar(input, '>'); - } - RCTSkipWhitespace(input); - if (!RCTReadChar(input, '*')) { - RCTReadChar(input, '&'); - } - return type; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTPerformanceLogger.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTPerformanceLogger.h deleted file mode 100644 index f1a615f4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTPerformanceLogger.h +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -typedef NS_ENUM(NSUInteger, RCTPLTag) { - RCTPLScriptDownload = 0, - RCTPLScriptExecution, - RCTPLRAMBundleLoad, - RCTPLRAMStartupCodeSize, - RCTPLRAMStartupNativeRequires, - RCTPLRAMStartupNativeRequiresCount, - RCTPLRAMNativeRequires, - RCTPLRAMNativeRequiresCount, - RCTPLNativeModuleInit, - RCTPLNativeModuleMainThread, - RCTPLNativeModulePrepareConfig, - RCTPLNativeModuleMainThreadUsesCount, - RCTPLJSCWrapperOpenLibrary, - RCTPLBridgeStartup, - RCTPLTTI, - RCTPLBundleSize, - RCTPLSize -}; - -@interface RCTPerformanceLogger : NSObject - -/** - * Starts measuring a metric with the given tag. - * Overrides previous value if the measurement has been already started. - * If RCTProfile is enabled it also begins appropriate async event. - * All work is scheduled on the background queue so this doesn't block current thread. - */ -- (void)markStartForTag:(RCTPLTag)tag; - -/** - * Stops measuring a metric with given tag. - * Checks if RCTPerformanceLoggerStart() has been called before - * and doesn't do anything and log a message if it hasn't. - * If RCTProfile is enabled it also ends appropriate async event. - * All work is scheduled on the background queue so this doesn't block current thread. - */ -- (void)markStopForTag:(RCTPLTag)tag; - -/** - * Sets given value for a metric with given tag. - * All work is scheduled on the background queue so this doesn't block current thread. - */ -- (void)setValue:(int64_t)value forTag:(RCTPLTag)tag; - -/** - * Adds given value to the current value for a metric with given tag. - * All work is scheduled on the background queue so this doesn't block current thread. - */ -- (void)addValue:(int64_t)value forTag:(RCTPLTag)tag; - -/** - * Starts an additional measurement for a metric with given tag. - * It doesn't override previous measurement, instead it'll append a new value - * to the old one. - * All work is scheduled on the background queue so this doesn't block current thread. - */ -- (void)appendStartForTag:(RCTPLTag)tag; - -/** - * Stops measurement and appends the result to the metric with given tag. - * Checks if RCTPerformanceLoggerAppendStart() has been called before - * and doesn't do anything and log a message if it hasn't. - * All work is scheduled on the background queue so this doesn't block current thread. - */ -- (void)appendStopForTag:(RCTPLTag)tag; - -/** - * Returns an array with values for all tags. - * Use RCTPLTag to go over the array, there's a pair of values - * for each tag: start and stop (with indexes 2 * tag and 2 * tag + 1). - */ -- (NSArray *)valuesForTags; - -/** - * Returns a duration in ms (stop_time - start_time) for given RCTPLTag. - */ -- (int64_t)durationForTag:(RCTPLTag)tag; - -/** - * Returns a value for given RCTPLTag. - */ -- (int64_t)valueForTag:(RCTPLTag)tag; - -/** - * Returns an array with values for all tags. - * Use RCTPLTag to go over the array. - */ -- (NSArray *)labelsForTags; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTPerformanceLogger.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTPerformanceLogger.m deleted file mode 100644 index af7cc711..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTPerformanceLogger.m +++ /dev/null @@ -1,129 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "RCTPerformanceLogger.h" -#import "RCTRootView.h" -#import "RCTLog.h" -#import "RCTProfile.h" - -@interface RCTPerformanceLogger () -{ - int64_t _data[RCTPLSize][2]; - NSUInteger _cookies[RCTPLSize]; -} - -@property (nonatomic, copy) NSArray *labelsForTags; - -@end - -@implementation RCTPerformanceLogger - -- (instancetype)init -{ - if (self = [super init]) { - _labelsForTags = @[ - @"ScriptDownload", - @"ScriptExecution", - @"RAMBundleLoad", - @"RAMStartupCodeSize", - @"RAMStartupNativeRequires", - @"RAMStartupNativeRequiresCount", - @"RAMNativeRequires", - @"RAMNativeRequiresCount", - @"NativeModuleInit", - @"NativeModuleMainThread", - @"NativeModulePrepareConfig", - @"NativeModuleInjectConfig", - @"NativeModuleMainThreadUsesCount", - @"JSCWrapperOpenLibrary", - @"JSCExecutorSetup", - @"BridgeStartup", - @"RootViewTTI", - @"BundleSize", - ]; - } - return self; -} - -- (void)markStartForTag:(RCTPLTag)tag -{ -#if RCT_PROFILE - if (RCTProfileIsProfiling()) { - NSString *label = _labelsForTags[tag]; - _cookies[tag] = RCTProfileBeginAsyncEvent(RCTProfileTagAlways, label, nil); - } -#endif - _data[tag][0] = CACurrentMediaTime() * 1000; - _data[tag][1] = 0; -} - - -- (void)markStopForTag:(RCTPLTag)tag -{ -#if RCT_PROFILE - if (RCTProfileIsProfiling()) { - NSString *label =_labelsForTags[tag]; - RCTProfileEndAsyncEvent(RCTProfileTagAlways, @"native", _cookies[tag], label, @"RCTPerformanceLogger"); - } -#endif - if (_data[tag][0] != 0 && _data[tag][1] == 0) { - _data[tag][1] = CACurrentMediaTime() * 1000; - } else { - RCTLogInfo(@"Unbalanced calls start/end for tag %li", (unsigned long)tag); - } -} - -- (void)setValue:(int64_t)value forTag:(RCTPLTag)tag -{ - _data[tag][0] = 0; - _data[tag][1] = value; -} - -- (void)addValue:(int64_t)value forTag:(RCTPLTag)tag -{ - _data[tag][0] = 0; - _data[tag][1] += value; -} - -- (void)appendStartForTag:(RCTPLTag)tag -{ - _data[tag][0] = CACurrentMediaTime() * 1000; -} - -- (void)appendStopForTag:(RCTPLTag)tag -{ - if (_data[tag][0] != 0) { - _data[tag][1] += CACurrentMediaTime() * 1000 - _data[tag][0]; - _data[tag][0] = 0; - } else { - RCTLogInfo(@"Unbalanced calls start/end for tag %li", (unsigned long)tag); - } -} - -- (NSArray *)valuesForTags -{ - NSMutableArray *result = [NSMutableArray array]; - for (NSUInteger index = 0; index < RCTPLSize; index++) { - [result addObject:@(_data[index][0])]; - [result addObject:@(_data[index][1])]; - } - return result; -} - -- (int64_t)durationForTag:(RCTPLTag)tag -{ - return _data[tag][1] - _data[tag][0]; -} - -- (int64_t)valueForTag:(RCTPLTag)tag -{ - return _data[tag][1]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTPlatform.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTPlatform.h deleted file mode 100644 index 63e8a7f1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTPlatform.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTPlatform : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTPlatform.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTPlatform.m deleted file mode 100644 index ef19af55..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTPlatform.m +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTPlatform.h" - -#import - -#import "RCTUtils.h" -#import "RCTVersion.h" - -static NSString *interfaceIdiom(UIUserInterfaceIdiom idiom) { - switch(idiom) { - case UIUserInterfaceIdiomPhone: - return @"phone"; - case UIUserInterfaceIdiomPad: - return @"pad"; - case UIUserInterfaceIdiomTV: - return @"tv"; - case UIUserInterfaceIdiomCarPlay: - return @"carplay"; - default: - return @"unknown"; - } -} - -@implementation RCTPlatform - -RCT_EXPORT_MODULE(PlatformConstants) - -+ (BOOL)requiresMainQueueSetup -{ - return YES; -} - -- (NSDictionary *)constantsToExport -{ - return [self getConstants]; -} - -- (NSDictionary *)getConstants -{ - UIDevice *device = [UIDevice currentDevice]; - return @{ - @"forceTouchAvailable": @(RCTForceTouchAvailable()), - @"osVersion": [device systemVersion], - @"systemName": [device systemName], - @"interfaceIdiom": interfaceIdiom([device userInterfaceIdiom]), - @"isTesting": @(RCTRunningInTestEnvironment()), - @"reactNativeVersion": RCTGetReactNativeVersion(), - }; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTReloadCommand.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTReloadCommand.h deleted file mode 100644 index ddf0bd87..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTReloadCommand.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@protocol RCTReloadListener -- (void)didReceiveReloadCommand; -@end - -/** Registers a weakly-held observer of the Command+R reload key command. */ -RCT_EXTERN void RCTRegisterReloadCommandListener(id listener); - -/** Triggers a reload for all current listeners. You shouldn't need to use this directly in most cases. */ -RCT_EXTERN void RCTTriggerReloadCommandListeners(void); diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTReloadCommand.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTReloadCommand.m deleted file mode 100644 index 2e69165d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTReloadCommand.m +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTReloadCommand.h" - -#import "RCTAssert.h" -#import "RCTKeyCommands.h" - -/** main queue only */ -static NSHashTable> *listeners; - -void RCTRegisterReloadCommandListener(id listener) -{ - RCTAssertMainQueue(); // because registerKeyCommandWithInput: must be called on the main thread - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - listeners = [NSHashTable weakObjectsHashTable]; - [[RCTKeyCommands sharedInstance] registerKeyCommandWithInput:@"r" - modifierFlags:UIKeyModifierCommand - action: - ^(__unused UIKeyCommand *command) { - RCTTriggerReloadCommandListeners(); - }]; - }); - [listeners addObject:listener]; -} - -void RCTTriggerReloadCommandListeners(void) -{ - RCTAssertMainQueue(); - // Copy to protect against mutation-during-enumeration. - // If listeners hasn't been initialized yet we get nil, which works just fine. - NSArray> *copiedListeners = [listeners allObjects]; - for (id l in copiedListeners) { - [l didReceiveReloadCommand]; - } -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTRootContentView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTRootContentView.h deleted file mode 100644 index 139f1919..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTRootContentView.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import - -@class RCTBridge; -@class RCTTouchHandler; - -@interface RCTRootContentView : RCTView - -@property (nonatomic, readonly, weak) RCTBridge *bridge; -@property (nonatomic, readonly, assign) BOOL contentHasAppeared; -@property (nonatomic, readonly, strong) RCTTouchHandler *touchHandler; -@property (nonatomic, readonly, assign) CGSize availableSize; - -@property (nonatomic, assign) BOOL passThroughTouches; -@property (nonatomic, assign) RCTRootViewSizeFlexibility sizeFlexibility; - -- (instancetype)initWithFrame:(CGRect)frame - bridge:(RCTBridge *)bridge - reactTag:(NSNumber *)reactTag - sizeFlexiblity:(RCTRootViewSizeFlexibility)sizeFlexibility NS_DESIGNATED_INITIALIZER; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTRootContentView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTRootContentView.m deleted file mode 100644 index 15d0bf82..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTRootContentView.m +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTRootContentView.h" - -#import "RCTBridge.h" -#import "RCTPerformanceLogger.h" -#import "RCTRootView.h" -#import "RCTRootViewInternal.h" -#import "RCTTouchHandler.h" -#import "RCTUIManager.h" -#import "UIView+React.h" - -@implementation RCTRootContentView - -- (instancetype)initWithFrame:(CGRect)frame - bridge:(RCTBridge *)bridge - reactTag:(NSNumber *)reactTag - sizeFlexiblity:(RCTRootViewSizeFlexibility)sizeFlexibility -{ - if ((self = [super initWithFrame:frame])) { - _bridge = bridge; - self.reactTag = reactTag; - _sizeFlexibility = sizeFlexibility; - _touchHandler = [[RCTTouchHandler alloc] initWithBridge:_bridge]; - [_touchHandler attachToView:self]; - [_bridge.uiManager registerRootView:self]; - } - return self; -} - -RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame:(CGRect)frame) -RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder:(nonnull NSCoder *)aDecoder) - -- (void)layoutSubviews -{ - [super layoutSubviews]; - [self updateAvailableSize]; -} - -- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex -{ - [super insertReactSubview:subview atIndex:atIndex]; - [_bridge.performanceLogger markStopForTag:RCTPLTTI]; - dispatch_async(dispatch_get_main_queue(), ^{ - if (!self->_contentHasAppeared) { - self->_contentHasAppeared = YES; - [[NSNotificationCenter defaultCenter] postNotificationName:RCTContentDidAppearNotification - object:self.superview]; - } - }); -} - -- (void)setSizeFlexibility:(RCTRootViewSizeFlexibility)sizeFlexibility -{ - if (_sizeFlexibility == sizeFlexibility) { - return; - } - - _sizeFlexibility = sizeFlexibility; - [self setNeedsLayout]; -} - -- (CGSize)availableSize -{ - CGSize size = self.bounds.size; - return CGSizeMake( - _sizeFlexibility & RCTRootViewSizeFlexibilityWidth ? INFINITY : size.width, - _sizeFlexibility & RCTRootViewSizeFlexibilityHeight ? INFINITY : size.height - ); -} - -- (void)updateAvailableSize -{ - if (!self.reactTag || !_bridge.isValid) { - return; - } - - [_bridge.uiManager setAvailableSize:self.availableSize forRootView:self]; -} - -- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - // The root content view itself should never receive touches - UIView *hitView = [super hitTest:point withEvent:event]; - if (_passThroughTouches && hitView == self) { - return nil; - } - return hitView; -} - -- (void)invalidate -{ - if (self.userInteractionEnabled) { - self.userInteractionEnabled = NO; - [(RCTRootView *)self.superview contentViewInvalidated]; - - [_bridge enqueueJSCall:@"AppRegistry" - method:@"unmountApplicationComponentAtRootTag" - args:@[self.reactTag] - completion:NULL]; - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTRootView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTRootView.h deleted file mode 100644 index a601f45f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTRootView.h +++ /dev/null @@ -1,174 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#if __has_include() -#import -#elif __has_include("RCTBridge.h") -#import "RCTBridge.h" -#else -#import "React/RCTBridge.h" -#endif - -@protocol RCTRootViewDelegate; - -/** - * This enum is used to define size flexibility type of the root view. - * If a dimension is flexible, the view will recalculate that dimension - * so the content fits. Recalculations are performed when the root's frame, - * size flexibility mode or content size changes. After a recalculation, - * rootViewDidChangeIntrinsicSize method of the RCTRootViewDelegate will be called. - */ -typedef NS_ENUM(NSInteger, RCTRootViewSizeFlexibility) { - RCTRootViewSizeFlexibilityNone = 0, - RCTRootViewSizeFlexibilityWidth = 1 << 0, - RCTRootViewSizeFlexibilityHeight = 1 << 1, - RCTRootViewSizeFlexibilityWidthAndHeight = RCTRootViewSizeFlexibilityWidth | RCTRootViewSizeFlexibilityHeight, -}; - -/** - * This notification is sent when the first subviews are added to the root view - * after the application has loaded. This is used to hide the `loadingView`, and - * is a good indicator that the application is ready to use. - */ -#if defined(__cplusplus) -extern "C" -#else -extern -#endif -NSString *const RCTContentDidAppearNotification; - -/** - * Native view used to host React-managed views within the app. Can be used just - * like any ordinary UIView. You can have multiple RCTRootViews on screen at - * once, all controlled by the same JavaScript application. - */ -@interface RCTRootView : UIView - -/** - * - Designated initializer - - */ -- (instancetype)initWithBridge:(RCTBridge *)bridge - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties NS_DESIGNATED_INITIALIZER; - -/** - * - Convenience initializer - - * A bridge will be created internally. - * This initializer is intended to be used when the app has a single RCTRootView, - * otherwise create an `RCTBridge` and pass it in via `initWithBridge:moduleName:` - * to all the instances. - */ -- (instancetype)initWithBundleURL:(NSURL *)bundleURL - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties - launchOptions:(NSDictionary *)launchOptions; - - -/** - * The name of the JavaScript module to execute within the - * specified scriptURL (required). Setting this will not have - * any immediate effect, but it must be done prior to loading - * the script. - */ -@property (nonatomic, copy, readonly) NSString *moduleName; - -/** - * The bridge used by the root view. Bridges can be shared between multiple - * root views, so you can use this property to initialize another RCTRootView. - */ -@property (nonatomic, strong, readonly) RCTBridge *bridge; - -/** - * The properties to apply to the view. Use this property to update - * application properties and rerender the view. Initialized with - * initialProperties argument of the initializer. - * - * Set this property only on the main thread. - */ -@property (nonatomic, copy, readwrite) NSDictionary *appProperties; - -/** - * The size flexibility mode of the root view. - */ -@property (nonatomic, assign) RCTRootViewSizeFlexibility sizeFlexibility; - -/** - * The delegate that handles intrinsic size updates. - */ -@property (nonatomic, weak) id delegate; - -/** - * The backing view controller of the root view. - */ -@property (nonatomic, weak) UIViewController *reactViewController; - -/** - * The React-managed contents view of the root view. - */ -@property (nonatomic, strong, readonly) UIView *contentView; - -/** - * A view to display while the JavaScript is loading, so users aren't presented - * with a blank screen. By default this is nil, but you can override it with - * (for example) a UIActivityIndicatorView or a placeholder image. - */ -@property (nonatomic, strong) UIView *loadingView; - -/** - * Calling this will result in emitting a "touches cancelled" event to js, - * which effectively cancels all js "gesture recognizers" such as touchable components - * (unless they explicitely ignore cancellation events, but no one should do that). - * - * This API is exposed for integration purposes where you embed RN rootView - * in a native view with a native gesture recognizer, - * whose activation should prevent any in-flight js "gesture recognizer" from activating. - * - * An example would be RN rootView embedded in an UIScrollView. - * When you touch down on a touchable component and drag your finger up, - * you don't want any touch to be registered as soon as the UIScrollView starts scrolling. - * - * Note that this doesn't help with tapping on a touchable element that is being scrolled, - * unless you can call cancelTouches exactly between "touches began" and "touches ended" events. - * This is a reason why this API may be soon removed in favor of a better solution. - */ -- (void)cancelTouches; - -/** - * When set, any touches on the RCTRootView that are not matched up to any of the child - * views will be passed to siblings of the RCTRootView. See -[UIView hitTest:withEvent:] - * for details on iOS hit testing. - * - * Enable this to support a semi-transparent RN view that occupies the whole screen but - * has visible content below it that the user can interact with. - * - * The default value is NO. - */ -@property (nonatomic, assign) BOOL passThroughTouches; - -/** - * Timings for hiding the loading view after the content has loaded. Both of - * these values default to 0.25 seconds. - */ -@property (nonatomic, assign) NSTimeInterval loadingViewFadeDelay; -@property (nonatomic, assign) NSTimeInterval loadingViewFadeDuration; - -@end - -@interface RCTRootView (Deprecated) - -/** - * The intrinsic size of the root view's content. This is set right before the - * `rootViewDidChangeIntrinsicSize` method of `RCTRootViewDelegate` is called. - * This property is deprecated and will be removed in next releases. - * Use UIKit `intrinsicContentSize` propery instead. - */ -@property (readonly, nonatomic, assign) CGSize intrinsicSize -__deprecated_msg("Use `intrinsicContentSize` instead."); - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTRootView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTRootView.m deleted file mode 100644 index ca40eec2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTRootView.m +++ /dev/null @@ -1,390 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTRootView.h" -#import "RCTRootViewDelegate.h" -#import "RCTRootViewInternal.h" - -#import - -#import "RCTAssert.h" -#import "RCTBridge.h" -#import "RCTBridge+Private.h" -#import "RCTEventDispatcher.h" -#import "RCTKeyCommands.h" -#import "RCTLog.h" -#import "RCTPerformanceLogger.h" -#import "RCTProfile.h" -#import "RCTRootContentView.h" -#import "RCTTouchHandler.h" -#import "RCTUIManager.h" -#import "RCTUIManagerUtils.h" -#import "RCTUtils.h" -#import "RCTView.h" -#import "UIView+React.h" - -#if TARGET_OS_TV -#import "RCTTVRemoteHandler.h" -#import "RCTTVNavigationEventEmitter.h" -#endif - -NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotification"; - -@interface RCTUIManager (RCTRootView) - -- (NSNumber *)allocateRootTag; - -@end - -@implementation RCTRootView -{ - RCTBridge *_bridge; - NSString *_moduleName; - RCTRootContentView *_contentView; - BOOL _passThroughTouches; - CGSize _intrinsicContentSize; -} - -- (instancetype)initWithBridge:(RCTBridge *)bridge - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties -{ - RCTAssertMainQueue(); - RCTAssert(bridge, @"A bridge instance is required to create an RCTRootView"); - RCTAssert(moduleName, @"A moduleName is required to create an RCTRootView"); - - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[RCTRootView init]", nil); - if (!bridge.isLoading) { - [bridge.performanceLogger markStartForTag:RCTPLTTI]; - } - - if (self = [super initWithFrame:CGRectZero]) { - self.backgroundColor = [UIColor whiteColor]; - - _bridge = bridge; - _moduleName = moduleName; - _appProperties = [initialProperties copy]; - _loadingViewFadeDelay = 0.25; - _loadingViewFadeDuration = 0.25; - _sizeFlexibility = RCTRootViewSizeFlexibilityNone; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(bridgeDidReload) - name:RCTJavaScriptWillStartLoadingNotification - object:_bridge]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(javaScriptDidLoad:) - name:RCTJavaScriptDidLoadNotification - object:_bridge]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(hideLoadingView) - name:RCTContentDidAppearNotification - object:self]; - -#if TARGET_OS_TV - self.tvRemoteHandler = [RCTTVRemoteHandler new]; - for (NSString *key in [self.tvRemoteHandler.tvRemoteGestureRecognizers allKeys]) { - [self addGestureRecognizer:self.tvRemoteHandler.tvRemoteGestureRecognizers[key]]; - } -#endif - - [self showLoadingView]; - - // Immediately schedule the application to be started. - // (Sometimes actual `_bridge` is already batched bridge here.) - [self bundleFinishedLoading:([_bridge batchedBridge] ?: _bridge)]; - } - - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - - return self; -} - -- (instancetype)initWithBundleURL:(NSURL *)bundleURL - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties - launchOptions:(NSDictionary *)launchOptions -{ - RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:bundleURL - moduleProvider:nil - launchOptions:launchOptions]; - - return [self initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties]; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) -RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) - -#if TARGET_OS_TV -- (UIView *)preferredFocusedView -{ - if (self.reactPreferredFocusedView) { - return self.reactPreferredFocusedView; - } - return [super preferredFocusedView]; -} -#endif - -#pragma mark - passThroughTouches - -- (BOOL)passThroughTouches -{ - return _contentView.passThroughTouches; -} - -- (void)setPassThroughTouches:(BOOL)passThroughTouches -{ - _passThroughTouches = passThroughTouches; - _contentView.passThroughTouches = passThroughTouches; -} - -#pragma mark - Layout - -- (CGSize)sizeThatFits:(CGSize)size -{ - CGSize fitSize = _intrinsicContentSize; - CGSize currentSize = self.bounds.size; - - // Following the current `size` and current `sizeFlexibility` policy. - fitSize = CGSizeMake( - _sizeFlexibility & RCTRootViewSizeFlexibilityWidth ? fitSize.width : currentSize.width, - _sizeFlexibility & RCTRootViewSizeFlexibilityHeight ? fitSize.height : currentSize.height - ); - - // Following the given size constraints. - fitSize = CGSizeMake( - MIN(size.width, fitSize.width), - MIN(size.height, fitSize.height) - ); - - return fitSize; -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - _contentView.frame = self.bounds; - _loadingView.center = (CGPoint){ - CGRectGetMidX(self.bounds), - CGRectGetMidY(self.bounds) - }; -} - -- (UIViewController *)reactViewController -{ - return _reactViewController ?: [super reactViewController]; -} - -- (BOOL)canBecomeFirstResponder -{ - return YES; -} - -- (void)setLoadingView:(UIView *)loadingView -{ - _loadingView = loadingView; - if (!_contentView.contentHasAppeared) { - [self showLoadingView]; - } -} - -- (void)showLoadingView -{ - if (_loadingView && !_contentView.contentHasAppeared) { - _loadingView.hidden = NO; - [self addSubview:_loadingView]; - } -} - -- (void)hideLoadingView -{ - if (_loadingView.superview == self && _contentView.contentHasAppeared) { - if (_loadingViewFadeDuration > 0) { - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(_loadingViewFadeDelay * NSEC_PER_SEC)), - dispatch_get_main_queue(), ^{ - - [UIView transitionWithView:self - duration:self->_loadingViewFadeDuration - options:UIViewAnimationOptionTransitionCrossDissolve - animations:^{ - self->_loadingView.hidden = YES; - } completion:^(__unused BOOL finished) { - [self->_loadingView removeFromSuperview]; - }]; - }); - } else { - _loadingView.hidden = YES; - [_loadingView removeFromSuperview]; - } - } -} - -- (NSNumber *)reactTag -{ - RCTAssertMainQueue(); - if (!super.reactTag) { - /** - * Every root view that is created must have a unique react tag. - * Numbering of these tags goes from 1, 11, 21, 31, etc - * - * NOTE: Since the bridge persists, the RootViews might be reused, so the - * react tag must be re-assigned every time a new UIManager is created. - */ - self.reactTag = RCTAllocateRootViewTag(); - } - return super.reactTag; -} - -- (void)bridgeDidReload -{ - RCTAssertMainQueue(); - // Clear the reactTag so it can be re-assigned - self.reactTag = nil; -} - -- (void)javaScriptDidLoad:(NSNotification *)notification -{ - RCTAssertMainQueue(); - - // Use the (batched) bridge that's sent in the notification payload, so the - // RCTRootContentView is scoped to the right bridge - RCTBridge *bridge = notification.userInfo[@"bridge"]; - if (bridge != _contentView.bridge) { - [self bundleFinishedLoading:bridge]; - } -} - -- (void)bundleFinishedLoading:(RCTBridge *)bridge -{ - RCTAssert(bridge != nil, @"Bridge cannot be nil"); - if (!bridge.valid) { - return; - } - - [_contentView removeFromSuperview]; - _contentView = [[RCTRootContentView alloc] initWithFrame:self.bounds - bridge:bridge - reactTag:self.reactTag - sizeFlexiblity:_sizeFlexibility]; - [self runApplication:bridge]; - - _contentView.passThroughTouches = _passThroughTouches; - [self insertSubview:_contentView atIndex:0]; - - if (_sizeFlexibility == RCTRootViewSizeFlexibilityNone) { - self.intrinsicContentSize = self.bounds.size; - } -} - -- (void)runApplication:(RCTBridge *)bridge -{ - NSString *moduleName = _moduleName ?: @""; - NSDictionary *appParameters = @{ - @"rootTag": _contentView.reactTag, - @"initialProps": _appProperties ?: @{}, - }; - - RCTLogInfo(@"Running application %@ (%@)", moduleName, appParameters); - [bridge enqueueJSCall:@"AppRegistry" - method:@"runApplication" - args:@[moduleName, appParameters] - completion:NULL]; -} - -- (void)setSizeFlexibility:(RCTRootViewSizeFlexibility)sizeFlexibility -{ - if (_sizeFlexibility == sizeFlexibility) { - return; - } - - _sizeFlexibility = sizeFlexibility; - [self setNeedsLayout]; - _contentView.sizeFlexibility = _sizeFlexibility; -} - -- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - // The root view itself should never receive touches - UIView *hitView = [super hitTest:point withEvent:event]; - if (self.passThroughTouches && hitView == self) { - return nil; - } - return hitView; -} - -- (void)setAppProperties:(NSDictionary *)appProperties -{ - RCTAssertMainQueue(); - - if ([_appProperties isEqualToDictionary:appProperties]) { - return; - } - - _appProperties = [appProperties copy]; - - if (_contentView && _bridge.valid && !_bridge.loading) { - [self runApplication:_bridge]; - } -} - -- (void)setIntrinsicContentSize:(CGSize)intrinsicContentSize -{ - BOOL oldSizeHasAZeroDimension = _intrinsicContentSize.height == 0 || _intrinsicContentSize.width == 0; - BOOL newSizeHasAZeroDimension = intrinsicContentSize.height == 0 || intrinsicContentSize.width == 0; - BOOL bothSizesHaveAZeroDimension = oldSizeHasAZeroDimension && newSizeHasAZeroDimension; - - BOOL sizesAreEqual = CGSizeEqualToSize(_intrinsicContentSize, intrinsicContentSize); - - _intrinsicContentSize = intrinsicContentSize; - - [self invalidateIntrinsicContentSize]; - [self.superview setNeedsLayout]; - - // Don't notify the delegate if the content remains invisible or its size has not changed - if (bothSizesHaveAZeroDimension || sizesAreEqual) { - return; - } - - [_delegate rootViewDidChangeIntrinsicSize:self]; -} - -- (CGSize)intrinsicContentSize -{ - return _intrinsicContentSize; -} - -- (void)contentViewInvalidated -{ - [_contentView removeFromSuperview]; - _contentView = nil; - [self showLoadingView]; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; - [_contentView invalidate]; -} - -- (void)cancelTouches -{ - [[_contentView touchHandler] cancel]; -} - -@end - -@implementation RCTRootView (Deprecated) - -- (CGSize)intrinsicSize -{ - RCTLogWarn(@"Calling deprecated `[-RCTRootView intrinsicSize]`."); - return self.intrinsicContentSize; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTRootViewDelegate.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTRootViewDelegate.h deleted file mode 100644 index bd3a4f9a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTRootViewDelegate.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@class RCTRootView; - -@protocol RCTRootViewDelegate - -/** - * Called after the root view's intrinsic content size is changed. - * - * The method is not called when both old size and new size have - * a dimension that equals to zero. - * - * The delegate can use this callback to appropriately resize - * the root view's frame to fit the new intrinsic content view size, - * but usually it is not necessary because the root view will also call - * `setNeedsLayout` for its superview which in its turn will trigger relayout. - * - * The new intrinsic content size is available via the `intrinsicContentSize` - * propery of the root view. The view will not resize itself. - */ -- (void)rootViewDidChangeIntrinsicSize:(RCTRootView *)rootView; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTRootViewInternal.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTRootViewInternal.h deleted file mode 100644 index 7ddabdaa..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTRootViewInternal.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@class RCTTVRemoteHandler; - -/** - * The interface provides a set of functions that allow other internal framework - * classes to change the RCTRootViews's internal state. - */ -@interface RCTRootView () - -/** - * This setter should be used only by RCTUIManager on react root view - * intrinsic content size update. - */ -@property (readwrite, nonatomic, assign) CGSize intrinsicContentSize; - -/** - * TV remote gesture recognizers - */ -#if TARGET_OS_TV -@property (nonatomic, strong) RCTTVRemoteHandler *tvRemoteHandler; -@property (nonatomic, strong) UIView *reactPreferredFocusedView; -#endif - -- (void)contentViewInvalidated; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTTVRemoteHandler.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTTVRemoteHandler.h deleted file mode 100644 index 30390c94..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTTVRemoteHandler.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - - -extern NSString *const RCTTVRemoteEventMenu; -extern NSString *const RCTTVRemoteEventPlayPause; -extern NSString *const RCTTVRemoteEventSelect; - -extern NSString *const RCTTVRemoteEventLongPlayPause; -extern NSString *const RCTTVRemoteEventLongSelect; - -extern NSString *const RCTTVRemoteEventLeft; -extern NSString *const RCTTVRemoteEventRight; -extern NSString *const RCTTVRemoteEventUp; -extern NSString *const RCTTVRemoteEventDown; - -extern NSString *const RCTTVRemoteEventSwipeLeft; -extern NSString *const RCTTVRemoteEventSwipeRight; -extern NSString *const RCTTVRemoteEventSwipeUp; -extern NSString *const RCTTVRemoteEventSwipeDown; - -@interface RCTTVRemoteHandler : NSObject - -@property (nonatomic, copy, readonly) NSDictionary *tvRemoteGestureRecognizers; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTTVRemoteHandler.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTTVRemoteHandler.m deleted file mode 100644 index 1546802b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTTVRemoteHandler.m +++ /dev/null @@ -1,232 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTVRemoteHandler.h" - -#import - -#import "RCTAssert.h" -#import "RCTBridge.h" -#import "RCTEventDispatcher.h" -#import "RCTLog.h" -#import "RCTRootView.h" -#import "RCTTVNavigationEventEmitter.h" -#import "RCTUIManager.h" -#import "RCTUtils.h" -#import "RCTView.h" -#import "UIView+React.h" - -#if __has_include("RCTDevMenu.h") -#import "RCTDevMenu.h" -#endif - -NSString *const RCTTVRemoteEventMenu = @"menu"; -NSString *const RCTTVRemoteEventPlayPause = @"playPause"; -NSString *const RCTTVRemoteEventSelect = @"select"; - -NSString *const RCTTVRemoteEventLongPlayPause = @"longPlayPause"; -NSString *const RCTTVRemoteEventLongSelect = @"longSelect"; - -NSString *const RCTTVRemoteEventLeft = @"left"; -NSString *const RCTTVRemoteEventRight = @"right"; -NSString *const RCTTVRemoteEventUp = @"up"; -NSString *const RCTTVRemoteEventDown = @"down"; - -NSString *const RCTTVRemoteEventSwipeLeft = @"swipeLeft"; -NSString *const RCTTVRemoteEventSwipeRight = @"swipeRight"; -NSString *const RCTTVRemoteEventSwipeUp = @"swipeUp"; -NSString *const RCTTVRemoteEventSwipeDown = @"swipeDown"; - - -@implementation RCTTVRemoteHandler { - NSMutableDictionary *_tvRemoteGestureRecognizers; -} - -- (instancetype)init -{ - if ((self = [super init])) { - _tvRemoteGestureRecognizers = [NSMutableDictionary dictionary]; - - // Recognizers for Apple TV remote buttons - - // Play/Pause - [self addTapGestureRecognizerWithSelector:@selector(playPausePressed:) - pressType:UIPressTypePlayPause - name:RCTTVRemoteEventPlayPause]; - - // Menu - [self addTapGestureRecognizerWithSelector:@selector(menuPressed:) - pressType:UIPressTypeMenu - name:RCTTVRemoteEventMenu]; - - // Select - [self addTapGestureRecognizerWithSelector:@selector(selectPressed:) - pressType:UIPressTypeSelect - name:RCTTVRemoteEventSelect]; - - // Up - [self addTapGestureRecognizerWithSelector:@selector(tappedUp:) - pressType:UIPressTypeUpArrow - name:RCTTVRemoteEventUp]; - - // Down - [self addTapGestureRecognizerWithSelector:@selector(tappedDown:) - pressType:UIPressTypeDownArrow - name:RCTTVRemoteEventDown]; - - // Left - [self addTapGestureRecognizerWithSelector:@selector(tappedLeft:) - pressType:UIPressTypeLeftArrow - name:RCTTVRemoteEventLeft]; - - // Right - [self addTapGestureRecognizerWithSelector:@selector(tappedRight:) - pressType:UIPressTypeRightArrow - name:RCTTVRemoteEventRight]; - - // Recognizers for long button presses - // We don't intercept long menu press -- that's used by the system to go to the home screen - - [self addLongPressGestureRecognizerWithSelector:@selector(longPlayPausePressed:) - pressType:UIPressTypePlayPause - name:RCTTVRemoteEventLongPlayPause]; - - [self addLongPressGestureRecognizerWithSelector:@selector(longSelectPressed:) - pressType:UIPressTypeSelect - name:RCTTVRemoteEventLongSelect]; - - // Recognizers for Apple TV remote trackpad swipes - - // Up - [self addSwipeGestureRecognizerWithSelector:@selector(swipedUp:) - direction:UISwipeGestureRecognizerDirectionUp - name:RCTTVRemoteEventSwipeUp]; - - // Down - [self addSwipeGestureRecognizerWithSelector:@selector(swipedDown:) - direction:UISwipeGestureRecognizerDirectionDown - name:RCTTVRemoteEventSwipeDown]; - - // Left - [self addSwipeGestureRecognizerWithSelector:@selector(swipedLeft:) - direction:UISwipeGestureRecognizerDirectionLeft - name:RCTTVRemoteEventSwipeLeft]; - - // Right - [self addSwipeGestureRecognizerWithSelector:@selector(swipedRight:) - direction:UISwipeGestureRecognizerDirectionRight - name:RCTTVRemoteEventSwipeRight]; - - } - - return self; -} - -- (void)playPausePressed:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventPlayPause toView:r.view]; -} - -- (void)menuPressed:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventMenu toView:r.view]; -} - -- (void)selectPressed:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventSelect toView:r.view]; -} - -- (void)longPlayPausePressed:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventLongPlayPause toView:r.view]; - -#if __has_include("RCTDevMenu.h") && RCT_DEV - // If shake to show is enabled on device, use long play/pause event to show dev menu - [[NSNotificationCenter defaultCenter] postNotificationName:RCTShowDevMenuNotification object:nil]; -#endif -} - -- (void)longSelectPressed:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventLongSelect toView:r.view]; -} - -- (void)swipedUp:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventSwipeUp toView:r.view]; -} - -- (void)swipedDown:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventSwipeDown toView:r.view]; -} - -- (void)swipedLeft:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventSwipeLeft toView:r.view]; -} - -- (void)swipedRight:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventSwipeRight toView:r.view]; -} - -- (void)tappedUp:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventUp toView:r.view]; -} - -- (void)tappedDown:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventDown toView:r.view]; -} - -- (void)tappedLeft:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventLeft toView:r.view]; -} - -- (void)tappedRight:(UIGestureRecognizer *)r -{ - [self sendAppleTVEvent:RCTTVRemoteEventRight toView:r.view]; -} - -#pragma mark - - -- (void)addLongPressGestureRecognizerWithSelector:(nonnull SEL)selector pressType:(UIPressType)pressType name:(NSString *)name -{ - UILongPressGestureRecognizer *recognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:selector]; - recognizer.allowedPressTypes = @[@(pressType)]; - - _tvRemoteGestureRecognizers[name] = recognizer; -} - -- (void)addTapGestureRecognizerWithSelector:(nonnull SEL)selector pressType:(UIPressType)pressType name:(NSString *)name -{ - UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:selector]; - recognizer.allowedPressTypes = @[@(pressType)]; - - _tvRemoteGestureRecognizers[name] = recognizer; -} - -- (void)addSwipeGestureRecognizerWithSelector:(nonnull SEL)selector direction:(UISwipeGestureRecognizerDirection)direction name:(NSString *)name -{ - UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:selector]; - recognizer.direction = direction; - - _tvRemoteGestureRecognizers[name] = recognizer; -} - -- (void)sendAppleTVEvent:(NSString *)eventType toView:(__unused UIView *)v -{ - [[NSNotificationCenter defaultCenter] postNotificationName:RCTTVNavigationEventNotification - object:@{@"eventType":eventType}]; -} - - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTTouchEvent.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTTouchEvent.h deleted file mode 100644 index 5ba67155..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTTouchEvent.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -/** - * Represents a touch event, which may be composed of several touches (one for every finger). - * For more information on contents of passed data structures see RCTTouchHandler. - */ -@interface RCTTouchEvent : NSObject - -- (instancetype)initWithEventName:(NSString *)eventName - reactTag:(NSNumber *)reactTag - reactTouches:(NSArray *)reactTouches - changedIndexes:(NSArray *)changedIndexes - coalescingKey:(uint16_t)coalescingKey NS_DESIGNATED_INITIALIZER; -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTTouchEvent.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTTouchEvent.m deleted file mode 100644 index f5ea609a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTTouchEvent.m +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTouchEvent.h" - -#import "RCTAssert.h" - -@implementation RCTTouchEvent -{ - NSArray *_reactTouches; - NSArray *_changedIndexes; - uint16_t _coalescingKey; -} - -@synthesize eventName = _eventName; -@synthesize viewTag = _viewTag; - -- (instancetype)initWithEventName:(NSString *)eventName - reactTag:(NSNumber *)reactTag - reactTouches:(NSArray *)reactTouches - changedIndexes:(NSArray *)changedIndexes - coalescingKey:(uint16_t)coalescingKey -{ - if (self = [super init]) { - _viewTag = reactTag; - _eventName = eventName; - _reactTouches = reactTouches; - _changedIndexes = changedIndexes; - _coalescingKey = coalescingKey; - } - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -#pragma mark - RCTEvent - -- (BOOL)canCoalesce -{ - return [_eventName isEqual:@"touchMove"]; -} - -// We coalesce only move events, while holding some assumptions that seem reasonable but there are no explicit guarantees about them. -- (id)coalesceWithEvent:(id)newEvent -{ - RCTAssert([newEvent isKindOfClass:[RCTTouchEvent class]], @"Touch event cannot be coalesced with any other type of event, such as provided %@", newEvent); - RCTTouchEvent *newTouchEvent = (RCTTouchEvent *)newEvent; - RCTAssert([_reactTouches count] == [newTouchEvent->_reactTouches count], @"Touch events have different number of touches. %@ %@", self, newEvent); - - BOOL newEventIsMoreRecent = NO; - BOOL oldEventIsMoreRecent = NO; - NSInteger count = _reactTouches.count; - for (int i = 0; i_reactTouches[i]; - RCTAssert([touch[@"identifier"] isEqual:newTouch[@"identifier"]], @"Touch events doesn't have touches in the same order. %@ %@", touch, newTouch); - if ([touch[@"timestamp"] doubleValue] > [newTouch[@"timestamp"] doubleValue]) { - oldEventIsMoreRecent = YES; - } else { - newEventIsMoreRecent = YES; - } - } - RCTAssert(!(oldEventIsMoreRecent && newEventIsMoreRecent), @"Neither touch event is exclusively more recent than the other one. %@ %@", _reactTouches, newTouchEvent->_reactTouches); - return newEventIsMoreRecent ? newEvent : self; -} - -+ (NSString *)moduleDotMethod -{ - return @"RCTEventEmitter.receiveTouches"; -} - -- (NSArray *)arguments -{ - return @[RCTNormalizeInputEventName(_eventName), _reactTouches, _changedIndexes]; -} - -- (uint16_t)coalescingKey -{ - return _coalescingKey; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"<%@: %p; name = %@; coalescing key = %hu>", [self class], self, _eventName, _coalescingKey]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTTouchHandler.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTTouchHandler.h deleted file mode 100644 index a1a11918..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTTouchHandler.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@class RCTBridge; - -@interface RCTTouchHandler : UIGestureRecognizer - -- (instancetype)initWithBridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER; - -- (void)attachToView:(UIView *)view; -- (void)detachFromView:(UIView *)view; - -- (void)cancel; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTTouchHandler.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTTouchHandler.m deleted file mode 100644 index dee8526e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTTouchHandler.m +++ /dev/null @@ -1,381 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTouchHandler.h" - -#import - -#import "RCTAssert.h" -#import "RCTBridge.h" -#import "RCTEventDispatcher.h" -#import "RCTLog.h" -#import "RCTSurfaceView.h" -#import "RCTTouchEvent.h" -#import "RCTUIManager.h" -#import "RCTUtils.h" -#import "UIView+React.h" - -@interface RCTTouchHandler () -@end - -// TODO: this class behaves a lot like a module, and could be implemented as a -// module if we were to assume that modules and RootViews had a 1:1 relationship -@implementation RCTTouchHandler -{ - __weak RCTEventDispatcher *_eventDispatcher; - - /** - * Arrays managed in parallel tracking native touch object along with the - * native view that was touched, and the React touch data dictionary. - * These must be kept track of because `UIKit` destroys the touch targets - * if touches are canceled, and we have no other way to recover this info. - */ - NSMutableOrderedSet *_nativeTouches; - NSMutableArray *_reactTouches; - NSMutableArray *_touchViews; - - __weak UIView *_cachedRootView; - - uint16_t _coalescingKey; -} - -- (instancetype)initWithBridge:(RCTBridge *)bridge -{ - RCTAssertParam(bridge); - - if ((self = [super initWithTarget:nil action:NULL])) { - _eventDispatcher = [bridge moduleForClass:[RCTEventDispatcher class]]; - - _nativeTouches = [NSMutableOrderedSet new]; - _reactTouches = [NSMutableArray new]; - _touchViews = [NSMutableArray new]; - - // `cancelsTouchesInView` and `delaysTouches*` are needed in order to be used as a top level - // event delegated recognizer. Otherwise, lower-level components not built - // using RCT, will fail to recognize gestures. - self.cancelsTouchesInView = NO; - self.delaysTouchesBegan = NO; // This is default value. - self.delaysTouchesEnded = NO; - - self.delegate = self; - } - - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)initWithTarget:(id)target action:(SEL)action) - -- (void)attachToView:(UIView *)view -{ - RCTAssert(self.view == nil, @"RCTTouchHandler already has attached view."); - - [view addGestureRecognizer:self]; -} - -- (void)detachFromView:(UIView *)view -{ - RCTAssertParam(view); - RCTAssert(self.view == view, @"RCTTouchHandler attached to another view."); - - [view removeGestureRecognizer:self]; -} - -#pragma mark - Bookkeeping for touch indices - -- (void)_recordNewTouches:(NSSet *)touches -{ - for (UITouch *touch in touches) { - - RCTAssert(![_nativeTouches containsObject:touch], - @"Touch is already recorded. This is a critical bug."); - - // Find closest React-managed touchable view - UIView *targetView = touch.view; - while (targetView) { - if (targetView.reactTag && targetView.userInteractionEnabled) { - break; - } - targetView = targetView.superview; - } - - NSNumber *reactTag = [targetView reactTagAtPoint:[touch locationInView:targetView]]; - if (!reactTag || !targetView.userInteractionEnabled) { - continue; - } - - // Get new, unique touch identifier for the react touch - const NSUInteger RCTMaxTouches = 11; // This is the maximum supported by iDevices - NSInteger touchID = ([_reactTouches.lastObject[@"identifier"] integerValue] + 1) % RCTMaxTouches; - for (NSDictionary *reactTouch in _reactTouches) { - NSInteger usedID = [reactTouch[@"identifier"] integerValue]; - if (usedID == touchID) { - // ID has already been used, try next value - touchID ++; - } else if (usedID > touchID) { - // If usedID > touchID, touchID must be unique, so we can stop looking - break; - } - } - - // Create touch - NSMutableDictionary *reactTouch = [[NSMutableDictionary alloc] initWithCapacity:RCTMaxTouches]; - reactTouch[@"target"] = reactTag; - reactTouch[@"identifier"] = @(touchID); - - // Add to arrays - [_touchViews addObject:targetView]; - [_nativeTouches addObject:touch]; - [_reactTouches addObject:reactTouch]; - } -} - -- (void)_recordRemovedTouches:(NSSet *)touches -{ - for (UITouch *touch in touches) { - NSUInteger index = [_nativeTouches indexOfObject:touch]; - if (index == NSNotFound) { - continue; - } - - [_touchViews removeObjectAtIndex:index]; - [_nativeTouches removeObjectAtIndex:index]; - [_reactTouches removeObjectAtIndex:index]; - } -} - -- (void)_updateReactTouchAtIndex:(NSInteger)touchIndex -{ - UITouch *nativeTouch = _nativeTouches[touchIndex]; - CGPoint windowLocation = [nativeTouch locationInView:nativeTouch.window]; - RCTAssert(_cachedRootView, @"We were unable to find a root view for the touch"); - CGPoint rootViewLocation = [nativeTouch.window convertPoint:windowLocation toView:_cachedRootView]; - - UIView *touchView = _touchViews[touchIndex]; - CGPoint touchViewLocation = [nativeTouch.window convertPoint:windowLocation toView:touchView]; - - NSMutableDictionary *reactTouch = _reactTouches[touchIndex]; - reactTouch[@"pageX"] = @(RCTSanitizeNaNValue(rootViewLocation.x, @"touchEvent.pageX")); - reactTouch[@"pageY"] = @(RCTSanitizeNaNValue(rootViewLocation.y, @"touchEvent.pageY")); - reactTouch[@"locationX"] = @(RCTSanitizeNaNValue(touchViewLocation.x, @"touchEvent.locationX")); - reactTouch[@"locationY"] = @(RCTSanitizeNaNValue(touchViewLocation.y, @"touchEvent.locationY")); - reactTouch[@"timestamp"] = @(nativeTouch.timestamp * 1000); // in ms, for JS - - // TODO: force for a 'normal' touch is usually 1.0; - // should we expose a `normalTouchForce` constant somewhere (which would - // have a value of `1.0 / nativeTouch.maximumPossibleForce`)? - if (RCTForceTouchAvailable()) { - reactTouch[@"force"] = @(RCTZeroIfNaN(nativeTouch.force / nativeTouch.maximumPossibleForce)); - } -} - -/** - * Constructs information about touch events to send across the serialized - * boundary. This data should be compliant with W3C `Touch` objects. This data - * alone isn't sufficient to construct W3C `Event` objects. To construct that, - * there must be a simple receiver on the other side of the bridge that - * organizes the touch objects into `Event`s. - * - * We send the data as an array of `Touch`es, the type of action - * (start/end/move/cancel) and the indices that represent "changed" `Touch`es - * from that array. - */ -- (void)_updateAndDispatchTouches:(NSSet *)touches - eventName:(NSString *)eventName -{ - // Update touches - NSMutableArray *changedIndexes = [NSMutableArray new]; - for (UITouch *touch in touches) { - NSInteger index = [_nativeTouches indexOfObject:touch]; - if (index == NSNotFound) { - continue; - } - - [self _updateReactTouchAtIndex:index]; - [changedIndexes addObject:@(index)]; - } - - if (changedIndexes.count == 0) { - return; - } - - // Deep copy the touches because they will be accessed from another thread - // TODO: would it be safer to do this in the bridge or executor, rather than trusting caller? - NSMutableArray *reactTouches = - [[NSMutableArray alloc] initWithCapacity:_reactTouches.count]; - for (NSDictionary *touch in _reactTouches) { - [reactTouches addObject:[touch copy]]; - } - - BOOL canBeCoalesced = [eventName isEqualToString:@"touchMove"]; - - // We increment `_coalescingKey` twice here just for sure that - // this `_coalescingKey` will not be reused by another (preceding or following) event - // (yes, even if coalescing only happens (and makes sense) on events of the same type). - - if (!canBeCoalesced) { - _coalescingKey++; - } - - RCTTouchEvent *event = [[RCTTouchEvent alloc] initWithEventName:eventName - reactTag:self.view.reactTag - reactTouches:reactTouches - changedIndexes:changedIndexes - coalescingKey:_coalescingKey]; - - if (!canBeCoalesced) { - _coalescingKey++; - } - - [_eventDispatcher sendEvent:event]; -} - -/*** - * To ensure compatibilty when using UIManager.measure and RCTTouchHandler, we have to adopt - * UIManager.measure's behavior in finding a "root view". - * Usually RCTTouchHandler is already attached to a root view but in some cases (e.g. Modal), - * we are instead attached to some RCTView subtree. This is also the case when embedding some RN - * views inside a seperate ViewController not controlled by RN. - * This logic will either find the nearest rootView, or go all the way to the UIWindow. - * While this is not optimal, it is exactly what UIManager.measure does, and what Touchable.js - * relies on. - * We cache it here so that we don't have to repeat it for every touch in the gesture. - */ -- (void)_cacheRootView -{ - UIView *rootView = self.view; - while (rootView.superview && ![rootView isReactRootView] && ![rootView isKindOfClass:[RCTSurfaceView class]]) { - rootView = rootView.superview; - } - _cachedRootView = rootView; -} - -#pragma mark - Gesture Recognizer Delegate Callbacks - -static BOOL RCTAllTouchesAreCancelledOrEnded(NSSet *touches) -{ - for (UITouch *touch in touches) { - if (touch.phase == UITouchPhaseBegan || - touch.phase == UITouchPhaseMoved || - touch.phase == UITouchPhaseStationary) { - return NO; - } - } - return YES; -} - -static BOOL RCTAnyTouchesChanged(NSSet *touches) -{ - for (UITouch *touch in touches) { - if (touch.phase == UITouchPhaseBegan || - touch.phase == UITouchPhaseMoved) { - return YES; - } - } - return NO; -} - -#pragma mark - `UIResponder`-ish touch-delivery methods - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesBegan:touches withEvent:event]; - - [self _cacheRootView]; - - // "start" has to record new touches *before* extracting the event. - // "end"/"cancel" needs to remove the touch *after* extracting the event. - [self _recordNewTouches:touches]; - - [self _updateAndDispatchTouches:touches eventName:@"touchStart"]; - - if (self.state == UIGestureRecognizerStatePossible) { - self.state = UIGestureRecognizerStateBegan; - } else if (self.state == UIGestureRecognizerStateBegan) { - self.state = UIGestureRecognizerStateChanged; - } -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesMoved:touches withEvent:event]; - - [self _updateAndDispatchTouches:touches eventName:@"touchMove"]; - self.state = UIGestureRecognizerStateChanged; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesEnded:touches withEvent:event]; - - [self _updateAndDispatchTouches:touches eventName:@"touchEnd"]; - - if (RCTAllTouchesAreCancelledOrEnded(event.allTouches)) { - self.state = UIGestureRecognizerStateEnded; - } else if (RCTAnyTouchesChanged(event.allTouches)) { - self.state = UIGestureRecognizerStateChanged; - } - - [self _recordRemovedTouches:touches]; -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesCancelled:touches withEvent:event]; - - [self _updateAndDispatchTouches:touches eventName:@"touchCancel"]; - - if (RCTAllTouchesAreCancelledOrEnded(event.allTouches)) { - self.state = UIGestureRecognizerStateCancelled; - } else if (RCTAnyTouchesChanged(event.allTouches)) { - self.state = UIGestureRecognizerStateChanged; - } - - [self _recordRemovedTouches:touches]; -} - -- (BOOL)canPreventGestureRecognizer:(__unused UIGestureRecognizer *)preventedGestureRecognizer -{ - return NO; -} - -- (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)preventingGestureRecognizer -{ - // We fail in favour of other external gesture recognizers. - // iOS will ask `delegate`'s opinion about this gesture recognizer little bit later. - return ![preventingGestureRecognizer.view isDescendantOfView:self.view]; -} - -- (void)reset -{ - if (_nativeTouches.count != 0) { - [self _updateAndDispatchTouches:_nativeTouches.set eventName:@"touchCancel"]; - - [_nativeTouches removeAllObjects]; - [_reactTouches removeAllObjects]; - [_touchViews removeAllObjects]; - - _cachedRootView = nil; - } -} - -#pragma mark - Other - -- (void)cancel -{ - self.enabled = NO; - self.enabled = YES; -} - -#pragma mark - UIGestureRecognizerDelegate - -- (BOOL)gestureRecognizer:(__unused UIGestureRecognizer *)gestureRecognizer shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer -{ - // Same condition for `failure of` as for `be prevented by`. - return [self canBePreventedByGestureRecognizer:otherGestureRecognizer]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTURLRequestDelegate.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTURLRequestDelegate.h deleted file mode 100644 index ab8e24f9..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTURLRequestDelegate.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -/** - * An abstract interface used by request handler modules to send - * data back over the bridge back to JS. - */ -@protocol RCTURLRequestDelegate - -/** - * Call this when you send request data to the server. This is used to track - * upload progress, so should be called multiple times for large request bodies. - */ -- (void)URLRequest:(id)requestToken didSendDataWithProgress:(int64_t)bytesSent; - -/** - * Call this when you first receives a response from the server. This should - * include response headers, etc. - */ -- (void)URLRequest:(id)requestToken didReceiveResponse:(NSURLResponse *)response; - -/** - * Call this when you receive data from the server. This can be called multiple - * times with partial data chunks, or just once with the full data packet. - */ -- (void)URLRequest:(id)requestToken didReceiveData:(NSData *)data; - -/** - * Call this when the request is complete and/or if an error is encountered. - * For a successful request, the error parameter should be nil. - */ -- (void)URLRequest:(id)requestToken didCompleteWithError:(NSError *)error; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTURLRequestHandler.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTURLRequestHandler.h deleted file mode 100644 index b176bd2a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTURLRequestHandler.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -/** - * Provides the interface needed to register a request handler. Request handlers - * are also bridge modules, so should be registered using RCT_EXPORT_MODULE(). - */ -@protocol RCTURLRequestHandler - -/** - * Indicates whether this handler is capable of processing the specified - * request. Typically the handler would examine the scheme/protocol of the - * request URL (and possibly the HTTP method and/or headers) to determine this. - */ -- (BOOL)canHandleRequest:(NSURLRequest *)request; - -/** - * Send a network request and call the delegate with the response data. The - * method should return a token, which can be anything, including the request - * itself. This will be used later to refer to the request in callbacks. The - * `sendRequest:withDelegate:` method *must* return before calling any of the - * delegate methods, or the delegate won't recognize the token. - * Following common Objective-C pattern, `delegate` will not be retained. - */ -- (id)sendRequest:(NSURLRequest *)request - withDelegate:(id)delegate; - -@optional - -/** - * Not all request types can be cancelled, but this method can be implemented - * for ones that can. It should be used to free up any resources on ongoing - * processes associated with the request. - */ -- (void)cancelRequest:(id)requestToken; - -/** - * If more than one RCTURLRequestHandler responds YES to `canHandleRequest:` - * then `handlerPriority` is used to determine which one to use. The handler - * with the highest priority will be selected. Default priority is zero. If - * two or more valid handlers have the same priority, the selection order is - * undefined. - */ -- (float)handlerPriority; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTUtils.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTUtils.h deleted file mode 100644 index 75291008..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTUtils.h +++ /dev/null @@ -1,164 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import - -#if __has_include() -#import -#elif __has_include("RCTAssert.h") -#import "RCTAssert.h" -#else -#import "React/RCTAssert.h" -#endif -#if __has_include() -#import -#elif __has_include("RCTDefines.h") -#import "RCTDefines.h" -#else -#import "React/RCTDefines.h" -#endif - -NS_ASSUME_NONNULL_BEGIN - -// JSON serialization/deserialization -RCT_EXTERN NSString *__nullable RCTJSONStringify(id __nullable jsonObject, NSError **error); -RCT_EXTERN id __nullable RCTJSONParse(NSString *__nullable jsonString, NSError **error); -RCT_EXTERN id __nullable RCTJSONParseMutable(NSString *__nullable jsonString, NSError **error); - -// Sanitize a JSON object by stripping invalid types and/or NaN values -RCT_EXTERN id RCTJSONClean(id object); - -// Get MD5 hash of a string -RCT_EXTERN NSString *RCTMD5Hash(NSString *string); - -// Check if we are currently on the main queue (not to be confused with -// the main thread, which is not necessarily the same thing) -// https://twitter.com/olebegemann/status/738656134731599872 -RCT_EXTERN BOOL RCTIsMainQueue(void); - -// Execute the specified block on the main queue. Unlike dispatch_async() -// this will execute immediately if we're already on the main queue. -RCT_EXTERN void RCTExecuteOnMainQueue(dispatch_block_t block); - -// Legacy function to execute the specified block on the main queue synchronously. -// Please do not use this unless you know what you're doing. -RCT_EXTERN void RCTUnsafeExecuteOnMainQueueSync(dispatch_block_t block); - -// Get screen metrics in a thread-safe way -RCT_EXTERN CGFloat RCTScreenScale(void); -RCT_EXTERN CGSize RCTScreenSize(void); - -// Round float coordinates to nearest whole screen pixel (not point) -RCT_EXTERN CGFloat RCTRoundPixelValue(CGFloat value); -RCT_EXTERN CGFloat RCTCeilPixelValue(CGFloat value); -RCT_EXTERN CGFloat RCTFloorPixelValue(CGFloat value); - -// Convert a size in points to pixels, rounded up to the nearest integral size -RCT_EXTERN CGSize RCTSizeInPixels(CGSize pointSize, CGFloat scale); - -// Method swizzling -RCT_EXTERN void RCTSwapClassMethods(Class cls, SEL original, SEL replacement); -RCT_EXTERN void RCTSwapInstanceMethods(Class cls, SEL original, SEL replacement); - -// Module subclass support -RCT_EXTERN BOOL RCTClassOverridesClassMethod(Class cls, SEL selector); -RCT_EXTERN BOOL RCTClassOverridesInstanceMethod(Class cls, SEL selector); - -// Creates a standardized error object to return in callbacks -RCT_EXTERN NSDictionary *RCTMakeError(NSString *message, id __nullable toStringify, NSDictionary *__nullable extraData); -RCT_EXTERN NSDictionary *RCTMakeAndLogError(NSString *message, id __nullable toStringify, NSDictionary *__nullable extraData); -RCT_EXTERN NSDictionary *RCTJSErrorFromNSError(NSError *error); -RCT_EXTERN NSDictionary *RCTJSErrorFromCodeMessageAndNSError(NSString *code, NSString *message, NSError *__nullable error); - -// The default error code to use as the `code` property for callback error objects -RCT_EXTERN NSString *const RCTErrorUnspecified; - -// Returns YES if React is running in a test environment -RCT_EXTERN BOOL RCTRunningInTestEnvironment(void); - -// Returns YES if React is running in an iOS App Extension -RCT_EXTERN BOOL RCTRunningInAppExtension(void); - -// Returns the shared UIApplication instance, or nil if running in an App Extension -RCT_EXTERN UIApplication *__nullable RCTSharedApplication(void); - -// Returns the current main window, useful if you need to access the root view -// or view controller -RCT_EXTERN UIWindow *__nullable RCTKeyWindow(void); - -// Returns the presented view controller, useful if you need -// e.g. to present a modal view controller or alert over it -RCT_EXTERN UIViewController *__nullable RCTPresentedViewController(void); - -// Does this device support force touch (aka 3D Touch)? -RCT_EXTERN BOOL RCTForceTouchAvailable(void); - -// Create an NSError in the RCTErrorDomain -RCT_EXTERN NSError *RCTErrorWithMessage(NSString *message); - -// Convert nil values to NSNull, and vice-versa -#define RCTNullIfNil(value) (value ?: (id)kCFNull) -#define RCTNilIfNull(value) \ - ({ __typeof__(value) t = (value); (id)t == (id)kCFNull ? (__typeof(value))nil : t; }) - -// Convert NaN or infinite values to zero, as these aren't JSON-safe -RCT_EXTERN double RCTZeroIfNaN(double value); - -// Returns `0` and log special warning if value is NaN or INF. -RCT_EXTERN double RCTSanitizeNaNValue(double value, NSString *property); - -// Convert data to a Base64-encoded data URL -RCT_EXTERN NSURL *RCTDataURL(NSString *mimeType, NSData *data); - -// Gzip functionality - compression level in range 0 - 1 (-1 for default) -RCT_EXTERN NSData *__nullable RCTGzipData(NSData *__nullable data, float level); - -// Returns the relative path within the main bundle for an absolute URL -// (or nil, if the URL does not specify a path within the main bundle) -RCT_EXTERN NSString *__nullable RCTBundlePathForURL(NSURL *__nullable URL); - -// Returns the Path of Library directory -RCT_EXTERN NSString *__nullable RCTLibraryPath(void); - -// Returns the relative path within the library for an absolute URL -// (or nil, if the URL does not specify a path within the Library directory) -RCT_EXTERN NSString *__nullable RCTLibraryPathForURL(NSURL *__nullable URL); - -// Determines if a given image URL refers to a image in bundle -RCT_EXTERN BOOL RCTIsBundleAssetURL(NSURL *__nullable imageURL); - -// Determines if a given image URL refers to a image in library -RCT_EXTERN BOOL RCTIsLibraryAssetURL(NSURL *__nullable imageURL); - -// Determines if a given image URL refers to a local image -RCT_EXTERN BOOL RCTIsLocalAssetURL(NSURL *__nullable imageURL); - -// Returns an UIImage for a local image asset. Returns nil if the URL -// does not correspond to a local asset. -RCT_EXTERN UIImage *__nullable RCTImageFromLocalAssetURL(NSURL *imageURL); - -// Creates a new, unique temporary file path with the specified extension -RCT_EXTERN NSString *__nullable RCTTempFilePath(NSString *__nullable extension, NSError **error); - -// Converts a CGColor to a hex string -RCT_EXTERN NSString *RCTColorToHexString(CGColorRef color); - -// Get standard localized string (if it exists) -RCT_EXTERN NSString *RCTUIKitLocalizedString(NSString *string); - -// URL manipulation -RCT_EXTERN NSString *__nullable RCTGetURLQueryParam(NSURL *__nullable URL, NSString *param); -RCT_EXTERN NSURL *__nullable RCTURLByReplacingQueryParam(NSURL *__nullable URL, NSString *param, NSString *__nullable value); - -// Given a string, drop common RN prefixes (RCT, RK, etc.) -RCT_EXTERN NSString *RCTDropReactPrefixes(NSString *s); - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTUtils.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTUtils.m deleted file mode 100644 index 37fff6a2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTUtils.m +++ /dev/null @@ -1,913 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTUtils.h" - -#import -#import -#import -#import -#import - -#import - -#import - -#import "RCTAssert.h" -#import "RCTLog.h" - -NSString *const RCTErrorUnspecified = @"EUNSPECIFIED"; - -static NSString *__nullable _RCTJSONStringifyNoRetry(id __nullable jsonObject, NSError **error) -{ - if (!jsonObject) { - return nil; - } - - static SEL JSONKitSelector = NULL; - static NSSet *collectionTypes; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - SEL selector = NSSelectorFromString(@"JSONStringWithOptions:error:"); - if ([NSDictionary instancesRespondToSelector:selector]) { - JSONKitSelector = selector; - collectionTypes = [NSSet setWithObjects: - [NSArray class], [NSMutableArray class], - [NSDictionary class], [NSMutableDictionary class], nil]; - } - }); - - @try { - - // Use JSONKit if available and object is not a fragment - if (JSONKitSelector && [collectionTypes containsObject:[jsonObject classForCoder]]) { - return ((NSString *(*)(id, SEL, int, NSError **))objc_msgSend)(jsonObject, JSONKitSelector, 0, error); - } - - // Use Foundation JSON method - NSData *jsonData = [NSJSONSerialization - dataWithJSONObject:jsonObject options:(NSJSONWritingOptions)NSJSONReadingAllowFragments - error:error]; - - return jsonData ? [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding] : nil; - } - @catch (NSException *exception) { - - // Convert exception to error - if (error) { - *error = [NSError errorWithDomain:RCTErrorDomain code:0 userInfo:@{ - NSLocalizedDescriptionKey: exception.description ?: @"" - }]; - } - return nil; - } -} - -NSString *__nullable RCTJSONStringify(id __nullable jsonObject, NSError **error) -{ - if (error) { - return _RCTJSONStringifyNoRetry(jsonObject, error); - } else { - NSError *localError; - NSString *json = _RCTJSONStringifyNoRetry(jsonObject, &localError); - if (localError) { - RCTLogError(@"RCTJSONStringify() encountered the following error: %@", - localError.localizedDescription); - // Sanitize the data, then retry. This is slow, but it prevents uncaught - // data issues from crashing in production - return _RCTJSONStringifyNoRetry(RCTJSONClean(jsonObject), NULL); - } - return json; - } -} - -static id __nullable _RCTJSONParse(NSString *__nullable jsonString, BOOL mutable, NSError **error) -{ - static SEL JSONKitSelector = NULL; - static SEL JSONKitMutableSelector = NULL; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - SEL selector = NSSelectorFromString(@"objectFromJSONStringWithParseOptions:error:"); - if ([NSString instancesRespondToSelector:selector]) { - JSONKitSelector = selector; - JSONKitMutableSelector = NSSelectorFromString(@"mutableObjectFromJSONStringWithParseOptions:error:"); - } - }); - - if (jsonString) { - - // Use JSONKit if available and string is not a fragment - if (JSONKitSelector) { - NSInteger length = jsonString.length; - for (NSInteger i = 0; i < length; i++) { - unichar c = [jsonString characterAtIndex:i]; - if (strchr("{[", c)) { - static const int options = (1 << 2); // loose unicode - SEL selector = mutable ? JSONKitMutableSelector : JSONKitSelector; - return ((id (*)(id, SEL, int, NSError **))objc_msgSend)(jsonString, selector, options, error); - } - if (!strchr(" \r\n\t", c)) { - break; - } - } - } - - // Use Foundation JSON method - NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; - if (!jsonData) { - jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES]; - if (jsonData) { - RCTLogWarn(@"RCTJSONParse received the following string, which could " - "not be losslessly converted to UTF8 data: '%@'", jsonString); - } else { - NSString *errorMessage = @"RCTJSONParse received invalid UTF8 data"; - if (error) { - *error = RCTErrorWithMessage(errorMessage); - } else { - RCTLogError(@"%@", errorMessage); - } - return nil; - } - } - NSJSONReadingOptions options = NSJSONReadingAllowFragments; - if (mutable) { - options |= NSJSONReadingMutableContainers; - } - return [NSJSONSerialization JSONObjectWithData:jsonData - options:options - error:error]; - } - return nil; -} - -id __nullable RCTJSONParse(NSString *__nullable jsonString, NSError **error) -{ - return _RCTJSONParse(jsonString, NO, error); -} - -id __nullable RCTJSONParseMutable(NSString *__nullable jsonString, NSError **error) -{ - return _RCTJSONParse(jsonString, YES, error); -} - -id RCTJSONClean(id object) -{ - static dispatch_once_t onceToken; - static NSSet *validLeafTypes; - dispatch_once(&onceToken, ^{ - validLeafTypes = [[NSSet alloc] initWithArray:@[ - [NSString class], - [NSMutableString class], - [NSNumber class], - [NSNull class], - ]]; - }); - - if ([validLeafTypes containsObject:[object classForCoder]]) { - if ([object isKindOfClass:[NSNumber class]]) { - return @(RCTZeroIfNaN([object doubleValue])); - } - if ([object isKindOfClass:[NSString class]]) { - if ([object UTF8String] == NULL) { - return (id)kCFNull; - } - } - return object; - } - - if ([object isKindOfClass:[NSDictionary class]]) { - __block BOOL copy = NO; - NSMutableDictionary *values = [[NSMutableDictionary alloc] initWithCapacity:[object count]]; - [object enumerateKeysAndObjectsUsingBlock:^(NSString *key, id item, __unused BOOL *stop) { - id value = RCTJSONClean(item); - values[key] = value; - copy |= value != item; - }]; - return copy ? values : object; - } - - if ([object isKindOfClass:[NSArray class]]) { - __block BOOL copy = NO; - __block NSArray *values = object; - [object enumerateObjectsUsingBlock:^(id item, NSUInteger idx, __unused BOOL *stop) { - id value = RCTJSONClean(item); - if (copy) { - [(NSMutableArray *)values addObject:value]; - } else if (value != item) { - // Converted value is different, so we'll need to copy the array - values = [[NSMutableArray alloc] initWithCapacity:values.count]; - for (NSUInteger i = 0; i < idx; i++) { - [(NSMutableArray *)values addObject:object[i]]; - } - [(NSMutableArray *)values addObject:value]; - copy = YES; - } - }]; - return values; - } - - return (id)kCFNull; -} - -NSString *RCTMD5Hash(NSString *string) -{ - const char *str = string.UTF8String; - unsigned char result[CC_MD5_DIGEST_LENGTH]; - CC_MD5(str, (CC_LONG)strlen(str), result); - - return [NSString stringWithFormat:@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", - result[0], result[1], result[2], result[3], - result[4], result[5], result[6], result[7], - result[8], result[9], result[10], result[11], - result[12], result[13], result[14], result[15] - ]; -} - -BOOL RCTIsMainQueue() -{ - static void *mainQueueKey = &mainQueueKey; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - dispatch_queue_set_specific(dispatch_get_main_queue(), - mainQueueKey, mainQueueKey, NULL); - }); - return dispatch_get_specific(mainQueueKey) == mainQueueKey; -} - -void RCTExecuteOnMainQueue(dispatch_block_t block) -{ - if (RCTIsMainQueue()) { - block(); - } else { - dispatch_async(dispatch_get_main_queue(), ^{ - block(); - }); - } -} - -// Please do not use this method -// unless you know what you are doing. -void RCTUnsafeExecuteOnMainQueueSync(dispatch_block_t block) -{ - if (RCTIsMainQueue()) { - block(); - } else { - dispatch_sync(dispatch_get_main_queue(), ^{ - block(); - }); - } -} - -static void RCTUnsafeExecuteOnMainQueueOnceSync(dispatch_once_t *onceToken, dispatch_block_t block) -{ - // The solution was borrowed from a post by Ben Alpert: - // https://benalpert.com/2014/04/02/dispatch-once-initialization-on-the-main-thread.html - // See also: https://www.mikeash.com/pyblog/friday-qa-2014-06-06-secrets-of-dispatch_once.html - if (RCTIsMainQueue()) { - dispatch_once(onceToken, block); - } else { - if (DISPATCH_EXPECT(*onceToken == 0L, NO)) { - dispatch_sync(dispatch_get_main_queue(), ^{ - dispatch_once(onceToken, block); - }); - } - } -} - -CGFloat RCTScreenScale() -{ - static dispatch_once_t onceToken; - static CGFloat scale; - - RCTUnsafeExecuteOnMainQueueOnceSync(&onceToken, ^{ - scale = [UIScreen mainScreen].scale; - }); - - return scale; -} - -CGSize RCTScreenSize() -{ - // FIXME: this caches the bounds at app start, whatever those were, and then - // doesn't update when the device is rotated. We need to find another thread- - // safe way to get the screen size. - - static CGSize size; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - RCTUnsafeExecuteOnMainQueueSync(^{ - size = [UIScreen mainScreen].bounds.size; - }); - }); - - return size; -} - -CGFloat RCTRoundPixelValue(CGFloat value) -{ - CGFloat scale = RCTScreenScale(); - return round(value * scale) / scale; -} - -CGFloat RCTCeilPixelValue(CGFloat value) -{ - CGFloat scale = RCTScreenScale(); - return ceil(value * scale) / scale; -} - -CGFloat RCTFloorPixelValue(CGFloat value) -{ - CGFloat scale = RCTScreenScale(); - return floor(value * scale) / scale; -} - -CGSize RCTSizeInPixels(CGSize pointSize, CGFloat scale) -{ - return (CGSize){ - ceil(pointSize.width * scale), - ceil(pointSize.height * scale), - }; -} - -void RCTSwapClassMethods(Class cls, SEL original, SEL replacement) -{ - Method originalMethod = class_getClassMethod(cls, original); - IMP originalImplementation = method_getImplementation(originalMethod); - const char *originalArgTypes = method_getTypeEncoding(originalMethod); - - Method replacementMethod = class_getClassMethod(cls, replacement); - IMP replacementImplementation = method_getImplementation(replacementMethod); - const char *replacementArgTypes = method_getTypeEncoding(replacementMethod); - - if (class_addMethod(cls, original, replacementImplementation, replacementArgTypes)) { - class_replaceMethod(cls, replacement, originalImplementation, originalArgTypes); - } else { - method_exchangeImplementations(originalMethod, replacementMethod); - } -} - -void RCTSwapInstanceMethods(Class cls, SEL original, SEL replacement) -{ - Method originalMethod = class_getInstanceMethod(cls, original); - IMP originalImplementation = method_getImplementation(originalMethod); - const char *originalArgTypes = method_getTypeEncoding(originalMethod); - - Method replacementMethod = class_getInstanceMethod(cls, replacement); - IMP replacementImplementation = method_getImplementation(replacementMethod); - const char *replacementArgTypes = method_getTypeEncoding(replacementMethod); - - if (class_addMethod(cls, original, replacementImplementation, replacementArgTypes)) { - class_replaceMethod(cls, replacement, originalImplementation, originalArgTypes); - } else { - method_exchangeImplementations(originalMethod, replacementMethod); - } -} - -BOOL RCTClassOverridesClassMethod(Class cls, SEL selector) -{ - return RCTClassOverridesInstanceMethod(object_getClass(cls), selector); -} - -BOOL RCTClassOverridesInstanceMethod(Class cls, SEL selector) -{ - unsigned int numberOfMethods; - Method *methods = class_copyMethodList(cls, &numberOfMethods); - for (unsigned int i = 0; i < numberOfMethods; i++) { - if (method_getName(methods[i]) == selector) { - free(methods); - return YES; - } - } - free(methods); - return NO; -} - -NSDictionary *RCTMakeError(NSString *message, - id __nullable toStringify, - NSDictionary *__nullable extraData) -{ - if (toStringify) { - message = [message stringByAppendingString:[toStringify description]]; - } - - NSMutableDictionary *error = [extraData mutableCopy] ?: [NSMutableDictionary new]; - error[@"message"] = message; - return error; -} - -NSDictionary *RCTMakeAndLogError(NSString *message, - id __nullable toStringify, - NSDictionary *__nullable extraData) -{ - NSDictionary *error = RCTMakeError(message, toStringify, extraData); - RCTLogError(@"\nError: %@", error); - return error; -} - -NSDictionary *RCTJSErrorFromNSError(NSError *error) -{ - NSString *codeWithDomain = [NSString stringWithFormat:@"E%@%lld", error.domain.uppercaseString, (long long)error.code]; - return RCTJSErrorFromCodeMessageAndNSError(codeWithDomain, - error.localizedDescription, - error); -} - -// TODO: Can we just replace RCTMakeError with this function instead? -NSDictionary *RCTJSErrorFromCodeMessageAndNSError(NSString *code, - NSString *message, - NSError *__nullable error) -{ - NSString *errorMessage; - NSArray *stackTrace = [NSThread callStackSymbols]; - NSMutableDictionary *userInfo; - NSMutableDictionary *errorInfo = - [NSMutableDictionary dictionaryWithObject:stackTrace forKey:@"nativeStackIOS"]; - - if (error) { - errorMessage = error.localizedDescription ?: @"Unknown error from a native module"; - errorInfo[@"domain"] = error.domain ?: RCTErrorDomain; - if (error.userInfo) { - userInfo = [error.userInfo mutableCopy]; - if (userInfo != nil && userInfo[NSUnderlyingErrorKey] != nil) { - NSError *underlyingError = error.userInfo[NSUnderlyingErrorKey]; - NSString *underlyingCode = [NSString stringWithFormat:@"%d", (int)underlyingError.code]; - userInfo[NSUnderlyingErrorKey] = RCTJSErrorFromCodeMessageAndNSError(underlyingCode, @"underlying error", underlyingError); - } - } - } else { - errorMessage = @"Unknown error from a native module"; - errorInfo[@"domain"] = RCTErrorDomain; - userInfo = nil; - } - errorInfo[@"code"] = code ?: RCTErrorUnspecified; - errorInfo[@"userInfo"] = RCTNullIfNil(userInfo); - - // Allow for explicit overriding of the error message - errorMessage = message ?: errorMessage; - - return RCTMakeError(errorMessage, nil, errorInfo); -} - -BOOL RCTRunningInTestEnvironment(void) -{ - static BOOL isTestEnvironment = NO; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - NSDictionary *environment = [[NSProcessInfo processInfo] environment]; - isTestEnvironment = objc_lookUpClass("SenTestCase") || - objc_lookUpClass("XCTest") || - objc_lookUpClass("SnapshotTestAppDelegate") || - [environment[@"IS_TESTING"] boolValue]; - }); - return isTestEnvironment; -} - -BOOL RCTRunningInAppExtension(void) -{ - return [[[[NSBundle mainBundle] bundlePath] pathExtension] isEqualToString:@"appex"]; -} - -UIApplication *__nullable RCTSharedApplication(void) -{ - if (RCTRunningInAppExtension()) { - return nil; - } - return [[UIApplication class] performSelector:@selector(sharedApplication)]; -} - -UIWindow *__nullable RCTKeyWindow(void) -{ - if (RCTRunningInAppExtension()) { - return nil; - } - - // TODO: replace with a more robust solution - return RCTSharedApplication().keyWindow; -} - -UIViewController *__nullable RCTPresentedViewController(void) -{ - if (RCTRunningInAppExtension()) { - return nil; - } - - UIViewController *controller = RCTKeyWindow().rootViewController; - UIViewController *presentedController = controller.presentedViewController; - while (presentedController && ![presentedController isBeingDismissed]) { - controller = presentedController; - presentedController = controller.presentedViewController; - } - - return controller; -} - -BOOL RCTForceTouchAvailable(void) -{ - static BOOL forceSupported; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - forceSupported = [UITraitCollection class] && - [UITraitCollection instancesRespondToSelector:@selector(forceTouchCapability)]; - }); - - return forceSupported && - (RCTKeyWindow() ?: [UIView new]).traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable; -} - -NSError *RCTErrorWithMessage(NSString *message) -{ - NSDictionary *errorInfo = @{NSLocalizedDescriptionKey: message}; - return [[NSError alloc] initWithDomain:RCTErrorDomain code:0 userInfo:errorInfo]; -} - -double RCTZeroIfNaN(double value) -{ - return isnan(value) || isinf(value) ? 0 : value; -} - -double RCTSanitizeNaNValue(double value, NSString *property) -{ - if (!isnan(value) && !isinf(value)) { - return value; - } - - RCTLogWarn(@"The value `%@` equals NaN or INF and will be replaced by `0`.", property); - return 0; -} - -NSURL *RCTDataURL(NSString *mimeType, NSData *data) -{ - return [NSURL URLWithString: - [NSString stringWithFormat:@"data:%@;base64,%@", mimeType, - [data base64EncodedStringWithOptions:(NSDataBase64EncodingOptions)0]]]; -} - -BOOL RCTIsGzippedData(NSData *__nullable); // exposed for unit testing purposes -BOOL RCTIsGzippedData(NSData *__nullable data) -{ - UInt8 *bytes = (UInt8 *)data.bytes; - return (data.length >= 2 && bytes[0] == 0x1f && bytes[1] == 0x8b); -} - -NSData *__nullable RCTGzipData(NSData *__nullable input, float level) -{ - if (input.length == 0 || RCTIsGzippedData(input)) { - return input; - } - - void *libz = dlopen("/usr/lib/libz.dylib", RTLD_LAZY); - int (*deflateInit2_)(z_streamp, int, int, int, int, int, const char *, int) = dlsym(libz, "deflateInit2_"); - int (*deflate)(z_streamp, int) = dlsym(libz, "deflate"); - int (*deflateEnd)(z_streamp) = dlsym(libz, "deflateEnd"); - - z_stream stream; - stream.zalloc = Z_NULL; - stream.zfree = Z_NULL; - stream.opaque = Z_NULL; - stream.avail_in = (uint)input.length; - stream.next_in = (Bytef *)input.bytes; - stream.total_out = 0; - stream.avail_out = 0; - - static const NSUInteger RCTGZipChunkSize = 16384; - - NSMutableData *output = nil; - int compression = (level < 0.0f)? Z_DEFAULT_COMPRESSION: (int)(roundf(level * 9)); - if (deflateInit2(&stream, compression, Z_DEFLATED, 31, 8, Z_DEFAULT_STRATEGY) == Z_OK) { - output = [NSMutableData dataWithLength:RCTGZipChunkSize]; - while (stream.avail_out == 0) { - if (stream.total_out >= output.length) { - output.length += RCTGZipChunkSize; - } - stream.next_out = (uint8_t *)output.mutableBytes + stream.total_out; - stream.avail_out = (uInt)(output.length - stream.total_out); - deflate(&stream, Z_FINISH); - } - deflateEnd(&stream); - output.length = stream.total_out; - } - - dlclose(libz); - - return output; -} - -static NSString *RCTRelativePathForURL(NSString *basePath, NSURL *__nullable URL) -{ - if (!URL.fileURL) { - // Not a file path - return nil; - } - NSString *path = [NSString stringWithUTF8String:[URL fileSystemRepresentation]]; - if (![path hasPrefix:basePath]) { - // Not a bundle-relative file - return nil; - } - path = [path substringFromIndex:basePath.length]; - if ([path hasPrefix:@"/"]) { - path = [path substringFromIndex:1]; - } - return path; -} - -NSString *__nullable RCTLibraryPath(void) -{ - static NSString *libraryPath = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - libraryPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) lastObject]; - }); - return libraryPath; -} - -NSString *__nullable RCTBundlePathForURL(NSURL *__nullable URL) -{ - return RCTRelativePathForURL([[NSBundle mainBundle] resourcePath], URL); - -} - -NSString *__nullable RCTLibraryPathForURL(NSURL *__nullable URL) -{ - return RCTRelativePathForURL(RCTLibraryPath(), URL); -} - -static BOOL RCTIsImageAssetsPath(NSString *path) -{ - NSString *extension = [path pathExtension]; - return [extension isEqualToString:@"png"] || [extension isEqualToString:@"jpg"]; -} - -BOOL RCTIsBundleAssetURL(NSURL *__nullable imageURL) -{ - return RCTIsImageAssetsPath(RCTBundlePathForURL(imageURL)); -} - -BOOL RCTIsLibraryAssetURL(NSURL *__nullable imageURL) -{ - return RCTIsImageAssetsPath(RCTLibraryPathForURL(imageURL)); -} - -BOOL RCTIsLocalAssetURL(NSURL *__nullable imageURL) -{ - return RCTIsBundleAssetURL(imageURL) || RCTIsLibraryAssetURL(imageURL); -} - -static NSString *bundleName(NSBundle *bundle) -{ - NSString *name = bundle.infoDictionary[@"CFBundleName"]; - if (!name) { - name = [[bundle.bundlePath lastPathComponent] stringByDeletingPathExtension]; - } - return name; -} - -static NSBundle *bundleForPath(NSString *key) -{ - static NSMutableDictionary *bundleCache; - if (!bundleCache) { - bundleCache = [NSMutableDictionary new]; - bundleCache[@"main"] = [NSBundle mainBundle]; - - // Initialize every bundle in the array - for (NSString *path in [[NSBundle mainBundle] pathsForResourcesOfType:@"bundle" inDirectory:nil]) { - [NSBundle bundleWithPath:path]; - } - - // The bundles initialized above will now also be in `allBundles` - for (NSBundle *bundle in [NSBundle allBundles]) { - bundleCache[bundleName(bundle)] = bundle; - } - } - - return bundleCache[key]; -} - -UIImage *__nullable RCTImageFromLocalAssetURL(NSURL *imageURL) -{ - NSString *imageName = RCTBundlePathForURL(imageURL); - - NSBundle *bundle = nil; - NSArray *imagePathComponents = [imageName pathComponents]; - if ([imagePathComponents count] > 1 && - [[[imagePathComponents firstObject] pathExtension] isEqualToString:@"bundle"]) { - NSString *bundlePath = [imagePathComponents firstObject]; - bundle = bundleForPath([bundlePath stringByDeletingPathExtension]); - imageName = [imageName substringFromIndex:(bundlePath.length + 1)]; - } - - UIImage *image = nil; - if (bundle) { - image = [UIImage imageNamed:imageName inBundle:bundle compatibleWithTraitCollection:nil]; - } else { - image = [UIImage imageNamed:imageName]; - } - - if (!image) { - // Attempt to load from the file system - NSString *filePath = [NSString stringWithUTF8String:[imageURL fileSystemRepresentation]]; - if (filePath.pathExtension.length == 0) { - filePath = [filePath stringByAppendingPathExtension:@"png"]; - } - image = [UIImage imageWithContentsOfFile:filePath]; - } - - if (!image && !bundle) { - // We did not find the image in the mainBundle, check in other shipped frameworks. - NSArray *possibleFrameworks = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:[[NSBundle mainBundle] privateFrameworksURL] - includingPropertiesForKeys:@[] - options:0 - error:nil]; - for (NSURL *frameworkURL in possibleFrameworks) { - bundle = [NSBundle bundleWithURL:frameworkURL]; - image = [UIImage imageNamed:imageName inBundle:bundle compatibleWithTraitCollection:nil]; - if (image) { - RCTLogWarn(@"Image %@ not found in mainBundle, but found in %@", imageName, bundle); - break; - } - } - } - return image; -} - -RCT_EXTERN NSString *__nullable RCTTempFilePath(NSString *extension, NSError **error) -{ - static NSError *setupError = nil; - static NSString *directory; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - directory = [NSTemporaryDirectory() stringByAppendingPathComponent:@"ReactNative"]; - // If the temporary directory already exists, we'll delete it to ensure - // that temp files from the previous run have all been deleted. This is not - // a security measure, it simply prevents the temp directory from using too - // much space, as the circumstances under which iOS clears it automatically - // are not well-defined. - NSFileManager *fileManager = [NSFileManager new]; - if ([fileManager fileExistsAtPath:directory]) { - [fileManager removeItemAtPath:directory error:NULL]; - } - if (![fileManager fileExistsAtPath:directory]) { - NSError *localError = nil; - if (![fileManager createDirectoryAtPath:directory - withIntermediateDirectories:YES - attributes:nil - error:&localError]) { - // This is bad - RCTLogError(@"Failed to create temporary directory: %@", localError); - setupError = localError; - directory = nil; - } - } - }); - - if (!directory || setupError) { - if (error) { - *error = setupError; - } - return nil; - } - - // Append a unique filename - NSString *filename = [NSUUID new].UUIDString; - if (extension) { - filename = [filename stringByAppendingPathExtension:extension]; - } - return [directory stringByAppendingPathComponent:filename]; -} - -static void RCTGetRGBAColorComponents(CGColorRef color, CGFloat rgba[4]) -{ - CGColorSpaceModel model = CGColorSpaceGetModel(CGColorGetColorSpace(color)); - const CGFloat *components = CGColorGetComponents(color); - switch (model) - { - case kCGColorSpaceModelMonochrome: - { - rgba[0] = components[0]; - rgba[1] = components[0]; - rgba[2] = components[0]; - rgba[3] = components[1]; - break; - } - case kCGColorSpaceModelRGB: - { - rgba[0] = components[0]; - rgba[1] = components[1]; - rgba[2] = components[2]; - rgba[3] = components[3]; - break; - } - case kCGColorSpaceModelCMYK: - case kCGColorSpaceModelDeviceN: - case kCGColorSpaceModelIndexed: - case kCGColorSpaceModelLab: - case kCGColorSpaceModelPattern: - case kCGColorSpaceModelUnknown: - // TODO: kCGColorSpaceModelXYZ should be added sometime after Xcode 10 release. - default: - { - -#if RCT_DEBUG - //unsupported format - RCTLogError(@"Unsupported color model: %i", model); -#endif - - rgba[0] = 0.0; - rgba[1] = 0.0; - rgba[2] = 0.0; - rgba[3] = 1.0; - break; - } - } -} - -NSString *RCTColorToHexString(CGColorRef color) -{ - CGFloat rgba[4]; - RCTGetRGBAColorComponents(color, rgba); - uint8_t r = rgba[0]*255; - uint8_t g = rgba[1]*255; - uint8_t b = rgba[2]*255; - uint8_t a = rgba[3]*255; - if (a < 255) { - return [NSString stringWithFormat:@"#%02x%02x%02x%02x", r, g, b, a]; - } else { - return [NSString stringWithFormat:@"#%02x%02x%02x", r, g, b]; - } -} - -// (https://github.com/0xced/XCDFormInputAccessoryView/blob/master/XCDFormInputAccessoryView/XCDFormInputAccessoryView.m#L10-L14) -NSString *RCTUIKitLocalizedString(NSString *string) -{ - NSBundle *UIKitBundle = [NSBundle bundleForClass:[UIApplication class]]; - return UIKitBundle ? [UIKitBundle localizedStringForKey:string value:string table:nil] : string; -} - -NSString *__nullable RCTGetURLQueryParam(NSURL *__nullable URL, NSString *param) -{ - RCTAssertParam(param); - if (!URL) { - return nil; - } - - NSURLComponents *components = [NSURLComponents componentsWithURL:URL - resolvingAgainstBaseURL:YES]; - for (NSURLQueryItem *queryItem in [components.queryItems reverseObjectEnumerator]) { - if ([queryItem.name isEqualToString:param]) { - return queryItem.value; - } - } - - return nil; -} - -NSURL *__nullable RCTURLByReplacingQueryParam(NSURL *__nullable URL, NSString *param, NSString *__nullable value) -{ - RCTAssertParam(param); - if (!URL) { - return nil; - } - - NSURLComponents *components = [NSURLComponents componentsWithURL:URL - resolvingAgainstBaseURL:YES]; - - __block NSInteger paramIndex = NSNotFound; - NSMutableArray *queryItems = [components.queryItems mutableCopy]; - [queryItems enumerateObjectsWithOptions:NSEnumerationReverse usingBlock: - ^(NSURLQueryItem *item, NSUInteger i, BOOL *stop) { - if ([item.name isEqualToString:param]) { - paramIndex = i; - *stop = YES; - } - }]; - - if (!value) { - if (paramIndex != NSNotFound) { - [queryItems removeObjectAtIndex:paramIndex]; - } - } else { - NSURLQueryItem *newItem = [NSURLQueryItem queryItemWithName:param - value:value]; - if (paramIndex == NSNotFound) { - [queryItems addObject:newItem]; - } else { - [queryItems replaceObjectAtIndex:paramIndex withObject:newItem]; - } - } - components.queryItems = queryItems; - return components.URL; -} - -RCT_EXTERN NSString *RCTDropReactPrefixes(NSString *s) -{ - if ([s hasPrefix:@"RK"]) { - return [s substringFromIndex:2]; - } else if ([s hasPrefix:@"RCT"]) { - return [s substringFromIndex:3]; - } - - return s; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTVersion.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTVersion.h deleted file mode 100644 index e0e53692..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTVersion.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - -#import - -extern NSString* const RCTVersionMajor; -extern NSString* const RCTVersionMinor; -extern NSString* const RCTVersionPatch; -extern NSString* const RCTVersionPrerelease; - -extern NSDictionary* RCTGetReactNativeVersion(void); diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTVersion.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTVersion.m deleted file mode 100644 index 5f3024e3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/RCTVersion.m +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @generated by scripts/bump-oss-version.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTVersion.h" - -NSString* const RCTVersionMajor = @"major"; -NSString* const RCTVersionMinor = @"minor"; -NSString* const RCTVersionPatch = @"patch"; -NSString* const RCTVersionPrerelease = @"prerelease"; - -static NSDictionary* __rnVersion; - -__attribute__((constructor)) -static void __makeVersion() -{ - __rnVersion = @{ - RCTVersionMajor: @(0), - RCTVersionMinor: @(59), - RCTVersionPatch: @(4), - RCTVersionPrerelease: [NSNull null], - }; -} - -NSDictionary* RCTGetReactNativeVersion(void) -{ - return __rnVersion; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurface.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurface.h deleted file mode 100644 index 5adbd0be..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurface.h +++ /dev/null @@ -1,141 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RCTBridge; -@class RCTSurfaceView; -@protocol RCTSurfaceDelegate; - -/** - * RCTSurface instance represents React Native-powered piece of a user interface - * which can be a full-screen app, separate modal view controller, - * or even small widget. - * It is called "Surface". - * - * The RCTSurface instance is completely thread-safe by design; - * it can be created on any thread, and any its method can be called from - * any thread (if the opposite is not mentioned explicitly). - * - * The primary goals of the RCTSurface are: - * * ability to measure and layout the surface in a thread-safe - * and synchronous manner; - * * ability to create a UIView instance on demand (later); - * * ability to communicate the current stage of the surface granularly. - */ -@interface RCTSurface : NSObject - -@property (atomic, readonly) RCTSurfaceStage stage; -@property (atomic, readonly) NSString *moduleName; -@property (atomic, readonly) NSNumber *rootViewTag; - -@property (atomic, readwrite, weak, nullable) id delegate; - -@property (atomic, copy, readwrite) NSDictionary *properties; - -- (instancetype)initWithBridge:(RCTBridge *)bridge - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties NS_DESIGNATED_INITIALIZER; - -#pragma mark - Dealing with UIView representation, the Main thread only access - -/** - * Creates (if needed) and returns `UIView` instance which represents the Surface. - * The Surface will cache and *retain* this object. - * Returning the UIView instance does not mean that the Surface is ready - * to execute and layout. It can be just a handler which Surface will use later - * to mount the actual views. - * RCTSurface does not control (or influence in any way) the size or origin - * of this view. Some superview (or another owner) must use other methods - * of this class to setup proper layout and interop interactions with UIKit - * or another UI framework. - * This method must be called only from the main queue. - */ -- (RCTSurfaceView *)view; - -#pragma mark - Layout: Setting the size constrains - -/** - * Sets `minimumSize` and `maximumSize` layout constraints for the Surface. - */ -- (void)setMinimumSize:(CGSize)minimumSize - maximumSize:(CGSize)maximumSize; - -/** - * Previously set `minimumSize` layout constraint. - * Defaults to `{0, 0}`. - */ -@property (atomic, assign, readonly) CGSize minimumSize; - -/** - * Previously set `maximumSize` layout constraint. - * Defaults to `{CGFLOAT_MAX, CGFLOAT_MAX}`. - */ -@property (atomic, assign, readonly) CGSize maximumSize; - -/** - * Simple shortcut to `-[RCTSurface setMinimumSize:size maximumSize:size]`. - */ -- (void)setSize:(CGSize)size; - -#pragma mark - Layout: Measuring - -/** - * Measures the Surface with given constraints. - * This method does not cause any side effects on the surface object. - */ -- (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize - maximumSize:(CGSize)maximumSize; - -/** - * Return the current size of the root view based on (but not clamp by) current - * size constraints. - */ -@property (atomic, assign, readonly) CGSize intrinsicSize; - -#pragma mark - Synchronous waiting - -/** - * Synchronously blocks the current thread up to given `timeout` until - * the Surface reaches `stage`. - * Limitations: - * - Do nothing, if called on `UIManager` queue. - * - Calling on the main queue with `RCTSurfaceStageSurfaceDidInitialMounting` - * stage temporary is not supported; in this case the stage will be - * downgraded to `RCTSurfaceStageSurfaceDidInitialLayout`. - */ -- (BOOL)synchronouslyWaitForStage:(RCTSurfaceStage)stage timeout:(NSTimeInterval)timeout; - -#pragma mark - Start & Stop - -/** - * Starts or stops the Surface. - * Those methods are a no-op for regular RCTSurface (for now), but all call sites must call them appropriately. - */ -- (BOOL)start; -- (BOOL)stop; - -#pragma mark - Mounting/Unmounting of React components - -/** - * Mount the React component specified by the given moduleName. This is typically - * calling runApplication.js from the native side. - */ -- (void)mountReactComponentWithBridge:(RCTBridge *)bridge moduleName:(NSString *)moduleName params:(NSDictionary *)params; - -/** - * Unmount the React component specified by the given rootViewTag, called from native. - */ -- (void)unmountReactComponentWithBridge:(RCTBridge *)bridge rootViewTag:(NSNumber *)rootViewTag; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurface.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurface.mm deleted file mode 100644 index 05c55f80..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurface.mm +++ /dev/null @@ -1,589 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSurface.h" -#import "RCTSurfaceView+Internal.h" - -#import -#import - -#import "RCTAssert.h" -#import "RCTBridge+Private.h" -#import "RCTBridge.h" -#import "RCTShadowView+Layout.h" -#import "RCTSurfaceDelegate.h" -#import "RCTSurfaceRootShadowView.h" -#import "RCTSurfaceRootShadowViewDelegate.h" -#import "RCTSurfaceRootView.h" -#import "RCTSurfaceView.h" -#import "RCTTouchHandler.h" -#import "RCTUIManager.h" -#import "RCTUIManagerObserverCoordinator.h" -#import "RCTUIManagerUtils.h" - -@interface RCTSurface () -@end - -@implementation RCTSurface { - // Immutable - RCTBridge *_bridge; - NSString *_moduleName; - NSNumber *_rootViewTag; - - // Protected by the `_mutex` - std::mutex _mutex; - RCTBridge *_batchedBridge; - RCTSurfaceStage _stage; - NSDictionary *_properties; - CGSize _minimumSize; - CGSize _maximumSize; - CGSize _intrinsicSize; - RCTUIManagerMountingBlock _mountingBlock; - - // The Main thread only - RCTSurfaceView *_Nullable _view; - RCTTouchHandler *_Nullable _touchHandler; - - // Semaphores - dispatch_semaphore_t _rootShadowViewDidStartRenderingSemaphore; - dispatch_semaphore_t _rootShadowViewDidStartLayingOutSemaphore; - dispatch_semaphore_t _uiManagerDidPerformMountingSemaphore; - - // Atomics - atomic_bool _waitingForMountingStageOnMainQueue; -} - - -- (instancetype)initWithBridge:(RCTBridge *)bridge - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties -{ - RCTAssert(bridge.valid, @"Valid bridge is required to instanciate `RCTSurface`."); - - if (self = [super init]) { - _bridge = bridge; - _batchedBridge = [_bridge batchedBridge] ?: _bridge; - _moduleName = moduleName; - _properties = [initialProperties copy]; - _rootViewTag = RCTAllocateRootViewTag(); - - _rootShadowViewDidStartRenderingSemaphore = dispatch_semaphore_create(0); - _rootShadowViewDidStartLayingOutSemaphore = dispatch_semaphore_create(0); - _uiManagerDidPerformMountingSemaphore = dispatch_semaphore_create(0); - - _minimumSize = CGSizeZero; - _maximumSize = CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX); - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleBridgeWillLoadJavaScriptNotification:) - name:RCTJavaScriptWillStartLoadingNotification - object:_bridge]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleBridgeDidLoadJavaScriptNotification:) - name:RCTJavaScriptDidLoadNotification - object:_bridge]; - - _stage = RCTSurfaceStageSurfaceDidInitialize; - - if (!bridge.loading) { - _stage = _stage | RCTSurfaceStageBridgeDidLoad; - } - - [_bridge.uiManager.observerCoordinator addObserver:self]; - - [self _registerRootView]; - [self _run]; - } - - return self; -} - -- (void)dealloc -{ - [self _stop]; - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -#pragma mark - Immutable Properties (no need to enforce synchonization) - -- (RCTBridge *)bridge -{ - return _bridge; -} - -- (NSString *)moduleName -{ - return _moduleName; -} - -- (NSNumber *)rootViewTag -{ - return _rootViewTag; -} - -#pragma mark - Convinience Internal Thread-Safe Properties - -- (RCTBridge *)_batchedBridge -{ - std::lock_guard lock(_mutex); - return _batchedBridge; -} - -- (RCTUIManager *)_uiManager -{ - return self._batchedBridge.uiManager; -} - -#pragma mark - Main-Threaded Routines - -- (RCTSurfaceView *)view -{ - RCTAssertMainQueue(); - - if (!_view) { - _view = [[RCTSurfaceView alloc] initWithSurface:self]; - - _touchHandler = [[RCTTouchHandler alloc] initWithBridge:self.bridge]; - [_touchHandler attachToView:_view]; - - [self _mountRootViewIfNeeded]; - } - - return _view; -} - -- (void)_mountRootViewIfNeeded -{ - RCTAssertMainQueue(); - - RCTSurfaceView *view = self->_view; - if (!view) { - return; - } - - RCTSurfaceRootView *rootView = - (RCTSurfaceRootView *)[self._uiManager viewForReactTag:self->_rootViewTag]; - if (!rootView) { - return; - } - - RCTAssert([rootView isKindOfClass:[RCTSurfaceRootView class]], - @"Received root view is not an instanse of `RCTSurfaceRootView`."); - - if (rootView.superview != view) { - view.rootView = rootView; - } -} - -#pragma mark - Bridge Events - -- (void)handleBridgeWillLoadJavaScriptNotification:(NSNotification *)notification -{ - RCTAssertMainQueue(); - - // Reset states because the bridge is reloading. This is similar to initialization phase. - _stage = RCTSurfaceStageSurfaceDidInitialize; - _view = nil; - _touchHandler = nil; - [self _setStage:RCTSurfaceStageBridgeDidLoad]; -} - -- (void)handleBridgeDidLoadJavaScriptNotification:(NSNotification *)notification -{ - RCTAssertMainQueue(); - - [self _setStage:RCTSurfaceStageModuleDidLoad]; - - RCTBridge *bridge = notification.userInfo[@"bridge"]; - - BOOL isRerunNeeded = NO; - - { - std::lock_guard lock(_mutex); - - if (bridge != _batchedBridge) { - _batchedBridge = bridge; - isRerunNeeded = YES; - } - } - - if (isRerunNeeded) { - [self _registerRootView]; - [self _run]; - } -} - -#pragma mark - Stage management - -- (RCTSurfaceStage)stage -{ - std::lock_guard lock(_mutex); - return _stage; -} - -- (void)_setStage:(RCTSurfaceStage)stage -{ - RCTSurfaceStage updatedStage; - { - std::lock_guard lock(_mutex); - - if (_stage & stage) { - return; - } - - updatedStage = (RCTSurfaceStage)(_stage | stage); - _stage = updatedStage; - } - - [self _propagateStageChange:updatedStage]; -} - -- (void)_propagateStageChange:(RCTSurfaceStage)stage -{ - // Updating the `view` - RCTExecuteOnMainQueue(^{ - self->_view.stage = stage; - }); - - // Notifying the `delegate` - id delegate = self.delegate; - if ([delegate respondsToSelector:@selector(surface:didChangeStage:)]) { - [delegate surface:self didChangeStage:stage]; - } -} - -#pragma mark - Properties Management - -- (NSDictionary *)properties -{ - std::lock_guard lock(_mutex); - return _properties; -} - -- (void)setProperties:(NSDictionary *)properties -{ - { - std::lock_guard lock(_mutex); - - if ([properties isEqualToDictionary:_properties]) { - return; - } - - _properties = [properties copy]; - } - - [self _run]; -} - -#pragma mark - Running - -- (void)_run -{ - RCTBridge *batchedBridge; - NSDictionary *properties; - - { - std::lock_guard lock(_mutex); - - batchedBridge = _batchedBridge; - properties = _properties; - } - - if (!batchedBridge.valid) { - return; - } - - NSDictionary *applicationParameters = - @{ - @"rootTag": _rootViewTag, - @"initialProps": properties, - }; - - RCTLogInfo(@"Running surface %@ (%@)", _moduleName, applicationParameters); - - [self mountReactComponentWithBridge:batchedBridge moduleName:_moduleName params:applicationParameters]; - - [self _setStage:RCTSurfaceStageSurfaceDidRun]; -} - -- (void)_stop -{ - [self unmountReactComponentWithBridge:self._batchedBridge rootViewTag:self->_rootViewTag]; -} - -- (void)_registerRootView -{ - RCTBridge *batchedBridge; - CGSize minimumSize; - CGSize maximumSize; - - { - std::lock_guard lock(_mutex); - batchedBridge = _batchedBridge; - minimumSize = _minimumSize; - maximumSize = _maximumSize; - } - - RCTUIManager *uiManager = batchedBridge.uiManager; - - // If we are on the main queue now, we have to proceed synchronously. - // Otherwise, we cannot perform synchronous waiting for some stages later. - (RCTIsMainQueue() ? RCTUnsafeExecuteOnUIManagerQueueSync : RCTExecuteOnUIManagerQueue)(^{ - [uiManager registerRootViewTag:self->_rootViewTag]; - - RCTSurfaceRootShadowView *rootShadowView = - (RCTSurfaceRootShadowView *)[uiManager shadowViewForReactTag:self->_rootViewTag]; - RCTAssert([rootShadowView isKindOfClass:[RCTSurfaceRootShadowView class]], - @"Received shadow view is not an instanse of `RCTSurfaceRootShadowView`."); - - [rootShadowView setMinimumSize:minimumSize - maximumSize:maximumSize]; - rootShadowView.delegate = self; - }); -} - -#pragma mark - Layout - -- (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize - maximumSize:(CGSize)maximumSize -{ - RCTUIManager *uiManager = self._uiManager; - __block CGSize fittingSize; - - RCTUnsafeExecuteOnUIManagerQueueSync(^{ - RCTSurfaceRootShadowView *rootShadowView = - (RCTSurfaceRootShadowView *)[uiManager shadowViewForReactTag:self->_rootViewTag]; - - RCTAssert([rootShadowView isKindOfClass:[RCTSurfaceRootShadowView class]], - @"Received shadow view is not an instanse of `RCTSurfaceRootShadowView`."); - - fittingSize = [rootShadowView sizeThatFitsMinimumSize:minimumSize - maximumSize:maximumSize]; - }); - - return fittingSize; -} - -#pragma mark - Size Constraints - -- (void)setSize:(CGSize)size -{ - [self setMinimumSize:size maximumSize:size]; -} - -- (void)setMinimumSize:(CGSize)minimumSize - maximumSize:(CGSize)maximumSize -{ - { - std::lock_guard lock(_mutex); - if (CGSizeEqualToSize(minimumSize, _minimumSize) && - CGSizeEqualToSize(maximumSize, _maximumSize)) { - return; - } - - _maximumSize = maximumSize; - _minimumSize = minimumSize; - } - - RCTUIManager *uiManager = self._uiManager; - - RCTUnsafeExecuteOnUIManagerQueueSync(^{ - RCTSurfaceRootShadowView *rootShadowView = - (RCTSurfaceRootShadowView *)[uiManager shadowViewForReactTag:self->_rootViewTag]; - RCTAssert([rootShadowView isKindOfClass:[RCTSurfaceRootShadowView class]], - @"Received shadow view is not an instanse of `RCTSurfaceRootShadowView`."); - - [rootShadowView setMinimumSize:minimumSize maximumSize:maximumSize]; - [uiManager setNeedsLayout]; - }); -} - -- (CGSize)minimumSize -{ - std::lock_guard lock(_mutex); - return _minimumSize; -} - -- (CGSize)maximumSize -{ - std::lock_guard lock(_mutex); - return _maximumSize; -} - -#pragma mark - intrinsicSize - -- (void)setIntrinsicSize:(CGSize)intrinsicSize -{ - { - std::lock_guard lock(_mutex); - if (CGSizeEqualToSize(intrinsicSize, _intrinsicSize)) { - return; - } - - _intrinsicSize = intrinsicSize; - } - - // Notifying `delegate` - id delegate = self.delegate; - if ([delegate respondsToSelector:@selector(surface:didChangeIntrinsicSize:)]) { - [delegate surface:self didChangeIntrinsicSize:intrinsicSize]; - } -} - -- (CGSize)intrinsicSize -{ - std::lock_guard lock(_mutex); - return _intrinsicSize; -} - -#pragma mark - Synchronous Waiting - -- (BOOL)synchronouslyWaitForStage:(RCTSurfaceStage)stage timeout:(NSTimeInterval)timeout -{ - if (RCTIsUIManagerQueue()) { - RCTLogInfo(@"Synchronous waiting is not supported on UIManager queue."); - return NO; - } - - if (RCTIsMainQueue() && (stage & RCTSurfaceStageSurfaceDidInitialMounting)) { - // All main-threaded execution (especially mounting process) has to be - // intercepted, captured and performed synchnously at the end of this method - // right after the semaphore signals. - - // Atomic variant of `_waitingForMountingStageOnMainQueue = YES;` - atomic_fetch_or(&_waitingForMountingStageOnMainQueue, 1); - } - - dispatch_semaphore_t semaphore; - switch (stage) { - case RCTSurfaceStageSurfaceDidInitialLayout: - semaphore = _rootShadowViewDidStartLayingOutSemaphore; - break; - case RCTSurfaceStageSurfaceDidInitialRendering: - semaphore = _rootShadowViewDidStartRenderingSemaphore; - break; - case RCTSurfaceStageSurfaceDidInitialMounting: - semaphore = _uiManagerDidPerformMountingSemaphore; - break; - default: - RCTAssert(NO, @"Only waiting for `RCTSurfaceStageSurfaceDidInitialRendering`, `RCTSurfaceStageSurfaceDidInitialLayout` and `RCTSurfaceStageSurfaceDidInitialMounting` stages are supported."); - } - - BOOL timeoutOccurred = dispatch_semaphore_wait(semaphore, dispatch_time(DISPATCH_TIME_NOW, timeout * NSEC_PER_SEC)); - - // Atomic equivalent of `_waitingForMountingStageOnMainQueue = NO;`. - atomic_fetch_and(&_waitingForMountingStageOnMainQueue, 0); - - if (!timeoutOccurred) { - // Balancing the semaphore. - // Note: `dispatch_semaphore_wait` reverts the decrement in case when timeout occurred. - dispatch_semaphore_signal(semaphore); - } - - if (RCTIsMainQueue() && (stage & RCTSurfaceStageSurfaceDidInitialMounting)) { - // Time to apply captured mounting block. - RCTUIManagerMountingBlock mountingBlock; - { - std::lock_guard lock(_mutex); - mountingBlock = _mountingBlock; - _mountingBlock = nil; - } - - if (mountingBlock) { - mountingBlock(); - [self _mountRootViewIfNeeded]; - } - } - - return !timeoutOccurred; -} - -#pragma mark - RCTSurfaceRootShadowViewDelegate - -- (void)rootShadowView:(RCTRootShadowView *)rootShadowView didChangeIntrinsicSize:(CGSize)intrinsicSize -{ - self.intrinsicSize = intrinsicSize; -} - -- (void)rootShadowViewDidStartRendering:(RCTSurfaceRootShadowView *)rootShadowView -{ - [self _setStage:RCTSurfaceStageSurfaceDidInitialRendering]; - - dispatch_semaphore_signal(_rootShadowViewDidStartRenderingSemaphore); -} - -- (void)rootShadowViewDidStartLayingOut:(RCTSurfaceRootShadowView *)rootShadowView -{ - [self _setStage:RCTSurfaceStageSurfaceDidInitialLayout]; - - dispatch_semaphore_signal(_rootShadowViewDidStartLayingOutSemaphore); - - RCTExecuteOnMainQueue(^{ - // Rendering is happening, let's mount `rootView` into `view` if we already didn't do this. - [self _mountRootViewIfNeeded]; - }); -} - -#pragma mark - RCTUIManagerObserver - -- (BOOL)uiManager:(RCTUIManager *)manager performMountingWithBlock:(RCTUIManagerMountingBlock)block -{ - if (atomic_load(&_waitingForMountingStageOnMainQueue) && (self.stage & RCTSurfaceStageSurfaceDidInitialLayout)) { - // Atomic equivalent of `_waitingForMountingStageOnMainQueue = NO;`. - atomic_fetch_and(&_waitingForMountingStageOnMainQueue, 0); - - { - std::lock_guard lock(_mutex); - _mountingBlock = block; - } - return YES; - } - - return NO; -} - -- (void)uiManagerDidPerformMounting:(RCTUIManager *)manager -{ - if (self.stage & RCTSurfaceStageSurfaceDidInitialLayout) { - [self _setStage:RCTSurfaceStageSurfaceDidInitialMounting]; - dispatch_semaphore_signal(_uiManagerDidPerformMountingSemaphore); - - // No need to listen to UIManager anymore. - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{ - [self->_bridge.uiManager.observerCoordinator removeObserver:self]; - }); - } -} - -- (BOOL)start -{ - // Does nothing. - // The Start&Stop feature is not implemented for regular Surface yet. - return YES; -} - -- (BOOL)stop -{ - // Does nothing. - // The Start&Stop feature is not implemented for regular Surface yet. - return YES; -} - -#pragma mark - Mounting/Unmounting of React components - -- (void)mountReactComponentWithBridge:(RCTBridge *)bridge moduleName:(NSString *)moduleName params:(NSDictionary *)params -{ - [bridge enqueueJSCall:@"AppRegistry" method:@"runApplication" args:@[moduleName, params] completion:NULL]; -} - -- (void)unmountReactComponentWithBridge:(RCTBridge *)bridge rootViewTag:(NSNumber *)rootViewTag -{ - [bridge enqueueJSCall:@"AppRegistry" method:@"unmountApplicationComponentAtRootTag" args:@[rootViewTag] completion:NULL]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceDelegate.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceDelegate.h deleted file mode 100644 index b006ecf0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceDelegate.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RCTSurface; - -@protocol RCTSurfaceDelegate - -@optional - -/** - * Notifies a receiver that a surface transitioned to a new stage. - * See `RCTSurfaceStage` for more details. - */ -- (void)surface:(RCTSurface *)surface didChangeStage:(RCTSurfaceStage)stage; - -/** - * Notifies a receiver that root view got a new (intrinsic) size during the last - * layout pass. - */ -- (void)surface:(RCTSurface *)surface didChangeIntrinsicSize:(CGSize)intrinsicSize; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceRootShadowView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceRootShadowView.h deleted file mode 100644 index c277f36e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceRootShadowView.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import -#import - -@interface RCTSurfaceRootShadowView : RCTShadowView - -@property (nonatomic, assign, readonly) CGSize minimumSize; -@property (nonatomic, assign, readonly) CGSize maximumSize; - -- (void)setMinimumSize:(CGSize)size maximumSize:(CGSize)maximumSize; - -@property (nonatomic, assign, readonly) CGSize intrinsicSize; - -@property (nonatomic, weak) id delegate; - -/** - * Layout direction (LTR or RTL) inherited from native environment and - * is using as a base direction value in layout engine. - * Defaults to value inferred from current locale. - */ -@property (nonatomic, assign) YGDirection baseDirection; - -- (void)layoutWithAffectedShadowViews:(NSHashTable *)affectedShadowViews; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceRootShadowView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceRootShadowView.m deleted file mode 100644 index 5a706928..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceRootShadowView.m +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSurfaceRootShadowView.h" - -#import "RCTI18nUtil.h" -#import "RCTShadowView+Layout.h" -#import "RCTUIManagerUtils.h" - -@implementation RCTSurfaceRootShadowView { - CGSize _intrinsicSize; - BOOL _isRendered; - BOOL _isLaidOut; -} - -- (instancetype)init -{ - if (self = [super init]) { - self.viewName = @"RCTSurfaceRootView"; - _baseDirection = [[RCTI18nUtil sharedInstance] isRTL] ? YGDirectionRTL : YGDirectionLTR; - _minimumSize = CGSizeZero; - _maximumSize = CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX); - - self.alignSelf = YGAlignStretch; - self.flex = 1; - } - - return self; -} - -- (void)insertReactSubview:(RCTShadowView *)subview atIndex:(NSInteger)atIndex -{ - [super insertReactSubview:subview atIndex:atIndex]; - if (!_isRendered) { - [_delegate rootShadowViewDidStartRendering:self]; - _isRendered = YES; - } -} - -- (void)layoutWithAffectedShadowViews:(NSHashTable *)affectedShadowViews -{ - NSHashTable *other = [NSHashTable new]; - - RCTLayoutContext layoutContext = {}; - layoutContext.absolutePosition = CGPointZero; - layoutContext.affectedShadowViews = affectedShadowViews; - layoutContext.other = other; - - [self layoutWithMinimumSize:_minimumSize - maximumSize:_maximumSize - layoutDirection:RCTUIKitLayoutDirectionFromYogaLayoutDirection(_baseDirection) - layoutContext:layoutContext]; - - self.intrinsicSize = self.layoutMetrics.frame.size; - - if (_isRendered && !_isLaidOut) { - [_delegate rootShadowViewDidStartLayingOut:self]; - _isLaidOut = YES; - } -} - -- (void)setMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximumSize -{ - if (CGSizeEqualToSize(minimumSize, _minimumSize) && - CGSizeEqualToSize(maximumSize, _maximumSize)) { - return; - } - - _maximumSize = maximumSize; - _minimumSize = minimumSize; -} - -- (void)setIntrinsicSize:(CGSize)intrinsicSize -{ - if (CGSizeEqualToSize(_intrinsicSize, intrinsicSize)) { - return; - } - - _intrinsicSize = intrinsicSize; - - [_delegate rootShadowView:self didChangeIntrinsicSize:intrinsicSize]; -} - -- (CGSize)intrinsicSize -{ - return _intrinsicSize; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceRootShadowViewDelegate.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceRootShadowViewDelegate.h deleted file mode 100644 index f1bb29bb..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceRootShadowViewDelegate.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RCTSurfaceRootShadowView; - -@protocol RCTSurfaceRootShadowViewDelegate - -- (void)rootShadowView:(RCTSurfaceRootShadowView *)rootShadowView didChangeIntrinsicSize:(CGSize)instrinsicSize; -- (void)rootShadowViewDidStartRendering:(RCTSurfaceRootShadowView *)rootShadowView; -- (void)rootShadowViewDidStartLayingOut:(RCTSurfaceRootShadowView *)rootShadowView; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceRootView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceRootView.h deleted file mode 100644 index 53ebe47e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceRootView.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Internal class represents Surface's root view. - */ -@interface RCTSurfaceRootView : RCTView - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceRootView.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceRootView.mm deleted file mode 100644 index 9b889431..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceRootView.mm +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSurfaceRootView.h" - -#import "RCTDefines.h" - -@implementation RCTSurfaceRootView - -RCT_NOT_IMPLEMENTED(- (nullable instancetype)initWithCoder:(NSCoder *)coder) - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceStage.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceStage.h deleted file mode 100644 index 354cf850..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceStage.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -/** - * The stage of the Surface - */ -typedef NS_OPTIONS(NSInteger, RCTSurfaceStage) { - RCTSurfaceStageSurfaceDidInitialize = 1 << 0, // Surface object was created - RCTSurfaceStageBridgeDidLoad = 1 << 1, // Bridge was loaded - RCTSurfaceStageModuleDidLoad = 1 << 2, // Module (JavaScript code) was loaded - RCTSurfaceStageSurfaceDidRun = 1 << 3, // Module (JavaScript code) was run - RCTSurfaceStageSurfaceDidInitialRendering = 1 << 4, // UIManager created the first shadow views - RCTSurfaceStageSurfaceDidInitialLayout = 1 << 5, // UIManager completed the first layout pass - RCTSurfaceStageSurfaceDidInitialMounting = 1 << 6, // UIManager completed the first mounting pass - RCTSurfaceStageSurfaceDidStop = 1 << 7, // Surface stopped - - // Most of the previously existed stages make no sense in the new architecture; - // now Surface exposes only three simple stages: - // - // Surface object was constructed and still valid. - RCTSurfaceStageInitialized = RCTSurfaceStageSurfaceDidInitialize, - // Surface was started. - RCTSurfaceStageStarted = 1 << 8, - // All off-main-thread work is done; we are ready to mount the UI. - RCTSurfaceStagePrepared = RCTSurfaceStageBridgeDidLoad | RCTSurfaceStageModuleDidLoad | RCTSurfaceStageSurfaceDidRun | RCTSurfaceStageSurfaceDidInitialRendering | RCTSurfaceStageSurfaceDidInitialLayout, - // All main-thread work is done, the UI was mounted. - RCTSurfaceStageMounted = RCTSurfaceStageSurfaceDidInitialMounting, -}; - -/** - * Returns `YES` if the stage is suitable for displaying normal React Native app. - */ -RCT_EXTERN BOOL RCTSurfaceStageIsRunning(RCTSurfaceStage stage); - -/** - * Returns `YES` if the stage is suitable for displaying activity indicator. - */ -RCT_EXTERN BOOL RCTSurfaceStageIsPreparing(RCTSurfaceStage stage); diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceStage.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceStage.m deleted file mode 100644 index 53054dd7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceStage.m +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSurfaceStage.h" - -BOOL RCTSurfaceStageIsRunning(RCTSurfaceStage stage) { - return - (stage & RCTSurfaceStageSurfaceDidInitialLayout) && - !(stage & RCTSurfaceStageSurfaceDidStop); -} - -BOOL RCTSurfaceStageIsPreparing(RCTSurfaceStage stage) { - return - !(stage & RCTSurfaceStageSurfaceDidInitialLayout) && - !(stage & RCTSurfaceStageSurfaceDidStop); -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceView+Internal.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceView+Internal.h deleted file mode 100644 index ed2a4b83..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceView+Internal.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -@class RCTSurfaceRootView; - -NS_ASSUME_NONNULL_BEGIN - -@interface RCTSurfaceView (Internal) - -@property (nonatomic, strong) RCTSurfaceRootView *rootView; -@property (nonatomic, assign) RCTSurfaceStage stage; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceView.h deleted file mode 100644 index 9a92bfeb..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceView.h +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RCTSurface; - -/** - * UIView instance which represents the Surface - */ -@interface RCTSurfaceView : UIView - -- (instancetype)initWithSurface:(RCTSurface *)surface NS_DESIGNATED_INITIALIZER; - -@property (nonatomic, weak, readonly, nullable) RCTSurface *surface; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceView.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceView.mm deleted file mode 100644 index f519da11..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/RCTSurfaceView.mm +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSurfaceView.h" -#import "RCTSurfaceView+Internal.h" - -#import "RCTDefines.h" -#import "RCTSurface.h" -#import "RCTSurfaceRootView.h" - -@implementation RCTSurfaceView { - RCTSurfaceRootView *_Nullable _rootView; - RCTSurfaceStage _stage; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) -RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) -RCT_NOT_IMPLEMENTED(- (nullable instancetype)initWithCoder:(NSCoder *)coder) - -- (instancetype)initWithSurface:(RCTSurface *)surface -{ - if (self = [super initWithFrame:CGRectZero]) { - _stage = surface.stage; - _surface = surface; - } - - return self; -} - -#pragma mark - Internal Interface - -- (void)setRootView:(RCTSurfaceRootView *)rootView -{ - if (_rootView == rootView) { - return; - } - - [_rootView removeFromSuperview]; - _rootView = rootView; - [self _updateStage]; -} - -- (RCTSurfaceRootView *)rootView -{ - return _rootView; -} - -#pragma mark - stage - -- (void)setStage:(RCTSurfaceStage)stage -{ - if (stage == _stage) { - return; - } - - _stage = stage; - - [self _updateStage]; -} - -- (RCTSurfaceStage)stage -{ - return _stage; -} - -#pragma mark - Private - -- (void)_updateStage -{ - if (RCTSurfaceStageIsRunning(_stage)) { - if (_rootView.superview != self) { - [self addSubview:_rootView]; - } - } - else { - [_rootView removeFromSuperview]; - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h deleted file mode 100644 index 702746db..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#import "RCTSurfaceHostingView.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - * This is a RCTRootView-compatible implementation of RCTSurfaceHostingView. - * Use this class to replace all usages of RCTRootView in the app for easier migration - * to RCTSurfaceHostingView. - * - * WARNING: In the future, RCTRootView will be deprecated in favor of RCTSurfaceHostingView. - */ -@interface RCTSurfaceHostingProxyRootView : RCTSurfaceHostingView - -#pragma mark RCTRootView compatibility - keep these sync'ed with RCTRootView.h - -@property (nonatomic, copy, readonly) NSString *moduleName; -@property (nonatomic, strong, readonly) RCTBridge *bridge; -@property (nonatomic, copy, readwrite) NSDictionary *appProperties; -@property (nonatomic, assign) RCTRootViewSizeFlexibility sizeFlexibility; -@property (nonatomic, weak) id delegate; -@property (nonatomic, weak) UIViewController *reactViewController; -@property (nonatomic, strong, readonly) UIView *contentView; -@property (nonatomic, strong) UIView *loadingView; -@property (nonatomic, assign) BOOL passThroughTouches; -@property (nonatomic, assign) NSTimeInterval loadingViewFadeDelay; -@property (nonatomic, assign) NSTimeInterval loadingViewFadeDuration; - -- (instancetype)initWithBridge:(RCTBridge *)bridge - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties NS_DESIGNATED_INITIALIZER; - -- (instancetype)initWithBundleURL:(NSURL *)bundleURL - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties - launchOptions:(NSDictionary *)launchOptions; - -- (void)cancelTouches; - -@end - -NS_ASSUME_NONNULL_END - diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm deleted file mode 100644 index 539e236b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm +++ /dev/null @@ -1,180 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSurfaceHostingProxyRootView.h" - -#import - -#import "RCTAssert.h" -#import "RCTBridge.h" -#import "RCTLog.h" -#import "RCTPerformanceLogger.h" -#import "RCTProfile.h" -#import "RCTRootContentView.h" -#import "RCTRootViewDelegate.h" -#import "RCTSurface.h" -#import "UIView+React.h" - -static RCTSurfaceSizeMeasureMode convertToSurfaceSizeMeasureMode(RCTRootViewSizeFlexibility sizeFlexibility) { - switch (sizeFlexibility) { - case RCTRootViewSizeFlexibilityWidthAndHeight: - return RCTSurfaceSizeMeasureModeWidthUndefined | RCTSurfaceSizeMeasureModeHeightUndefined; - case RCTRootViewSizeFlexibilityWidth: - return RCTSurfaceSizeMeasureModeWidthUndefined | RCTSurfaceSizeMeasureModeHeightExact; - case RCTRootViewSizeFlexibilityHeight: - return RCTSurfaceSizeMeasureModeWidthExact | RCTSurfaceSizeMeasureModeHeightUndefined; - case RCTRootViewSizeFlexibilityNone: - return RCTSurfaceSizeMeasureModeWidthExact | RCTSurfaceSizeMeasureModeHeightExact; - } -} - -static RCTRootViewSizeFlexibility convertToRootViewSizeFlexibility(RCTSurfaceSizeMeasureMode sizeMeasureMode) { - switch (sizeMeasureMode) { - case RCTSurfaceSizeMeasureModeWidthUndefined | RCTSurfaceSizeMeasureModeHeightUndefined: - return RCTRootViewSizeFlexibilityWidthAndHeight; - case RCTSurfaceSizeMeasureModeWidthUndefined | RCTSurfaceSizeMeasureModeHeightExact: - return RCTRootViewSizeFlexibilityWidth; - case RCTSurfaceSizeMeasureModeWidthExact | RCTSurfaceSizeMeasureModeHeightUndefined: - return RCTRootViewSizeFlexibilityHeight; - case RCTSurfaceSizeMeasureModeWidthExact | RCTSurfaceSizeMeasureModeHeightExact: - default: - return RCTRootViewSizeFlexibilityNone; - } -} - -@implementation RCTSurfaceHostingProxyRootView - -- (instancetype)initWithBridge:(RCTBridge *)bridge - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties -{ - RCTAssertMainQueue(); - RCTAssert(bridge, @"A bridge instance is required to create an RCTSurfaceHostingProxyRootView"); - RCTAssert(moduleName, @"A moduleName is required to create an RCTSurfaceHostingProxyRootView"); - - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[RCTSurfaceHostingProxyRootView init]", nil); - - _bridge = bridge; - - if (!bridge.isLoading) { - [bridge.performanceLogger markStartForTag:RCTPLTTI]; - } - - // `RCTRootViewSizeFlexibilityNone` is the RCTRootView's default. - RCTSurfaceSizeMeasureMode sizeMeasureMode = convertToSurfaceSizeMeasureMode(RCTRootViewSizeFlexibilityNone); - - if (self = [super initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties sizeMeasureMode:sizeMeasureMode]) { - self.backgroundColor = [UIColor whiteColor]; - [super.surface start]; - } - - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - - return self; -} - -- (instancetype)initWithBundleURL:(NSURL *)bundleURL - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties - launchOptions:(NSDictionary *)launchOptions -{ - RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:bundleURL - moduleProvider:nil - launchOptions:launchOptions]; - - return [self initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties]; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) -RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) - -# pragma mark proxy methods to RCTSurfaceHostingView - -- (NSString *)moduleName -{ - return super.surface.moduleName; -} - -- (UIView *)contentView -{ - return self; -} - -- (NSNumber *)reactTag -{ - return super.surface.rootViewTag; -} - -- (RCTRootViewSizeFlexibility)sizeFlexibility -{ - return convertToRootViewSizeFlexibility(super.sizeMeasureMode); -} - -- (void)setSizeFlexibility:(RCTRootViewSizeFlexibility)sizeFlexibility -{ - super.sizeMeasureMode = convertToSurfaceSizeMeasureMode(sizeFlexibility); -} - -- (NSDictionary *)appProperties -{ - return super.surface.properties; -} - -- (void)setAppProperties:(NSDictionary *)appProperties -{ - [super.surface setProperties:appProperties]; -} - -- (UIView *)loadingView -{ - return super.activityIndicatorViewFactory ? super.activityIndicatorViewFactory() : nil; -} - -- (void)setLoadingView:(UIView *)loadingView -{ - super.activityIndicatorViewFactory = ^UIView *(void) { - return loadingView; - }; -} - -#pragma mark RCTSurfaceDelegate proxying - -- (void)surface:(RCTSurface *)surface didChangeStage:(RCTSurfaceStage)stage -{ - [super surface:surface didChangeStage:stage]; - if (RCTSurfaceStageIsRunning(stage)) { - [_bridge.performanceLogger markStopForTag:RCTPLTTI]; - dispatch_async(dispatch_get_main_queue(), ^{ - [[NSNotificationCenter defaultCenter] postNotificationName:RCTContentDidAppearNotification - object:self]; - }); - } -} - -- (void)surface:(RCTSurface *)surface didChangeIntrinsicSize:(CGSize)intrinsicSize -{ - [super surface:surface didChangeIntrinsicSize:intrinsicSize]; - - [_delegate rootViewDidChangeIntrinsicSize:(RCTRootView *)self]; -} - -#pragma mark legacy - -- (UIViewController *)reactViewController -{ - return _reactViewController ?: [super reactViewController]; -} - -#pragma mark unsupported - -- (void)cancelTouches -{ - // Not supported. -} - -@end - diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h deleted file mode 100644 index 3694e052..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import - -@class RCTBridge; -@class RCTSurface; - -typedef UIView *_Nullable(^RCTSurfaceHostingViewActivityIndicatorViewFactory)(void); - -NS_ASSUME_NONNULL_BEGIN - -/** - * UIView subclass which providers interoperability between UIKit and - * Surface regarding layout and life-cycle. - * This class can be used as easy-to-use general purpose integration point - * of ReactNative-powered experiences in UIKit based apps. - */ -@interface RCTSurfaceHostingView : UIView - -/** - * Create an instance of RCTSurface to be hosted. - */ -+ (RCTSurface *)createSurfaceWithBridge:(RCTBridge *)bridge - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties; - -/** - * Designated initializer. - * Instanciates a view with given Surface object. - * Note: The view retains the surface object. - */ -- (instancetype)initWithSurface:(RCTSurface *)surface - sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode NS_DESIGNATED_INITIALIZER; - -/** - * Convenience initializer. - * Instanciates a Surface object with given `bridge`, `moduleName`, and - * `initialProperties`, and then use it to instanciate a view. - */ -- (instancetype)initWithBridge:(RCTBridge *)bridge - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties - sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode; - -/** - * Surface object which is currently using to power the view. - * Read-only. - */ -@property (nonatomic, strong, readonly) RCTSurface *surface; - -/** - * Size measure mode which are defining relationship between UIKit and ReactNative - * layout approaches. - * Defaults to `RCTSurfaceSizeMeasureModeWidthAtMost | RCTSurfaceSizeMeasureModeHeightAtMost`. - */ -@property (nonatomic, assign) RCTSurfaceSizeMeasureMode sizeMeasureMode; - -/** - * Activity indicator factory. - * A hosting view may use this block to instantiate and display custom activity - * (loading) indicator (aka "spinner") when it needed. - * Defaults to `nil` (no activity indicator). - */ -@property (nonatomic, copy, nullable) RCTSurfaceHostingViewActivityIndicatorViewFactory activityIndicatorViewFactory; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm deleted file mode 100644 index 7e4284ab..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm +++ /dev/null @@ -1,243 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSurfaceHostingView.h" - -#import "RCTDefines.h" -#import "RCTSurface.h" -#import "RCTSurfaceDelegate.h" -#import "RCTSurfaceView.h" -#import "RCTUtils.h" - -@interface RCTSurfaceHostingView () - -@property (nonatomic, assign) BOOL isActivityIndicatorViewVisible; -@property (nonatomic, assign) BOOL isSurfaceViewVisible; - -@end - -@implementation RCTSurfaceHostingView { - UIView *_Nullable _activityIndicatorView; - UIView *_Nullable _surfaceView; - RCTSurfaceStage _stage; -} - -+ (RCTSurface *)createSurfaceWithBridge:(RCTBridge *)bridge - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties -{ - return [[RCTSurface alloc] initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties]; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) -RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) -RCT_NOT_IMPLEMENTED(- (nullable instancetype)initWithCoder:(NSCoder *)coder) - -- (instancetype)initWithBridge:(RCTBridge *)bridge - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties - sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode -{ - RCTSurface *surface = [[self class] createSurfaceWithBridge:bridge moduleName:moduleName initialProperties:initialProperties]; - [surface start]; - return [self initWithSurface:surface sizeMeasureMode:sizeMeasureMode]; -} - -- (instancetype)initWithSurface:(RCTSurface *)surface sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode -{ - if (self = [super initWithFrame:CGRectZero]) { - _surface = surface; - _sizeMeasureMode = sizeMeasureMode; - - _surface.delegate = self; - _stage = surface.stage; - [self _updateViews]; - } - - return self; -} - -- (void)dealloc -{ - [_surface stop]; -} - -- (void)setFrame:(CGRect)frame -{ - [super setFrame:frame]; - - CGSize minimumSize; - CGSize maximumSize; - - RCTSurfaceMinimumSizeAndMaximumSizeFromSizeAndSizeMeasureMode( - self.bounds.size, - _sizeMeasureMode, - &minimumSize, - &maximumSize - ); - - [_surface setMinimumSize:minimumSize - maximumSize:maximumSize]; -} - -- (CGSize)intrinsicContentSize -{ - if (RCTSurfaceStageIsPreparing(_stage)) { - if (_activityIndicatorView) { - return _activityIndicatorView.intrinsicContentSize; - } - - return CGSizeZero; - } - - return _surface.intrinsicSize; -} - -- (CGSize)sizeThatFits:(CGSize)size -{ - if (RCTSurfaceStageIsPreparing(_stage)) { - if (_activityIndicatorView) { - return [_activityIndicatorView sizeThatFits:size]; - } - - return CGSizeZero; - } - - CGSize minimumSize; - CGSize maximumSize; - - RCTSurfaceMinimumSizeAndMaximumSizeFromSizeAndSizeMeasureMode( - size, - _sizeMeasureMode, - &minimumSize, - &maximumSize - ); - - return [_surface sizeThatFitsMinimumSize:minimumSize - maximumSize:maximumSize]; -} - -- (void)setStage:(RCTSurfaceStage)stage -{ - if (stage == _stage) { - return; - } - - BOOL shouldInvalidateLayout = - RCTSurfaceStageIsRunning(stage) != RCTSurfaceStageIsRunning(_stage) || - RCTSurfaceStageIsPreparing(stage) != RCTSurfaceStageIsPreparing(_stage); - - _stage = stage; - - if (shouldInvalidateLayout) { - [self _invalidateLayout]; - [self _updateViews]; - } -} - -- (void)setSizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode -{ - if (sizeMeasureMode == _sizeMeasureMode) { - return; - } - - _sizeMeasureMode = sizeMeasureMode; - [self _invalidateLayout]; -} - -#pragma mark - isActivityIndicatorViewVisible - -- (void)setIsActivityIndicatorViewVisible:(BOOL)visible -{ - if (_isActivityIndicatorViewVisible == visible) { - return; - } - - _isActivityIndicatorViewVisible = visible; - - if (visible) { - if (_activityIndicatorViewFactory) { - _activityIndicatorView = _activityIndicatorViewFactory(); - _activityIndicatorView.frame = self.bounds; - _activityIndicatorView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - [self addSubview:_activityIndicatorView]; - } - } else { - [_activityIndicatorView removeFromSuperview]; - _activityIndicatorView = nil; - } -} - -#pragma mark - isSurfaceViewVisible - -- (void)setIsSurfaceViewVisible:(BOOL)visible -{ - if (_isSurfaceViewVisible == visible) { - return; - } - - _isSurfaceViewVisible = visible; - - if (visible) { - _surfaceView = _surface.view; - _surfaceView.frame = self.bounds; - _surfaceView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - [self addSubview:_surfaceView]; - } else { - [_surfaceView removeFromSuperview]; - _surfaceView = nil; - } -} - -#pragma mark - activityIndicatorViewFactory - -- (void)setActivityIndicatorViewFactory:(RCTSurfaceHostingViewActivityIndicatorViewFactory)activityIndicatorViewFactory -{ - _activityIndicatorViewFactory = activityIndicatorViewFactory; - if (_isActivityIndicatorViewVisible) { - self.isActivityIndicatorViewVisible = NO; - self.isActivityIndicatorViewVisible = YES; - } -} - -#pragma mark - Private stuff - -- (void)_invalidateLayout -{ - [self invalidateIntrinsicContentSize]; - [self.superview setNeedsLayout]; -} - -- (void)_updateViews -{ - self.isSurfaceViewVisible = RCTSurfaceStageIsRunning(_stage); - self.isActivityIndicatorViewVisible = RCTSurfaceStageIsPreparing(_stage); -} - -- (void)didMoveToWindow -{ - [super didMoveToWindow]; - [self _updateViews]; -} - -#pragma mark - RCTSurfaceDelegate - -- (void)surface:(RCTSurface *)surface didChangeStage:(RCTSurfaceStage)stage -{ - RCTExecuteOnMainQueue(^{ - [self setStage:stage]; - }); -} - -- (void)surface:(RCTSurface *)surface didChangeIntrinsicSize:(CGSize)intrinsicSize -{ - RCTExecuteOnMainQueue(^{ - [self _invalidateLayout]; - }); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.h deleted file mode 100644 index 59464554..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -/** - * Bitmask defines how size constrains from `-[UIView sizeThatFits:]` - * are translated to `-[RCTSurface sizeThatFitsMinimumSize:maximumSize:]`. - */ -typedef NS_OPTIONS(NSInteger, RCTSurfaceSizeMeasureMode) { - RCTSurfaceSizeMeasureModeWidthUndefined = 0 << 0, - RCTSurfaceSizeMeasureModeWidthExact = 1 << 0, - RCTSurfaceSizeMeasureModeWidthAtMost = 2 << 0, - RCTSurfaceSizeMeasureModeHeightUndefined = 0 << 2, - RCTSurfaceSizeMeasureModeHeightExact = 1 << 2, - RCTSurfaceSizeMeasureModeHeightAtMost = 2 << 2, -}; - -/** - * Returns size constraints based on `size` and `sizeMeasureMode`. - */ -RCT_EXTERN void RCTSurfaceMinimumSizeAndMaximumSizeFromSizeAndSizeMeasureMode( - CGSize size, - RCTSurfaceSizeMeasureMode sizeMeasureMode, - CGSize *minimumSize, - CGSize *maximumSize -); diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.mm deleted file mode 100644 index 05bd50c3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.mm +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "RCTSurfaceSizeMeasureMode.h" - -void RCTSurfaceMinimumSizeAndMaximumSizeFromSizeAndSizeMeasureMode( - CGSize size, - RCTSurfaceSizeMeasureMode sizeMeasureMode, - CGSize *minimumSize, - CGSize *maximumSize -) { - *minimumSize = CGSizeZero; - *maximumSize = CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX); - - if (sizeMeasureMode & RCTSurfaceSizeMeasureModeWidthExact) { - minimumSize->width = size.width; - maximumSize->width = size.width; - } - else if (sizeMeasureMode & RCTSurfaceSizeMeasureModeWidthAtMost) { - maximumSize->width = size.width; - } - - if (sizeMeasureMode & RCTSurfaceSizeMeasureModeHeightExact) { - minimumSize->height = size.height; - maximumSize->height = size.height; - } - else if (sizeMeasureMode & RCTSurfaceSizeMeasureModeHeightAtMost) { - maximumSize->height = size.height; - } -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/JSCExecutorFactory.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/JSCExecutorFactory.h deleted file mode 100644 index e60288d5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/JSCExecutorFactory.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -namespace facebook { -namespace react { - -class JSCExecutorFactory : public JSExecutorFactory { -public: - explicit JSCExecutorFactory( - JSIExecutor::RuntimeInstaller runtimeInstaller) - : runtimeInstaller_(std::move(runtimeInstaller)) {} - - std::unique_ptr createJSExecutor( - std::shared_ptr delegate, - std::shared_ptr jsQueue) override; - -private: - JSIExecutor::RuntimeInstaller runtimeInstaller_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/JSCExecutorFactory.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/JSCExecutorFactory.mm deleted file mode 100644 index 7a436eb8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/JSCExecutorFactory.mm +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "JSCExecutorFactory.h" - -#import -#import - -namespace facebook { -namespace react { - -std::unique_ptr JSCExecutorFactory::createJSExecutor( - std::shared_ptr delegate, - std::shared_ptr jsQueue) { - return folly::make_unique( - facebook::jsc::makeJSCRuntime(), - delegate, - [](const std::string &message, unsigned int logLevel) { - _RCTLogJavaScriptInternal( - static_cast(logLevel), - [NSString stringWithUTF8String:message.c_str()]); - }, - JSIExecutor::defaultTimeoutInvoker, - std::move(runtimeInstaller_)); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/NSDataBigString.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/NSDataBigString.h deleted file mode 100644 index 473496c3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/NSDataBigString.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#include - -namespace facebook { -namespace react { - -class NSDataBigString : public JSBigString { -public: - // The NSData passed in must be be null-terminated. - NSDataBigString(NSData *data); - - // The ASCII optimization is not enabled on iOS - bool isAscii() const override { - return false; - } - - const char *c_str() const override { - return (const char *)[m_data bytes]; - } - - size_t size() const override { - return m_length; - } - -private: - NSData *m_data; - size_t m_length; -}; - -} } diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/NSDataBigString.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/NSDataBigString.mm deleted file mode 100644 index 31a92586..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/NSDataBigString.mm +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "NSDataBigString.h" - -namespace facebook { -namespace react { - -static NSData *ensureNullTerminated(NSData *source) -{ - if (!source || source.length == 0) { - return nil; - } - - NSUInteger sourceLength = source.length; - unsigned char lastByte; - [source getBytes:&lastByte range:NSMakeRange(sourceLength - 1, 1)]; - - // TODO: bundles from the packager should always include a NULL byte - // or we should we relax this requirement and only read as much from the - // buffer as length indicates - if (lastByte == '\0') { - return source; - } else { - NSMutableData *data = [source mutableCopy]; - unsigned char nullByte = '\0'; - [data appendBytes:&nullByte length:1]; - return data; - } -} - -NSDataBigString::NSDataBigString(NSData *data) -{ - m_length = [data length]; - m_data = ensureNullTerminated(data); -} - -} } diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/RCTCxxBridge.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/RCTCxxBridge.mm deleted file mode 100644 index 194b06c9..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/RCTCxxBridge.mm +++ /dev/null @@ -1,1391 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include -#include - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#import "JSCExecutorFactory.h" -#import "NSDataBigString.h" -#import "RCTMessageThread.h" -#import "RCTObjcExecutor.h" - -#ifdef WITH_FBSYSTRACE -#import -#endif - -#if RCT_DEV && __has_include("RCTDevLoadingView.h") -#import "RCTDevLoadingView.h" -#endif - -#define RCTAssertJSThread() \ - RCTAssert(self.executorClass || self->_jsThread == [NSThread currentThread], \ - @"This method must be called on JS thread") - -static NSString *const RCTJSThreadName = @"com.facebook.react.JavaScript"; - -typedef void (^RCTPendingCall)(); - -using namespace facebook::jsi; -using namespace facebook::react; - -/** - * Must be kept in sync with `MessageQueue.js`. - */ -typedef NS_ENUM(NSUInteger, RCTBridgeFields) { - RCTBridgeFieldRequestModuleIDs = 0, - RCTBridgeFieldMethodIDs, - RCTBridgeFieldParams, - RCTBridgeFieldCallID, -}; - -namespace { - -class GetDescAdapter : public JSExecutorFactory { -public: - GetDescAdapter(RCTCxxBridge *bridge, std::shared_ptr factory) - : bridge_(bridge) - , factory_(factory) {} - std::unique_ptr createJSExecutor( - std::shared_ptr delegate, - std::shared_ptr jsQueue) override { - auto ret = factory_->createJSExecutor(delegate, jsQueue); - bridge_.bridgeDescription = - [NSString stringWithFormat:@"RCTCxxBridge %s", - ret->getDescription().c_str()]; - return std::move(ret); - } - -private: - RCTCxxBridge *bridge_; - std::shared_ptr factory_; -}; - -} - -static bool isRAMBundle(NSData *script) { - BundleHeader header; - [script getBytes:&header length:sizeof(header)]; - return parseTypeFromHeader(header) == ScriptTag::RAMBundle; -} - -static void registerPerformanceLoggerHooks(RCTPerformanceLogger *performanceLogger) { - __weak RCTPerformanceLogger *weakPerformanceLogger = performanceLogger; - ReactMarker::logTaggedMarker = [weakPerformanceLogger](const ReactMarker::ReactMarkerId markerId, const char *tag) { - switch (markerId) { - case ReactMarker::RUN_JS_BUNDLE_START: - [weakPerformanceLogger markStartForTag:RCTPLScriptExecution]; - break; - case ReactMarker::RUN_JS_BUNDLE_STOP: - [weakPerformanceLogger markStopForTag:RCTPLScriptExecution]; - break; - case ReactMarker::NATIVE_REQUIRE_START: - [weakPerformanceLogger appendStartForTag:RCTPLRAMNativeRequires]; - break; - case ReactMarker::NATIVE_REQUIRE_STOP: - [weakPerformanceLogger appendStopForTag:RCTPLRAMNativeRequires]; - [weakPerformanceLogger addValue:1 forTag:RCTPLRAMNativeRequiresCount]; - break; - case ReactMarker::CREATE_REACT_CONTEXT_STOP: - case ReactMarker::JS_BUNDLE_STRING_CONVERT_START: - case ReactMarker::JS_BUNDLE_STRING_CONVERT_STOP: - case ReactMarker::NATIVE_MODULE_SETUP_START: - case ReactMarker::NATIVE_MODULE_SETUP_STOP: - case ReactMarker::REGISTER_JS_SEGMENT_START: - case ReactMarker::REGISTER_JS_SEGMENT_STOP: - // These are not used on iOS. - break; - } - }; -} - -@interface RCTCxxBridge () - -@property (nonatomic, weak, readonly) RCTBridge *parentBridge; -@property (nonatomic, assign, readonly) BOOL moduleSetupComplete; - -- (instancetype)initWithParentBridge:(RCTBridge *)bridge; -- (void)partialBatchDidFlush; -- (void)batchDidComplete; - -@end - -struct RCTInstanceCallback : public InstanceCallback { - __weak RCTCxxBridge *bridge_; - RCTInstanceCallback(RCTCxxBridge *bridge): bridge_(bridge) {}; - void onBatchComplete() override { - // There's no interface to call this per partial batch - [bridge_ partialBatchDidFlush]; - [bridge_ batchDidComplete]; - } -}; - -@implementation RCTCxxBridge -{ - BOOL _didInvalidate; - BOOL _moduleRegistryCreated; - - NSMutableArray *_pendingCalls; - std::atomic _pendingCount; - - // Native modules - NSMutableDictionary *_moduleDataByName; - NSMutableArray *_moduleDataByID; - NSMutableArray *_moduleClassesByID; - NSUInteger _modulesInitializedOnMainQueue; - RCTDisplayLink *_displayLink; - - // JS thread management - NSThread *_jsThread; - std::shared_ptr _jsMessageThread; - std::mutex _moduleRegistryLock; - - // This is uniquely owned, but weak_ptr is used. - std::shared_ptr _reactInstance; - - // Necessary for searching in TurboModuleRegistry - id _turboModuleLookupDelegate; -} - -@synthesize bridgeDescription = _bridgeDescription; -@synthesize loading = _loading; -@synthesize performanceLogger = _performanceLogger; -@synthesize valid = _valid; - -- (void) setRCTTurboModuleLookupDelegate:(id)turboModuleLookupDelegate -{ - _turboModuleLookupDelegate = turboModuleLookupDelegate; -} - -- (std::shared_ptr)jsMessageThread -{ - return _jsMessageThread; -} - -- (BOOL)isInspectable -{ - return _reactInstance ? _reactInstance->isInspectable() : NO; -} - -- (instancetype)initWithParentBridge:(RCTBridge *)bridge -{ - RCTAssertParam(bridge); - - if ((self = [super initWithDelegate:bridge.delegate - bundleURL:bridge.bundleURL - moduleProvider:bridge.moduleProvider - launchOptions:bridge.launchOptions])) { - _parentBridge = bridge; - _performanceLogger = [bridge performanceLogger]; - - registerPerformanceLoggerHooks(_performanceLogger); - - RCTLogInfo(@"Initializing %@ (parent: %@, executor: %@)", self, bridge, [self executorClass]); - - /** - * Set Initial State - */ - _valid = YES; - _loading = YES; - _moduleRegistryCreated = NO; - _pendingCalls = [NSMutableArray new]; - _displayLink = [RCTDisplayLink new]; - _moduleDataByName = [NSMutableDictionary new]; - _moduleClassesByID = [NSMutableArray new]; - _moduleDataByID = [NSMutableArray new]; - - [RCTBridge setCurrentBridge:self]; - } - return self; -} - -+ (void)runRunLoop -{ - @autoreleasepool { - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[RCTCxxBridge runJSRunLoop] setup", nil); - - // copy thread name to pthread name - pthread_setname_np([NSThread currentThread].name.UTF8String); - - // Set up a dummy runloop source to avoid spinning - CFRunLoopSourceContext noSpinCtx = {0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; - CFRunLoopSourceRef noSpinSource = CFRunLoopSourceCreate(NULL, 0, &noSpinCtx); - CFRunLoopAddSource(CFRunLoopGetCurrent(), noSpinSource, kCFRunLoopDefaultMode); - CFRelease(noSpinSource); - - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - - // run the run loop - while (kCFRunLoopRunStopped != CFRunLoopRunInMode(kCFRunLoopDefaultMode, ((NSDate *)[NSDate distantFuture]).timeIntervalSinceReferenceDate, NO)) { - RCTAssert(NO, @"not reached assertion"); // runloop spun. that's bad. - } - } -} - -- (void)_tryAndHandleError:(dispatch_block_t)block -{ - NSError *error = tryAndReturnError(block); - if (error) { - [self handleError:error]; - } -} - -/** - * Ensure block is run on the JS thread. If we're already on the JS thread, the block will execute synchronously. - * If we're not on the JS thread, the block is dispatched to that thread. Any errors encountered while executing - * the block will go through handleError: - */ -- (void)ensureOnJavaScriptThread:(dispatch_block_t)block -{ - RCTAssert(_jsThread, @"This method must not be called before the JS thread is created"); - - // This does not use _jsMessageThread because it may be called early before the runloop reference is captured - // and _jsMessageThread is valid. _jsMessageThread also doesn't allow us to shortcut the dispatch if we're - // already on the correct thread. - - if ([NSThread currentThread] == _jsThread) { - [self _tryAndHandleError:block]; - } else { - [self performSelector:@selector(_tryAndHandleError:) - onThread:_jsThread - withObject:block - waitUntilDone:NO]; - } -} - -- (void)start -{ - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[RCTCxxBridge start]", nil); - - [[NSNotificationCenter defaultCenter] - postNotificationName:RCTJavaScriptWillStartLoadingNotification - object:_parentBridge userInfo:@{@"bridge": self}]; - - // Set up the JS thread early - _jsThread = [[NSThread alloc] initWithTarget:[self class] - selector:@selector(runRunLoop) - object:nil]; - _jsThread.name = RCTJSThreadName; - _jsThread.qualityOfService = NSOperationQualityOfServiceUserInteractive; -#if RCT_DEBUG - _jsThread.stackSize *= 2; -#endif - [_jsThread start]; - - dispatch_group_t prepareBridge = dispatch_group_create(); - - [_performanceLogger markStartForTag:RCTPLNativeModuleInit]; - - [self registerExtraModules]; - // Initialize all native modules that cannot be loaded lazily - (void)[self _initializeModules:RCTGetModuleClasses() withDispatchGroup:prepareBridge lazilyDiscovered:NO]; - [self registerExtraLazyModules]; - - [_performanceLogger markStopForTag:RCTPLNativeModuleInit]; - - // This doesn't really do anything. The real work happens in initializeBridge. - _reactInstance.reset(new Instance); - - __weak RCTCxxBridge *weakSelf = self; - - // Prepare executor factory (shared_ptr for copy into block) - std::shared_ptr executorFactory; - if (!self.executorClass) { - if ([self.delegate conformsToProtocol:@protocol(RCTCxxBridgeDelegate)]) { - id cxxDelegate = (id) self.delegate; - executorFactory = [cxxDelegate jsExecutorFactoryForBridge:self]; - } - if (!executorFactory) { - executorFactory = std::make_shared(nullptr); - } - } else { - id objcExecutor = [self moduleForClass:self.executorClass]; - executorFactory.reset(new RCTObjcExecutorFactory(objcExecutor, ^(NSError *error) { - if (error) { - [weakSelf handleError:error]; - } - })); - } - - // Dispatch the instance initialization as soon as the initial module metadata has - // been collected (see initModules) - dispatch_group_enter(prepareBridge); - [self ensureOnJavaScriptThread:^{ - [weakSelf _initializeBridge:executorFactory]; - dispatch_group_leave(prepareBridge); - }]; - - // Load the source asynchronously, then store it for later execution. - dispatch_group_enter(prepareBridge); - __block NSData *sourceCode; - [self loadSource:^(NSError *error, RCTSource *source) { - if (error) { - [weakSelf handleError:error]; - } - - sourceCode = source.data; - dispatch_group_leave(prepareBridge); - } onProgress:^(RCTLoadingProgress *progressData) { -#if RCT_DEV && __has_include("RCTDevLoadingView.h") - // Note: RCTDevLoadingView should have been loaded at this point, so no need to allow lazy loading. - RCTDevLoadingView *loadingView = [weakSelf moduleForName:RCTBridgeModuleNameForClass([RCTDevLoadingView class]) - lazilyLoadIfNecessary:NO]; - [loadingView updateProgress:progressData]; -#endif - }]; - - // Wait for both the modules and source code to have finished loading - dispatch_group_notify(prepareBridge, dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{ - RCTCxxBridge *strongSelf = weakSelf; - if (sourceCode && strongSelf.loading) { - [strongSelf executeSourceCode:sourceCode sync:NO]; - } - }); - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); -} - -- (void)loadSource:(RCTSourceLoadBlock)_onSourceLoad onProgress:(RCTSourceLoadProgressBlock)onProgress -{ - NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; - [center postNotificationName:RCTBridgeWillDownloadScriptNotification object:_parentBridge]; - [_performanceLogger markStartForTag:RCTPLScriptDownload]; - NSUInteger cookie = RCTProfileBeginAsyncEvent(0, @"JavaScript download", nil); - - // Suppress a warning if RCTProfileBeginAsyncEvent gets compiled out - (void)cookie; - - RCTPerformanceLogger *performanceLogger = _performanceLogger; - RCTSourceLoadBlock onSourceLoad = ^(NSError *error, RCTSource *source) { - RCTProfileEndAsyncEvent(0, @"native", cookie, @"JavaScript download", @"JS async"); - [performanceLogger markStopForTag:RCTPLScriptDownload]; - [performanceLogger setValue:source.length forTag:RCTPLBundleSize]; - - NSDictionary *userInfo = @{ - RCTBridgeDidDownloadScriptNotificationSourceKey: source ?: [NSNull null], - RCTBridgeDidDownloadScriptNotificationBridgeDescriptionKey: self->_bridgeDescription ?: [NSNull null], - }; - - [center postNotificationName:RCTBridgeDidDownloadScriptNotification object:self->_parentBridge userInfo:userInfo]; - - _onSourceLoad(error, source); - }; - - if ([self.delegate respondsToSelector:@selector(loadSourceForBridge:onProgress:onComplete:)]) { - [self.delegate loadSourceForBridge:_parentBridge onProgress:onProgress onComplete:onSourceLoad]; - } else if ([self.delegate respondsToSelector:@selector(loadSourceForBridge:withBlock:)]) { - [self.delegate loadSourceForBridge:_parentBridge withBlock:onSourceLoad]; - } else if (!self.bundleURL) { - NSError *error = RCTErrorWithMessage(@"No bundle URL present.\n\nMake sure you're running a packager " \ - "server or have included a .jsbundle file in your application bundle."); - onSourceLoad(error, nil); - } else { - [RCTJavaScriptLoader loadBundleAtURL:self.bundleURL onProgress:onProgress onComplete:^(NSError *error, RCTSource *source) { - if (error) { - RCTLogError(@"Failed to load bundle(%@) with error:(%@ %@)", self.bundleURL, error.localizedDescription, error.localizedFailureReason); - return; - } - onSourceLoad(error, source); - }]; - } -} - -- (NSArray *)moduleClasses -{ - if (RCT_DEBUG && _valid && _moduleClassesByID == nil) { - RCTLogError(@"Bridge modules have not yet been initialized. You may be " - "trying to access a module too early in the startup procedure."); - } - return _moduleClassesByID; -} - -/** - * Used by RCTUIManager - */ -- (RCTModuleData *)moduleDataForName:(NSString *)moduleName -{ - return _moduleDataByName[moduleName]; -} - -- (id)moduleForName:(NSString *)moduleName -{ - return [self moduleForName:moduleName lazilyLoadIfNecessary:NO]; -} - -- (id)moduleForName:(NSString *)moduleName lazilyLoadIfNecessary:(BOOL)lazilyLoad -{ - if (RCTTurboModuleEnabled() && _turboModuleLookupDelegate) { - const char* moduleNameCStr = [moduleName UTF8String]; - if (lazilyLoad || [_turboModuleLookupDelegate moduleIsInitialized:moduleNameCStr]) { - id module = [_turboModuleLookupDelegate moduleForName:moduleNameCStr warnOnLookupFailure:NO]; - if (module != nil) { - return module; - } - } - } - - if (!lazilyLoad) { - return _moduleDataByName[moduleName].instance; - } - - RCTModuleData *moduleData = _moduleDataByName[moduleName]; - if (moduleData) { - if (![moduleData isKindOfClass:[RCTModuleData class]]) { - // There is rare race condition where the data stored in the dictionary - // may have been deallocated, which means the module instance is no longer - // usable. - return nil; - } - return moduleData.instance; - } - - // Module may not be loaded yet, so attempt to force load it here. - const BOOL result = [self.delegate respondsToSelector:@selector(bridge:didNotFindModule:)] && - [self.delegate bridge:self didNotFindModule:moduleName]; - if (result) { - // Try again. - moduleData = _moduleDataByName[moduleName]; - } else { - RCTLogError(@"Unable to find module for %@", moduleName); - } - - return moduleData.instance; -} - -- (BOOL)moduleIsInitialized:(Class)moduleClass -{ - NSString* moduleName = RCTBridgeModuleNameForClass(moduleClass); - if (_moduleDataByName[moduleName].hasInstance) { - return YES; - } - - if (_turboModuleLookupDelegate) { - return [_turboModuleLookupDelegate moduleIsInitialized:[moduleName UTF8String]]; - } - - return NO; -} - -- (id)moduleForClass:(Class)moduleClass -{ - return [self moduleForName:RCTBridgeModuleNameForClass(moduleClass) lazilyLoadIfNecessary:YES]; -} - -- (std::shared_ptr)_buildModuleRegistryUnlocked -{ - if (!self.valid) { - return {}; - } - - [_performanceLogger markStartForTag:RCTPLNativeModulePrepareConfig]; - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[RCTCxxBridge buildModuleRegistry]", nil); - - __weak __typeof(self) weakSelf = self; - ModuleRegistry::ModuleNotFoundCallback moduleNotFoundCallback = ^bool(const std::string &name) { - __strong __typeof(weakSelf) strongSelf = weakSelf; - return [strongSelf.delegate respondsToSelector:@selector(bridge:didNotFindModule:)] && - [strongSelf.delegate bridge:strongSelf didNotFindModule:@(name.c_str())]; - }; - - auto registry = std::make_shared( - createNativeModules(_moduleDataByID, self, _reactInstance), - moduleNotFoundCallback); - - [_performanceLogger markStopForTag:RCTPLNativeModulePrepareConfig]; - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - - return registry; -} - -- (void)_initializeBridge:(std::shared_ptr)executorFactory -{ - if (!self.valid) { - return; - } - - RCTAssertJSThread(); - __weak RCTCxxBridge *weakSelf = self; - _jsMessageThread = std::make_shared([NSRunLoop currentRunLoop], ^(NSError *error) { - if (error) { - [weakSelf handleError:error]; - } - }); - - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[RCTCxxBridge initializeBridge:]", nil); - // This can only be false if the bridge was invalidated before startup completed - if (_reactInstance) { -#if RCT_DEV - executorFactory = std::make_shared(self, executorFactory); -#endif - - [self _initializeBridgeLocked:executorFactory]; - -#if RCT_PROFILE - if (RCTProfileIsProfiling()) { - _reactInstance->setGlobalVariable( - "__RCTProfileIsProfiling", - std::make_unique("true")); - } -#endif - } - - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); -} - -- (void)_initializeBridgeLocked:(std::shared_ptr)executorFactory -{ - std::lock_guard guard(_moduleRegistryLock); - - // This is async, but any calls into JS are blocked by the m_syncReady CV in Instance - _reactInstance->initializeBridge( - std::make_unique(self), - executorFactory, - _jsMessageThread, - [self _buildModuleRegistryUnlocked]); - _moduleRegistryCreated = YES; -} - -- (void)updateModuleWithInstance:(id)instance; -{ - NSString *const moduleName = RCTBridgeModuleNameForClass([instance class]); - if (moduleName) { - RCTModuleData *const moduleData = _moduleDataByName[moduleName]; - if (moduleData) { - moduleData.instance = instance; - } - } -} - -- (NSArray *)registerModulesForClasses:(NSArray *)moduleClasses -{ - return [self _registerModulesForClasses:moduleClasses lazilyDiscovered:NO]; -} - -- (NSArray *)_registerModulesForClasses:(NSArray *)moduleClasses - lazilyDiscovered:(BOOL)lazilyDiscovered -{ - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, - @"-[RCTCxxBridge initModulesWithDispatchGroup:] autoexported moduleData", nil); - - NSArray *moduleClassesCopy = [moduleClasses copy]; - NSMutableArray *moduleDataByID = [NSMutableArray arrayWithCapacity:moduleClassesCopy.count]; - for (Class moduleClass in moduleClassesCopy) { - if (RCTTurboModuleEnabled() && [moduleClass conformsToProtocol:@protocol(RCTTurboModule)]) { - continue; - } - NSString *moduleName = RCTBridgeModuleNameForClass(moduleClass); - - // Check for module name collisions - RCTModuleData *moduleData = _moduleDataByName[moduleName]; - if (moduleData) { - if (moduleData.hasInstance || lazilyDiscovered) { - // Existing module was preregistered, so it takes precedence - continue; - } else if ([moduleClass new] == nil) { - // The new module returned nil from init, so use the old module - continue; - } else if ([moduleData.moduleClass new] != nil) { - // Both modules were non-nil, so it's unclear which should take precedence - RCTLogError(@"Attempted to register RCTBridgeModule class %@ for the " - "name '%@', but name was already registered by class %@", - moduleClass, moduleName, moduleData.moduleClass); - } - } - - // Instantiate moduleData - // TODO #13258411: can we defer this until config generation? - moduleData = [[RCTModuleData alloc] initWithModuleClass:moduleClass bridge:self]; - - _moduleDataByName[moduleName] = moduleData; - [_moduleClassesByID addObject:moduleClass]; - [moduleDataByID addObject:moduleData]; - } - [_moduleDataByID addObjectsFromArray:moduleDataByID]; - - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - - return moduleDataByID; -} - -- (void)registerExtraModules -{ - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, - @"-[RCTCxxBridge initModulesWithDispatchGroup:] extraModules", nil); - - NSArray> *extraModules = nil; - if ([self.delegate respondsToSelector:@selector(extraModulesForBridge:)]) { - extraModules = [self.delegate extraModulesForBridge:_parentBridge]; - } else if (self.moduleProvider) { - extraModules = self.moduleProvider(); - } - - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - -#if RCT_DEBUG - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - RCTVerifyAllModulesExported(extraModules); - }); -#endif - - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, - @"-[RCTCxxBridge initModulesWithDispatchGroup:] preinitialized moduleData", nil); - // Set up moduleData for pre-initialized module instances - for (id module in extraModules) { - Class moduleClass = [module class]; - NSString *moduleName = RCTBridgeModuleNameForClass(moduleClass); - - if (RCT_DEBUG) { - // Check for name collisions between preregistered modules - RCTModuleData *moduleData = _moduleDataByName[moduleName]; - if (moduleData) { - RCTLogError(@"Attempted to register RCTBridgeModule class %@ for the " - "name '%@', but name was already registered by class %@", - moduleClass, moduleName, moduleData.moduleClass); - continue; - } - } - - if (RCTTurboModuleEnabled() && [module conformsToProtocol:@protocol(RCTTurboModule)]) { -#if RCT_DEBUG - // TODO: don't ask for extra module for when TurboModule is enabled. - RCTLogError(@"NativeModule '%@' was marked as TurboModule, but provided as an extra NativeModule " - "by the class '%@', ignoring.", - moduleName, moduleClass); -#endif - continue; - } - - // Instantiate moduleData container - RCTModuleData *moduleData = [[RCTModuleData alloc] initWithModuleInstance:module bridge:self]; - _moduleDataByName[moduleName] = moduleData; - [_moduleClassesByID addObject:moduleClass]; - [_moduleDataByID addObject:moduleData]; - } - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); -} - -- (void)registerExtraLazyModules -{ -#if RCT_DEBUG - // This is debug-only and only when Chrome is attached, since it expects all modules to be already - // available on start up. Otherwise, we can let the lazy module discovery to load them on demand. - Class executorClass = [_parentBridge executorClass]; - if (executorClass && [NSStringFromClass(executorClass) isEqualToString:@"RCTWebSocketExecutor"]) { - NSDictionary *moduleClasses = nil; - if ([self.delegate respondsToSelector:@selector(extraLazyModuleClassesForBridge:)]) { - moduleClasses = [self.delegate extraLazyModuleClassesForBridge:_parentBridge]; - } - - if (!moduleClasses) { - return; - } - - // This logic is mostly copied from `registerModulesForClasses:`, but with one difference: - // we must use the names provided by the delegate method here. - for (NSString *moduleName in moduleClasses) { - Class moduleClass = moduleClasses[moduleName]; - if (RCTTurboModuleEnabled() && [moduleClass conformsToProtocol:@protocol(RCTTurboModule)]) { - continue; - } - - // Check for module name collisions - RCTModuleData *moduleData = _moduleDataByName[moduleName]; - if (moduleData) { - if (moduleData.hasInstance) { - // Existing module was preregistered, so it takes precedence - continue; - } else if ([moduleClass new] == nil) { - // The new module returned nil from init, so use the old module - continue; - } else if ([moduleData.moduleClass new] != nil) { - // Use existing module since it was already loaded but not yet instantiated. - continue; - } - } - - moduleData = [[RCTModuleData alloc] initWithModuleClass:moduleClass bridge:self]; - - _moduleDataByName[moduleName] = moduleData; - [_moduleClassesByID addObject:moduleClass]; - [_moduleDataByID addObject:moduleData]; - } - } -#endif -} - -- (NSArray *)_initializeModules:(NSArray> *)modules - withDispatchGroup:(dispatch_group_t)dispatchGroup - lazilyDiscovered:(BOOL)lazilyDiscovered -{ - // Set up moduleData for automatically-exported modules - NSArray *moduleDataById = [self _registerModulesForClasses:modules lazilyDiscovered:lazilyDiscovered]; - - if (lazilyDiscovered) { -#if RCT_DEBUG - // Lazily discovered modules do not require instantiation here, - // as they are not allowed to have pre-instantiated instance - // and must not require the main queue. - for (RCTModuleData *moduleData in moduleDataById) { - RCTAssert(!(moduleData.requiresMainQueueSetup || moduleData.hasInstance), - @"Module \'%@\' requires initialization on the Main Queue or has pre-instantiated, which is not supported for the lazily discovered modules.", moduleData.name); - } -#endif - } else { - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, - @"-[RCTCxxBridge initModulesWithDispatchGroup:] moduleData.hasInstance", nil); - // Dispatch module init onto main thread for those modules that require it - // For non-lazily discovered modules we run through the entire set of modules - // that we have, otherwise some modules coming from the delegate - // or module provider block, will not be properly instantiated. - for (RCTModuleData *moduleData in _moduleDataByID) { - if (moduleData.hasInstance && (!moduleData.requiresMainQueueSetup || RCTIsMainQueue())) { - // Modules that were pre-initialized should ideally be set up before - // bridge init has finished, otherwise the caller may try to access the - // module directly rather than via `[bridge moduleForClass:]`, which won't - // trigger the lazy initialization process. If the module cannot safely be - // set up on the current thread, it will instead be async dispatched - // to the main thread to be set up in _prepareModulesWithDispatchGroup:. - (void)[moduleData instance]; - } - } - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - - // From this point on, RCTDidInitializeModuleNotification notifications will - // be sent the first time a module is accessed. - _moduleSetupComplete = YES; - [self _prepareModulesWithDispatchGroup:dispatchGroup]; - } - -#if RCT_PROFILE - if (RCTProfileIsProfiling()) { - // Depends on moduleDataByID being loaded - RCTProfileHookModules(self); - } -#endif - return moduleDataById; -} - -- (void)registerAdditionalModuleClasses:(NSArray *)modules -{ - std::lock_guard guard(_moduleRegistryLock); - if (_moduleRegistryCreated) { - NSArray *newModules = [self _initializeModules:modules withDispatchGroup:NULL lazilyDiscovered:YES]; - assert(_reactInstance); // at this point you must have reactInstance as you already called reactInstance->initialzeBridge - _reactInstance->getModuleRegistry().registerModules(createNativeModules(newModules, self, _reactInstance)); - } else { - [self registerModulesForClasses:modules]; - } -} - -- (void)_prepareModulesWithDispatchGroup:(dispatch_group_t)dispatchGroup -{ - RCT_PROFILE_BEGIN_EVENT(0, @"-[RCTCxxBridge _prepareModulesWithDispatchGroup]", nil); - - BOOL initializeImmediately = NO; - if (dispatchGroup == NULL) { - // If no dispatchGroup is passed in, we must prepare everything immediately. - // We better be on the right thread too. - RCTAssertMainQueue(); - initializeImmediately = YES; - } - - // Set up modules that require main thread init or constants export - [_performanceLogger setValue:0 forTag:RCTPLNativeModuleMainThread]; - - for (RCTModuleData *moduleData in _moduleDataByID) { - if (moduleData.requiresMainQueueSetup) { - // Modules that need to be set up on the main thread cannot be initialized - // lazily when required without doing a dispatch_sync to the main thread, - // which can result in deadlock. To avoid this, we initialize all of these - // modules on the main thread in parallel with loading the JS code, so - // they will already be available before they are ever required. - dispatch_block_t block = ^{ - if (self.valid && ![moduleData.moduleClass isSubclassOfClass:[RCTCxxModule class]]) { - [self->_performanceLogger appendStartForTag:RCTPLNativeModuleMainThread]; - (void)[moduleData instance]; - [moduleData gatherConstants]; - [self->_performanceLogger appendStopForTag:RCTPLNativeModuleMainThread]; - } - }; - - if (initializeImmediately && RCTIsMainQueue()) { - block(); - } else { - // We've already checked that dispatchGroup is non-null, but this satisifies the - // Xcode analyzer - if (dispatchGroup) { - dispatch_group_async(dispatchGroup, dispatch_get_main_queue(), block); - } - } - _modulesInitializedOnMainQueue++; - } - } - [_performanceLogger setValue:_modulesInitializedOnMainQueue forTag:RCTPLNativeModuleMainThreadUsesCount]; - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); -} - -- (void)registerModuleForFrameUpdates:(id)module - withModuleData:(RCTModuleData *)moduleData -{ - [_displayLink registerModuleForFrameUpdates:module withModuleData:moduleData]; -} - -- (void)executeSourceCode:(NSData *)sourceCode sync:(BOOL)sync -{ - // This will get called from whatever thread was actually executing JS. - dispatch_block_t completion = ^{ - // Log start up metrics early before processing any other js calls - [self logStartupFinish]; - // Flush pending calls immediately so we preserve ordering - [self _flushPendingCalls]; - - // Perform the state update and notification on the main thread, so we can't run into - // timing issues with RCTRootView - dispatch_async(dispatch_get_main_queue(), ^{ - [[NSNotificationCenter defaultCenter] - postNotificationName:RCTJavaScriptDidLoadNotification - object:self->_parentBridge userInfo:@{@"bridge": self}]; - - // Starting the display link is not critical to startup, so do it last - [self ensureOnJavaScriptThread:^{ - // Register the display link to start sending js calls after everything is setup - [self->_displayLink addToRunLoop:[NSRunLoop currentRunLoop]]; - }]; - }); - }; - - if (sync) { - [self executeApplicationScriptSync:sourceCode url:self.bundleURL]; - completion(); - } else { - [self enqueueApplicationScript:sourceCode url:self.bundleURL onComplete:completion]; - } - -#if RCT_DEV - if (self.devSettings.isHotLoadingAvailable && self.devSettings.isHotLoadingEnabled) { - NSString *path = [self.bundleURL.path substringFromIndex:1]; // strip initial slash - NSString *host = self.bundleURL.host; - NSNumber *port = self.bundleURL.port; - [self enqueueJSCall:@"HMRClient" - method:@"enable" - args:@[@"ios", path, host, RCTNullIfNil(port)] - completion:NULL]; } -#endif -} - -- (void)handleError:(NSError *)error -{ - // This is generally called when the infrastructure throws an - // exception while calling JS. Most product exceptions will not go - // through this method, but through RCTExceptionManager. - - // There are three possible states: - // 1. initializing == _valid && _loading - // 2. initializing/loading finished (success or failure) == _valid && !_loading - // 3. invalidated == !_valid && !_loading - - // !_valid && _loading can't happen. - - // In state 1: on main queue, move to state 2, reset the bridge, and RCTFatal. - // In state 2: go directly to RCTFatal. Do not enqueue, do not collect $200. - // In state 3: do nothing. - - if (self->_valid && !self->_loading) { - if ([error userInfo][RCTJSRawStackTraceKey]) { - [self.redBox showErrorMessage:[error localizedDescription] - withRawStack:[error userInfo][RCTJSRawStackTraceKey]]; - } - - RCTFatal(error); - - // RN will stop, but let the rest of the app keep going. - return; - } - - if (!_valid || !_loading) { - return; - } - - // Hack: once the bridge is invalidated below, it won't initialize any new native - // modules. Initialize the redbox module now so we can still report this error. - RCTRedBox *redBox = [self redBox]; - - _loading = NO; - _valid = NO; - _moduleRegistryCreated = NO; - - dispatch_async(dispatch_get_main_queue(), ^{ - if (self->_jsMessageThread) { - // Make sure initializeBridge completed - self->_jsMessageThread->runOnQueueSync([] {}); - } - - self->_reactInstance.reset(); - self->_jsMessageThread.reset(); - - [[NSNotificationCenter defaultCenter] - postNotificationName:RCTJavaScriptDidFailToLoadNotification - object:self->_parentBridge userInfo:@{@"bridge": self, @"error": error}]; - - if ([error userInfo][RCTJSRawStackTraceKey]) { - [redBox showErrorMessage:[error localizedDescription] - withRawStack:[error userInfo][RCTJSRawStackTraceKey]]; - } - - RCTFatal(error); - }); -} - -RCT_NOT_IMPLEMENTED(- (instancetype)initWithDelegate:(__unused id)delegate - bundleURL:(__unused NSURL *)bundleURL - moduleProvider:(__unused RCTBridgeModuleListProvider)block - launchOptions:(__unused NSDictionary *)launchOptions) - -RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleURL - moduleProvider:(__unused RCTBridgeModuleListProvider)block - launchOptions:(__unused NSDictionary *)launchOptions) - -/** - * Prevent super from calling setUp (that'd create another batchedBridge) - */ -- (void)setUp {} - -- (void)reload -{ - if (!_valid) { - RCTLogError(@"Attempting to reload bridge before it's valid: %@. Try restarting the development server if connected.", self); - } - [_parentBridge reload]; -} - -- (Class)executorClass -{ - return _parentBridge.executorClass; -} - -- (void)setExecutorClass:(Class)executorClass -{ - RCTAssertMainQueue(); - - _parentBridge.executorClass = executorClass; -} - -- (NSURL *)bundleURL -{ - return _parentBridge.bundleURL; -} - -- (void)setBundleURL:(NSURL *)bundleURL -{ - _parentBridge.bundleURL = bundleURL; -} - -- (id)delegate -{ - return _parentBridge.delegate; -} - -- (void)dispatchBlock:(dispatch_block_t)block - queue:(dispatch_queue_t)queue -{ - if (queue == RCTJSThread) { - [self ensureOnJavaScriptThread:block]; - } else if (queue) { - dispatch_async(queue, block); - } -} - -#pragma mark - RCTInvalidating - -- (void)invalidate -{ - if (_didInvalidate) { - return; - } - - RCTAssertMainQueue(); - RCTLogInfo(@"Invalidating %@ (parent: %@, executor: %@)", self, _parentBridge, [self executorClass]); - - _loading = NO; - _valid = NO; - _didInvalidate = YES; - _moduleRegistryCreated = NO; - - if ([RCTBridge currentBridge] == self) { - [RCTBridge setCurrentBridge:nil]; - } - - // Stop JS instance and message thread - [self ensureOnJavaScriptThread:^{ - [self->_displayLink invalidate]; - self->_displayLink = nil; - - if (RCTProfileIsProfiling()) { - RCTProfileUnhookModules(self); - } - - // Invalidate modules - // We're on the JS thread (which we'll be suspending soon), so no new calls will be made to native modules after - // this completes. We must ensure all previous calls were dispatched before deallocating the instance (and module - // wrappers) or we may have invalid pointers still in flight. - dispatch_group_t moduleInvalidation = dispatch_group_create(); - for (RCTModuleData *moduleData in self->_moduleDataByID) { - // Be careful when grabbing an instance here, we don't want to instantiate - // any modules just to invalidate them. - if (![moduleData hasInstance]) { - continue; - } - - if ([moduleData.instance respondsToSelector:@selector(invalidate)]) { - dispatch_group_enter(moduleInvalidation); - [self dispatchBlock:^{ - [(id)moduleData.instance invalidate]; - dispatch_group_leave(moduleInvalidation); - } queue:moduleData.methodQueue]; - } - [moduleData invalidate]; - } - - if (dispatch_group_wait(moduleInvalidation, dispatch_time(DISPATCH_TIME_NOW, 10 * NSEC_PER_SEC))) { - RCTLogError(@"Timed out waiting for modules to be invalidated"); - } - - self->_reactInstance.reset(); - self->_jsMessageThread.reset(); - - self->_moduleDataByName = nil; - self->_moduleDataByID = nil; - self->_moduleClassesByID = nil; - self->_pendingCalls = nil; - - [self->_jsThread cancel]; - self->_jsThread = nil; - CFRunLoopStop(CFRunLoopGetCurrent()); - }]; -} - -- (void)logMessage:(NSString *)message level:(NSString *)level -{ - if (RCT_DEBUG && _valid) { - [self enqueueJSCall:@"RCTLog" - method:@"logIfNoNativeHook" - args:@[level, message] - completion:NULL]; - } -} - -#pragma mark - RCTBridge methods - -- (void)_runAfterLoad:(RCTPendingCall)block -{ - // Ordering here is tricky. Ideally, the C++ bridge would provide - // functionality to defer calls until after the app is loaded. Until that - // happens, we do this. _pendingCount keeps a count of blocks which have - // been deferred. It is incremented using an atomic barrier call before each - // block is added to the js queue, and decremented using an atomic barrier - // call after the block is executed. If _pendingCount is zero, there is no - // work either in the js queue, or in _pendingCalls, so it is safe to add new - // work to the JS queue directly. - - if (self.loading || _pendingCount > 0) { - // From the callers' perspecive: - - // Phase 1: jsQueueBlocks are added to the queue; _pendingCount is - // incremented for each. If the first block is created after self.loading is - // true, phase 1 will be nothing. - _pendingCount++; - dispatch_block_t jsQueueBlock = ^{ - // From the perspective of the JS queue: - if (self.loading) { - // Phase A: jsQueueBlocks are executed. self.loading is true, so they - // are added to _pendingCalls. - [self->_pendingCalls addObject:block]; - } else { - // Phase C: More jsQueueBlocks are executed. self.loading is false, so - // each block is executed, adding work to the queue, and _pendingCount is - // decremented. - block(); - self->_pendingCount--; - } - }; - [self ensureOnJavaScriptThread:jsQueueBlock]; - } else { - // Phase 2/Phase D: blocks are executed directly, adding work to the JS queue. - block(); - } -} - -- (void)logStartupFinish -{ - // Log metrics about native requires during the bridge startup. - uint64_t nativeRequiresCount = [_performanceLogger valueForTag:RCTPLRAMNativeRequiresCount]; - [_performanceLogger setValue:nativeRequiresCount forTag:RCTPLRAMStartupNativeRequiresCount]; - uint64_t nativeRequires = [_performanceLogger valueForTag:RCTPLRAMNativeRequires]; - [_performanceLogger setValue:nativeRequires forTag:RCTPLRAMStartupNativeRequires]; - - [_performanceLogger markStopForTag:RCTPLBridgeStartup]; -} - -- (void)_flushPendingCalls -{ - RCT_PROFILE_BEGIN_EVENT(0, @"Processing pendingCalls", @{ @"count": [@(_pendingCalls.count) stringValue] }); - // Phase B: _flushPendingCalls happens. Each block in _pendingCalls is - // executed, adding work to the queue, and _pendingCount is decremented. - // loading is set to NO. - NSArray *pendingCalls = _pendingCalls; - _pendingCalls = nil; - for (RCTPendingCall call in pendingCalls) { - call(); - _pendingCount--; - } - _loading = NO; - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); -} - -/** - * Public. Can be invoked from any thread. - */ -- (void)enqueueJSCall:(NSString *)module method:(NSString *)method args:(NSArray *)args completion:(dispatch_block_t)completion -{ - if (!self.valid) { - return; - } - - /** - * AnyThread - */ - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[RCTCxxBridge enqueueJSCall:]", nil); - - RCTProfileBeginFlowEvent(); - __weak __typeof(self) weakSelf = self; - [self _runAfterLoad:^(){ - RCTProfileEndFlowEvent(); - __strong __typeof(weakSelf) strongSelf = weakSelf; - if (!strongSelf) { - return; - } - - if (strongSelf->_reactInstance) { - strongSelf->_reactInstance->callJSFunction([module UTF8String], [method UTF8String], - convertIdToFollyDynamic(args ?: @[])); - - // ensureOnJavaScriptThread may execute immediately, so use jsMessageThread, to make sure - // the block is invoked after callJSFunction - if (completion) { - if (strongSelf->_jsMessageThread) { - strongSelf->_jsMessageThread->runOnQueue(completion); - } else { - RCTLogWarn(@"Can't invoke completion without messageThread"); - } - } - } - }]; - - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); -} - -/** - * Called by RCTModuleMethod from any thread. - */ -- (void)enqueueCallback:(NSNumber *)cbID args:(NSArray *)args -{ - if (!self.valid) { - return; - } - - /** - * AnyThread - */ - - RCTProfileBeginFlowEvent(); - __weak __typeof(self) weakSelf = self; - [self _runAfterLoad:^(){ - RCTProfileEndFlowEvent(); - __strong __typeof(weakSelf) strongSelf = weakSelf; - if (!strongSelf) { - return; - } - - if (strongSelf->_reactInstance) { - strongSelf->_reactInstance->callJSCallback([cbID unsignedLongLongValue], convertIdToFollyDynamic(args ?: @[])); - } - }]; -} - -/** - * Private hack to support `setTimeout(fn, 0)` - */ -- (void)_immediatelyCallTimer:(NSNumber *)timer -{ - RCTAssertJSThread(); - - if (_reactInstance) { - _reactInstance->callJSFunction("JSTimers", "callTimers", - folly::dynamic::array(folly::dynamic::array([timer doubleValue]))); - } -} - -- (void)enqueueApplicationScript:(NSData *)script - url:(NSURL *)url - onComplete:(dispatch_block_t)onComplete -{ - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[RCTCxxBridge enqueueApplicationScript]", nil); - - [self executeApplicationScript:script url:url async:YES]; - - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - - // Assumes that onComplete can be called when the next block on the JS thread is scheduled - if (onComplete) { - RCTAssert(_jsMessageThread != nullptr, @"Cannot invoke completion without jsMessageThread"); - _jsMessageThread->runOnQueue(onComplete); - } -} - -- (void)executeApplicationScriptSync:(NSData *)script url:(NSURL *)url -{ - [self executeApplicationScript:script url:url async:NO]; -} - -- (void)executeApplicationScript:(NSData *)script - url:(NSURL *)url - async:(BOOL)async -{ - [self _tryAndHandleError:^{ - NSString *sourceUrlStr = deriveSourceURL(url); - [[NSNotificationCenter defaultCenter] - postNotificationName:RCTJavaScriptWillStartExecutingNotification - object:self->_parentBridge userInfo:@{@"bridge": self}]; - if (isRAMBundle(script)) { - [self->_performanceLogger markStartForTag:RCTPLRAMBundleLoad]; - auto ramBundle = std::make_unique(sourceUrlStr.UTF8String); - std::unique_ptr scriptStr = ramBundle->getStartupCode(); - [self->_performanceLogger markStopForTag:RCTPLRAMBundleLoad]; - [self->_performanceLogger setValue:scriptStr->size() forTag:RCTPLRAMStartupCodeSize]; - if (self->_reactInstance) { - auto registry = RAMBundleRegistry::multipleBundlesRegistry(std::move(ramBundle), JSIndexedRAMBundle::buildFactory()); - self->_reactInstance->loadRAMBundle(std::move(registry), std::move(scriptStr), - sourceUrlStr.UTF8String, !async); - } - } else if (self->_reactInstance) { - self->_reactInstance->loadScriptFromString(std::make_unique(script), - sourceUrlStr.UTF8String, !async); - } else { - std::string methodName = async ? "loadApplicationScript" : "loadApplicationScriptSync"; - throw std::logic_error("Attempt to call " + methodName + ": on uninitialized bridge"); - } - }]; -} - -- (void)registerSegmentWithId:(NSUInteger)segmentId path:(NSString *)path -{ - if (_reactInstance) { - _reactInstance->registerBundle(static_cast(segmentId), path.UTF8String); - } -} - -#pragma mark - Payload Processing - -- (void)partialBatchDidFlush -{ - for (RCTModuleData *moduleData in _moduleDataByID) { - if (moduleData.implementsPartialBatchDidFlush) { - [self dispatchBlock:^{ - [moduleData.instance partialBatchDidFlush]; - } queue:moduleData.methodQueue]; - } - } -} - -- (void)batchDidComplete -{ - // TODO #12592471: batchDidComplete is only used by RCTUIManager, - // can we eliminate this special case? - for (RCTModuleData *moduleData in _moduleDataByID) { - if (moduleData.implementsBatchDidComplete) { - [self dispatchBlock:^{ - [moduleData.instance batchDidComplete]; - } queue:moduleData.methodQueue]; - } - } -} - -- (void)startProfiling -{ - RCTAssertMainQueue(); - - [self ensureOnJavaScriptThread:^{ - #if WITH_FBSYSTRACE - [RCTFBSystrace registerCallbacks]; - #endif - RCTProfileInit(self); - - [self enqueueJSCall:@"Systrace" method:@"setEnabled" args:@[@YES] completion:NULL]; - }]; -} - -- (void)stopProfiling:(void (^)(NSData *))callback -{ - RCTAssertMainQueue(); - - [self ensureOnJavaScriptThread:^{ - [self enqueueJSCall:@"Systrace" method:@"setEnabled" args:@[@NO] completion:NULL]; - RCTProfileEnd(self, ^(NSString *log) { - NSData *logData = [log dataUsingEncoding:NSUTF8StringEncoding]; - callback(logData); - #if WITH_FBSYSTRACE - if (![RCTFBSystrace verifyTraceSize:logData.length]) { - RCTLogWarn(@"Your FBSystrace trace might be truncated, try to bump up the buffer size" - " in RCTFBSystrace.m or capture a shorter trace"); - } - [RCTFBSystrace unregisterCallbacks]; - #endif - }); - }]; -} - -- (BOOL)isBatchActive -{ - return _reactInstance ? _reactInstance->isBatchActive() : NO; -} - -- (void *)runtime -{ - if (!_reactInstance) { - return nullptr; - } - - return _reactInstance->getJavaScriptContext(); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/RCTCxxBridgeDelegate.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/RCTCxxBridgeDelegate.h deleted file mode 100644 index cc75608b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/RCTCxxBridgeDelegate.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#import - -namespace facebook { -namespace react { - -class JSExecutorFactory; - -} -} - -// This is a separate class so non-C++ implementations don't need to -// take a C++ dependency. - -@protocol RCTCxxBridgeDelegate - -/** - * In the RCTCxxBridge, if this method is implemented, return a - * ExecutorFactory instance which can be used to create the executor. - * If not implemented, or returns an empty pointer, JSIExecutorFactory - * will be used with a JSCRuntime. - */ -- (std::unique_ptr)jsExecutorFactoryForBridge:(RCTBridge *)bridge; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/RCTMessageThread.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/RCTMessageThread.h deleted file mode 100644 index 1e1f8cd2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/RCTMessageThread.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#import -#import - -namespace facebook { -namespace react { - -class RCTMessageThread : public MessageQueueThread { - public: - RCTMessageThread(NSRunLoop *runLoop, RCTJavaScriptCompleteBlock errorBlock); - ~RCTMessageThread() override; - void runOnQueue(std::function&&) override; - void runOnQueueSync(std::function&&) override; - void quitSynchronous() override; - void setRunLoop(NSRunLoop *runLoop); - - private: - void tryFunc(const std::function& func); - void runAsync(std::function func); - void runSync(std::function func); - - CFRunLoopRef m_cfRunLoop; - RCTJavaScriptCompleteBlock m_errorBlock; - std::atomic_bool m_shutdown; -}; - -} -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/RCTMessageThread.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/RCTMessageThread.mm deleted file mode 100644 index 5017bbb4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/RCTMessageThread.mm +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "RCTMessageThread.h" - -#include -#include - -#import -#import - -// A note about the implementation: This class is not used -// generically. It's a thin wrapper around a run loop which -// implements a C++ interface, for use by the C++ xplat bridge code. -// This means it can make certain non-generic assumptions. In -// particular, the sync functions are only used for bridge setup and -// teardown, and quitSynchronous is guaranteed to be called. - -namespace facebook { -namespace react { - -RCTMessageThread::RCTMessageThread(NSRunLoop *runLoop, RCTJavaScriptCompleteBlock errorBlock) - : m_cfRunLoop([runLoop getCFRunLoop]) - , m_errorBlock(errorBlock) - , m_shutdown(false) { - CFRetain(m_cfRunLoop); -} - -RCTMessageThread::~RCTMessageThread() { - CFRelease(m_cfRunLoop); -} - -// This is analogous to dispatch_async -void RCTMessageThread::runAsync(std::function func) { - CFRunLoopPerformBlock(m_cfRunLoop, kCFRunLoopCommonModes, ^{ func(); }); - CFRunLoopWakeUp(m_cfRunLoop); -} - -// This is analogous to dispatch_sync -void RCTMessageThread::runSync(std::function func) { - if (m_cfRunLoop == CFRunLoopGetCurrent()) { - func(); - return; - } - - dispatch_semaphore_t sema = dispatch_semaphore_create(0); - runAsync([func=std::make_shared>(std::move(func)), &sema] { - (*func)(); - dispatch_semaphore_signal(sema); - }); - dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER); -} - -void RCTMessageThread::tryFunc(const std::function& func) { - NSError *error = tryAndReturnError(func); - if (error) { - m_errorBlock(error); - } -} - -void RCTMessageThread::runOnQueue(std::function&& func) { - if (m_shutdown) { - return; - } - - runAsync([this, func=std::make_shared>(std::move(func))] { - if (!m_shutdown) { - tryFunc(*func); - } - }); -} - -void RCTMessageThread::runOnQueueSync(std::function&& func) { - if (m_shutdown) { - return; - } - runSync([this, func=std::move(func)] { - if (!m_shutdown) { - tryFunc(func); - } - }); -} - -void RCTMessageThread::quitSynchronous() { - m_shutdown = true; - runSync([]{}); - CFRunLoopStop(m_cfRunLoop); -} - -void RCTMessageThread::setRunLoop(NSRunLoop *runLoop) { - CFRelease(m_cfRunLoop); - m_cfRunLoop = [runLoop getCFRunLoop]; - CFRetain(m_cfRunLoop); -} - -} -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/RCTObjcExecutor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/RCTObjcExecutor.h deleted file mode 100644 index eddb94bf..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/RCTObjcExecutor.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include -#include - -#import -#import -#import - -namespace facebook { -namespace react { - -class RCTObjcExecutorFactory : public JSExecutorFactory { -public: - RCTObjcExecutorFactory(id jse, RCTJavaScriptCompleteBlock errorBlock); - std::unique_ptr createJSExecutor( - std::shared_ptr delegate, - std::shared_ptr jsQueue) override; - -private: - id m_jse; - RCTJavaScriptCompleteBlock m_errorBlock; -}; - -} -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/RCTObjcExecutor.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/RCTObjcExecutor.mm deleted file mode 100644 index 448562f5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxBridge/RCTObjcExecutor.mm +++ /dev/null @@ -1,153 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTObjcExecutor.h" - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -namespace facebook { -namespace react { - -namespace { - -class JSEException : public std::runtime_error { -public: - JSEException(NSError *error) - : runtime_error([[error description] UTF8String]) {} -}; - -class RCTObjcExecutor : public JSExecutor { -public: - RCTObjcExecutor(id jse, - RCTJavaScriptCompleteBlock errorBlock, - std::shared_ptr jsThread, - std::shared_ptr delegate) - : m_jse(jse) - , m_errorBlock(errorBlock) - , m_delegate(std::move(delegate)) - , m_jsThread(std::move(jsThread)) - { - m_jsCallback = ^(id json, NSError *error) { - if (error) { - // 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. - errorBlock(error); - return; - } - - m_jsThread->runOnQueue([this, json]{ - m_delegate->callNativeModules(*this, convertIdToFollyDynamic(json), true); - }); - }; - - // Synchronously initialize the executor - [jse setUp]; - - folly::dynamic nativeModuleConfig = folly::dynamic::array; - auto moduleRegistry = m_delegate->getModuleRegistry(); - for (const auto &name : moduleRegistry->moduleNames()) { - auto config = moduleRegistry->getConfig(name); - nativeModuleConfig.push_back(config ? config->config : nullptr); - } - - folly::dynamic config = - folly::dynamic::object("remoteModuleConfig", std::move(nativeModuleConfig)); - - setGlobalVariable( - "__fbBatchedBridgeConfig", - std::make_unique(folly::toJson(config))); - } - - void loadApplicationScript( - std::unique_ptr script, - std::string sourceURL) override { - RCTProfileBeginFlowEvent(); - [m_jse executeApplicationScript:[NSData dataWithBytes:script->c_str() length:script->size()] - sourceURL:[[NSURL alloc] - initWithString:@(sourceURL.c_str())] - onComplete:^(NSError *error) { - RCTProfileEndFlowEvent(); - - if (error) { - m_errorBlock(error); - return; - } - - [m_jse flushedQueue:m_jsCallback]; - }]; - } - - void setBundleRegistry(std::unique_ptr) override { - RCTAssert(NO, @"RAM bundles are not supported in RCTObjcExecutor"); - } - - void registerBundle(uint32_t bundleId, const std::string &bundlePath) override { - RCTAssert(NO, @"RAM bundles are not supported in RCTObjcExecutor"); - } - - void callFunction(const std::string &module, const std::string &method, - const folly::dynamic &arguments) override { - [m_jse callFunctionOnModule:@(module.c_str()) - method:@(method.c_str()) - arguments:convertFollyDynamicToId(arguments) - callback:m_jsCallback]; - } - - void invokeCallback(double callbackId, const folly::dynamic &arguments) override { - [m_jse invokeCallbackID:@(callbackId) - arguments:convertFollyDynamicToId(arguments) - callback:m_jsCallback]; - } - - virtual void setGlobalVariable( - std::string propName, - std::unique_ptr jsonValue) override { - [m_jse injectJSONText:@(jsonValue->c_str()) - asGlobalObjectNamed:@(propName.c_str()) - callback:m_errorBlock]; - } - - virtual std::string getDescription() override { - return [NSStringFromClass([m_jse class]) UTF8String]; - } - -private: - id m_jse; - RCTJavaScriptCompleteBlock m_errorBlock; - std::shared_ptr m_delegate; - std::shared_ptr m_jsThread; - RCTJavaScriptCallback m_jsCallback; -}; - -} - -RCTObjcExecutorFactory::RCTObjcExecutorFactory( - id jse, RCTJavaScriptCompleteBlock errorBlock) - : m_jse(jse) - , m_errorBlock(errorBlock) {} - -std::unique_ptr RCTObjcExecutorFactory::createJSExecutor( - std::shared_ptr delegate, - std::shared_ptr jsQueue) { - return std::unique_ptr( - new RCTObjcExecutor(m_jse, m_errorBlock, jsQueue, delegate)); -} - -} -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/DispatchMessageQueueThread.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/DispatchMessageQueueThread.h deleted file mode 100644 index 5fa1c5ca..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/DispatchMessageQueueThread.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include -#include - -namespace facebook { -namespace react { - -// RCTNativeModule arranges for native methods to be invoked on a queue which -// is not the JS thread. C++ modules don't use RCTNativeModule, so this little -// adapter does the work. - -class DispatchMessageQueueThread : public MessageQueueThread { -public: - DispatchMessageQueueThread(RCTModuleData *moduleData) - : moduleData_(moduleData) {} - - void runOnQueue(std::function&& func) override { - dispatch_queue_t queue = moduleData_.methodQueue; - dispatch_block_t block = [func=std::move(func)] { func(); }; - RCTAssert(block != nullptr, @"Invalid block generated in call to %@", moduleData_); - if (queue && block) { - dispatch_async(queue, block); - } - } - void runOnQueueSync(std::function&& func) override { - LOG(FATAL) << "Unsupported operation"; - } - void quitSynchronous() override { - LOG(FATAL) << "Unsupported operation"; - } - -private: - RCTModuleData *moduleData_; -}; - -} } diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTCxxMethod.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTCxxMethod.h deleted file mode 100644 index da1ed8a6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTCxxMethod.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -@interface RCTCxxMethod : NSObject - -- (instancetype)initWithCxxMethod:(const facebook::xplat::module::CxxModule::Method &)cxxMethod; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTCxxMethod.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTCxxMethod.mm deleted file mode 100644 index 2559a9cc..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTCxxMethod.mm +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTCxxMethod.h" - -#import -#import -#import -#import -#import -#import - -#import "RCTCxxUtils.h" - -using facebook::xplat::module::CxxModule; -using namespace facebook::react; - -@implementation RCTCxxMethod -{ - std::unique_ptr _method; -} - -- (instancetype)initWithCxxMethod:(const CxxModule::Method &)method -{ - if ((self = [super init])) { - _method = folly::make_unique(method); - } - return self; -} - -- (const char *)JSMethodName -{ - return _method->name.c_str(); -} - -- (RCTFunctionType)functionType -{ - std::string type(_method->getType()); - if (type == "sync") { - return RCTFunctionTypeSync; - } else if (type == "async") { - return RCTFunctionTypeNormal; - } else { - return RCTFunctionTypePromise; - } -} - -- (id)invokeWithBridge:(RCTBridge *)bridge - module:(id)module - arguments:(NSArray *)arguments -{ - // module is unused except for printing errors. The C++ object it represents - // is also baked into _method. - - // the last N arguments are callbacks, according to the Method data. The - // preceding arguments are values whic have already been parsed from JS: they - // may be NSNumber (bool, int, double), NSString, NSArray, or NSObject. - - CxxModule::Callback first; - CxxModule::Callback second; - - if (arguments.count < _method->callbacks) { - RCTLogError(@"Method %@.%s expects at least %zu arguments, but got %tu", - RCTBridgeModuleNameForClass([module class]), _method->name.c_str(), - _method->callbacks, arguments.count); - return nil; - } - - if (_method->callbacks >= 1) { - if (![arguments[arguments.count - 1] isKindOfClass:[NSNumber class]]) { - RCTLogError(@"Argument %tu (%@) of %@.%s should be a function", - arguments.count - 1, arguments[arguments.count - 1], - RCTBridgeModuleNameForClass([module class]), _method->name.c_str()); - return nil; - } - - NSNumber *id1; - if (_method->callbacks == 2) { - if (![arguments[arguments.count - 2] isKindOfClass:[NSNumber class]]) { - RCTLogError(@"Argument %tu (%@) of %@.%s should be a function", - arguments.count - 2, arguments[arguments.count - 2], - RCTBridgeModuleNameForClass([module class]), _method->name.c_str()); - return nil; - } - - id1 = arguments[arguments.count - 2]; - NSNumber *id2 = arguments[arguments.count - 1]; - - second = ^(std::vector args) { - [bridge enqueueCallback:id2 args:convertFollyDynamicToId(folly::dynamic(args.begin(), args.end()))]; - }; - } else { - id1 = arguments[arguments.count - 1]; - } - - first = ^(std::vector args) { - [bridge enqueueCallback:id1 args:convertFollyDynamicToId(folly::dynamic(args.begin(), args.end()))]; - }; - } - - folly::dynamic args = convertIdToFollyDynamic(arguments); - args.resize(args.size() - _method->callbacks); - - try { - if (_method->func) { - _method->func(std::move(args), first, second); - return nil; - } else { - auto result = _method->syncFunc(std::move(args)); - // TODO: we should convert this to JSValue directly - return convertFollyDynamicToId(result); - } - } catch (const facebook::xplat::JsArgumentException &ex) { - RCTLogError(@"Method %@.%s argument error: %s", - RCTBridgeModuleNameForClass([module class]), _method->name.c_str(), - ex.what()); - return nil; - } -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"<%@: %p; name = %s>", [self class], self, self.JSMethodName]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTCxxModule.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTCxxModule.h deleted file mode 100644 index f7ed461a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTCxxModule.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#import - -namespace facebook { -namespace xplat { -namespace module { -class CxxModule; -} -} -} - -/** - * Subclass RCTCxxModule to use cross-platform CxxModule on iOS. - * - * Subclasses must implement the createModule method to lazily produce the module. When running under the Cxx bridge - * modules will be accessed directly, under the Objective-C bridge method access is wrapped through RCTCxxMethod. - */ -@interface RCTCxxModule : NSObject - -// To be implemented by subclasses -- (std::unique_ptr)createModule; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTCxxModule.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTCxxModule.mm deleted file mode 100644 index 95891da8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTCxxModule.mm +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTCxxModule.h" - -#import -#import -#import -#import - -#import "RCTCxxMethod.h" - -using namespace facebook::react; - -@implementation RCTCxxModule -{ - std::unique_ptr _module; -} - -+ (NSString *)moduleName -{ - return @""; -} - -+ (BOOL)requiresMainQueueSetup -{ - return NO; -} - -- (void)lazyInit -{ - if (!_module) { - _module = [self createModule]; - - if (_module) { - RCTAssert([RCTBridgeModuleNameForClass([self class]) isEqualToString:@(_module->getName().c_str())], - @"CxxModule class name %@ does not match runtime name %s", - RCTBridgeModuleNameForClass([self class]), _module->getName().c_str()); - } - } -} - -- (std::unique_ptr)createModule -{ - RCTAssert(NO, @"Subclass %@ must override createModule", [self class]); - return nullptr; -} - -- (NSArray> *)methodsToExport; -{ - [self lazyInit]; - if (!_module) { - return nil; - } - - NSMutableArray *moduleMethods = [NSMutableArray new]; - for (const auto &method : _module->getMethods()) { - [moduleMethods addObject:[[RCTCxxMethod alloc] initWithCxxMethod:method]]; - } - return moduleMethods; -} - -- (NSDictionary *)constantsToExport -{ - return [self getConstants]; -} - -- (NSDictionary *)getConstants; -{ - [self lazyInit]; - if (!_module) { - return nil; - } - - NSMutableDictionary *moduleConstants = [NSMutableDictionary new]; - for (const auto &c : _module->getConstants()) { - moduleConstants[@(c.first.c_str())] = convertFollyDynamicToId(c.second); - } - return moduleConstants; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTCxxUtils.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTCxxUtils.h deleted file mode 100644 index ac24636e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTCxxUtils.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include -#include - -#import - -@class RCTBridge; -@class RCTModuleData; - -namespace facebook { -namespace react { - -class Instance; -class NativeModule; - -std::vector> createNativeModules(NSArray *modules, RCTBridge *bridge, const std::shared_ptr &instance); - -NSError *tryAndReturnError(const std::function& func); -NSString *deriveSourceURL(NSURL *url); - -} } diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTCxxUtils.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTCxxUtils.mm deleted file mode 100644 index 72dfa60c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTCxxUtils.mm +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTCxxUtils.h" - -#import -#import -#import -#import -#import - -#import "DispatchMessageQueueThread.h" -#import "RCTCxxModule.h" -#import "RCTNativeModule.h" - -namespace facebook { -namespace react { - -using facebook::jsi::JSError; - -std::vector> createNativeModules(NSArray *modules, RCTBridge *bridge, const std::shared_ptr &instance) -{ - std::vector> nativeModules; - for (RCTModuleData *moduleData in modules) { - if ([moduleData.moduleClass isSubclassOfClass:[RCTCxxModule class]]) { - nativeModules.emplace_back(std::make_unique( - instance, - [moduleData.name UTF8String], - [moduleData] { return [(RCTCxxModule *)(moduleData.instance) createModule]; }, - std::make_shared(moduleData))); - } else { - nativeModules.emplace_back(std::make_unique(bridge, moduleData)); - } - } - return nativeModules; -} - -static NSError *errorWithException(const std::exception &e) -{ - NSString *msg = @(e.what()); - NSMutableDictionary *errorInfo = [NSMutableDictionary dictionary]; - - const auto *jsError = dynamic_cast(&e); - if (jsError) { - errorInfo[RCTJSRawStackTraceKey] = @(jsError->getStack().c_str()); - msg = [@"Unhandled JS Exception: " stringByAppendingString:msg]; - } - - NSError *nestedError; - try { - std::rethrow_if_nested(e); - } catch(const std::exception &e) { - nestedError = errorWithException(e); - } catch(...) {} - - if (nestedError) { - msg = [NSString stringWithFormat:@"%@\n\n%@", msg, [nestedError localizedDescription]]; - } - - errorInfo[NSLocalizedDescriptionKey] = msg; - return [NSError errorWithDomain:RCTErrorDomain code:1 userInfo:errorInfo]; -} - -NSError *tryAndReturnError(const std::function& func) -{ - try { - @try { - func(); - return nil; - } - @catch (NSException *exception) { - NSString *message = - [NSString stringWithFormat:@"Exception '%@' was thrown from JS thread", exception]; - return RCTErrorWithMessage(message); - } - @catch (id exception) { - // This will catch any other ObjC exception, but no C++ exceptions - return RCTErrorWithMessage(@"non-std ObjC Exception"); - } - } catch (const std::exception &ex) { - return errorWithException(ex); - } catch (...) { - // On a 64-bit platform, this would catch ObjC exceptions, too, but not on - // 32-bit platforms, so we catch those with id exceptions above. - return RCTErrorWithMessage(@"non-std C++ exception"); - } -} - -NSString *deriveSourceURL(NSURL *url) -{ - NSString *sourceUrl; - if (url.isFileURL) { - // Url will contain only path to resource (i.g. file:// will be removed) - sourceUrl = url.path; - } else { - // Url will include protocol (e.g. http://) - sourceUrl = url.absoluteString; - } - return sourceUrl ?: @""; -} - -} } diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTNativeModule.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTNativeModule.h deleted file mode 100644 index de876cab..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTNativeModule.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -namespace facebook { -namespace react { - -class RCTNativeModule : public NativeModule { - public: - RCTNativeModule(RCTBridge *bridge, RCTModuleData *moduleData); - - std::string getName() override; - std::vector getMethods() override; - folly::dynamic getConstants() override; - void invoke(unsigned int methodId, folly::dynamic &¶ms, int callId) override; - MethodCallResult callSerializableNativeHook(unsigned int reactMethodId, folly::dynamic &¶ms) override; - - private: - __weak RCTBridge *m_bridge; - RCTModuleData *m_moduleData; -}; - -} -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTNativeModule.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTNativeModule.mm deleted file mode 100644 index 5d4a2b87..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxModule/RCTNativeModule.mm +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTNativeModule.h" - -#import -#import -#import -#import -#import -#import -#import -#import - -#ifdef WITH_FBSYSTRACE -#include -#endif - -namespace facebook { -namespace react { - -static MethodCallResult invokeInner(RCTBridge *bridge, RCTModuleData *moduleData, unsigned int methodId, const folly::dynamic ¶ms); - -RCTNativeModule::RCTNativeModule(RCTBridge *bridge, RCTModuleData *moduleData) - : m_bridge(bridge) - , m_moduleData(moduleData) {} - -std::string RCTNativeModule::getName() { - return [m_moduleData.name UTF8String]; -} - -std::vector RCTNativeModule::getMethods() { - std::vector descs; - - for (id method in m_moduleData.methods) { - descs.emplace_back( - method.JSMethodName, - RCTFunctionDescriptorFromType(method.functionType) - ); - } - - return descs; -} - -folly::dynamic RCTNativeModule::getConstants() { - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, - @"[RCTNativeModule getConstants] moduleData.exportedConstants", nil); - NSDictionary *constants = m_moduleData.exportedConstants; - folly::dynamic ret = convertIdToFollyDynamic(constants); - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - return ret; -} - -void RCTNativeModule::invoke(unsigned int methodId, folly::dynamic &¶ms, int callId) { - // capture by weak pointer so that we can safely use these variables in a callback - __weak RCTBridge *weakBridge = m_bridge; - __weak RCTModuleData *weakModuleData = m_moduleData; - // The BatchedBridge version of this buckets all the callbacks by thread, and - // queues one block on each. This is much simpler; we'll see how it goes and - // iterate. - dispatch_block_t block = [weakBridge, weakModuleData, methodId, params=std::move(params), callId] { - #ifdef WITH_FBSYSTRACE - if (callId != -1) { - fbsystrace_end_async_flow(TRACE_TAG_REACT_APPS, "native", callId); - } - #endif - invokeInner(weakBridge, weakModuleData, methodId, std::move(params)); - }; - - if (m_bridge.valid) { - dispatch_queue_t queue = m_moduleData.methodQueue; - if (queue == RCTJSThread) { - block(); - } else if (queue) { - dispatch_async(queue, block); - } - } else { - RCTLogWarn(@"Attempted to invoke `%u` (method ID) on `%@` (NativeModule name) with an invalid bridge.", - methodId, m_moduleData.name); - } -} - -MethodCallResult RCTNativeModule::callSerializableNativeHook(unsigned int reactMethodId, folly::dynamic &¶ms) { - return invokeInner(m_bridge, m_moduleData, reactMethodId, params); -} - -static MethodCallResult invokeInner(RCTBridge *bridge, RCTModuleData *moduleData, unsigned int methodId, const folly::dynamic ¶ms) { - if (!bridge || !bridge.valid || !moduleData) { - return folly::none; - } - - id method = moduleData.methods[methodId]; - if (RCT_DEBUG && !method) { - RCTLogError(@"Unknown methodID: %ud for module: %@", - methodId, moduleData.name); - } - - NSArray *objcParams = convertFollyDynamicToId(params); - @try { - id result = [method invokeWithBridge:bridge module:moduleData.instance arguments:objcParams]; - return convertIdToFollyDynamic(result); - } - @catch (NSException *exception) { - // Pass on JS exceptions - if ([exception.name hasPrefix:RCTFatalExceptionName]) { - @throw exception; - } - - NSString *message = [NSString stringWithFormat: - @"Exception '%@' was thrown while invoking %s on target %@ with params %@\ncallstack: %@", - exception, method.JSMethodName, moduleData.name, objcParams, exception.callStackSymbols]; - RCTFatal(RCTErrorWithMessage(message)); - } - - return folly::none; -} - -} -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxUtils/RCTFollyConvert.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxUtils/RCTFollyConvert.h deleted file mode 100644 index 2821bd85..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxUtils/RCTFollyConvert.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#include - -namespace facebook { -namespace react { - -folly::dynamic convertIdToFollyDynamic(id json); -id convertFollyDynamicToId(const folly::dynamic &dyn); - -} } diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxUtils/RCTFollyConvert.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxUtils/RCTFollyConvert.mm deleted file mode 100644 index 2e3ec327..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/CxxUtils/RCTFollyConvert.mm +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTFollyConvert.h" - -#import - -namespace facebook { -namespace react { - -id convertFollyDynamicToId(const folly::dynamic &dyn) { - // I could imagine an implementation which avoids copies by wrapping the - // dynamic in a derived class of NSDictionary. We can do that if profiling - // implies it will help. - - switch (dyn.type()) { - case folly::dynamic::NULLT: - return (id)kCFNull; - case folly::dynamic::BOOL: - return dyn.getBool() ? @YES : @NO; - case folly::dynamic::INT64: - return @(dyn.getInt()); - case folly::dynamic::DOUBLE: - return @(dyn.getDouble()); - case folly::dynamic::STRING: - return [[NSString alloc] initWithBytes:dyn.c_str() length:dyn.size() - encoding:NSUTF8StringEncoding]; - case folly::dynamic::ARRAY: { - NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:dyn.size()]; - for (auto &elem : dyn) { - [array addObject:convertFollyDynamicToId(elem)]; - } - return array; - } - case folly::dynamic::OBJECT: { - NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithCapacity:dyn.size()]; - for (auto &elem : dyn.items()) { - dict[convertFollyDynamicToId(elem.first)] = convertFollyDynamicToId(elem.second); - } - return dict; - } - } -} - -folly::dynamic convertIdToFollyDynamic(id json) -{ - if (json == nil || json == (id)kCFNull) { - return nullptr; - } else if ([json isKindOfClass:[NSNumber class]]) { - const char *objCType = [json objCType]; - switch (objCType[0]) { - // This is a c++ bool or C99 _Bool. On some platforms, BOOL is a bool. - case _C_BOOL: - return (bool) [json boolValue]; - case _C_CHR: - // On some platforms, objc BOOL is a signed char, but it - // might also be a small number. Use the same hack JSC uses - // to distinguish them: - // https://phabricator.intern.facebook.com/diffusion/FBS/browse/master/fbobjc/xplat/third-party/jsc/safari-600-1-4-17/JavaScriptCore/API/JSValue.mm;b8ee03916489f8b12143cd5c0bca546da5014fc9$901 - if ([json isKindOfClass:[@YES class]]) { - return (bool) [json boolValue]; - } else { - return [json longLongValue]; - } - case _C_UCHR: - case _C_SHT: - case _C_USHT: - case _C_INT: - case _C_UINT: - case _C_LNG: - case _C_ULNG: - case _C_LNG_LNG: - case _C_ULNG_LNG: - return [json longLongValue]; - - case _C_FLT: - case _C_DBL: - return [json doubleValue]; - - // default: - // fall through - } - } else if ([json isKindOfClass:[NSString class]]) { - NSData *data = [json dataUsingEncoding:NSUTF8StringEncoding]; - return std::string(reinterpret_cast(data.bytes), - data.length); - } else if ([json isKindOfClass:[NSArray class]]) { - folly::dynamic array = folly::dynamic::array; - for (id element in json) { - array.push_back(convertIdToFollyDynamic(element)); - } - return array; - } else if ([json isKindOfClass:[NSDictionary class]]) { - __block folly::dynamic object = folly::dynamic::object(); - - [json enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *value, __unused BOOL *stop) { - object.insert(convertIdToFollyDynamic(key), - convertIdToFollyDynamic(value)); - }]; - - return object; - } - - return nil; -} - -} } diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTDevLoadingView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTDevLoadingView.h deleted file mode 100644 index 2a4a7d4c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTDevLoadingView.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@class RCTLoadingProgress; - -@interface RCTDevLoadingView : NSObject - -+ (void)setEnabled:(BOOL)enabled; -- (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(UIColor *)backgroundColor; -- (void)showWithURL:(NSURL *)URL; -- (void)updateProgress:(RCTLoadingProgress *)progress; -- (void)hide; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTDevLoadingView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTDevLoadingView.m deleted file mode 100644 index 08ae65b0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTDevLoadingView.m +++ /dev/null @@ -1,177 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTDevLoadingView.h" - -#import - -#import "RCTBridge.h" -#import "RCTDefines.h" -#import "RCTModalHostViewController.h" -#import "RCTUtils.h" - -#if RCT_DEV | RCT_ENABLE_LOADING_VIEW - -static BOOL isEnabled = YES; - -@implementation RCTDevLoadingView -{ - UIWindow *_window; - UILabel *_label; - NSDate *_showDate; -} - -@synthesize bridge = _bridge; - -RCT_EXPORT_MODULE() - -+ (void)setEnabled:(BOOL)enabled -{ - isEnabled = enabled; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -+ (BOOL)requiresMainQueueSetup -{ - return YES; -} - -- (void)setBridge:(RCTBridge *)bridge -{ - _bridge = bridge; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(hide) - name:RCTJavaScriptDidLoadNotification - object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(hide) - name:RCTJavaScriptDidFailToLoadNotification - object:nil]; - - if (bridge.loading) { - [self showWithURL:bridge.bundleURL]; - } -} - -RCT_EXPORT_METHOD(showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(UIColor *)backgroundColor) -{ - if (!isEnabled) { - return; - } - - dispatch_async(dispatch_get_main_queue(), ^{ - self->_showDate = [NSDate date]; - if (!self->_window && !RCTRunningInTestEnvironment()) { - CGSize screenSize = [UIScreen mainScreen].bounds.size; - - if (@available(iOS 11.0, *)) { - UIWindow *window = UIApplication.sharedApplication.keyWindow; - self->_window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, screenSize.width, window.safeAreaInsets.top + 30)]; - self->_label = [[UILabel alloc] initWithFrame:CGRectMake(0, window.safeAreaInsets.top, screenSize.width, 30)]; - } else { - self->_window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, screenSize.width, 22)]; - self->_label = [[UILabel alloc] initWithFrame:self->_window.bounds]; - } - [self->_window addSubview:self->_label]; -#if TARGET_OS_TV - self->_window.windowLevel = UIWindowLevelNormal + 1; -#else - self->_window.windowLevel = UIWindowLevelStatusBar + 1; -#endif - // set a root VC so rotation is supported - self->_window.rootViewController = [UIViewController new]; - - self->_label.font = [UIFont systemFontOfSize:12.0]; - self->_label.textAlignment = NSTextAlignmentCenter; - } - - self->_label.text = message; - self->_label.textColor = color; - self->_window.backgroundColor = backgroundColor; - self->_window.hidden = NO; - }); -} - -RCT_EXPORT_METHOD(hide) -{ - if (!isEnabled) { - return; - } - - dispatch_async(dispatch_get_main_queue(), ^{ - const NSTimeInterval MIN_PRESENTED_TIME = 0.6; - NSTimeInterval presentedTime = [[NSDate date] timeIntervalSinceDate:self->_showDate]; - NSTimeInterval delay = MAX(0, MIN_PRESENTED_TIME - presentedTime); - CGRect windowFrame = self->_window.frame; - [UIView animateWithDuration:0.25 - delay:delay - options:0 - animations:^{ - self->_window.frame = CGRectOffset(windowFrame, 0, -windowFrame.size.height); - } completion:^(__unused BOOL finished) { - self->_window.frame = windowFrame; - self->_window.hidden = YES; - self->_window = nil; - }]; - }); -} - -- (void)showWithURL:(NSURL *)URL -{ - UIColor *color; - UIColor *backgroundColor; - NSString *source; - if (URL.fileURL) { - // If dev mode is not enabled, we don't want to show this kind of notification -#if !RCT_DEV - return; -#endif - color = [UIColor grayColor]; - backgroundColor = [UIColor blackColor]; - source = @"pre-bundled file"; - } else { - color = [UIColor whiteColor]; - backgroundColor = [UIColor colorWithHue:1./3 saturation:1 brightness:.35 alpha:1]; - source = [NSString stringWithFormat:@"%@:%@", URL.host, URL.port]; - } - - [self showMessage:[NSString stringWithFormat:@"Loading from %@...", source] - color:color - backgroundColor:backgroundColor]; -} - -- (void)updateProgress:(RCTLoadingProgress *)progress -{ - if (!progress) { - return; - } - dispatch_async(dispatch_get_main_queue(), ^{ - self->_label.text = [progress description]; - }); -} - -@end - -#else - -@implementation RCTDevLoadingView - -+ (NSString *)moduleName { return nil; } -+ (void)setEnabled:(BOOL)enabled { } -- (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(UIColor *)backgroundColor { } -- (void)showWithURL:(NSURL *)URL { } -- (void)updateProgress:(RCTLoadingProgress *)progress { } -- (void)hide { } - -@end - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTDevMenu.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTDevMenu.h deleted file mode 100644 index a7979c8a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTDevMenu.h +++ /dev/null @@ -1,113 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -#if RCT_DEV - -RCT_EXTERN NSString *const RCTShowDevMenuNotification; - -#endif - - -@class RCTDevMenuItem; - -/** - * Developer menu, useful for exposing extra functionality when debugging. - */ -@interface RCTDevMenu : NSObject - -/** - * Deprecated, use RCTDevSettings instead. - */ -@property (nonatomic, assign) BOOL shakeToShow DEPRECATED_ATTRIBUTE; - -/** - * Deprecated, use RCTDevSettings instead. - */ -@property (nonatomic, assign) BOOL profilingEnabled DEPRECATED_ATTRIBUTE; - -/** - * Deprecated, use RCTDevSettings instead. - */ -@property (nonatomic, assign) BOOL liveReloadEnabled DEPRECATED_ATTRIBUTE; - -/** - * Deprecated, use RCTDevSettings instead. - */ -@property (nonatomic, assign) BOOL hotLoadingEnabled DEPRECATED_ATTRIBUTE; - -/** - * Presented items in development menu - */ -@property (nonatomic, copy, readonly) NSArray *presentedItems; - -/** - * Detect if actions sheet (development menu) is shown - */ -- (BOOL)isActionSheetShown; - -/** - * Manually show the dev menu (can be called from JS). - */ -- (void)show; - -/** - * Deprecated, use -[RCTBRidge reload] instead. - */ -- (void)reload DEPRECATED_ATTRIBUTE; - -/** - * Deprecated. Use the `-addItem:` method instead. - */ -- (void)addItem:(NSString *)title - handler:(void(^)(void))handler DEPRECATED_ATTRIBUTE; - -/** - * Add custom item to the development menu. The handler will be called - * when user selects the item. - */ -- (void)addItem:(RCTDevMenuItem *)item; - -@end - -typedef NSString *(^RCTDevMenuItemTitleBlock)(void); - -/** - * Developer menu item, used to expose additional functionality via the menu. - */ -@interface RCTDevMenuItem : NSObject - -/** - * This creates an item with a simple push-button interface, used to trigger an - * action. - */ -+ (instancetype)buttonItemWithTitle:(NSString *)title - handler:(dispatch_block_t)handler; - -/** - * This creates an item with a simple push-button interface, used to trigger an - * action. getTitleForPresentation is called each time the item is about to be - * presented, and should return the item's title. - */ -+ (instancetype)buttonItemWithTitleBlock:(RCTDevMenuItemTitleBlock)titleBlock - handler:(dispatch_block_t)handler; - -@end - -/** - * This category makes the developer menu instance available via the - * RCTBridge, which is useful for any class that needs to access the menu. - */ -@interface RCTBridge (RCTDevMenu) - -@property (nonatomic, readonly) RCTDevMenu *devMenu; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTDevMenu.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTDevMenu.m deleted file mode 100644 index d4682094..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTDevMenu.m +++ /dev/null @@ -1,420 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTDevMenu.h" - -#import "RCTBridge+Private.h" -#import "RCTDevSettings.h" -#import "RCTKeyCommands.h" -#import "RCTLog.h" -#import "RCTUtils.h" - -#if RCT_DEV - -#if RCT_ENABLE_INSPECTOR -#import "RCTInspectorDevServerHelper.h" -#endif - -NSString *const RCTShowDevMenuNotification = @"RCTShowDevMenuNotification"; - -@implementation UIWindow (RCTDevMenu) - -- (void)RCT_motionEnded:(__unused UIEventSubtype)motion withEvent:(UIEvent *)event -{ - if (event.subtype == UIEventSubtypeMotionShake) { - [[NSNotificationCenter defaultCenter] postNotificationName:RCTShowDevMenuNotification object:nil]; - } -} - -@end - -@implementation RCTDevMenuItem -{ - RCTDevMenuItemTitleBlock _titleBlock; - dispatch_block_t _handler; -} - -- (instancetype)initWithTitleBlock:(RCTDevMenuItemTitleBlock)titleBlock - handler:(dispatch_block_t)handler -{ - if ((self = [super init])) { - _titleBlock = [titleBlock copy]; - _handler = [handler copy]; - } - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -+ (instancetype)buttonItemWithTitleBlock:(NSString *(^)(void))titleBlock handler:(dispatch_block_t)handler -{ - return [[self alloc] initWithTitleBlock:titleBlock handler:handler]; -} - -+ (instancetype)buttonItemWithTitle:(NSString *)title - handler:(dispatch_block_t)handler -{ - return [[self alloc] initWithTitleBlock:^NSString *{ return title; } handler:handler]; -} - -- (void)callHandler -{ - if (_handler) { - _handler(); - } -} - -- (NSString *)title -{ - if (_titleBlock) { - return _titleBlock(); - } - return nil; -} - -@end - -typedef void(^RCTDevMenuAlertActionHandler)(UIAlertAction *action); - -@interface RCTDevMenu () - -@end - -@implementation RCTDevMenu -{ - UIAlertController *_actionSheet; - NSMutableArray *_extraMenuItems; -} - -@synthesize bridge = _bridge; - -RCT_EXPORT_MODULE() - -+ (void)initialize -{ - // We're swizzling here because it's poor form to override methods in a category, - // however UIWindow doesn't actually implement motionEnded:withEvent:, so there's - // no need to call the original implementation. - RCTSwapInstanceMethods([UIWindow class], @selector(motionEnded:withEvent:), @selector(RCT_motionEnded:withEvent:)); -} - -+ (BOOL)requiresMainQueueSetup -{ - return YES; -} - -- (instancetype)init -{ - if ((self = [super init])) { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(showOnShake) - name:RCTShowDevMenuNotification - object:nil]; - _extraMenuItems = [NSMutableArray new]; - -#if TARGET_OS_SIMULATOR - RCTKeyCommands *commands = [RCTKeyCommands sharedInstance]; - __weak __typeof(self) weakSelf = self; - - // Toggle debug menu - [commands registerKeyCommandWithInput:@"d" - modifierFlags:UIKeyModifierCommand - action:^(__unused UIKeyCommand *command) { - [weakSelf toggle]; - }]; - - // Toggle element inspector - [commands registerKeyCommandWithInput:@"i" - modifierFlags:UIKeyModifierCommand - action:^(__unused UIKeyCommand *command) { - [weakSelf.bridge.devSettings toggleElementInspector]; - }]; - - // Reload in normal mode - [commands registerKeyCommandWithInput:@"n" - modifierFlags:UIKeyModifierCommand - action:^(__unused UIKeyCommand *command) { - [weakSelf.bridge.devSettings setIsDebuggingRemotely:NO]; - }]; -#endif - } - return self; -} - -- (dispatch_queue_t)methodQueue -{ - return dispatch_get_main_queue(); -} - -- (void)invalidate -{ - _presentedItems = nil; - [_actionSheet dismissViewControllerAnimated:YES completion:^(void){}]; - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (void)showOnShake -{ - if ([_bridge.devSettings isShakeToShowDevMenuEnabled]) { - [self show]; - } -} - -- (void)toggle -{ - if (_actionSheet) { - [_actionSheet dismissViewControllerAnimated:YES completion:^(void){}]; - _actionSheet = nil; - } else { - [self show]; - } -} - -- (BOOL)isActionSheetShown -{ - return _actionSheet != nil; -} - -- (void)addItem:(NSString *)title handler:(void(^)(void))handler -{ - [self addItem:[RCTDevMenuItem buttonItemWithTitle:title handler:handler]]; -} - -- (void)addItem:(RCTDevMenuItem *)item -{ - [_extraMenuItems addObject:item]; -} - -- (NSArray *)_menuItemsToPresent -{ - NSMutableArray *items = [NSMutableArray new]; - - // Add built-in items - __weak RCTBridge *bridge = _bridge; - __weak RCTDevSettings *devSettings = _bridge.devSettings; - - [items addObject:[RCTDevMenuItem buttonItemWithTitle:@"Reload" handler:^{ - [bridge reload]; - }]]; - - if (devSettings.isNuclideDebuggingAvailable) { - [items addObject:[RCTDevMenuItem buttonItemWithTitle:[NSString stringWithFormat:@"Debug JS in Nuclide %@", @"\U0001F4AF"] handler:^{ -#if RCT_ENABLE_INSPECTOR - [RCTInspectorDevServerHelper attachDebugger:@"ReactNative" withBundleURL:bridge.bundleURL withView: RCTPresentedViewController()]; -#endif - }]]; - } - - if (!devSettings.isRemoteDebuggingAvailable) { - [items addObject:[RCTDevMenuItem buttonItemWithTitle:@"Remote JS Debugger Unavailable" handler:^{ - UIAlertController *alertController = [UIAlertController - alertControllerWithTitle:@"Remote JS Debugger Unavailable" - message:@"You need to include the RCTWebSocket library to enable remote JS debugging" - preferredStyle:UIAlertControllerStyleAlert]; - __weak typeof(alertController) weakAlertController = alertController; - [alertController addAction: - [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){ - [weakAlertController dismissViewControllerAnimated:YES completion:nil]; - }]]; - [RCTPresentedViewController() presentViewController:alertController animated:YES completion:NULL]; - }]]; - } else { - [items addObject:[RCTDevMenuItem buttonItemWithTitleBlock:^NSString *{ - NSString *title = devSettings.isDebuggingRemotely ? @"Stop Remote JS Debugging" : @"Debug JS Remotely"; - if (devSettings.isNuclideDebuggingAvailable) { - return [NSString stringWithFormat:@"%@ %@", title, @"\U0001F645"]; - } else { - return title; - } - } handler:^{ - devSettings.isDebuggingRemotely = !devSettings.isDebuggingRemotely; - }]]; - } - - if (devSettings.isLiveReloadAvailable) { - [items addObject:[RCTDevMenuItem buttonItemWithTitleBlock:^NSString *{ - return devSettings.isLiveReloadEnabled ? @"Disable Live Reload" : @"Enable Live Reload"; - } handler:^{ - devSettings.isLiveReloadEnabled = !devSettings.isLiveReloadEnabled; - }]]; - [items addObject:[RCTDevMenuItem buttonItemWithTitleBlock:^NSString *{ - return devSettings.isProfilingEnabled ? @"Stop Systrace" : @"Start Systrace"; - } handler:^{ - if (devSettings.isDebuggingRemotely) { - UIAlertController *alertController = [UIAlertController - alertControllerWithTitle:@"Systrace Unavailable" - message:@"You need to stop remote JS debugging to enable Systrace" - preferredStyle:UIAlertControllerStyleAlert]; - __weak typeof(alertController) weakAlertController = alertController; - [alertController addAction: - [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){ - [weakAlertController dismissViewControllerAnimated:YES completion:nil]; - }]]; - [RCTPresentedViewController() presentViewController:alertController animated:YES completion:NULL]; - } else { - devSettings.isProfilingEnabled = !devSettings.isProfilingEnabled; - } - }]]; - } - - if (_bridge.devSettings.isHotLoadingAvailable) { - [items addObject:[RCTDevMenuItem buttonItemWithTitleBlock:^NSString *{ - return devSettings.isHotLoadingEnabled ? @"Disable Hot Reloading" : @"Enable Hot Reloading"; - } handler:^{ - devSettings.isHotLoadingEnabled = !devSettings.isHotLoadingEnabled; - }]]; - } - - [items addObject:[RCTDevMenuItem buttonItemWithTitleBlock:^NSString *{ - return @"Toggle Inspector"; - } handler:^{ - [devSettings toggleElementInspector]; - }]]; - - [items addObjectsFromArray:_extraMenuItems]; - return items; -} - -RCT_EXPORT_METHOD(show) -{ - if (_actionSheet || !_bridge || RCTRunningInAppExtension()) { - return; - } - - NSString *desc = _bridge.bridgeDescription; - if (desc.length == 0) { - desc = NSStringFromClass([_bridge class]); - } - NSString *title = [NSString stringWithFormat:@"React Native: Development (%@)", desc]; - // On larger devices we don't have an anchor point for the action sheet - UIAlertControllerStyle style = [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone ? UIAlertControllerStyleActionSheet : UIAlertControllerStyleAlert; - _actionSheet = [UIAlertController alertControllerWithTitle:title - message:@"" - preferredStyle:style]; - - NSArray *items = [self _menuItemsToPresent]; - for (RCTDevMenuItem *item in items) { - [_actionSheet addAction:[UIAlertAction actionWithTitle:item.title - style:UIAlertActionStyleDefault - handler:[self alertActionHandlerForDevItem:item]]]; - } - - [_actionSheet addAction:[UIAlertAction actionWithTitle:@"Cancel" - style:UIAlertActionStyleCancel - handler:[self alertActionHandlerForDevItem:nil]]]; - - _presentedItems = items; - [RCTPresentedViewController() presentViewController:_actionSheet animated:YES completion:nil]; -} - -- (RCTDevMenuAlertActionHandler)alertActionHandlerForDevItem:(RCTDevMenuItem *__nullable)item -{ - return ^(__unused UIAlertAction *action) { - if (item) { - [item callHandler]; - } - - self->_actionSheet = nil; - }; -} - -#pragma mark - deprecated methods and properties - -#define WARN_DEPRECATED_DEV_MENU_EXPORT() RCTLogWarn(@"Using deprecated method %s, use RCTDevSettings instead", __func__) - -- (void)setShakeToShow:(BOOL)shakeToShow -{ - _bridge.devSettings.isShakeToShowDevMenuEnabled = shakeToShow; -} - -- (BOOL)shakeToShow -{ - return _bridge.devSettings.isShakeToShowDevMenuEnabled; -} - -RCT_EXPORT_METHOD(reload) -{ - WARN_DEPRECATED_DEV_MENU_EXPORT(); - [_bridge reload]; -} - -RCT_EXPORT_METHOD(debugRemotely:(BOOL)enableDebug) -{ - WARN_DEPRECATED_DEV_MENU_EXPORT(); - _bridge.devSettings.isDebuggingRemotely = enableDebug; -} - -RCT_EXPORT_METHOD(setProfilingEnabled:(BOOL)enabled) -{ - WARN_DEPRECATED_DEV_MENU_EXPORT(); - _bridge.devSettings.isProfilingEnabled = enabled; -} - -- (BOOL)profilingEnabled -{ - return _bridge.devSettings.isProfilingEnabled; -} - -RCT_EXPORT_METHOD(setLiveReloadEnabled:(BOOL)enabled) -{ - WARN_DEPRECATED_DEV_MENU_EXPORT(); - _bridge.devSettings.isLiveReloadEnabled = enabled; -} - -- (BOOL)liveReloadEnabled -{ - return _bridge.devSettings.isLiveReloadEnabled; -} - -RCT_EXPORT_METHOD(setHotLoadingEnabled:(BOOL)enabled) -{ - WARN_DEPRECATED_DEV_MENU_EXPORT(); - _bridge.devSettings.isHotLoadingEnabled = enabled; -} - -- (BOOL)hotLoadingEnabled -{ - return _bridge.devSettings.isHotLoadingEnabled; -} - -@end - -#else // Unavailable when not in dev mode - -@implementation RCTDevMenu - -- (void)show {} -- (void)reload {} -- (void)addItem:(NSString *)title handler:(dispatch_block_t)handler {} -- (void)addItem:(RCTDevMenu *)item {} -- (BOOL)isActionSheetShown { return NO; } -+ (NSString *)moduleName { return @""; } - -@end - -@implementation RCTDevMenuItem - -+ (instancetype)buttonItemWithTitle:(NSString *)title handler:(void(^)(void))handler {return nil;} -+ (instancetype)buttonItemWithTitleBlock:(NSString * (^)(void))titleBlock - handler:(void(^)(void))handler {return nil;} - -@end - -#endif - -@implementation RCTBridge (RCTDevMenu) - -- (RCTDevMenu *)devMenu -{ -#if RCT_DEV - return [self moduleForClass:[RCTDevMenu class]]; -#else - return nil; -#endif -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTInspectorDevServerHelper.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTInspectorDevServerHelper.h deleted file mode 100644 index c718dfd3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTInspectorDevServerHelper.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#import -#import - -#import -#import - -#if RCT_DEV - -@interface RCTInspectorDevServerHelper : NSObject - -+ (RCTInspectorPackagerConnection *)connectWithBundleURL:(NSURL *)bundleURL; -+ (void)disableDebugger; -+ (void)attachDebugger:(NSString *)owner - withBundleURL:(NSURL *)bundleURL - withView:(UIViewController *)view; -@end - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTInspectorDevServerHelper.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTInspectorDevServerHelper.mm deleted file mode 100644 index e157ef5d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTInspectorDevServerHelper.mm +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#import "RCTInspectorDevServerHelper.h" - -#if RCT_DEV - -#import -#import - -#import "RCTDefines.h" -#import "RCTInspectorPackagerConnection.h" - -static NSString *const kDebuggerMsgDisable = @"{ \"id\":1,\"method\":\"Debugger.disable\" }"; - -static NSString *getServerHost(NSURL *bundleURL, NSNumber *port) -{ - NSString *host = [bundleURL host]; - if (!host) { - host = @"localhost"; - } - - // this is consistent with the Android implementation, where http:// is the - // hardcoded implicit scheme for the debug server. Note, packagerURL - // technically looks like it could handle schemes/protocols other than HTTP, - // so rather than force HTTP, leave it be for now, in case someone is relying - // on that ability when developing against iOS. - return [NSString stringWithFormat:@"%@:%@", host, port]; -} - -static NSURL *getInspectorDeviceUrl(NSURL *bundleURL) -{ - NSNumber *inspectorProxyPort = @8082; - NSString *escapedDeviceName = [[[UIDevice currentDevice] name] stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet]; - NSString *escapedAppName = [[[NSBundle mainBundle] bundleIdentifier] stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet]; - return [NSURL URLWithString:[NSString stringWithFormat:@"http://%@/inspector/device?name=%@&app=%@", - getServerHost(bundleURL, inspectorProxyPort), - escapedDeviceName, - escapedAppName]]; -} - -static NSURL *getAttachDeviceUrl(NSURL *bundleURL, NSString *title) -{ - NSNumber *metroBundlerPort = @8081; - NSString *escapedDeviceName = [[[UIDevice currentDevice] name] stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLHostAllowedCharacterSet]; - NSString *escapedAppName = [[[NSBundle mainBundle] bundleIdentifier] stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLHostAllowedCharacterSet]; - return [NSURL URLWithString:[NSString stringWithFormat:@"http://%@/attach-debugger-nuclide?title=%@&device=%@&app=%@", - getServerHost(bundleURL, metroBundlerPort), - title, - escapedDeviceName, - escapedAppName]]; -} - -@implementation RCTInspectorDevServerHelper - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -static NSMutableDictionary *socketConnections = nil; - -static void sendEventToAllConnections(NSString *event) -{ - for (NSString *socketId in socketConnections) { - [socketConnections[socketId] sendEventToAllConnections:event]; - } -} - -static void displayErrorAlert(UIViewController *view, NSString *message) { - UIAlertController *alert = - [UIAlertController alertControllerWithTitle:nil - message:message - preferredStyle:UIAlertControllerStyleAlert]; - [view presentViewController:alert animated:YES completion:nil]; - dispatch_after( - dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * 2.5), - dispatch_get_main_queue(), - ^{ - [alert dismissViewControllerAnimated:YES completion:nil]; - }); -} - -+ (void)attachDebugger:(NSString *)owner - withBundleURL:(NSURL *)bundleURL - withView:(UIViewController *)view -{ - NSURL *url = getAttachDeviceUrl(bundleURL, owner); - - NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; - [request setHTTPMethod:@"GET"]; - - __weak UIViewController *viewCapture = view; - [[[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler: - ^(NSData *_Nullable data, - NSURLResponse *_Nullable response, - NSError *_Nullable error) { - UIViewController *viewCaptureStrong = viewCapture; - if (error != nullptr && viewCaptureStrong != nullptr) { - displayErrorAlert(viewCaptureStrong, @"The request to attach Nuclide couldn't reach Metro Bundler!"); - } - }] resume]; -} - -+ (void)disableDebugger -{ - sendEventToAllConnections(kDebuggerMsgDisable); -} - -+ (RCTInspectorPackagerConnection *)connectWithBundleURL:(NSURL *)bundleURL -{ - NSURL *inspectorURL = getInspectorDeviceUrl(bundleURL); - - // Note, using a static dictionary isn't really the greatest design, but - // the packager connection does the same thing, so it's at least consistent. - // This is a static map that holds different inspector clients per the inspectorURL - if (socketConnections == nil) { - socketConnections = [NSMutableDictionary new]; - } - - NSString *key = [inspectorURL absoluteString]; - RCTInspectorPackagerConnection *connection = socketConnections[key]; - if (!connection) { - connection = [[RCTInspectorPackagerConnection alloc] initWithURL:inspectorURL]; - socketConnections[key] = connection; - [connection connect]; - } - - return connection; -} - -@end - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTPackagerClient.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTPackagerClient.h deleted file mode 100644 index e0877bbb..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTPackagerClient.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#if RCT_DEV // Only supported in dev mode - -@class RCTPackagerClientResponder; -@class RCTReconnectingWebSocket; - -#if defined(__cplusplus) -extern "C" { -#endif - -extern const int RCT_PACKAGER_CLIENT_PROTOCOL_VERSION; - -#if defined(__cplusplus) -} -#endif - -@protocol RCTPackagerClientMethod - -- (void)handleRequest:(NSDictionary *)params withResponder:(RCTPackagerClientResponder *)responder; -- (void)handleNotification:(NSDictionary *)params; - -@optional - -/** By default object will receive its methods on the main queue, unless this method is overriden. */ -- (dispatch_queue_t)methodQueue; - -@end - -@interface RCTPackagerClientResponder : NSObject - -- (instancetype)initWithId:(id)msgId socket:(RCTReconnectingWebSocket *)socket; -- (void)respondWithResult:(id)result; -- (void)respondWithError:(id)error; - -@end - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTPackagerClient.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTPackagerClient.m deleted file mode 100644 index 66c086f3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTPackagerClient.m +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTPackagerClient.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 RCTReconnectingWebSocket *_socket; -} - -- (instancetype)initWithId:(id)msgId socket:(RCTReconnectingWebSocket *)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/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTPackagerConnection.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTPackagerConnection.h deleted file mode 100644 index 67832ca9..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTPackagerConnection.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#if RCT_DEV - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTPackagerClientMethod; -@class RCTPackagerClientResponder; - -typedef uint32_t RCTHandlerToken; -typedef void (^RCTNotificationHandler)(NSDictionary *); -typedef void (^RCTRequestHandler)(NSDictionary *, RCTPackagerClientResponder *); -typedef void (^RCTConnectedHandler)(void); - -/** Encapsulates singleton connection to React Native packager. */ -@interface RCTPackagerConnection : NSObject - -+ (instancetype)sharedPackagerConnection; - -/** - * Registers a handler for a notification broadcast from the packager. An - * example is "reload" - an instruction to reload from the packager. - * If multiple notification handlers are registered for the same method, they - * will all be invoked sequentially. - */ -- (RCTHandlerToken)addNotificationHandler:(RCTNotificationHandler)handler - queue:(dispatch_queue_t)queue - forMethod:(NSString *)method; - -/** - * Registers a handler for a request from the packager. An example is - * pokeSamplingProfiler; it asks for profile data from the client. - * Only one handler can be registered for a given method; calling this - * displaces any previous request handler registered for that method. - */ -- (RCTHandlerToken)addRequestHandler:(RCTRequestHandler)handler - queue:(dispatch_queue_t)queue - forMethod:(NSString *)method; - -/** - * Registers a handler that runs at most once, when the connection to the - * packager has been established. The handler will be dispatched immediately - * if the connection is already established. - */ -- (RCTHandlerToken)addConnectedHandler:(RCTConnectedHandler)handler - queue:(dispatch_queue_t)queue; - -/** Removes a handler. Silently does nothing if the token is not valid. */ -- (void)removeHandler:(RCTHandlerToken)token; - -/** Disconnects and removes all handlers. */ -- (void)stop; - -/** - * Historically no distinction was made between notification and request - * handlers. If you use this method, it will be registered as *both* a - * notification handler *and* a request handler. You should migrate to the - * new block-based API instead. - */ -- (void)addHandler:(id)handler - forMethod:(NSString *)method __deprecated_msg("Use addRequestHandler or addNotificationHandler instead"); - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTPackagerConnection.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTPackagerConnection.mm deleted file mode 100644 index de9ab999..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/DevSupport/RCTPackagerConnection.mm +++ /dev/null @@ -1,283 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTPackagerConnection.h" - -#import -#import -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#if RCT_DEV -@interface RCTPackagerConnection () -@end - -template -struct Registration { - NSString *method; - Handler handler; - dispatch_queue_t queue; - uint32_t token; -}; - -@implementation RCTPackagerConnection { - std::mutex _mutex; // protects all ivars - RCTReconnectingWebSocket *_socket; - BOOL _socketConnected; - NSString *_jsLocationForSocket; - id _bundleURLChangeObserver; - uint32_t _nextToken; - std::vector> _notificationRegistrations; - std::vector> _requestRegistrations; - std::vector> _connectedRegistrations; -} - -+ (instancetype)sharedPackagerConnection -{ - static RCTPackagerConnection *connection; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - connection = [RCTPackagerConnection new]; - }); - return connection; -} - -- (instancetype)init -{ - if (self = [super init]) { - _nextToken = 1; // Prevent randomly erasing a handler if you pass a bogus 0 token - _jsLocationForSocket = [RCTBundleURLProvider sharedSettings].jsLocation; - _socket = socketForLocation(_jsLocationForSocket); - _socket.delegate = self; - [_socket start]; - - RCTPackagerConnection *const __weak weakSelf = self; - _bundleURLChangeObserver = - [[NSNotificationCenter defaultCenter] - addObserverForName:RCTBundleURLProviderUpdatedNotification - object:nil - queue:[NSOperationQueue mainQueue] - usingBlock:^(NSNotification *_Nonnull note) { - [weakSelf bundleURLSettingsChanged]; - }]; - } - return self; -} - -static RCTReconnectingWebSocket *socketForLocation(NSString *const jsLocation) -{ - NSURLComponents *const components = [NSURLComponents new]; - components.host = jsLocation ?: @"localhost"; - components.scheme = @"http"; - components.port = @(kRCTBundleURLProviderDefaultPort); - components.path = @"/message"; - components.queryItems = @[[NSURLQueryItem queryItemWithName:@"role" value:@"ios"]]; - static dispatch_queue_t queue; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - queue = dispatch_queue_create("com.facebook.RCTPackagerConnectionQueue", DISPATCH_QUEUE_SERIAL); - }); - return [[RCTReconnectingWebSocket alloc] initWithURL:components.URL queue:queue]; -} - -- (void)stop -{ - std::lock_guard l(_mutex); - if (_socket == nil) { - // Already stopped - return; - } - [[NSNotificationCenter defaultCenter] removeObserver:_bundleURLChangeObserver]; - _bundleURLChangeObserver = nil; - _socketConnected = NO; - [_socket stop]; - _socket = nil; - _notificationRegistrations.clear(); - _requestRegistrations.clear(); -} - -- (void)bundleURLSettingsChanged -{ - std::lock_guard l(_mutex); - if (_socket == nil) { - return; // already stopped - } - - NSString *const jsLocation = [RCTBundleURLProvider sharedSettings].jsLocation; - if ([jsLocation isEqual:_jsLocationForSocket]) { - return; // unchanged - } - - _socket.delegate = nil; - [_socket stop]; - _jsLocationForSocket = jsLocation; - _socket = socketForLocation(jsLocation); - _socket.delegate = self; - [_socket start]; -} - -- (RCTHandlerToken)addNotificationHandler:(RCTNotificationHandler)handler queue:(dispatch_queue_t)queue forMethod:(NSString *)method -{ - std::lock_guard l(_mutex); - const auto token = _nextToken++; - _notificationRegistrations.push_back({method, handler, queue, token}); - return token; -} - -- (RCTHandlerToken)addRequestHandler:(RCTRequestHandler)handler queue:(dispatch_queue_t)queue forMethod:(NSString *)method -{ - std::lock_guard l(_mutex); - const auto token = _nextToken++; - _requestRegistrations.push_back({method, handler, queue, token}); - return token; -} - -- (RCTHandlerToken)addConnectedHandler:(RCTConnectedHandler)handler queue:(dispatch_queue_t)queue -{ - std::lock_guard l(_mutex); - if (_socketConnected) { - dispatch_async(queue, ^{ - handler(); - }); - return 0; // _nextToken starts at 1, so 0 is a no-op token - } else { - const auto token = _nextToken++; - _connectedRegistrations.push_back({nil, handler, queue, token}); - return token; - } -} - -- (void)removeHandler:(RCTHandlerToken)token -{ - std::lock_guard l(_mutex); - eraseRegistrationsWithToken(_notificationRegistrations, token); - eraseRegistrationsWithToken(_requestRegistrations, token); - eraseRegistrationsWithToken(_connectedRegistrations, token); -} - -template -static void eraseRegistrationsWithToken(std::vector> ®istrations, RCTHandlerToken token) -{ - registrations.erase(std::remove_if(registrations.begin(), registrations.end(), - [&token](const auto ®) { return reg.token == token; }), - registrations.end()); -} - -- (void)addHandler:(id)handler forMethod:(NSString *)method -{ - dispatch_queue_t queue = [handler respondsToSelector:@selector(methodQueue)] - ? [handler methodQueue] : dispatch_get_main_queue(); - - [self addNotificationHandler:^(NSDictionary *notification) { - [handler handleNotification:notification]; - } queue:queue forMethod:method]; - [self addRequestHandler:^(NSDictionary *request, RCTPackagerClientResponder *responder) { - [handler handleRequest:request withResponder:responder]; - } queue:queue forMethod:method]; -} - -static BOOL isSupportedVersion(NSNumber *version) -{ - NSArray *const kSupportedVersions = @[ @(RCT_PACKAGER_CLIENT_PROTOCOL_VERSION) ]; - return [kSupportedVersions containsObject:version]; -} - -#pragma mark - RCTReconnectingWebSocketDelegate - -- (void)reconnectingWebSocketDidOpen:(RCTReconnectingWebSocket *)webSocket -{ - std::vector> registrations; - { - std::lock_guard l(_mutex); - _socketConnected = YES; - registrations = _connectedRegistrations; - _connectedRegistrations.clear(); - } - for (const auto ®istration : registrations) { - // Beware: don't capture the reference to handler in a dispatched block! - RCTConnectedHandler handler = registration.handler; - dispatch_async(registration.queue, ^{ handler(); }); - } -} - -- (void)reconnectingWebSocket:(RCTReconnectingWebSocket *)webSocket didReceiveMessage:(id)message -{ - 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 (!isSupportedVersion(msg[@"version"])) { - RCTLogError(@"%@ received message with not supported version %@", [self class], msg[@"version"]); - return; - } - - NSString *const method = msg[@"method"]; - NSDictionary *const params = msg[@"params"]; - id messageId = msg[@"id"]; - - if (messageId) { // Request - const std::vector> registrations(registrationsWithMethod(_mutex, _requestRegistrations, method)); - if (registrations.empty()) { - RCTLogError(@"No handler found for packager method %@", msg[@"method"]); - [[[RCTPackagerClientResponder alloc] initWithId:messageId - socket:webSocket] - respondWithError: - [NSString stringWithFormat:@"No handler found for packager method %@", msg[@"method"]]]; - } else { - // If there are multiple matching request registrations, only one can win; - // otherwise the packager would get multiple responses. Choose the last one. - RCTRequestHandler handler = registrations.back().handler; - dispatch_async(registrations.back().queue, ^{ - handler(params, [[RCTPackagerClientResponder alloc] initWithId:messageId socket:webSocket]); - }); - } - } else { // Notification - const std::vector> registrations(registrationsWithMethod(_mutex, _notificationRegistrations, method)); - for (const auto ®istration : registrations) { - // Beware: don't capture the reference to handler in a dispatched block! - RCTNotificationHandler handler = registration.handler; - dispatch_async(registration.queue, ^{ handler(params); }); - } - } -} - -- (void)reconnectingWebSocketDidClose:(RCTReconnectingWebSocket *)webSocket -{ - std::lock_guard l(_mutex); - _socketConnected = NO; -} - -template -static std::vector> registrationsWithMethod(std::mutex &mutex, const std::vector> ®istrations, NSString *method) -{ - std::lock_guard l(mutex); // Scope lock acquisition to prevent deadlock when calling out - std::vector> matches; - for (const auto ® : registrations) { - if ([reg.method isEqual:method]) { - matches.push_back(reg); - } - } - return matches; -} - -@end - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.h deleted file mode 100644 index d7534d94..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * UIView class for root component. - */ -@interface RCTActivityIndicatorViewComponentView : RCTViewComponentView - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm deleted file mode 100644 index ffa0203c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTActivityIndicatorViewComponentView.h" - -#import -#import - -using namespace facebook::react; - -static UIActivityIndicatorViewStyle convertActivityIndicatorViewStyle(const ActivityIndicatorViewSize &size) { - switch (size) { - case ActivityIndicatorViewSize::Small: - return UIActivityIndicatorViewStyleWhite; - case ActivityIndicatorViewSize::Large: - return UIActivityIndicatorViewStyleWhiteLarge; - } -} - -@implementation RCTActivityIndicatorViewComponentView { - UIActivityIndicatorView *_activityIndicatorView; -} - -#pragma mark - RCTComponentViewProtocol - -+ (ComponentHandle)componentHandle -{ - return ActivityIndicatorViewShadowNode::Handle(); -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - - _activityIndicatorView = [[UIActivityIndicatorView alloc] initWithFrame:self.bounds]; - _activityIndicatorView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - - if (defaultProps->animating) { - [_activityIndicatorView startAnimating]; - } else { - [_activityIndicatorView stopAnimating]; - } - _activityIndicatorView.color = [UIColor colorWithCGColor:defaultProps->color.get()]; - _activityIndicatorView.hidesWhenStopped = defaultProps->hidesWhenStopped; - _activityIndicatorView.activityIndicatorViewStyle = convertActivityIndicatorViewStyle(defaultProps->size); - - [self addSubview:_activityIndicatorView]; - } - - return self; -} - -- (void)updateProps:(SharedProps)props oldProps:(SharedProps)oldProps -{ - const auto &oldViewProps = *std::static_pointer_cast(oldProps ?: _props); - const auto &newViewProps = *std::static_pointer_cast(props); - - [super updateProps:props oldProps:oldProps]; - - if (oldViewProps.animating != newViewProps.animating) { - if (newViewProps.animating) { - [_activityIndicatorView startAnimating]; - } else { - [_activityIndicatorView stopAnimating]; - } - } - - if (oldViewProps.color.get() != newViewProps.color.get()) { - _activityIndicatorView.color = [UIColor colorWithCGColor:newViewProps.color.get()]; - } - - // TODO: This prop should be deprecated. - if (oldViewProps.hidesWhenStopped != newViewProps.hidesWhenStopped) { - _activityIndicatorView.hidesWhenStopped = newViewProps.hidesWhenStopped; - } - - if (oldViewProps.size != newViewProps.size) { - _activityIndicatorView.activityIndicatorViewStyle = convertActivityIndicatorViewStyle(newViewProps.size); - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.h deleted file mode 100644 index 3fd08c2b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTViewComponentView.h" -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * UIView class for root component. - */ -@interface RCTImageComponentView : RCTViewComponentView - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm deleted file mode 100644 index b3ec1a83..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTImageComponentView.h" - -#import -#import -#import -#import -#import -#import -#import - -#import "RCTConversions.h" -#import "MainQueueExecutor.h" - -@implementation RCTImageComponentView { - UIImageView *_imageView; - SharedImageLocalData _imageLocalData; - const ImageResponseObserverCoordinator *_coordinator; - std::unique_ptr _imageResponseObserverProxy; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - - _imageView = [[UIImageView alloc] initWithFrame:self.bounds]; - _imageView.clipsToBounds = YES; - - _imageView.contentMode = (UIViewContentMode)RCTResizeModeFromImageResizeMode(defaultProps->resizeMode); - - _imageResponseObserverProxy = std::make_unique((__bridge void *)self); - - self.contentView = _imageView; - } - - return self; -} - -#pragma mark - RCTComponentViewProtocol - -+ (ComponentHandle)componentHandle -{ - return ImageShadowNode::Handle(); -} - -- (void)updateProps:(SharedProps)props oldProps:(SharedProps)oldProps -{ - const auto &oldImageProps = *std::static_pointer_cast(oldProps ?: _props); - const auto &newImageProps = *std::static_pointer_cast(props); - - [super updateProps:props oldProps:oldProps]; - - // `resizeMode` - if (oldImageProps.resizeMode != newImageProps.resizeMode) { - if (newImageProps.resizeMode == ImageResizeMode::Repeat) { - // Repeat resize mode is handled by the UIImage. Use scale to fill - // so the repeated image fills the UIImageView. - _imageView.contentMode = UIViewContentModeScaleToFill; - } else { - _imageView.contentMode = (UIViewContentMode)RCTResizeModeFromImageResizeMode(newImageProps.resizeMode); - } - } - - // `tintColor` - if (oldImageProps.tintColor != newImageProps.tintColor) { - _imageView.tintColor = [UIColor colorWithCGColor:newImageProps.tintColor.get()]; - } -} - -- (void)updateLocalData:(SharedLocalData)localData - oldLocalData:(SharedLocalData)oldLocalData -{ - SharedImageLocalData previousData = _imageLocalData; - _imageLocalData = std::static_pointer_cast(localData); - assert(_imageLocalData); - bool havePreviousData = previousData != nullptr; - - if (!havePreviousData || _imageLocalData->getImageSource() != previousData->getImageSource()) { - self.coordinator = _imageLocalData->getImageRequest().getObserverCoordinator(); - - // Loading actually starts a little before this, but this is the first time we know - // the image is loading and can fire an event from this component - std::static_pointer_cast(_eventEmitter)->onLoadStart(); - } -} - -- (void)setCoordinator:(const ImageResponseObserverCoordinator *)coordinator { - if (_coordinator) { - _coordinator->removeObserver(_imageResponseObserverProxy.get()); - } - _coordinator = coordinator; - if (_coordinator != nullptr) { - _coordinator->addObserver(_imageResponseObserverProxy.get()); - } -} - -- (void)prepareForRecycle -{ - [super prepareForRecycle]; - self.coordinator = nullptr; - _imageView.image = nil; - _imageLocalData.reset(); -} - --(void)dealloc -{ - self.coordinator = nullptr; - _imageResponseObserverProxy.reset(); -} - -#pragma mark - RCTImageResponseDelegate - -- (void)didReceiveImage:(UIImage *)image fromObserver:(void*)observer -{ - std::static_pointer_cast(_eventEmitter)->onLoad(); - - const auto &imageProps = *std::static_pointer_cast(_props); - - if (imageProps.tintColor) { - image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; - } - - if (imageProps.resizeMode == ImageResizeMode::Repeat) { - image = [image resizableImageWithCapInsets:RCTUIEdgeInsetsFromEdgeInsets(imageProps.capInsets) - resizingMode:UIImageResizingModeTile]; - } else if (imageProps.capInsets != EdgeInsets()) { - // Applying capInsets of 0 will switch the "resizingMode" of the image to "tile" which is undesired. - image = [image resizableImageWithCapInsets:RCTUIEdgeInsetsFromEdgeInsets(imageProps.capInsets) - resizingMode:UIImageResizingModeStretch]; - } - - self->_imageView.image = image; - - // Apply trilinear filtering to smooth out mis-sized images. - self->_imageView.layer.minificationFilter = kCAFilterTrilinear; - self->_imageView.layer.magnificationFilter = kCAFilterTrilinear; - - std::static_pointer_cast(self->_eventEmitter)->onLoadEnd(); -} - -- (void)didReceiveProgress:(float)progress fromObserver:(void*)observer { - std::static_pointer_cast(_eventEmitter)->onProgress(progress); -} - -- (void)didReceiveFailureFromObserver:(void*)observer { - std::static_pointer_cast(_eventEmitter)->onError(); -} - - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.h deleted file mode 100644 index ef647bc1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * UIView class for root component. - */ -@interface RCTRootComponentView : RCTViewComponentView - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.mm deleted file mode 100644 index d5e7b3be..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.mm +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTRootComponentView.h" - -#import -#import - -using namespace facebook::react; - -@implementation RCTRootComponentView - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - } - - return self; -} - -+ (ComponentHandle)componentHandle -{ - return RootShadowNode::Handle(); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.h deleted file mode 100644 index 8416d2b9..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.h +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * `UIScrollView` subclass which has some improvements and tweaks - * wich are not directly related to React. - */ -@interface RCTEnhancedScrollView : UIScrollView - -@property (nonatomic, assign) BOOL pinchGestureEnabled; -@property (nonatomic, assign) BOOL centerContent; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm deleted file mode 100644 index eab20fea..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTEnhancedScrollView.h" - -@implementation RCTEnhancedScrollView - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.h deleted file mode 100644 index 5840a9d3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * UIView class for component. - */ -@interface RCTScrollViewComponentView : RCTViewComponentView - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm deleted file mode 100644 index f92ca42a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +++ /dev/null @@ -1,185 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTScrollViewComponentView.h" - -#import -#import -#import -#import -#import -#import - -#import "RCTConversions.h" -#import "RCTEnhancedScrollView.h" - -using namespace facebook::react; - -@interface RCTScrollViewComponentView () - -@property (nonatomic, assign) CGFloat scrollEventThrottle; - -@end - -@implementation RCTScrollViewComponentView { - RCTEnhancedScrollView *_Nonnull _scrollView; - UIView *_Nonnull _contentView; - SharedScrollViewLocalData _scrollViewLocalData; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - - _scrollView = [[RCTEnhancedScrollView alloc] initWithFrame:self.bounds]; - _scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - _scrollView.delegate = self; - _scrollView.delaysContentTouches = NO; - _contentView = [[UIView alloc] initWithFrame:_scrollView.bounds]; - [_scrollView addSubview:_contentView]; - [self addSubview:_scrollView]; - } - - return self; -} - -#pragma mark - RCTComponentViewProtocol - -+ (ComponentHandle)componentHandle -{ - return ScrollViewShadowNode::Handle(); -} - -- (void)updateProps:(SharedProps)props oldProps:(SharedProps)oldProps -{ - const auto &oldScrollViewProps = *std::static_pointer_cast(oldProps ?: _props); - const auto &newScrollViewProps = *std::static_pointer_cast(props); - - [super updateProps:props oldProps:oldProps]; - -#define REMAP_PROP(reactName, localName, target) \ - if (oldScrollViewProps.reactName != newScrollViewProps.reactName) { \ - target.localName = newScrollViewProps.reactName; \ - } - -#define REMAP_VIEW_PROP(reactName, localName) REMAP_PROP(reactName, localName, self) -#define MAP_VIEW_PROP(name) REMAP_VIEW_PROP(name, name) -#define REMAP_SCROLL_VIEW_PROP(reactName, localName) REMAP_PROP(reactName, localName, _scrollView) -#define MAP_SCROLL_VIEW_PROP(name) REMAP_SCROLL_VIEW_PROP(name, name) - - // FIXME: Commented props are not supported yet. - MAP_SCROLL_VIEW_PROP(alwaysBounceHorizontal); - MAP_SCROLL_VIEW_PROP(alwaysBounceVertical); - MAP_SCROLL_VIEW_PROP(bounces); - MAP_SCROLL_VIEW_PROP(bouncesZoom); - MAP_SCROLL_VIEW_PROP(canCancelContentTouches); - MAP_SCROLL_VIEW_PROP(centerContent); - //MAP_SCROLL_VIEW_PROP(automaticallyAdjustContentInsets); - MAP_SCROLL_VIEW_PROP(decelerationRate); - MAP_SCROLL_VIEW_PROP(directionalLockEnabled); - //MAP_SCROLL_VIEW_PROP(indicatorStyle); - //MAP_SCROLL_VIEW_PROP(keyboardDismissMode); - MAP_SCROLL_VIEW_PROP(maximumZoomScale); - MAP_SCROLL_VIEW_PROP(minimumZoomScale); - MAP_SCROLL_VIEW_PROP(scrollEnabled); - MAP_SCROLL_VIEW_PROP(pagingEnabled); - MAP_SCROLL_VIEW_PROP(pinchGestureEnabled); - MAP_SCROLL_VIEW_PROP(scrollsToTop); - MAP_SCROLL_VIEW_PROP(showsHorizontalScrollIndicator); - MAP_SCROLL_VIEW_PROP(showsVerticalScrollIndicator); - MAP_VIEW_PROP(scrollEventThrottle); - MAP_SCROLL_VIEW_PROP(zoomScale); - //MAP_SCROLL_VIEW_PROP(contentInset); - //MAP_SCROLL_VIEW_PROP(scrollIndicatorInsets); - //MAP_SCROLL_VIEW_PROP(snapToInterval); - //MAP_SCROLL_VIEW_PROP(snapToAlignment); -} - -- (void)updateLocalData:(SharedLocalData)localData - oldLocalData:(SharedLocalData)oldLocalData -{ - assert(std::dynamic_pointer_cast(localData)); - _scrollViewLocalData = std::static_pointer_cast(localData); - CGSize contentSize = RCTCGSizeFromSize(_scrollViewLocalData->getContentSize()); - _contentView.frame = CGRect {CGPointZero, contentSize}; - _scrollView.contentSize = contentSize; -} - -- (void)mountChildComponentView:(UIView *)childComponentView - index:(NSInteger)index -{ - [_contentView insertSubview:childComponentView atIndex:index]; -} - -- (void)unmountChildComponentView:(UIView *)childComponentView - index:(NSInteger)index -{ - RCTAssert(childComponentView.superview == _contentView, @"Attempt to unmount improperly mounted component view."); - [childComponentView removeFromSuperview]; -} - -- (ScrollViewMetrics)_scrollViewMetrics -{ - ScrollViewMetrics metrics; - metrics.contentSize = RCTSizeFromCGSize(_scrollView.contentSize); - metrics.contentOffset = RCTPointFromCGPoint(_scrollView.contentOffset); - metrics.contentInset = RCTEdgeInsetsFromUIEdgeInsets(_scrollView.contentInset); - metrics.containerSize = RCTSizeFromCGSize(_scrollView.bounds.size); - metrics.zoomScale = _scrollView.zoomScale; - return metrics; -} - -#pragma mark - UIScrollViewDelegate - -- (void)scrollViewDidScroll:(UIScrollView *)scrollView -{ - std::static_pointer_cast(_eventEmitter)->onScroll([self _scrollViewMetrics]); -} - -- (void)scrollViewDidZoom:(UIScrollView *)scrollView -{ - std::static_pointer_cast(_eventEmitter)->onScroll([self _scrollViewMetrics]); -} - -- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView -{ - std::static_pointer_cast(_eventEmitter)->onScrollBeginDrag([self _scrollViewMetrics]); -} - -- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset -{ - std::static_pointer_cast(_eventEmitter)->onScrollEndDrag([self _scrollViewMetrics]); -} - -- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView -{ - std::static_pointer_cast(_eventEmitter)->onMomentumScrollBegin([self _scrollViewMetrics]); -} - -- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView -{ - std::static_pointer_cast(_eventEmitter)->onMomentumScrollEnd([self _scrollViewMetrics]); -} - -- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView -{ - std::static_pointer_cast(_eventEmitter)->onMomentumScrollEnd([self _scrollViewMetrics]); -} - -- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(nullable UIView *)view -{ - std::static_pointer_cast(_eventEmitter)->onScrollBeginDrag([self _scrollViewMetrics]); -} - -- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(nullable UIView *)view atScale:(CGFloat)scale -{ - std::static_pointer_cast(_eventEmitter)->onScrollEndDrag([self _scrollViewMetrics]); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.h deleted file mode 100644 index 75ca052d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * UIView class for root component. - */ -@interface RCTSliderComponentView : RCTViewComponentView - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm deleted file mode 100644 index ccdef3d9..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm +++ /dev/null @@ -1,335 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSliderComponentView.h" - -#import -#import -#import -#import -#import - -#import "MainQueueExecutor.h" - -using namespace facebook::react; - -@implementation RCTSliderComponentView { - UISlider *_sliderView; - float _previousValue; - SharedSliderLocalData _sliderLocalData; - - UIImage *_trackImage; - UIImage *_minimumTrackImage; - UIImage *_maximumTrackImage; - UIImage *_thumbImage; - - const ImageResponseObserverCoordinator *_trackImageCoordinator; - const ImageResponseObserverCoordinator *_minimumTrackImageCoordinator; - const ImageResponseObserverCoordinator *_maximumTrackImageCoordinator; - const ImageResponseObserverCoordinator *_thumbImageCoordinator; - - std::unique_ptr _trackImageResponseObserverProxy; - std::unique_ptr _minimumTrackImageResponseObserverProxy; - std::unique_ptr _maximumTrackImageResponseObserverProxy; - std::unique_ptr _thumbImageResponseObserverProxy; -} - - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - - _sliderView = [[UISlider alloc] initWithFrame:self.bounds]; - - [_sliderView addTarget:self - action:@selector(onChange:) - forControlEvents:UIControlEventValueChanged]; - [_sliderView addTarget:self - action:@selector(sliderTouchEnd:) - forControlEvents:(UIControlEventTouchUpInside | - UIControlEventTouchUpOutside | - UIControlEventTouchCancel)]; - - _sliderView.value = defaultProps->value; - - _trackImageResponseObserverProxy = std::make_unique((__bridge void *)self); - _minimumTrackImageResponseObserverProxy = std::make_unique((__bridge void *)self); - _maximumTrackImageResponseObserverProxy = std::make_unique((__bridge void *)self); - _thumbImageResponseObserverProxy = std::make_unique((__bridge void *)self); - - self.contentView = _sliderView; - } - - return self; -} - -// Recycling still doesn't work 100% properly -// TODO: T40099998 implement recycling properly for Fabric Slider component -- (void)prepareForRecycle -{ - [super prepareForRecycle]; - - self.trackImageCoordinator = nullptr; - self.minimumTrackImageCoordinator = nullptr; - self.maximumTrackImageCoordinator = nullptr; - self.thumbImageCoordinator = nullptr; - - _sliderLocalData.reset(); - - // Tint colors will be taken care of when props are set again - we just - // need to make sure that image properties are reset here - [_sliderView setMinimumTrackImage:nil forState:UIControlStateNormal]; - [_sliderView setMaximumTrackImage:nil forState:UIControlStateNormal]; - [_sliderView setThumbImage:nil forState:UIControlStateNormal]; - - _trackImage = nil; - _minimumTrackImage = nil; - _maximumTrackImage = nil; - _thumbImage = nil; -} - --(void)dealloc -{ - self.trackImageCoordinator = nullptr; - self.minimumTrackImageCoordinator = nullptr; - self.maximumTrackImageCoordinator = nullptr; - self.thumbImageCoordinator = nullptr; - - _trackImageResponseObserverProxy.reset(); - _minimumTrackImageResponseObserverProxy.reset(); - _maximumTrackImageResponseObserverProxy.reset(); - _thumbImageResponseObserverProxy.reset(); -} - -#pragma mark - RCTComponentViewProtocol - -+ (ComponentHandle)componentHandle -{ - return SliderShadowNode::Handle(); -} - -- (void)updateProps:(SharedProps)props oldProps:(SharedProps)oldProps -{ - const auto &oldSliderProps = *std::static_pointer_cast(oldProps ?: _props); - const auto &newSliderProps = *std::static_pointer_cast(props); - - [super updateProps:props oldProps:oldProps]; - - // `value` - if (oldSliderProps.value != newSliderProps.value) { - _sliderView.value = newSliderProps.value; - _previousValue = newSliderProps.value; - } - - // `minimumValue` - if (oldSliderProps.minimumValue != newSliderProps.minimumValue) { - _sliderView.minimumValue = newSliderProps.minimumValue; - } - - // `maximumValue` - if (oldSliderProps.maximumValue != newSliderProps.maximumValue) { - _sliderView.maximumValue = newSliderProps.maximumValue; - } - - // `disabled` - if (oldSliderProps.disabled != newSliderProps.disabled) { - _sliderView.enabled = !newSliderProps.disabled; - } - - // `thumbTintColor` - if (oldSliderProps.thumbTintColor != newSliderProps.thumbTintColor) { - _sliderView.thumbTintColor = [UIColor colorWithCGColor:newSliderProps.thumbTintColor.get()]; - } - - // `minimumTrackTintColor` - if (oldSliderProps.minimumTrackTintColor != newSliderProps.minimumTrackTintColor) { - _sliderView.minimumTrackTintColor = [UIColor colorWithCGColor:newSliderProps.minimumTrackTintColor.get()]; - } - - // `maximumTrackTintColor` - if (oldSliderProps.maximumTrackTintColor != newSliderProps.maximumTrackTintColor) { - _sliderView.maximumTrackTintColor = [UIColor colorWithCGColor:newSliderProps.maximumTrackTintColor.get()]; - } -} - -- (void)updateLocalData:(SharedLocalData)localData - oldLocalData:(SharedLocalData)oldLocalData -{ - SharedSliderLocalData previousData = _sliderLocalData; - _sliderLocalData = std::static_pointer_cast(localData); - assert(_sliderLocalData); - bool havePreviousData = previousData != nullptr; - - if (!havePreviousData || _sliderLocalData->getTrackImageSource() != previousData->getTrackImageSource()) { - self.trackImageCoordinator = _sliderLocalData->getTrackImageRequest().getObserverCoordinator(); - } - if (!havePreviousData || _sliderLocalData->getMinimumTrackImageSource() != previousData->getMinimumTrackImageSource()) { - self.minimumTrackImageCoordinator = _sliderLocalData->getMinimumTrackImageRequest().getObserverCoordinator(); - } - if (!havePreviousData || _sliderLocalData->getMaximumTrackImageSource() != previousData->getMaximumTrackImageSource()) { - self.maximumTrackImageCoordinator = _sliderLocalData->getMaximumTrackImageRequest().getObserverCoordinator(); - } - if (!havePreviousData || _sliderLocalData->getThumbImageSource() != previousData->getThumbImageSource()) { - self.thumbImageCoordinator = _sliderLocalData->getThumbImageRequest().getObserverCoordinator(); - } -} - -- (void)setTrackImageCoordinator:(const ImageResponseObserverCoordinator *)coordinator { - if (_trackImageCoordinator) { - _trackImageCoordinator->removeObserver(_trackImageResponseObserverProxy.get()); - } - _trackImageCoordinator = coordinator; - if (_trackImageCoordinator) { - _trackImageCoordinator->addObserver(_trackImageResponseObserverProxy.get()); - } -} - -- (void)setMinimumTrackImageCoordinator:(const ImageResponseObserverCoordinator *)coordinator { - if (_minimumTrackImageCoordinator) { - _minimumTrackImageCoordinator->removeObserver(_minimumTrackImageResponseObserverProxy.get()); - } - _minimumTrackImageCoordinator = coordinator; - if (_minimumTrackImageCoordinator) { - _minimumTrackImageCoordinator->addObserver(_minimumTrackImageResponseObserverProxy.get()); - } -} - -- (void)setMaximumTrackImageCoordinator:(const ImageResponseObserverCoordinator *)coordinator { - if (_maximumTrackImageCoordinator) { - _maximumTrackImageCoordinator->removeObserver(_maximumTrackImageResponseObserverProxy.get()); - } - _maximumTrackImageCoordinator = coordinator; - if (_maximumTrackImageCoordinator) { - _maximumTrackImageCoordinator->addObserver(_maximumTrackImageResponseObserverProxy.get()); - } -} - -- (void)setThumbImageCoordinator:(const ImageResponseObserverCoordinator *)coordinator { - if (_thumbImageCoordinator) { - _thumbImageCoordinator->removeObserver(_thumbImageResponseObserverProxy.get()); - } - _thumbImageCoordinator = coordinator; - if (_thumbImageCoordinator) { - _thumbImageCoordinator->addObserver(_thumbImageResponseObserverProxy.get()); - } -} - -- (void)setTrackImage:(UIImage *)trackImage { - if ([trackImage isEqual:_trackImage]) { - return; - } - - _trackImage = trackImage; - _minimumTrackImage = nil; - _maximumTrackImage = nil; - CGFloat width = trackImage.size.width / 2; - UIImage *minimumTrackImage = [trackImage resizableImageWithCapInsets:(UIEdgeInsets){ - 0, width, 0, width - } resizingMode:UIImageResizingModeStretch]; - UIImage *maximumTrackImage = [trackImage resizableImageWithCapInsets:(UIEdgeInsets){ - 0, width, 0, width - } resizingMode:UIImageResizingModeStretch]; - [_sliderView setMinimumTrackImage:minimumTrackImage forState:UIControlStateNormal]; - [_sliderView setMaximumTrackImage:maximumTrackImage forState:UIControlStateNormal]; -} - --(void)setMinimumTrackImage:(UIImage *)minimumTrackImage { - if ([minimumTrackImage isEqual:_minimumTrackImage] && _trackImage == nil) { - return; - } - - _trackImage = nil; - _minimumTrackImage = minimumTrackImage; - _minimumTrackImage = [_minimumTrackImage resizableImageWithCapInsets:(UIEdgeInsets) { - 0, _minimumTrackImage.size.width, 0, 0 - } resizingMode:UIImageResizingModeStretch]; - [_sliderView setMinimumTrackImage:_minimumTrackImage forState:UIControlStateNormal]; -} - --(void)setMaximumTrackImage:(UIImage *)maximumTrackImage { - if ([maximumTrackImage isEqual:_maximumTrackImage] && _trackImage == nil) { - return; - } - - _trackImage = nil; - _maximumTrackImage = maximumTrackImage; - _maximumTrackImage = [_maximumTrackImage resizableImageWithCapInsets:(UIEdgeInsets) { - 0, 0, 0, _maximumTrackImage.size.width - } resizingMode:UIImageResizingModeStretch]; - [_sliderView setMaximumTrackImage:_maximumTrackImage forState:UIControlStateNormal]; -} - --(void)setThumbImage:(UIImage *)thumbImage { - if ([thumbImage isEqual:_thumbImage]) { - return; - } - - _thumbImage = thumbImage; - [_sliderView setThumbImage:thumbImage forState:UIControlStateNormal]; -} - -- (void)onChange:(UISlider *)sender -{ - [self onChange:sender withContinuous:YES]; -} - -- (void)sliderTouchEnd:(UISlider *)sender -{ - [self onChange:sender withContinuous:NO]; -} - -- (void)onChange:(UISlider *)sender withContinuous:(BOOL)continuous -{ - float value = sender.value; - - const auto &props = *std::static_pointer_cast(_props); - - if (props.step > 0 && value <= (props.maximumValue - props.minimumValue)) { - value = MAX(props.minimumValue, - MIN(props.maximumValue, - props.minimumValue + round((value - props.minimumValue) / props.step) * props.step - ) - ); - - [_sliderView setValue:value animated:YES]; - } - - if (continuous && _previousValue != value) { - std::dynamic_pointer_cast(_eventEmitter)->onValueChange(value); - } - if (!continuous) { - std::dynamic_pointer_cast(_eventEmitter)->onSlidingComplete(value); - } - - _previousValue = value; -} - -#pragma mark - RCTImageResponseDelegate - -- (void)didReceiveImage:(UIImage *)image fromObserver:(void *)observer -{ - if (observer == _trackImageResponseObserverProxy.get()) { - self.trackImage = image; - } else if (observer == _minimumTrackImageResponseObserverProxy.get()) { - self.minimumTrackImage = image; - } else if (observer == _maximumTrackImageResponseObserverProxy.get()) { - self.maximumTrackImage = image; - } else if (observer == _thumbImageResponseObserverProxy.get()) { - self.thumbImage = image; - } -} - -- (void)didReceiveProgress:(float)progress fromObserver:(void *)observer { -} - -- (void)didReceiveFailureFromObserver:(void *)observer { -} - - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.h deleted file mode 100644 index b18ea4b2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * UIView class for root component. - */ -@interface RCTSwitchComponentView : RCTViewComponentView - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm deleted file mode 100644 index 54cb8b2c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSwitchComponentView.h" - -#import -#import -#import - -using namespace facebook::react; - -@implementation RCTSwitchComponentView { - UISwitch *_switchView; - BOOL _wasOn; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - - _switchView = [[UISwitch alloc] initWithFrame:self.bounds]; - - [_switchView addTarget:self - action:@selector(onChange:) - forControlEvents:UIControlEventValueChanged]; - - _switchView.on = defaultProps->value; - - self.contentView = _switchView; - } - - return self; -} - -#pragma mark - RCTComponentViewProtocol - -+ (ComponentHandle)componentHandle -{ - return SwitchShadowNode::Handle(); -} - -- (void)updateProps:(SharedProps)props oldProps:(SharedProps)oldProps -{ - const auto &oldSwitchProps = *std::static_pointer_cast(oldProps ?: _props); - const auto &newSwitchProps = *std::static_pointer_cast(props); - - [super updateProps:props oldProps:oldProps]; - - // `value` - if (oldSwitchProps.value != newSwitchProps.value) { - _switchView.on = newSwitchProps.value; - _wasOn = newSwitchProps.value; - } - - // `disabled` - if (oldSwitchProps.disabled != newSwitchProps.disabled) { - _switchView.enabled = !newSwitchProps.disabled; - } - - // `tintColor` - if (oldSwitchProps.tintColor != newSwitchProps.tintColor) { - _switchView.tintColor = [UIColor colorWithCGColor:newSwitchProps.tintColor.get()]; - } - - // `onTintColor - if (oldSwitchProps.onTintColor != newSwitchProps.onTintColor) { - _switchView.onTintColor = [UIColor colorWithCGColor:newSwitchProps.onTintColor.get()]; - } - - // `thumbTintColor` - if (oldSwitchProps.thumbTintColor != newSwitchProps.thumbTintColor) { - _switchView.thumbTintColor = [UIColor colorWithCGColor:newSwitchProps.thumbTintColor.get()]; - } -} - -- (void)onChange:(UISwitch *)sender -{ - if (_wasOn == sender.on) { - return; - } - _wasOn = sender.on; - - std::dynamic_pointer_cast(_eventEmitter)->onChange(SwitchOnChangeStruct{.value=static_cast(sender.on)}); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.h deleted file mode 100644 index 9e9573a5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * UIView class for component. - */ -@interface RCTParagraphComponentView : RCTViewComponentView - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm deleted file mode 100644 index 90ad5d2e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +++ /dev/null @@ -1,131 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTParagraphComponentView.h" - -#import -#import -#import -#import -#import -#import -#import -#import "RCTConversions.h" - -using namespace facebook::react; - -@implementation RCTParagraphComponentView { - SharedParagraphLocalData _paragraphLocalData; - ParagraphAttributes _paragraphAttributes; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - - self.isAccessibilityElement = YES; - self.accessibilityTraits |= UIAccessibilityTraitStaticText; - self.opaque = NO; - self.contentMode = UIViewContentModeRedraw; - } - - return self; -} - -#pragma mark - RCTComponentViewProtocol - -+ (ComponentHandle)componentHandle -{ - return ParagraphShadowNode::Handle(); -} - -- (void)updateProps:(SharedProps)props oldProps:(SharedProps)oldProps -{ - const auto ¶graphProps = std::static_pointer_cast(props); - - [super updateProps:props oldProps:oldProps]; - - assert(paragraphProps); - _paragraphAttributes = paragraphProps->paragraphAttributes; -} - -- (void)updateLocalData:(SharedLocalData)localData - oldLocalData:(SharedLocalData)oldLocalData -{ - _paragraphLocalData = std::static_pointer_cast(localData); - assert(_paragraphLocalData); - [self setNeedsDisplay]; -} - -- (void)prepareForRecycle -{ - [super prepareForRecycle]; - _paragraphLocalData.reset(); -} - -- (void)drawRect:(CGRect)rect -{ - if (!_paragraphLocalData) { - return; - } - - SharedTextLayoutManager textLayoutManager = - _paragraphLocalData->getTextLayoutManager(); - RCTTextLayoutManager *nativeTextLayoutManager = - (__bridge RCTTextLayoutManager *)textLayoutManager->getNativeTextLayoutManager(); - - CGRect frame = RCTCGRectFromRect(_layoutMetrics.getContentFrame()); - - [nativeTextLayoutManager drawAttributedString:_paragraphLocalData->getAttributedString() - paragraphAttributes:_paragraphAttributes - frame:frame]; -} - -#pragma mark - Accessibility - -- (NSString *)accessibilityLabel -{ - NSString *superAccessibilityLabel = - RCTNSStringFromStringNilIfEmpty(_props->accessibilityLabel); - if (superAccessibilityLabel) { - return superAccessibilityLabel; - } - - if (!_paragraphLocalData) { - return nil; - } - - return RCTNSStringFromString(_paragraphLocalData->getAttributedString().getString()); -} - -- (SharedTouchEventEmitter)touchEventEmitterAtPoint:(CGPoint)point -{ - if (!_paragraphLocalData) { - return _eventEmitter; - } - - SharedTextLayoutManager textLayoutManager = _paragraphLocalData->getTextLayoutManager(); - RCTTextLayoutManager *nativeTextLayoutManager = (__bridge RCTTextLayoutManager *)textLayoutManager->getNativeTextLayoutManager(); - CGRect frame = RCTCGRectFromRect(_layoutMetrics.getContentFrame()); - - SharedEventEmitter eventEmitter = - [nativeTextLayoutManager getEventEmitterWithAttributeString:_paragraphLocalData->getAttributedString() - paragraphAttributes:_paragraphAttributes - frame:frame - atPoint:point]; - - if (!eventEmitter) { - return _eventEmitter; - } - - assert(std::dynamic_pointer_cast(eventEmitter)); - return std::static_pointer_cast(eventEmitter); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h deleted file mode 100644 index 0b8a6dda..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import -#import -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * UIView class for component. - */ -@interface RCTViewComponentView : UIView { -@protected - facebook::react::LayoutMetrics _layoutMetrics; - facebook::react::SharedViewProps _props; - facebook::react::SharedViewEventEmitter _eventEmitter; -} - -/** - * Represents the `UIView` instance that is being automatically attached to - * the component view and laid out using on `layoutMetrics` (especially `size` - * and `padding`) of the component. - * This view must not be a component view; it's just a convenient way - * to embed/bridge pure native views as component views. - * Defaults to `nil`. Assing `nil` to remove view as subview. - */ -@property (nonatomic, strong, nullable) UIView *contentView; - -/** - * Provides access to `nativeId` prop of the component. - * It might be used by subclasses (which need to refer to the view from - * other platform-specific external views or systems by some id) or - * by debugging/inspection tools. - * Defaults to `nil`. - */ -@property (nonatomic, strong, nullable) NSString *nativeId; - -/** - * Provides access to `foregroundColor` prop of the component. - * Must be used by subclasses only. - */ -@property (nonatomic, strong, nullable) UIColor *foregroundColor; - -/** - * Returns the object - usually (sub)view - which represents this - * component view in terms of accessibility. - * All accessibility properties will be applied to this object. - * May be overridden in subclass which needs to be accessiblitywise - * transparent in favour of some subview. - * Defaults to `self`. - */ -@property (nonatomic, strong, nullable, readonly) NSObject *accessibilityElement; - -/** - * Insets used when hit testing inside this view. - */ -@property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm deleted file mode 100644 index 82ae59c1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +++ /dev/null @@ -1,573 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTViewComponentView.h" - -#import -#import -#import -#import -#import -#import - -#import "RCTConversions.h" - -using namespace facebook::react; - -@implementation RCTViewComponentView -{ - UIColor *_backgroundColor; - CALayer *_borderLayer; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - } - - return self; -} - -- (void)setContentView:(UIView *)contentView -{ - if (_contentView) { - [_contentView removeFromSuperview]; - } - - _contentView = contentView; - - if (_contentView) { - [self addSubview:_contentView]; - } -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - - if (_borderLayer) { - _borderLayer.frame = self.layer.bounds; - } - - if (_contentView) { - _contentView.frame = RCTCGRectFromRect(_layoutMetrics.getContentFrame()); - } -} - -- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event -{ - if (UIEdgeInsetsEqualToEdgeInsets(self.hitTestEdgeInsets, UIEdgeInsetsZero)) { - return [super pointInside:point withEvent:event]; - } - CGRect hitFrame = UIEdgeInsetsInsetRect(self.bounds, self.hitTestEdgeInsets); - return CGRectContainsPoint(hitFrame, point); -} - -- (UIColor *)backgroundColor -{ - return _backgroundColor; -} - -- (void)setBackgroundColor:(UIColor *)backgroundColor -{ - _backgroundColor = backgroundColor; -} - -#pragma mark - RCTComponentViewProtocol - -+ (ComponentHandle)componentHandle -{ - RCTAssert( - self == [RCTViewComponentView class], - @"`+[RCTComponentViewProtocol componentHandle]` must be implemented for all subclasses (and `%@` particularly).", NSStringFromClass([self class])); - return ViewShadowNode::Handle(); -} - -- (void)updateProps:(SharedProps)props - oldProps:(SharedProps)oldProps -{ -#ifndef NS_BLOCK_ASSERTIONS - auto propsRawPtr = _props.get(); - RCTAssert( - propsRawPtr && - ( - [self class] == [RCTViewComponentView class] || - typeid(*propsRawPtr).hash_code() != typeid(const ViewProps).hash_code() - ), - @"`RCTViewComponentView` subclasses (and `%@` particularly) must setup `_props`" - " instance variable with a default value in the constructor.", NSStringFromClass([self class]) - ); -#endif - - const auto &oldViewProps = *std::static_pointer_cast(oldProps ?: _props); - const auto &newViewProps = *std::static_pointer_cast(props); - - _props = std::static_pointer_cast(props); - - BOOL needsInvalidateLayer = NO; - - // `opacity` - if (oldViewProps.opacity != newViewProps.opacity) { - self.layer.opacity = (CGFloat)newViewProps.opacity; - needsInvalidateLayer = YES; - } - - // `backgroundColor` - if (oldViewProps.backgroundColor != newViewProps.backgroundColor) { - _backgroundColor = RCTUIColorFromSharedColor(newViewProps.backgroundColor); - needsInvalidateLayer = YES; - } - - // `foregroundColor` - if (oldViewProps.foregroundColor != newViewProps.foregroundColor) { - self.foregroundColor = RCTUIColorFromSharedColor(newViewProps.foregroundColor); - } - - // `shadowColor` - if (oldViewProps.shadowColor != newViewProps.shadowColor) { - CGColorRef shadowColor = RCTCGColorRefFromSharedColor(newViewProps.shadowColor); - self.layer.shadowColor = shadowColor; - CGColorRelease(shadowColor); - needsInvalidateLayer = YES; - } - - // `shadowOffset` - if (oldViewProps.shadowOffset != newViewProps.shadowOffset) { - self.layer.shadowOffset = RCTCGSizeFromSize(newViewProps.shadowOffset); - needsInvalidateLayer = YES; - } - - // `shadowOpacity` - if (oldViewProps.shadowOpacity != newViewProps.shadowOpacity) { - self.layer.shadowOpacity = (CGFloat)newViewProps.shadowOpacity; - needsInvalidateLayer = YES; - } - - // `shadowRadius` - if (oldViewProps.shadowRadius != newViewProps.shadowRadius) { - self.layer.shadowRadius = (CGFloat)newViewProps.shadowRadius; - needsInvalidateLayer = YES; - } - - // `backfaceVisibility` - if (oldViewProps.backfaceVisibility != newViewProps.backfaceVisibility) { - self.layer.doubleSided = newViewProps.backfaceVisibility; - } - - // `shouldRasterize` - if (oldViewProps.shouldRasterize != newViewProps.shouldRasterize) { - self.layer.shouldRasterize = newViewProps.shouldRasterize; - self.layer.rasterizationScale = newViewProps.shouldRasterize ? [UIScreen mainScreen].scale : 1.0; - } - - // `pointerEvents` - if (oldViewProps.pointerEvents != newViewProps.pointerEvents) { - self.userInteractionEnabled = newViewProps.pointerEvents != PointerEventsMode::None; - } - - // `transform` - if (oldViewProps.transform != newViewProps.transform) { - self.layer.transform = RCTCATransform3DFromTransformMatrix(newViewProps.transform); - self.layer.allowsEdgeAntialiasing = newViewProps.transform != Transform::Identity(); - } - - // `hitSlop` - if (oldViewProps.hitSlop != newViewProps.hitSlop) { - self.hitTestEdgeInsets = RCTUIEdgeInsetsFromEdgeInsets(newViewProps.hitSlop); - } - - // `overflow` - if (oldViewProps.yogaStyle.overflow != newViewProps.yogaStyle.overflow) { - self.clipsToBounds = newViewProps.yogaStyle.overflow != YGOverflowVisible; - needsInvalidateLayer = YES; - } - - // `zIndex` - if (oldViewProps.zIndex != newViewProps.zIndex) { - self.layer.zPosition = (CGFloat)newViewProps.zIndex; - } - - // `border` - if ( - oldViewProps.borderStyles != newViewProps.borderStyles || - oldViewProps.borderRadii != newViewProps.borderRadii || - oldViewProps.borderColors != newViewProps.borderColors - ) { - needsInvalidateLayer = YES; - } - - // `nativeId` - if (oldViewProps.nativeId != newViewProps.nativeId) { - self.nativeId = RCTNSStringFromStringNilIfEmpty(newViewProps.nativeId); - } - - // `accessible` - if (oldViewProps.accessible != newViewProps.accessible) { - self.accessibilityElement.isAccessibilityElement = newViewProps.accessible; - } - - // `accessibilityLabel` - if (oldViewProps.accessibilityLabel != newViewProps.accessibilityLabel) { - self.accessibilityElement.accessibilityLabel = RCTNSStringFromStringNilIfEmpty(newViewProps.accessibilityLabel); - } - - // `accessibilityHint` - if (oldViewProps.accessibilityHint != newViewProps.accessibilityHint) { - self.accessibilityElement.accessibilityHint = RCTNSStringFromStringNilIfEmpty(newViewProps.accessibilityHint); - } - - // `accessibilityTraits` - if (oldViewProps.accessibilityTraits != newViewProps.accessibilityTraits) { - self.accessibilityElement.accessibilityTraits = RCTUIAccessibilityTraitsFromAccessibilityTraits(newViewProps.accessibilityTraits); - } - - // `accessibilityViewIsModal` - if (oldViewProps.accessibilityViewIsModal != newViewProps.accessibilityViewIsModal) { - self.accessibilityElement.accessibilityViewIsModal = newViewProps.accessibilityViewIsModal; - } - - // `accessibilityElementsHidden` - if (oldViewProps.accessibilityElementsHidden != newViewProps.accessibilityElementsHidden) { - self.accessibilityElement.accessibilityElementsHidden = newViewProps.accessibilityElementsHidden; - } - - // `accessibilityIgnoresInvertColors` - if (oldViewProps.accessibilityIgnoresInvertColors != newViewProps.accessibilityIgnoresInvertColors) { -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ - if (@available(iOS 11.0, *)) { - self.accessibilityIgnoresInvertColors = newViewProps.accessibilityIgnoresInvertColors; - } -#endif - } - - if (needsInvalidateLayer) { - [self invalidateLayer]; - } -} - -- (void)updateEventEmitter:(SharedEventEmitter)eventEmitter -{ - assert(std::dynamic_pointer_cast(eventEmitter)); - _eventEmitter = std::static_pointer_cast(eventEmitter); -} - -- (void)updateLayoutMetrics:(LayoutMetrics)layoutMetrics - oldLayoutMetrics:(LayoutMetrics)oldLayoutMetrics -{ - _layoutMetrics = layoutMetrics; - - [super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics]; - - [self invalidateLayer]; -} - -- (void)prepareForRecycle -{ - [super prepareForRecycle]; - _eventEmitter.reset(); -} - -- (UIView *)betterHitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - // This is a classic textbook implementation of `hitTest:` with a couple of improvements: - // * It takes layers' `zIndex` property into an account; - // * It does not stop algorithm if some touch is outside the view - // which does not have `clipToBounds` enabled. - - if (!self.userInteractionEnabled || self.hidden || self.alpha < 0.01) { - return nil; - } - - BOOL isPointInside = [self pointInside:point withEvent:event]; - - if (self.clipsToBounds && !isPointInside) { - return nil; - } - - NSArray<__kindof UIView *> *sortedSubviews = - [self.subviews sortedArrayUsingComparator:^NSComparisonResult(UIView *a, UIView *b) { - // Ensure sorting is stable by treating equal `zIndex` as ascending so - // that original order is preserved. - return a.layer.zPosition > b.layer.zPosition ? NSOrderedDescending : NSOrderedAscending; - }]; - - for (UIView *subview in [sortedSubviews reverseObjectEnumerator]) { - UIView *hitView = [subview hitTest:[subview convertPoint:point fromView:self] withEvent:event]; - if (hitView) { - return hitView; - } - } - - return isPointInside ? self : nil; -} - -- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - switch (_props->pointerEvents) { - case PointerEventsMode::Auto: - return [self betterHitTest:point withEvent:event]; - case PointerEventsMode::None: - return nil; - case PointerEventsMode::BoxOnly: - return [self pointInside:point withEvent:event] ? self : nil; - case PointerEventsMode::BoxNone: - UIView *view = [self betterHitTest:point withEvent:event]; - return view != self ? view : nil; - } -} - -static RCTCornerRadii RCTCornerRadiiFromBorderRadii(BorderRadii borderRadii) { - return RCTCornerRadii { - .topLeft = (CGFloat)borderRadii.topLeft, - .topRight = (CGFloat)borderRadii.topRight, - .bottomLeft = (CGFloat)borderRadii.bottomLeft, - .bottomRight = (CGFloat)borderRadii.bottomRight - }; -} - -static RCTBorderColors RCTBorderColorsFromBorderColors(BorderColors borderColors) { - return RCTBorderColors { - .left = RCTCGColorRefFromSharedColor(borderColors.left), - .top = RCTCGColorRefFromSharedColor(borderColors.top), - .bottom = RCTCGColorRefFromSharedColor(borderColors.bottom), - .right = RCTCGColorRefFromSharedColor(borderColors.right) - }; -} - -static UIEdgeInsets UIEdgeInsetsFromBorderInsets(EdgeInsets edgeInsets) { - return UIEdgeInsets { - .left = (CGFloat)edgeInsets.left, - .top = (CGFloat)edgeInsets.top, - .bottom = (CGFloat)edgeInsets.bottom, - .right = (CGFloat)edgeInsets.right - }; -} - -static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle) { - switch (borderStyle) { - case BorderStyle::Solid: - return RCTBorderStyleSolid; - case BorderStyle::Dotted: - return RCTBorderStyleDotted; - case BorderStyle::Dashed: - return RCTBorderStyleDashed; - } -} - -- (void)invalidateLayer -{ - const auto borderMetrics = - _props->resolveBorderMetrics(_layoutMetrics.layoutDirection == LayoutDirection::RightToLeft); - - CALayer *layer = self.layer; - - // Stage 1. Shadow Path - BOOL layerHasShadow = layer.shadowOpacity > 0 && CGColorGetAlpha(layer.shadowColor) > 0; - if (layerHasShadow) { - if (CGColorGetAlpha(_backgroundColor.CGColor) > 0.999) { - // If view has a solid background color, calculate shadow path from border. - const RCTCornerInsets cornerInsets = - RCTGetCornerInsets(RCTCornerRadiiFromBorderRadii(borderMetrics.borderRadii), UIEdgeInsetsZero); - CGPathRef shadowPath = RCTPathCreateWithRoundedRect(self.bounds, cornerInsets, nil); - layer.shadowPath = shadowPath; - CGPathRelease(shadowPath); - } else { - // Can't accurately calculate box shadow, so fall back to pixel-based shadow. - layer.shadowPath = nil; - } - } else { - layer.shadowPath = nil; - } - - // Stage 2. Border Rendering - const bool useCoreAnimationBorderRendering = - borderMetrics.borderColors.isUniform() && - borderMetrics.borderWidths.isUniform() && - borderMetrics.borderStyles.isUniform() && - borderMetrics.borderRadii.isUniform() && - borderMetrics.borderStyles.left == BorderStyle::Solid && - ( - // iOS draws borders in front of the content whereas CSS draws them behind - // the content. For this reason, only use iOS border drawing when clipping - // or when the border is hidden. - borderMetrics.borderWidths.left == 0 || - colorComponentsFromColor(borderMetrics.borderColors.left).alpha == 0 || - self.clipsToBounds - ); - - if (useCoreAnimationBorderRendering) { - if (_borderLayer) { - [_borderLayer removeFromSuperlayer]; - _borderLayer = nil; - } - - layer.borderWidth = (CGFloat)borderMetrics.borderWidths.left; - layer.borderColor = RCTCGColorRefFromSharedColor(borderMetrics.borderColors.left); - layer.cornerRadius = (CGFloat)borderMetrics.borderRadii.topLeft; - layer.backgroundColor = _backgroundColor.CGColor; - _contentView.layer.cornerRadius = (CGFloat)borderMetrics.borderRadii.topLeft; - _contentView.layer.masksToBounds = YES; - } else { - if (!_borderLayer) { - _borderLayer = [[CALayer alloc] init]; - _borderLayer.zPosition = -1024.0f; - _borderLayer.frame = layer.bounds; - _borderLayer.magnificationFilter = kCAFilterNearest; - [layer addSublayer:_borderLayer]; - } - - layer.backgroundColor = nil; - layer.borderWidth = 0; - layer.borderColor = nil; - layer.cornerRadius = 0; - _contentView.layer.cornerRadius = 0; - _contentView.layer.masksToBounds = NO; - - UIImage *image = RCTGetBorderImage( - RCTBorderStyleFromBorderStyle(borderMetrics.borderStyles.left), - layer.bounds.size, - RCTCornerRadiiFromBorderRadii(borderMetrics.borderRadii), - UIEdgeInsetsFromBorderInsets(borderMetrics.borderWidths), - RCTBorderColorsFromBorderColors(borderMetrics.borderColors), - _backgroundColor.CGColor, - self.clipsToBounds - ); - - if (image == nil) { - _borderLayer.contents = nil; - } else { - CGSize imageSize = image.size; - UIEdgeInsets imageCapInsets = image.capInsets; - CGRect contentsCenter = CGRect { - CGPoint {imageCapInsets.left / imageSize.width, imageCapInsets.top / imageSize.height}, - CGSize {(CGFloat)1.0 / imageSize.width, (CGFloat)1.0 / imageSize.height} - }; - - _borderLayer.contents = (id)image.CGImage; - _borderLayer.contentsScale = image.scale; - - const BOOL isResizable = !UIEdgeInsetsEqualToEdgeInsets(image.capInsets, UIEdgeInsetsZero); - if (isResizable) { - _borderLayer.contentsCenter = contentsCenter; - } else { - _borderLayer.contentsCenter = CGRect { CGPoint {0.0, 0.0}, CGSize {1.0, 1.0}}; - } - } - - // Stage 2.5. Custom Clipping Mask - CAShapeLayer *maskLayer = nil; - CGFloat cornerRadius = 0; - if (self.clipsToBounds) { - if (borderMetrics.borderRadii.isUniform()) { - // In this case we can simply use `cornerRadius` exclusivly. - cornerRadius = borderMetrics.borderRadii.topLeft; - } else { - // In this case we have to generate masking layer manually. - CGPathRef path = RCTPathCreateWithRoundedRect( - self.bounds, - RCTGetCornerInsets(RCTCornerRadiiFromBorderRadii(borderMetrics.borderRadii), UIEdgeInsetsZero), - nil - ); - - maskLayer = [CAShapeLayer layer]; - maskLayer.path = path; - CGPathRelease(path); - } - } - - layer.cornerRadius = cornerRadius; - layer.mask = maskLayer; - } -} - -#pragma mark - Accessibility - -- (NSObject *)accessibilityElement -{ - return self; -} - -static NSString *RCTRecursiveAccessibilityLabel(UIView *view) -{ - NSMutableString *result = [NSMutableString stringWithString:@""]; - for (UIView *subview in view.subviews) { - NSString *label = subview.accessibilityLabel; - if (!label) { - label = RCTRecursiveAccessibilityLabel(subview); - } - if (label && label.length > 0) { - if (result.length > 0) { - [result appendString:@" "]; - } - [result appendString:label]; - } - } - return result; -} - -- (NSString *)accessibilityLabel -{ - NSString *label = super.accessibilityLabel; - if (label) { - return label; - } - - return RCTRecursiveAccessibilityLabel(self); -} - -#pragma mark - Accessibility Events - -- (NSArray *)accessibilityCustomActions -{ - const auto &accessibilityActions = _props->accessibilityActions; - - if (accessibilityActions.size() == 0) { - return nil; - } - - NSMutableArray *customActions = [NSMutableArray array]; - for (const auto &accessibilityAction : accessibilityActions) { - [customActions addObject:[[UIAccessibilityCustomAction alloc] initWithName:RCTNSStringFromString(accessibilityAction) - target:self - selector:@selector(didActivateAccessibilityCustomAction:)]]; - } - - return [customActions copy]; -} - -- (BOOL)accessibilityActivate -{ - _eventEmitter->onAccessibilityTap(); - return YES; -} - -- (BOOL)accessibilityPerformMagicTap -{ - _eventEmitter->onAccessibilityMagicTap(); - return YES; -} - -- (BOOL)accessibilityPerformEscape -{ - _eventEmitter->onAccessibilityEscape(); - return YES; -} - -- (BOOL)didActivateAccessibilityCustomAction:(UIAccessibilityCustomAction *)action -{ - _eventEmitter->onAccessibilityAction(RCTStringFromNSString(action.name)); - return YES; -} - -- (SharedTouchEventEmitter)touchEventEmitterAtPoint:(CGPoint)point -{ - return _eventEmitter; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTCreateMountItem.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTCreateMountItem.h deleted file mode 100644 index 344fd1ab..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTCreateMountItem.h +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RCTComponentViewRegistry; - -/** - * Creates a ready-to-mount component view. - */ -@interface RCTCreateMountItem : NSObject - -- (instancetype)initWithComponentHandle:(facebook::react::ComponentHandle)componentHandle - tag:(ReactTag)tag; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTCreateMountItem.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTCreateMountItem.mm deleted file mode 100644 index a91f0194..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTCreateMountItem.mm +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTCreateMountItem.h" - -#import "RCTComponentViewRegistry.h" - -using namespace facebook::react; - -@implementation RCTCreateMountItem { - ComponentHandle _componentHandle; - ReactTag _tag; -} - -- (instancetype)initWithComponentHandle:(facebook::react::ComponentHandle)componentHandle - tag:(ReactTag)tag -{ - if (self = [super init]) { - _componentHandle = componentHandle; - _tag = tag; - } - - return self; -} - -- (void)executeWithRegistry:(RCTComponentViewRegistry *)registry -{ - [registry dequeueComponentViewWithComponentHandle:_componentHandle tag:_tag]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTDeleteMountItem.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTDeleteMountItem.h deleted file mode 100644 index f0d07b47..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTDeleteMountItem.h +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Deletes (returns to recycle pool) a component view. - */ -@interface RCTDeleteMountItem : NSObject - -- (instancetype)initWithComponentHandle:(facebook::react::ComponentHandle)componentHandle - tag:(ReactTag)tag; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTDeleteMountItem.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTDeleteMountItem.mm deleted file mode 100644 index 9528d60c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTDeleteMountItem.mm +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTDeleteMountItem.h" - -#import "RCTComponentViewRegistry.h" - -using namespace facebook::react; - -@implementation RCTDeleteMountItem { - ComponentHandle _componentHandle; - ReactTag _tag; -} - -- (instancetype)initWithComponentHandle:(facebook::react::ComponentHandle)componentHandle - tag:(ReactTag)tag -{ - if (self = [super init]) { - _componentHandle = componentHandle; - _tag = tag; - } - - return self; -} - -- (void)executeWithRegistry:(RCTComponentViewRegistry *)registry -{ - UIView *componentView = [registry componentViewByTag:_tag]; - - if (componentView == nil) { - return; - } - - [registry enqueueComponentViewWithComponentHandle:_componentHandle tag:_tag componentView:componentView]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTInsertMountItem.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTInsertMountItem.h deleted file mode 100644 index dbae0a10..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTInsertMountItem.h +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RCTComponentViewRegistry; - -/** - * Inserts a component view into another component view. - */ -@interface RCTInsertMountItem : NSObject - -- (instancetype)initWithChildTag:(ReactTag)childTag - parentTag:(ReactTag)parentTag - index:(NSInteger)index; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTInsertMountItem.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTInsertMountItem.mm deleted file mode 100644 index 15894efe..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTInsertMountItem.mm +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTInsertMountItem.h" - -#import "RCTComponentViewRegistry.h" - -@implementation RCTInsertMountItem { - ReactTag _childTag; - ReactTag _parentTag; - NSInteger _index; -} - -- (instancetype)initWithChildTag:(ReactTag)childTag - parentTag:(ReactTag)parentTag - index:(NSInteger)index -{ - if (self = [super init]) { - _childTag = childTag; - _parentTag = parentTag; - _index = index; - } - - return self; -} - -- (void)executeWithRegistry:(RCTComponentViewRegistry *)registry -{ - UIView *childComponentView = [registry componentViewByTag:_childTag]; - UIView *parentComponentView = [registry componentViewByTag:_parentTag]; - - if (childComponentView == nil || parentComponentView == nil) { - return; - } - - [parentComponentView mountChildComponentView:childComponentView - index:_index]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTMountItemProtocol.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTMountItemProtocol.h deleted file mode 100644 index 4f3d7fe4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTMountItemProtocol.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RCTComponentViewRegistry; - -/** - * Granular representation of any change in a user interface. - */ -@protocol RCTMountItemProtocol - -- (void)executeWithRegistry:(RCTComponentViewRegistry *)registry; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTRemoveMountItem.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTRemoveMountItem.h deleted file mode 100644 index 3d387519..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTRemoveMountItem.h +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Removes a component view from another component view. - */ -@interface RCTRemoveMountItem : NSObject - -- (instancetype)initWithChildTag:(ReactTag)childTag - parentTag:(ReactTag)parentTag - index:(NSInteger)index; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTRemoveMountItem.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTRemoveMountItem.mm deleted file mode 100644 index 341929ca..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTRemoveMountItem.mm +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTRemoveMountItem.h" - -#import "RCTComponentViewRegistry.h" - -@implementation RCTRemoveMountItem { - ReactTag _childTag; - ReactTag _parentTag; - NSInteger _index; -} - -- (instancetype)initWithChildTag:(ReactTag)childTag - parentTag:(ReactTag)parentTag - index:(NSInteger)index -{ - if (self = [super init]) { - _childTag = childTag; - _parentTag = parentTag; - _index = index; - } - - return self; -} - -- (void)executeWithRegistry:(RCTComponentViewRegistry *)registry -{ - UIView *childComponentView = [registry componentViewByTag:_childTag]; - UIView *parentComponentView = [registry componentViewByTag:_parentTag]; - - if (childComponentView == nil || parentComponentView == nil) { - return; - } - - [parentComponentView unmountChildComponentView:childComponentView - index:_index]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdateEventEmitterMountItem.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdateEventEmitterMountItem.h deleted file mode 100644 index 24f37679..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdateEventEmitterMountItem.h +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Updates event handlers of a component view. - */ -@interface RCTUpdateEventEmitterMountItem : NSObject - -- (instancetype)initWithTag:(ReactTag)tag - eventEmitter:(facebook::react::SharedEventEmitter)eventEmitter; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdateEventEmitterMountItem.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdateEventEmitterMountItem.mm deleted file mode 100644 index f94a0859..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdateEventEmitterMountItem.mm +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTUpdateEventEmitterMountItem.h" - -#import "RCTComponentViewRegistry.h" - -using namespace facebook::react; - -@implementation RCTUpdateEventEmitterMountItem { - ReactTag _tag; - SharedEventEmitter _eventEmitter; -} - -- (instancetype)initWithTag:(ReactTag)tag - eventEmitter:(SharedEventEmitter)eventEmitter -{ - if (self = [super init]) { - _tag = tag; - _eventEmitter = eventEmitter; - } - - return self; -} - -- (void)executeWithRegistry:(RCTComponentViewRegistry *)registry -{ - UIView *componentView = [registry componentViewByTag:_tag]; - - [componentView updateEventEmitter:_eventEmitter]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdateLayoutMetricsMountItem.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdateLayoutMetricsMountItem.h deleted file mode 100644 index 7fbab407..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdateLayoutMetricsMountItem.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Updates layout metrics of a component view. - */ -@interface RCTUpdateLayoutMetricsMountItem : NSObject - -- (instancetype)initWithTag:(ReactTag)tag - oldLayoutMetrics:(facebook::react::LayoutMetrics)oldLayoutMetrics - newLayoutMetrics:(facebook::react::LayoutMetrics)newLayoutMetrics; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdateLayoutMetricsMountItem.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdateLayoutMetricsMountItem.mm deleted file mode 100644 index 71b76c32..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdateLayoutMetricsMountItem.mm +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTUpdateLayoutMetricsMountItem.h" - -#import "RCTComponentViewRegistry.h" - -using namespace facebook::react; - -@implementation RCTUpdateLayoutMetricsMountItem { - ReactTag _tag; - LayoutMetrics _oldLayoutMetrics; - LayoutMetrics _newLayoutMetrics; -} - -- (instancetype)initWithTag:(ReactTag)tag - oldLayoutMetrics:(facebook::react::LayoutMetrics)oldLayoutMetrics - newLayoutMetrics:(facebook::react::LayoutMetrics)newLayoutMetrics -{ - if (self = [super init]) { - _tag = tag; - _oldLayoutMetrics = oldLayoutMetrics; - _newLayoutMetrics = newLayoutMetrics; - } - - return self; -} - -- (void)executeWithRegistry:(RCTComponentViewRegistry *)registry -{ - UIView *componentView = [registry componentViewByTag:_tag]; - - [componentView updateLayoutMetrics:_newLayoutMetrics - oldLayoutMetrics:_oldLayoutMetrics]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdateLocalDataMountItem.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdateLocalDataMountItem.h deleted file mode 100644 index f25d4b7a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdateLocalDataMountItem.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Updates local data of a component view. - */ -@interface RCTUpdateLocalDataMountItem : NSObject - -- (instancetype)initWithTag:(ReactTag)tag - oldLocalData:(facebook::react::SharedLocalData)oldLocalData - newLocalData:(facebook::react::SharedLocalData)newLocalData; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdateLocalDataMountItem.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdateLocalDataMountItem.mm deleted file mode 100644 index 80ae5af8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdateLocalDataMountItem.mm +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTUpdateLocalDataMountItem.h" - -#import "RCTComponentViewRegistry.h" - -using namespace facebook::react; - -@implementation RCTUpdateLocalDataMountItem { - ReactTag _tag; - SharedLocalData _oldLocalData; - SharedLocalData _newLocalData; -} - -- (instancetype)initWithTag:(ReactTag)tag - oldLocalData:(facebook::react::SharedLocalData)oldLocalData - newLocalData:(facebook::react::SharedLocalData)newLocalData -{ - if (self = [super init]) { - _tag = tag; - _oldLocalData = oldLocalData; - _newLocalData = newLocalData; - } - - return self; -} - -- (void)executeWithRegistry:(RCTComponentViewRegistry *)registry -{ - UIView *componentView = [registry componentViewByTag:_tag]; - [componentView updateLocalData:_newLocalData oldLocalData:_oldLocalData]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdatePropsMountItem.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdatePropsMountItem.h deleted file mode 100644 index 7c05196e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdatePropsMountItem.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Updates props of a component view. - */ -@interface RCTUpdatePropsMountItem : NSObject - -- (instancetype)initWithTag:(ReactTag)tag - oldProps:(facebook::react::SharedProps)oldProps - newProps:(facebook::react::SharedProps)newProps; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdatePropsMountItem.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdatePropsMountItem.mm deleted file mode 100644 index 4587a5ec..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/MountItems/RCTUpdatePropsMountItem.mm +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTUpdatePropsMountItem.h" - -#import "RCTComponentViewRegistry.h" - -using namespace facebook::react; - -@implementation RCTUpdatePropsMountItem { - ReactTag _tag; - SharedProps _oldProps; - SharedProps _newProps; -} - -- (instancetype)initWithTag:(ReactTag)tag - oldProps:(SharedProps)oldProps - newProps:(SharedProps)newProps -{ - if (self = [super init]) { - _tag = tag; - _oldProps = oldProps; - _newProps = newProps; - } - - return self; -} - -- (void)executeWithRegistry:(RCTComponentViewRegistry *)registry -{ - UIView *componentView = [registry componentViewByTag:_tag]; - [componentView updateProps:_newProps oldProps:_oldProps]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTComponentViewFactory.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTComponentViewFactory.h deleted file mode 100644 index 535734aa..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTComponentViewFactory.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Registry of supported component view classes that can instantiate - * view component instances by given component handle. - */ -@interface RCTComponentViewFactory : NSObject - -/** - * Constructs and returns an instance of the class with a bunch of already registered standard components. - */ -+ (RCTComponentViewFactory *)standardComponentViewFactory; - -/** - * Registers a component view class in the factory. - */ -- (void)registerComponentViewClass:(Class)componentViewClass; - -/** - * Creates a component view with given component handle. - */ -- (UIView *)createComponentViewWithComponentHandle: - (facebook::react::ComponentHandle)componentHandle; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTComponentViewFactory.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTComponentViewFactory.mm deleted file mode 100644 index 06606d5c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTComponentViewFactory.mm +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTComponentViewFactory.h" - -#import -#import - -#import "RCTActivityIndicatorViewComponentView.h" -#import "RCTImageComponentView.h" -#import "RCTParagraphComponentView.h" -#import "RCTRootComponentView.h" -#import "RCTScrollViewComponentView.h" -#import "RCTSliderComponentView.h" -#import "RCTSwitchComponentView.h" -#import "RCTViewComponentView.h" - -using namespace facebook::react; - -@implementation RCTComponentViewFactory { - std::unordered_map> _registry; -} - -+ (RCTComponentViewFactory *)standardComponentViewFactory -{ - RCTAssertMainQueue(); - - RCTComponentViewFactory *componentViewFactory = [[RCTComponentViewFactory alloc] init]; - - [componentViewFactory registerComponentViewClass:[RCTViewComponentView class]]; - [componentViewFactory registerComponentViewClass:[RCTRootComponentView class]]; - [componentViewFactory registerComponentViewClass:[RCTScrollViewComponentView class]]; - [componentViewFactory registerComponentViewClass:[RCTImageComponentView class]]; - [componentViewFactory registerComponentViewClass:[RCTParagraphComponentView class]]; - [componentViewFactory registerComponentViewClass:[RCTActivityIndicatorViewComponentView class]]; - [componentViewFactory registerComponentViewClass:[RCTSliderComponentView class]]; - [componentViewFactory registerComponentViewClass:[RCTSwitchComponentView class]]; - - return componentViewFactory; -} - -- (void)registerComponentViewClass:(Class)componentViewClass -{ - RCTAssertMainQueue(); - - ComponentHandle componentHandle = [componentViewClass componentHandle]; - _registry[componentHandle] = componentViewClass; -} - -- (UIView *)createComponentViewWithComponentHandle: - (facebook::react::ComponentHandle)componentHandle -{ - RCTAssertMainQueue(); - - auto iterator = _registry.find(componentHandle); - RCTAssert( - iterator != _registry.end(), - @"ComponentView with componentHandle `%lli` (`%s`) not found.", - componentHandle, - (char *)componentHandle); - Class componentViewClass = iterator->second; - return [[componentViewClass alloc] init]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTComponentViewProtocol.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTComponentViewProtocol.h deleted file mode 100644 index 116f6ef4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTComponentViewProtocol.h +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Represents a `UIView` instance managed by React. - * All methods are non-@optional. - * `UIView+ComponentViewProtocol` category provides default implementation - * for all of them. - */ -@protocol RCTComponentViewProtocol - -/* - * Returns ComponentHandle of ComponentDescriptor which this ComponentView - * represents. - */ -+ (facebook::react::ComponentHandle)componentHandle; - -/* - * Called for mounting (attaching) a child component view inside `self` - * component view. - * Receiver must add `childComponentView` as a subview. - */ -- (void)mountChildComponentView:(UIView *)childComponentView index:(NSInteger)index; - -/* - * Called for unmounting (detaching) a child component view from `self` - * component view. - * Receiver must remove `childComponentView` as a subview. - */ -- (void)unmountChildComponentView:(UIView *)childComponentView index:(NSInteger)index; - -/* - * Called for updating component's props. - * Receiver must update native view props accordingly changed props. - */ -- (void)updateProps:(facebook::react::SharedProps)props oldProps:(facebook::react::SharedProps)oldProps; - -/* - * Called for updating component's local data. - * Receiver must update native view props accordingly changed local data. - */ -- (void)updateLocalData:(facebook::react::SharedLocalData)localData - oldLocalData:(facebook::react::SharedLocalData)oldLocalData; - -/* - * Called for updating component's event handlers set. - * Receiver must cache `eventEmitter` object inside and use it for emitting - * events when needed. - */ -- (void)updateEventEmitter:(facebook::react::SharedEventEmitter)eventEmitter; - -/* - * Called for updating component's layout metrics. - * Receiver must update `UIView` layout-related fields (such as `frame`, - * `bounds`, `layer.zPosition`, and so on) accordingly. - */ -- (void)updateLayoutMetrics:(facebook::react::LayoutMetrics)layoutMetrics - oldLayoutMetrics:(facebook::react::LayoutMetrics)oldLayoutMetrics; - -/* - * Called right after the component view is moved to a recycle pool. - * Receiver must reset any local state and release associated - * non-reusable resources. - */ -- (void)prepareForRecycle; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTComponentViewRegistry.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTComponentViewRegistry.h deleted file mode 100644 index a8530800..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTComponentViewRegistry.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Registry of native component views. - * Provides basic functionality for allocation, recycling, and querying (by tag) native view instances. - */ -@interface RCTComponentViewRegistry : NSObject - -@property (nonatomic, strong, readonly) RCTComponentViewFactory *componentViewFactory; - -/** - * Returns a native view instance from the recycle pool (or create) - * for given `componentHandle` and with given `tag`. - * #RefuseSingleUse - */ -- (UIView *)dequeueComponentViewWithComponentHandle: - (facebook::react::ComponentHandle)componentHandle - tag:(ReactTag)tag; - -/** - * Puts a given native component view to the recycle pool. - * #RefuseSingleUse - */ -- (void)enqueueComponentViewWithComponentHandle:(facebook::react::ComponentHandle)componentHandle - tag:(ReactTag)tag - componentView:(UIView *)componentView; - -/** - * Returns a native component view by given `tag`. - */ -- (UIView *)componentViewByTag:(ReactTag)tag; - -/** - * Returns `tag` assosiated with given `componentView`. - */ -- (ReactTag)tagByComponentView:(UIView *)componentView; - -/** - * Creates a component view with a given type and puts it to the recycle pool. - */ -- (void)optimisticallyCreateComponentViewWithComponentHandle:(facebook::react::ComponentHandle)componentHandle; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTComponentViewRegistry.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTComponentViewRegistry.mm deleted file mode 100644 index 8f4e881d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTComponentViewRegistry.mm +++ /dev/null @@ -1,198 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTComponentViewRegistry.h" - -#import -#import - -using namespace facebook::react; - -#define LEGACY_UIMANAGER_INTEGRATION_ENABLED 1 - -#ifdef LEGACY_UIMANAGER_INTEGRATION_ENABLED - -#import -#import - -/** - * Warning: This is a total hack and temporary solution. - * Unless we have a pure Fabric-based implementation of UIManager commands - * delivery pipeline, we have to leverage existing infra. This code tricks - * legacy UIManager by registering all Fabric-managed views in it, - * hence existing command-delivery infra can reach "foreign" views using - * the old pipeline. - */ -@interface RCTUIManager () -- (NSMutableDictionary *)viewRegistry; -@end - -@interface RCTUIManager (Hack) - -+ (void)registerView:(UIView *)view; -+ (void)unregisterView:(UIView *)view; - -@end - -@implementation RCTUIManager (Hack) - -+ (void)registerView:(UIView *)view -{ - if (!view) { - return; - } - - RCTUIManager *uiManager = [[RCTBridge currentBridge] uiManager]; - view.reactTag = @(view.tag); - [uiManager.viewRegistry setObject:view forKey:@(view.tag)]; -} - -+ (void)unregisterView:(UIView *)view -{ - if (!view) { - return; - } - - RCTUIManager *uiManager = [[RCTBridge currentBridge] uiManager]; - view.reactTag = nil; - [uiManager.viewRegistry removeObjectForKey:@(view.tag)]; -} - -@end - -#endif - -const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 1024; - -@implementation RCTComponentViewRegistry { - NSMapTable *> *_registry; - NSMapTable *> *> *_recyclePool; -} - -- (instancetype)init -{ - if (self = [super init]) { - _registry = [NSMapTable mapTableWithKeyOptions:NSPointerFunctionsIntegerPersonality | NSPointerFunctionsOpaqueMemory - valueOptions:NSPointerFunctionsObjectPersonality]; - _recyclePool = - [NSMapTable mapTableWithKeyOptions:NSPointerFunctionsOpaquePersonality | NSPointerFunctionsOpaqueMemory - valueOptions:NSPointerFunctionsObjectPersonality]; - _componentViewFactory = [RCTComponentViewFactory standardComponentViewFactory]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleApplicationDidReceiveMemoryWarningNotification) - name:UIApplicationDidReceiveMemoryWarningNotification - object:nil]; - } - - return self; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (UIView *)dequeueComponentViewWithComponentHandle:(ComponentHandle)componentHandle - tag:(ReactTag)tag -{ - RCTAssertMainQueue(); - - RCTAssert( - ![_registry objectForKey:(__bridge id)(void *)tag], - @"RCTComponentViewRegistry: Attempt to dequeue already registered component."); - - UIView *componentView = [self _dequeueComponentViewWithComponentHandle:componentHandle]; - componentView.tag = tag; - [_registry setObject:componentView forKey:(__bridge id)(void *)tag]; - -#ifdef LEGACY_UIMANAGER_INTEGRATION_ENABLED - [RCTUIManager registerView:componentView]; -#endif - - return componentView; -} - -- (void)enqueueComponentViewWithComponentHandle:(ComponentHandle)componentHandle - tag:(ReactTag)tag - componentView:(UIView *)componentView -{ - RCTAssertMainQueue(); - - RCTAssert( - [_registry objectForKey:(__bridge id)(void *)tag], - @"RCTComponentViewRegistry: Attempt to enqueue unregistered component."); - -#ifdef LEGACY_UIMANAGER_INTEGRATION_ENABLED - [RCTUIManager unregisterView:componentView]; -#endif - - [_registry removeObjectForKey:(__bridge id)(void *)tag]; - componentView.tag = 0; - [self _enqueueComponentViewWithComponentHandle:componentHandle componentView:componentView]; -} - -- (void)optimisticallyCreateComponentViewWithComponentHandle:(ComponentHandle)componentHandle -{ - RCTAssertMainQueue(); - [self _enqueueComponentViewWithComponentHandle:componentHandle - componentView:[self.componentViewFactory - createComponentViewWithComponentHandle:componentHandle]]; -} - -- (UIView *)componentViewByTag:(ReactTag)tag -{ - RCTAssertMainQueue(); - return [_registry objectForKey:(__bridge id)(void *)tag]; -} - -- (ReactTag)tagByComponentView:(UIView *)componentView -{ - RCTAssertMainQueue(); - return componentView.tag; -} - -- (nullable UIView *)_dequeueComponentViewWithComponentHandle:(ComponentHandle)componentHandle -{ - RCTAssertMainQueue(); - NSHashTable *> *componentViews = - [_recyclePool objectForKey:(__bridge id)(void *)componentHandle]; - if (!componentViews || componentViews.count == 0) { - return [self.componentViewFactory createComponentViewWithComponentHandle:componentHandle]; - } - - UIView *componentView = [componentViews anyObject]; - [componentViews removeObject:componentView]; - return componentView; -} - -- (void)_enqueueComponentViewWithComponentHandle:(ComponentHandle)componentHandle - componentView:(UIView *)componentView -{ - RCTAssertMainQueue(); - [componentView prepareForRecycle]; - - NSHashTable *> *componentViews = - [_recyclePool objectForKey:(__bridge id)(void *)componentHandle]; - if (!componentViews) { - componentViews = [NSHashTable hashTableWithOptions:NSPointerFunctionsObjectPersonality]; - [_recyclePool setObject:componentViews forKey:(__bridge id)(void *)componentHandle]; - } - - if (componentViews.count >= RCTComponentViewRegistryRecyclePoolMaxSize) { - return; - } - - [componentViews addObject:componentView]; -} - -- (void)handleApplicationDidReceiveMemoryWarningNotification -{ - [_recyclePool removeAllObjects]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTMountingManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTMountingManager.h deleted file mode 100644 index d4a64da8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTMountingManager.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RCTComponentViewRegistry; - -/** - * Manages mounting process. - */ -@interface RCTMountingManager : NSObject - -@property (nonatomic, weak) id delegate; -@property (nonatomic, strong) RCTComponentViewRegistry *componentViewRegistry; - -/** - * Transfroms mutation insturctions to mount items and execute them. - * The order of mutation tnstructions matters. - * Can be called from any thread. - */ -- (void)performTransactionWithMutations:(facebook::react::ShadowViewMutationList)mutations rootTag:(ReactTag)rootTag; - -/** - * Suggests preliminary creation of a component view of given type. - * The receiver is free to ignore the request. - * Can be called from any thread. - */ -- (void)optimisticallyCreateComponentViewWithComponentHandle:(facebook::react::ComponentHandle)componentHandle; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTMountingManager.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTMountingManager.mm deleted file mode 100644 index 105f3991..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTMountingManager.mm +++ /dev/null @@ -1,191 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTMountingManager.h" - -#import -#import -#import -#import - -#import "RCTComponentViewProtocol.h" -#import "RCTComponentViewRegistry.h" -#import "RCTMountItemProtocol.h" - -#import "RCTConversions.h" -#import "RCTCreateMountItem.h" -#import "RCTDeleteMountItem.h" -#import "RCTInsertMountItem.h" -#import "RCTRemoveMountItem.h" -#import "RCTUpdateEventEmitterMountItem.h" -#import "RCTUpdateLayoutMetricsMountItem.h" -#import "RCTUpdateLocalDataMountItem.h" -#import "RCTUpdatePropsMountItem.h" - -using namespace facebook::react; - -@implementation RCTMountingManager - -- (instancetype)init -{ - if (self = [super init]) { - _componentViewRegistry = [[RCTComponentViewRegistry alloc] init]; - } - - return self; -} - -- (void)performTransactionWithMutations:(facebook::react::ShadowViewMutationList)mutations rootTag:(ReactTag)rootTag -{ - NSMutableArray *mountItems; - - { - // This section is measured separately from `_performMountItems:rootTag:` because that can be asynchronous. - SystraceSection s("-[RCTMountingManager performTransactionWithMutations:rootTag:]"); - - mountItems = - [[NSMutableArray alloc] initWithCapacity:mutations.size() * 2 /* ~ the worst case */]; - - for (const auto &mutation : mutations) { - switch (mutation.type) { - case ShadowViewMutation::Create: { - RCTCreateMountItem *mountItem = - [[RCTCreateMountItem alloc] initWithComponentHandle:mutation.newChildShadowView.componentHandle - tag:mutation.newChildShadowView.tag]; - [mountItems addObject:mountItem]; - break; - } - - case ShadowViewMutation::Delete: { - RCTDeleteMountItem *mountItem = - [[RCTDeleteMountItem alloc] initWithComponentHandle:mutation.oldChildShadowView.componentHandle - tag:mutation.oldChildShadowView.tag]; - [mountItems addObject:mountItem]; - break; - } - - case ShadowViewMutation::Insert: { - // Props - [mountItems addObject:[[RCTUpdatePropsMountItem alloc] initWithTag:mutation.newChildShadowView.tag - oldProps:nullptr - newProps:mutation.newChildShadowView.props]]; - - // EventEmitter - [mountItems - addObject:[[RCTUpdateEventEmitterMountItem alloc] initWithTag:mutation.newChildShadowView.tag - eventEmitter:mutation.newChildShadowView.eventEmitter]]; - - // LocalData - if (mutation.newChildShadowView.localData) { - [mountItems - addObject:[[RCTUpdateLocalDataMountItem alloc] initWithTag:mutation.newChildShadowView.tag - oldLocalData:nullptr - newLocalData:mutation.newChildShadowView.localData]]; - } - - // Layout - if (mutation.newChildShadowView.layoutMetrics != EmptyLayoutMetrics) { - [mountItems addObject:[[RCTUpdateLayoutMetricsMountItem alloc] - initWithTag:mutation.newChildShadowView.tag - oldLayoutMetrics:{} - newLayoutMetrics:mutation.newChildShadowView.layoutMetrics]]; - } - - // Insertion - RCTInsertMountItem *mountItem = [[RCTInsertMountItem alloc] initWithChildTag:mutation.newChildShadowView.tag - parentTag:mutation.parentShadowView.tag - index:mutation.index]; - [mountItems addObject:mountItem]; - - break; - } - - case ShadowViewMutation::Remove: { - RCTRemoveMountItem *mountItem = [[RCTRemoveMountItem alloc] initWithChildTag:mutation.oldChildShadowView.tag - parentTag:mutation.parentShadowView.tag - index:mutation.index]; - [mountItems addObject:mountItem]; - break; - } - - case ShadowViewMutation::Update: { - auto oldChildShadowView = mutation.oldChildShadowView; - auto newChildShadowView = mutation.newChildShadowView; - - // Props - if (oldChildShadowView.props != newChildShadowView.props) { - RCTUpdatePropsMountItem *mountItem = - [[RCTUpdatePropsMountItem alloc] initWithTag:mutation.oldChildShadowView.tag - oldProps:mutation.oldChildShadowView.props - newProps:mutation.newChildShadowView.props]; - [mountItems addObject:mountItem]; - } - - // EventEmitter - if (oldChildShadowView.eventEmitter != newChildShadowView.eventEmitter) { - RCTUpdateEventEmitterMountItem *mountItem = - [[RCTUpdateEventEmitterMountItem alloc] initWithTag:mutation.oldChildShadowView.tag - eventEmitter:mutation.oldChildShadowView.eventEmitter]; - [mountItems addObject:mountItem]; - } - - // LocalData - if (oldChildShadowView.localData != newChildShadowView.localData) { - RCTUpdateLocalDataMountItem *mountItem = - [[RCTUpdateLocalDataMountItem alloc] initWithTag:newChildShadowView.tag - oldLocalData:oldChildShadowView.localData - newLocalData:newChildShadowView.localData]; - [mountItems addObject:mountItem]; - } - - // Layout - if (oldChildShadowView.layoutMetrics != newChildShadowView.layoutMetrics) { - RCTUpdateLayoutMetricsMountItem *mountItem = - [[RCTUpdateLayoutMetricsMountItem alloc] initWithTag:mutation.oldChildShadowView.tag - oldLayoutMetrics:oldChildShadowView.layoutMetrics - newLayoutMetrics:newChildShadowView.layoutMetrics]; - [mountItems addObject:mountItem]; - } - - break; - } - } - } - } - - RCTExecuteOnMainQueue(^{ - [self _performMountItems:mountItems rootTag:rootTag]; - }); -} - -- (void)_performMountItems:(NSArray *)mountItems rootTag:(ReactTag)rootTag -{ - SystraceSection s("-[RCTMountingManager _performMountItems:rootTag:]"); - RCTAssertMainQueue(); - - [self.delegate mountingManager:self willMountComponentsWithRootTag:rootTag]; - - for (id mountItem in mountItems) { - [mountItem executeWithRegistry:_componentViewRegistry]; - } - - [self.delegate mountingManager:self didMountComponentsWithRootTag:rootTag]; -} - -- (void)optimisticallyCreateComponentViewWithComponentHandle:(ComponentHandle)componentHandle -{ - if (RCTIsMainQueue()) { - // There is no reason to allocate views ahead of time on the main thread. - return; - } - - RCTExecuteOnMainQueue(^{ - [self->_componentViewRegistry optimisticallyCreateComponentViewWithComponentHandle:componentHandle]; - }); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTMountingManagerDelegate.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTMountingManagerDelegate.h deleted file mode 100644 index cd010815..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/RCTMountingManagerDelegate.h +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RCTMountingManager; - -/** - * MountingManager's delegate. - */ -@protocol RCTMountingManagerDelegate - -/* - * Called right *before* execution of mount items which affect a Surface with - * given `rootTag`. - * Always called on the main queue. - */ -- (void)mountingManager:(RCTMountingManager *)mountingManager willMountComponentsWithRootTag:(ReactTag)MountingManager; - -/* - * Called right *after* execution of mount items which affect a Surface with - * given `rootTag`. - * Always called on the main queue. - */ -- (void)mountingManager:(RCTMountingManager *)mountingManager didMountComponentsWithRootTag:(ReactTag)rootTag; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/UIView+ComponentViewProtocol.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/UIView+ComponentViewProtocol.h deleted file mode 100644 index b30cff79..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/UIView+ComponentViewProtocol.h +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Default implementation of RCTComponentViewProtocol. - */ -@interface UIView (ComponentViewProtocol) - -- (void)mountChildComponentView:(UIView *)childComponentView index:(NSInteger)index; - -- (void)unmountChildComponentView:(UIView *)childComponentView index:(NSInteger)index; - -- (void)updateProps:(facebook::react::SharedProps)props oldProps:(facebook::react::SharedProps)oldProps; - -- (void)updateEventEmitter:(facebook::react::SharedEventEmitter)eventEmitter; - -- (void)updateLocalData:(facebook::react::SharedLocalData)localData - oldLocalData:(facebook::react::SharedLocalData)oldLocalData; - -- (void)updateLayoutMetrics:(facebook::react::LayoutMetrics)layoutMetrics - oldLayoutMetrics:(facebook::react::LayoutMetrics)oldLayoutMetrics; - -- (void)prepareForRecycle; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm deleted file mode 100644 index 14fe9d95..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "UIView+ComponentViewProtocol.h" - -#import -#import "RCTConversions.h" - -using namespace facebook::react; - -@implementation UIView (ComponentViewProtocol) - -- (void)mountChildComponentView:(UIView *)childComponentView index:(NSInteger)index -{ - [self insertSubview:childComponentView atIndex:index]; -} - -- (void)unmountChildComponentView:(UIView *)childComponentView index:(NSInteger)index -{ - RCTAssert(childComponentView.superview == self, @"Attempt to unmount improperly mounted component view."); - [childComponentView removeFromSuperview]; -} - -- (void)updateProps:(SharedProps)props oldProps:(SharedProps)oldProps -{ - // Default implementation does nothing. -} - -- (void)updateEventEmitter:(SharedEventEmitter)eventEmitter -{ - // Default implementation does nothing. -} - -- (void)updateLocalData:(SharedLocalData)localData oldLocalData:(SharedLocalData)oldLocalData -{ - // Default implementation does nothing. -} - -- (void)updateLayoutMetrics:(LayoutMetrics)layoutMetrics oldLayoutMetrics:(LayoutMetrics)oldLayoutMetrics -{ - if (layoutMetrics.frame != oldLayoutMetrics.frame) { - self.frame = RCTCGRectFromRect(layoutMetrics.frame); - } - - if (layoutMetrics.layoutDirection != oldLayoutMetrics.layoutDirection) { - self.semanticContentAttribute = layoutMetrics.layoutDirection == LayoutDirection::RightToLeft - ? UISemanticContentAttributeForceRightToLeft - : UISemanticContentAttributeForceLeftToRight; - } - - if (layoutMetrics.displayType != oldLayoutMetrics.displayType) { - self.hidden = layoutMetrics.displayType == DisplayType::None; - } -} - -- (void)prepareForRecycle -{ - // Default implementation does nothing. -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTConversions.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTConversions.h deleted file mode 100644 index 16ee3ed2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTConversions.h +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -inline NSString *RCTNSStringFromString(const std::string &string, const NSStringEncoding &encoding = NSUTF8StringEncoding) { - return [NSString stringWithCString:string.c_str() encoding:encoding]; -} - -inline NSString *_Nullable RCTNSStringFromStringNilIfEmpty(const std::string &string, const NSStringEncoding &encoding = NSUTF8StringEncoding) { - return string.empty() ? nil : RCTNSStringFromString(string, encoding); -} - -inline std::string RCTStringFromNSString(NSString *string, const NSStringEncoding &encoding = NSUTF8StringEncoding) { - return [string cStringUsingEncoding:encoding]; -} - -inline UIColor *_Nullable RCTUIColorFromSharedColor(const facebook::react::SharedColor &sharedColor) { - return sharedColor ? [UIColor colorWithCGColor:sharedColor.get()] : nil; -} - -inline CGColorRef RCTCGColorRefFromSharedColor(const facebook::react::SharedColor &sharedColor) { - return sharedColor ? CGColorCreateCopy(sharedColor.get()) : nil; -} - -inline CGPoint RCTCGPointFromPoint(const facebook::react::Point &point) { - return {point.x, point.y}; -} - -inline CGSize RCTCGSizeFromSize(const facebook::react::Size &size) { - return {size.width, size.height}; -} - -inline CGRect RCTCGRectFromRect(const facebook::react::Rect &rect) { - return {RCTCGPointFromPoint(rect.origin), RCTCGSizeFromSize(rect.size)}; -} - -inline UIEdgeInsets RCTUIEdgeInsetsFromEdgeInsets(const facebook::react::EdgeInsets &edgeInsets) { - return {edgeInsets.top, edgeInsets.left, edgeInsets.bottom, edgeInsets.right}; -} - -inline UIAccessibilityTraits RCTUIAccessibilityTraitsFromAccessibilityTraits(facebook::react::AccessibilityTraits accessibilityTraits) { - using AccessibilityTraits = facebook::react::AccessibilityTraits; - UIAccessibilityTraits result = UIAccessibilityTraitNone; - if ((accessibilityTraits & AccessibilityTraits::Button) != AccessibilityTraits::None) { result |= UIAccessibilityTraitButton; } - if ((accessibilityTraits & AccessibilityTraits::Link) != AccessibilityTraits::None) { result |= UIAccessibilityTraitLink; } - if ((accessibilityTraits & AccessibilityTraits::Image) != AccessibilityTraits::None) { result |= UIAccessibilityTraitImage; } - if ((accessibilityTraits & AccessibilityTraits::Selected) != AccessibilityTraits::None) { result |= UIAccessibilityTraitSelected; } - if ((accessibilityTraits & AccessibilityTraits::PlaysSound) != AccessibilityTraits::None) { result |= UIAccessibilityTraitPlaysSound; } - if ((accessibilityTraits & AccessibilityTraits::KeyboardKey) != AccessibilityTraits::None) { result |= UIAccessibilityTraitKeyboardKey; } - if ((accessibilityTraits & AccessibilityTraits::StaticText) != AccessibilityTraits::None) { result |= UIAccessibilityTraitStaticText; } - if ((accessibilityTraits & AccessibilityTraits::SummaryElement) != AccessibilityTraits::None) { result |= UIAccessibilityTraitSummaryElement; } - if ((accessibilityTraits & AccessibilityTraits::NotEnabled) != AccessibilityTraits::None) { result |= UIAccessibilityTraitNotEnabled; } - if ((accessibilityTraits & AccessibilityTraits::UpdatesFrequently) != AccessibilityTraits::None) { result |= UIAccessibilityTraitUpdatesFrequently; } - if ((accessibilityTraits & AccessibilityTraits::SearchField) != AccessibilityTraits::None) { result |= UIAccessibilityTraitSearchField; } - if ((accessibilityTraits & AccessibilityTraits::StartsMediaSession) != AccessibilityTraits::None) { result |= UIAccessibilityTraitStartsMediaSession; } - if ((accessibilityTraits & AccessibilityTraits::Adjustable) != AccessibilityTraits::None) { result |= UIAccessibilityTraitAdjustable; } - if ((accessibilityTraits & AccessibilityTraits::AllowsDirectInteraction) != AccessibilityTraits::None) { result |= UIAccessibilityTraitAllowsDirectInteraction; } - if ((accessibilityTraits & AccessibilityTraits::CausesPageTurn) != AccessibilityTraits::None) { result |= UIAccessibilityTraitCausesPageTurn; } - if ((accessibilityTraits & AccessibilityTraits::Header) != AccessibilityTraits::None) { result |= UIAccessibilityTraitHeader; } - return result; -}; - -inline CATransform3D RCTCATransform3DFromTransformMatrix(const facebook::react::Transform &transformMatrix) { - return { - (CGFloat)transformMatrix.matrix[0], - (CGFloat)transformMatrix.matrix[1], - (CGFloat)transformMatrix.matrix[2], - (CGFloat)transformMatrix.matrix[3], - (CGFloat)transformMatrix.matrix[4], - (CGFloat)transformMatrix.matrix[5], - (CGFloat)transformMatrix.matrix[6], - (CGFloat)transformMatrix.matrix[7], - (CGFloat)transformMatrix.matrix[8], - (CGFloat)transformMatrix.matrix[9], - (CGFloat)transformMatrix.matrix[10], - (CGFloat)transformMatrix.matrix[11], - (CGFloat)transformMatrix.matrix[12], - (CGFloat)transformMatrix.matrix[13], - (CGFloat)transformMatrix.matrix[14], - (CGFloat)transformMatrix.matrix[15] - }; -} - -inline facebook::react::Point RCTPointFromCGPoint(const CGPoint &point) { - return {point.x, point.y}; -} - -inline facebook::react::Size RCTSizeFromCGSize(const CGSize &size) { - return {size.width, size.height}; -} - -inline facebook::react::Rect RCTRectFromCGRect(const CGRect &rect) { - return {RCTPointFromCGPoint(rect.origin), RCTSizeFromCGSize(rect.size)}; -} - -inline facebook::react::EdgeInsets RCTEdgeInsetsFromUIEdgeInsets(const UIEdgeInsets &edgeInsets) { - return {edgeInsets.top, edgeInsets.left, edgeInsets.bottom, edgeInsets.right}; -} - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTImageResponseDelegate.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTImageResponseDelegate.h deleted file mode 100644 index db313305..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTImageResponseDelegate.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTImageResponseDelegate - -- (void)didReceiveImage:(UIImage *)image fromObserver:(void*)observer; -- (void)didReceiveProgress:(float)progress fromObserver:(void*)observer; -- (void)didReceiveFailureFromObserver:(void*)observer; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTImageResponseObserverProxy.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTImageResponseObserverProxy.h deleted file mode 100644 index 72a1aa6b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTImageResponseObserverProxy.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#import "RCTImageResponseDelegate.h" -#import "RCTImageResponseDelegate.h" - -#include - -NS_ASSUME_NONNULL_BEGIN - -namespace facebook { - namespace react { - class RCTImageResponseObserverProxy: public ImageResponseObserver { - public: - RCTImageResponseObserverProxy(void* delegate); - void didReceiveImage(const ImageResponse &imageResponse) override; - void didReceiveProgress (float p) override; - void didReceiveFailure() override; - - private: - id delegate_; - }; - } -} - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTImageResponseObserverProxy.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTImageResponseObserverProxy.mm deleted file mode 100644 index f84e81d3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTImageResponseObserverProxy.mm +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTImageResponseObserverProxy.h" - -#import -#import - -namespace facebook { - namespace react { - -RCTImageResponseObserverProxy::RCTImageResponseObserverProxy(void* delegate): delegate_((__bridge id)delegate) {} - -void RCTImageResponseObserverProxy::didReceiveImage(const ImageResponse &imageResponse) { - UIImage *image = (__bridge UIImage *)imageResponse.getImage().get(); - void *this_ = this; - dispatch_async(dispatch_get_main_queue(), ^{ - [delegate_ didReceiveImage:image fromObserver:this_]; - }); -} - -void RCTImageResponseObserverProxy::didReceiveProgress (float p) { - void *this_ = this; - dispatch_async(dispatch_get_main_queue(), ^{ - [delegate_ didReceiveProgress:p fromObserver:this_]; - }); -} - -void RCTImageResponseObserverProxy::didReceiveFailure() { - void *this_ = this; - dispatch_async(dispatch_get_main_queue(), ^{ - [delegate_ didReceiveFailureFromObserver:this_]; - }); -} - - } // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTPrimitives.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTPrimitives.h deleted file mode 100644 index c837dd81..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTPrimitives.h +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -typedef NSInteger ReactTag; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTScheduler.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTScheduler.h deleted file mode 100644 index a57c2cbf..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTScheduler.h +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RCTMountingManager; - -/** - * Exactly same semantic as `facebook::react::SchedulerDelegate`. - */ -@protocol RCTSchedulerDelegate - -- (void)schedulerDidFinishTransaction:(facebook::react::ShadowViewMutationList)mutations - rootTag:(ReactTag)rootTag; - -- (void)schedulerOptimisticallyCreateComponentViewWithComponentHandle:(facebook::react::ComponentHandle)componentHandle; - -@end - -/** - * `facebook::react::Scheduler` as an Objective-C class. - */ -@interface RCTScheduler : NSObject - -@property (atomic, weak, nullable) id delegate; - -- (instancetype)initWithContextContainer:(std::shared_ptr)contextContatiner; - -- (void)startSurfaceWithSurfaceId:(facebook::react::SurfaceId)surfaceId - moduleName:(NSString *)moduleName - initailProps:(NSDictionary *)initialProps - layoutConstraints:(facebook::react::LayoutConstraints)layoutConstraints - layoutContext:(facebook::react::LayoutContext)layoutContext; - -- (void)stopSurfaceWithSurfaceId:(facebook::react::SurfaceId)surfaceId; - -- (CGSize)measureSurfaceWithLayoutConstraints:(facebook::react::LayoutConstraints)layoutConstraints - layoutContext:(facebook::react::LayoutContext)layoutContext - surfaceId:(facebook::react::SurfaceId)surfaceId; - -- (void)constraintSurfaceLayoutWithLayoutConstraints:(facebook::react::LayoutConstraints)layoutConstraints - layoutContext:(facebook::react::LayoutContext)layoutContext - surfaceId:(facebook::react::SurfaceId)surfaceId; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTScheduler.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTScheduler.mm deleted file mode 100644 index 60752913..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTScheduler.mm +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTScheduler.h" - -#import -#import -#import -#import -#import - -#import - -#import "RCTConversions.h" - -using namespace facebook::react; - -class SchedulerDelegateProxy: public SchedulerDelegate { -public: - SchedulerDelegateProxy(void *scheduler): - scheduler_(scheduler) {} - - void schedulerDidFinishTransaction(Tag rootTag, const ShadowViewMutationList &mutations, const long commitStartTime, const long layoutTime) override { - RCTScheduler *scheduler = (__bridge RCTScheduler *)scheduler_; - [scheduler.delegate schedulerDidFinishTransaction:mutations rootTag:rootTag]; - } - - void schedulerDidRequestPreliminaryViewAllocation(SurfaceId surfaceId, ComponentName componentName, bool isLayoutable, ComponentHandle componentHandle) override { - if (!isLayoutable) { - return; - } - - RCTScheduler *scheduler = (__bridge RCTScheduler *)scheduler_; - [scheduler.delegate schedulerOptimisticallyCreateComponentViewWithComponentHandle:componentHandle]; - } - -private: - void *scheduler_; -}; - -@implementation RCTScheduler { - std::shared_ptr _scheduler; - std::shared_ptr _delegateProxy; -} - -- (instancetype)initWithContextContainer:(std::shared_ptr)contextContainer -{ - if (self = [super init]) { - _delegateProxy = std::make_shared((__bridge void *)self); - _scheduler = std::make_shared(std::static_pointer_cast(contextContainer), getDefaultComponentRegistryFactory()); - _scheduler->setDelegate(_delegateProxy.get()); - } - - return self; -} - -- (void)dealloc -{ - _scheduler->setDelegate(nullptr); -} - -- (void)startSurfaceWithSurfaceId:(SurfaceId)surfaceId - moduleName:(NSString *)moduleName - initailProps:(NSDictionary *)initialProps - layoutConstraints:(LayoutConstraints)layoutConstraints - layoutContext:(LayoutContext)layoutContext; -{ - SystraceSection s("-[RCTScheduler startSurfaceWithSurfaceId:...]"); - - auto props = convertIdToFollyDynamic(initialProps); - _scheduler->startSurface( - surfaceId, - RCTStringFromNSString(moduleName), - props, - layoutConstraints, - layoutContext); - _scheduler->renderTemplateToSurface( - surfaceId, - props.getDefault("navigationConfig") - .getDefault("initialUITemplate", "") - .getString()); -} - -- (void)stopSurfaceWithSurfaceId:(SurfaceId)surfaceId -{ - SystraceSection s("-[RCTScheduler stopSurfaceWithSurfaceId:]"); - _scheduler->stopSurface(surfaceId); -} - -- (CGSize)measureSurfaceWithLayoutConstraints:(LayoutConstraints)layoutConstraints - layoutContext:(LayoutContext)layoutContext - surfaceId:(SurfaceId)surfaceId -{ - SystraceSection s("-[RCTScheduler measureSurfaceWithLayoutConstraints:]"); - return RCTCGSizeFromSize(_scheduler->measureSurface(surfaceId, layoutConstraints, layoutContext)); -} - -- (void)constraintSurfaceLayoutWithLayoutConstraints:(LayoutConstraints)layoutConstraints - layoutContext:(LayoutContext)layoutContext - surfaceId:(SurfaceId)surfaceId -{ - SystraceSection s("-[RCTScheduler constraintSurfaceLayoutWithLayoutConstraints:]"); - _scheduler->constraintSurfaceLayout(surfaceId, layoutConstraints, layoutContext); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTSurfacePresenter.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTSurfacePresenter.h deleted file mode 100644 index c4f1f98f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTSurfacePresenter.h +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -#import -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RCTFabricSurface; -@class RCTMountingManager; - -/** - * Coordinates presenting of React Native Surfaces and represents application - * facing interface of running React Native core. - * SurfacePresenter incapsulates a bridge object inside and discourage direct - * access to it. - */ -@interface RCTSurfacePresenter : NSObject - -- (instancetype)initWithBridge:(RCTBridge *)bridge - config:(std::shared_ptr)config; - -@property (nonatomic, readonly) RCTComponentViewFactory *componentViewFactory; -@property (nonatomic, readonly) facebook::react::SharedContextContainer contextContainer; - -@end - -@interface RCTSurfacePresenter (Surface) - -/** - * Surface uses these methods to register itself in the Presenter. - */ -- (void)registerSurface:(RCTFabricSurface *)surface; -/** - * Starting initiates running, rendering and mounting processes. - * Should be called after registerSurface and any other surface-specific setup is done - */ -- (void)startSurface:(RCTFabricSurface *)surface; -- (void)unregisterSurface:(RCTFabricSurface *)surface; -- (void)setProps:(NSDictionary *)props - surface:(RCTFabricSurface *)surface; - -- (nullable RCTFabricSurface *)surfaceForRootTag:(ReactTag)rootTag; - -/** - * Measures the Surface with given constraints. - */ -- (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize - maximumSize:(CGSize)maximumSize - surface:(RCTFabricSurface *)surface; - -/** - * Sets `minimumSize` and `maximumSize` layout constraints for the Surface. - */ -- (void)setMinimumSize:(CGSize)minimumSize - maximumSize:(CGSize)maximumSize - surface:(RCTFabricSurface *)surface; - -@end - -@interface RCTSurfacePresenter (Deprecated) - -/** - * Returns a underlying bridge. - */ -- (RCTBridge *)bridge_DO_NOT_USE; - -@end - -@interface RCTBridge (Deprecated) - -@property (nonatomic) RCTSurfacePresenter *surfacePresenter; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTSurfacePresenter.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTSurfacePresenter.mm deleted file mode 100644 index 3a18def1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTSurfacePresenter.mm +++ /dev/null @@ -1,365 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSurfacePresenter.h" - -#import -#import -#import -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#import "MainRunLoopEventBeat.h" -#import "RuntimeEventBeat.h" -#import "RCTConversions.h" - -using namespace facebook::react; - -@interface RCTBridge () -- (std::shared_ptr)jsMessageThread; -@end - -@interface RCTSurfacePresenter () -@end - -@implementation RCTSurfacePresenter { - std::mutex _schedulerMutex; - std::mutex _contextContainerMutex; - RCTScheduler *_Nullable _scheduler; // Thread-safe. Mutation of the instance variable is protected by `_schedulerMutex`. - RCTMountingManager *_mountingManager; // Thread-safe. - RCTSurfaceRegistry *_surfaceRegistry; // Thread-safe. - RCTBridge *_bridge; // Unsafe. We are moving away from Bridge. - RCTBridge *_batchedBridge; - std::shared_ptr _reactNativeConfig; -} - -- (instancetype)initWithBridge:(RCTBridge *)bridge config:(std::shared_ptr)config -{ - if (self = [super init]) { - _bridge = bridge; - _batchedBridge = [_bridge batchedBridge] ?: _bridge; - - _surfaceRegistry = [[RCTSurfaceRegistry alloc] init]; - - _mountingManager = [[RCTMountingManager alloc] init]; - _mountingManager.delegate = self; - - if (config != nullptr) { - _reactNativeConfig = config; - } else { - _reactNativeConfig = std::make_shared(); - } - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleBridgeWillReloadNotification:) - name:RCTBridgeWillReloadNotification - object:_bridge]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleJavaScriptDidLoadNotification:) - name:RCTJavaScriptDidLoadNotification - object:_bridge]; - } - - return self; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (RCTComponentViewFactory *)componentViewFactory -{ - return _mountingManager.componentViewRegistry.componentViewFactory; -} - -#pragma mark - Internal Surface-dedicated Interface - -- (void)registerSurface:(RCTFabricSurface *)surface -{ - [_surfaceRegistry registerSurface:surface]; -} - -- (void)startSurface:(RCTFabricSurface *)surface -{ - [self _startSurface:surface]; -} - -- (void)unregisterSurface:(RCTFabricSurface *)surface -{ - [self _stopSurface:surface]; - [_surfaceRegistry unregisterSurface:surface]; -} - -- (void)setProps:(NSDictionary *)props - surface:(RCTFabricSurface *)surface -{ - // This implementation is suboptimal indeed but still better than nothing for now. - [self _stopSurface:surface]; - [self _startSurface:surface]; -} - -- (RCTFabricSurface *)surfaceForRootTag:(ReactTag)rootTag -{ - return [_surfaceRegistry surfaceForRootTag:rootTag]; -} - -- (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize - maximumSize:(CGSize)maximumSize - surface:(RCTFabricSurface *)surface -{ - LayoutContext layoutContext = { - .pointScaleFactor = RCTScreenScale() - }; - - LayoutConstraints layoutConstraints = { - .minimumSize = RCTSizeFromCGSize(minimumSize), - .maximumSize = RCTSizeFromCGSize(maximumSize) - }; - - return [self._scheduler measureSurfaceWithLayoutConstraints:layoutConstraints - layoutContext:layoutContext - surfaceId:surface.rootTag]; -} - -- (void)setMinimumSize:(CGSize)minimumSize - maximumSize:(CGSize)maximumSize - surface:(RCTFabricSurface *)surface -{ - LayoutContext layoutContext = { - .pointScaleFactor = RCTScreenScale() - }; - - LayoutConstraints layoutConstraints = { - .minimumSize = RCTSizeFromCGSize(minimumSize), - .maximumSize = RCTSizeFromCGSize(maximumSize) - }; - - [self._scheduler constraintSurfaceLayoutWithLayoutConstraints:layoutConstraints - layoutContext:layoutContext - surfaceId:surface.rootTag]; -} - -#pragma mark - Private - -- (RCTScheduler *)_scheduler -{ - std::lock_guard lock(_schedulerMutex); - - if (_scheduler) { - return _scheduler; - } - - _scheduler = [[RCTScheduler alloc] initWithContextContainer:self.contextContainer]; - _scheduler.delegate = self; - - return _scheduler; -} - -@synthesize contextContainer = _contextContainer; - -- (SharedContextContainer)contextContainer -{ - std::lock_guard lock(_contextContainerMutex); - - if (_contextContainer) { - return _contextContainer; - } - - _contextContainer = std::make_shared(); - - _contextContainer->registerInstance(_reactNativeConfig, "ReactNativeConfig"); - - auto messageQueueThread = _batchedBridge.jsMessageThread; - auto runtime = (facebook::jsi::Runtime *)((RCTCxxBridge *)_batchedBridge).runtime; - - RuntimeExecutor runtimeExecutor = - [runtime, messageQueueThread](std::function &&callback) { - messageQueueThread->runOnQueue([runtime, callback = std::move(callback)]() { - callback(*runtime); - }); - }; - - EventBeatFactory synchronousBeatFactory = [runtimeExecutor]() { - return std::make_unique(runtimeExecutor); - }; - - EventBeatFactory asynchronousBeatFactory = [runtimeExecutor]() { - return std::make_unique(runtimeExecutor); - }; - - _contextContainer->registerInstance(synchronousBeatFactory, "synchronous"); - _contextContainer->registerInstance(asynchronousBeatFactory, "asynchronous"); - - _contextContainer->registerInstance(runtimeExecutor, "runtime-executor"); - - _contextContainer->registerInstance(std::make_shared((__bridge void *)[_bridge imageLoader]), "ImageManager"); - return _contextContainer; -} - -- (void)_startSurface:(RCTFabricSurface *)surface -{ - [_mountingManager.componentViewRegistry dequeueComponentViewWithComponentHandle:RootShadowNode::Handle() - tag:surface.rootTag]; - - LayoutContext layoutContext = { - .pointScaleFactor = RCTScreenScale() - }; - - LayoutConstraints layoutConstraints = { - .minimumSize = RCTSizeFromCGSize(surface.minimumSize), - .maximumSize = RCTSizeFromCGSize(surface.maximumSize) - }; - - [self._scheduler startSurfaceWithSurfaceId:surface.rootTag - moduleName:surface.moduleName - initailProps:surface.properties - layoutConstraints:layoutConstraints - layoutContext:layoutContext]; -} - -- (void)_stopSurface:(RCTFabricSurface *)surface -{ - [self._scheduler stopSurfaceWithSurfaceId:surface.rootTag]; - - UIView *rootView = - [_mountingManager.componentViewRegistry componentViewByTag:surface.rootTag]; - [_mountingManager.componentViewRegistry enqueueComponentViewWithComponentHandle:RootShadowNode::Handle() - tag:surface.rootTag - componentView:rootView]; - - [surface _unsetStage:(RCTSurfaceStagePrepared | RCTSurfaceStageMounted)]; -} - -- (void)_startAllSurfaces -{ - for (RCTFabricSurface *surface in _surfaceRegistry.enumerator) { - [self _startSurface:surface]; - } -} - -- (void)_stopAllSurfaces -{ - for (RCTFabricSurface *surface in _surfaceRegistry.enumerator) { - [self _stopSurface:surface]; - } -} - -#pragma mark - RCTSchedulerDelegate - -- (void)schedulerDidFinishTransaction:(facebook::react::ShadowViewMutationList)mutations - rootTag:(ReactTag)rootTag -{ - RCTFabricSurface *surface = [_surfaceRegistry surfaceForRootTag:rootTag]; - - [surface _setStage:RCTSurfaceStagePrepared]; - - [_mountingManager performTransactionWithMutations:mutations - rootTag:rootTag]; -} - -- (void)schedulerOptimisticallyCreateComponentViewWithComponentHandle:(ComponentHandle)componentHandle -{ - [_mountingManager optimisticallyCreateComponentViewWithComponentHandle:componentHandle]; -} - -#pragma mark - RCTMountingManagerDelegate - -- (void)mountingManager:(RCTMountingManager *)mountingManager willMountComponentsWithRootTag:(ReactTag)rootTag -{ - RCTAssertMainQueue(); - - // Does nothing. -} - -- (void)mountingManager:(RCTMountingManager *)mountingManager didMountComponentsWithRootTag:(ReactTag)rootTag -{ - RCTAssertMainQueue(); - - RCTFabricSurface *surface = [_surfaceRegistry surfaceForRootTag:rootTag]; - RCTSurfaceStage stage = surface.stage; - if (stage & RCTSurfaceStagePrepared) { - // We have to progress the stage only if the preparing phase is done. - if ([surface _setStage:RCTSurfaceStageMounted]) { - UIView *rootComponentView = [_mountingManager.componentViewRegistry componentViewByTag:rootTag]; - surface.view.rootView = (RCTSurfaceRootView *)rootComponentView; - } - } -} - -#pragma mark - Bridge events - -- (void)handleBridgeWillReloadNotification:(NSNotification *)notification -{ - { - std::lock_guard lock(_schedulerMutex); - if (!_scheduler) { - // Seems we are already in the realoding process. - return; - } - } - - [self _stopAllSurfaces]; - - { - std::lock_guard lock(_schedulerMutex); - _scheduler = nil; - _contextContainer = nil; - } -} - -- (void)handleJavaScriptDidLoadNotification:(NSNotification *)notification -{ - RCTBridge *bridge = notification.userInfo[@"bridge"]; - if (bridge != _batchedBridge) { - _batchedBridge = bridge; - - [self _startAllSurfaces]; - } -} - -@end - -@implementation RCTSurfacePresenter (Deprecated) - -- (RCTBridge *)bridge_DO_NOT_USE -{ - return _bridge; -} - -@end - -@implementation RCTBridge (Deprecated) - -- (void)setSurfacePresenter:(RCTSurfacePresenter *)surfacePresenter -{ - objc_setAssociatedObject(self, @selector(surfacePresenter), surfacePresenter, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -- (RCTSurfacePresenter *)surfacePresenter -{ - return objc_getAssociatedObject(self, @selector(surfacePresenter)); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTSurfaceRegistry.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTSurfaceRegistry.h deleted file mode 100644 index d7a3e755..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTSurfaceRegistry.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RCTFabricSurface; - -/** - * Registry of Surfaces. - * Incapsulates storing Surface objects and quering them by root tag. - * All methods of the registry are thread-safe. - * The registry stores Surface objects as weak refereces. - */ -@interface RCTSurfaceRegistry : NSObject - -- (NSEnumerator *)enumerator; - -/** - * Adds Surface object into the registry. - * The registry does not retain Surface references. - */ -- (void)registerSurface:(RCTFabricSurface *)surface; - -/** - * Removes Surface object from the registry. - */ -- (void)unregisterSurface:(RCTFabricSurface *)surface; - -/** - * Returns stored Surface object by given root tag. - * If the registry does not have such Surface registred, returns `nil`. - */ -- (nullable RCTFabricSurface *)surfaceForRootTag:(ReactTag)rootTag; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTSurfaceRegistry.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTSurfaceRegistry.mm deleted file mode 100644 index 727b4d0e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTSurfaceRegistry.mm +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSurfaceRegistry.h" - -#import - -#import - -@implementation RCTSurfaceRegistry { - std::mutex _mutex; - NSMapTable *_registry; -} - -- (instancetype)init -{ - if (self = [super init]) { - _registry = [NSMapTable mapTableWithKeyOptions:NSPointerFunctionsIntegerPersonality | NSPointerFunctionsOpaqueMemory - valueOptions:NSPointerFunctionsObjectPersonality | NSPointerFunctionsWeakMemory]; - } - - return self; -} - -- (NSEnumerator *)enumerator -{ - std::lock_guard lock(_mutex); - - return [_registry objectEnumerator]; -} - -- (void)registerSurface:(RCTFabricSurface *)surface -{ - std::lock_guard lock(_mutex); - - ReactTag rootTag = surface.rootViewTag.integerValue; - [_registry setObject:surface forKey:(__bridge id)(void *)rootTag]; -} - -- (void)unregisterSurface:(RCTFabricSurface *)surface -{ - std::lock_guard lock(_mutex); - - ReactTag rootTag = surface.rootViewTag.integerValue; - [_registry removeObjectForKey:(__bridge id)(void *)rootTag]; -} - -- (RCTFabricSurface *)surfaceForRootTag:(ReactTag)rootTag -{ - std::lock_guard lock(_mutex); - - return [_registry objectForKey:(__bridge id)(void *)rootTag]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTSurfaceTouchHandler.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTSurfaceTouchHandler.h deleted file mode 100644 index 3c0b68be..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTSurfaceTouchHandler.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface RCTSurfaceTouchHandler : UIGestureRecognizer - -- (void)attachToView:(UIView *)view; -- (void)detachFromView:(UIView *)view; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTSurfaceTouchHandler.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTSurfaceTouchHandler.mm deleted file mode 100644 index 14d1a807..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTSurfaceTouchHandler.mm +++ /dev/null @@ -1,383 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSurfaceTouchHandler.h" - -#import -#import -#import - -#import "RCTConversions.h" -#import "RCTTouchableComponentViewProtocol.h" - -using namespace facebook::react; - -template -class IdentifierPool { -public: - - void enqueue(int index) { - usage[index] = false; - } - - int dequeue() { - while (true) { - if (!usage[lastIndex]) { - usage[lastIndex] = true; - return lastIndex; - } - lastIndex = (lastIndex + 1) % size; - } - } - - void reset() { - for (int i = 0; i < size; i++) { - usage[i] = false; - } - } - -private: - - bool usage[size]; - int lastIndex; -}; - -typedef NS_ENUM(NSInteger, RCTTouchEventType) { - RCTTouchEventTypeTouchStart, - RCTTouchEventTypeTouchMove, - RCTTouchEventTypeTouchEnd, - RCTTouchEventTypeTouchCancel, -}; - -struct ActiveTouch { - Touch touch; - SharedTouchEventEmitter eventEmitter; - - struct Hasher { - size_t operator()(const ActiveTouch &activeTouch) const { - return std::hash()(activeTouch.touch.identifier); - } - }; - - struct Comparator { - bool operator()(const ActiveTouch &lhs, const ActiveTouch &rhs) const { - return lhs.touch.identifier == rhs.touch.identifier; - } - }; -}; - -static void UpdateActiveTouchWithUITouch(ActiveTouch &activeTouch, UITouch *uiTouch, UIView *rootComponentView) { - CGPoint offsetPoint = [uiTouch locationInView:uiTouch.view]; - CGPoint screenPoint = [uiTouch locationInView:uiTouch.window]; - CGPoint pagePoint = [uiTouch locationInView:rootComponentView]; - - activeTouch.touch.offsetPoint = RCTPointFromCGPoint(offsetPoint); - activeTouch.touch.screenPoint = RCTPointFromCGPoint(screenPoint); - activeTouch.touch.pagePoint = RCTPointFromCGPoint(pagePoint); - - activeTouch.touch.timestamp = uiTouch.timestamp; - - if (RCTForceTouchAvailable()) { - activeTouch.touch.force = uiTouch.force / uiTouch.maximumPossibleForce; - } -} - -static ActiveTouch CreateTouchWithUITouch(UITouch *uiTouch, UIView *rootComponentView) { - UIView *componentView = uiTouch.view; - - ActiveTouch activeTouch = {}; - - if ([componentView respondsToSelector:@selector(touchEventEmitterAtPoint:)]) { - activeTouch.eventEmitter = [(id)componentView touchEventEmitterAtPoint:[uiTouch locationInView:componentView]]; - activeTouch.touch.target = (Tag)componentView.tag; - } - - UpdateActiveTouchWithUITouch(activeTouch, uiTouch, rootComponentView); - return activeTouch; -} - -static BOOL AllTouchesAreCancelledOrEnded(NSSet *touches) { - for (UITouch *touch in touches) { - if (touch.phase == UITouchPhaseBegan || - touch.phase == UITouchPhaseMoved || - touch.phase == UITouchPhaseStationary) { - return NO; - } - } - return YES; -} - -static BOOL AnyTouchesChanged(NSSet *touches) { - for (UITouch *touch in touches) { - if (touch.phase == UITouchPhaseBegan || - touch.phase == UITouchPhaseMoved) { - return YES; - } - } - return NO; -} - -/** - * Surprisingly, `__unsafe_unretained id` pointers are not regular pointers - * and `std::hash<>` cannot hash them. - * This is quite trivial but decent implementation of hasher function - * inspired by this research: https://stackoverflow.com/a/21062520/496389. - */ -template -struct PointerHasher { - constexpr std::size_t operator()(const PointerT &value) const { - return reinterpret_cast(value); - } -}; - -@interface RCTSurfaceTouchHandler () -@end - -@implementation RCTSurfaceTouchHandler { - std::unordered_map< - __unsafe_unretained UITouch *, - ActiveTouch, - PointerHasher<__unsafe_unretained UITouch *> - > _activeTouches; - - UIView *_rootComponentView; - IdentifierPool<11> _identifierPool; -} - -- (instancetype)init -{ - if (self = [super initWithTarget:nil action:nil]) { - // `cancelsTouchesInView` and `delaysTouches*` are needed in order - // to be used as a top level event delegated recognizer. - // Otherwise, lower-level components not built using React Native, - // will fail to recognize gestures. - self.cancelsTouchesInView = NO; - self.delaysTouchesBegan = NO; // This is default value. - self.delaysTouchesEnded = NO; - - self.delegate = self; - } - - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)initWithTarget:(id)target action:(SEL)action) - -- (void)attachToView:(UIView *)view -{ - RCTAssert(self.view == nil, @"RCTTouchHandler already has attached view."); - - [view addGestureRecognizer:self]; - _rootComponentView = view; -} - -- (void)detachFromView:(UIView *)view -{ - RCTAssertParam(view); - RCTAssert(self.view == view, @"RCTTouchHandler attached to another view."); - - [view removeGestureRecognizer:self]; - _rootComponentView = nil; -} - -- (void)_registerTouches:(NSSet *)touches -{ - for (UITouch *touch in touches) { - auto activeTouch = CreateTouchWithUITouch(touch, _rootComponentView); - activeTouch.touch.identifier = _identifierPool.dequeue(); - _activeTouches.emplace(touch, activeTouch); - } -} - -- (void)_updateTouches:(NSSet *)touches -{ - for (UITouch *touch in touches) { - UpdateActiveTouchWithUITouch(_activeTouches.at(touch), touch, _rootComponentView); - } -} - -- (void)_unregisterTouches:(NSSet *)touches -{ - for (UITouch *touch in touches) { - const auto &activeTouch = _activeTouches.at(touch); - _identifierPool.enqueue(activeTouch.touch.identifier); - _activeTouches.erase(touch); - } -} - -- (std::vector)_activeTouchesFromTouches:(NSSet *)touches -{ - std::vector activeTouches; - activeTouches.reserve(touches.count); - - for (UITouch *touch in touches) { - activeTouches.push_back(_activeTouches.at(touch)); - } - - return activeTouches; -} - -- (void)_dispatchActiveTouches:(std::vector)activeTouches eventType:(RCTTouchEventType)eventType -{ - TouchEvent event = {}; - std::unordered_set changedActiveTouches = {}; - std::unordered_set uniqueEventEmitter = {}; - BOOL isEndishEventType = eventType == RCTTouchEventTypeTouchEnd || eventType == RCTTouchEventTypeTouchCancel; - - for (const auto &activeTouch : activeTouches) { - if (!activeTouch.eventEmitter) { - continue; - } - - changedActiveTouches.insert(activeTouch); - event.changedTouches.insert(activeTouch.touch); - uniqueEventEmitter.insert(activeTouch.eventEmitter); - } - - for (const auto &pair : _activeTouches) { - if (!pair.second.eventEmitter) { - continue; - } - - if ( - isEndishEventType && - event.changedTouches.find(pair.second.touch) != event.changedTouches.end() - ) { - continue; - } - - event.touches.insert(pair.second.touch); - } - - for (const auto &eventEmitter : uniqueEventEmitter) { - event.targetTouches.clear(); - - for (const auto &pair : _activeTouches) { - if (pair.second.eventEmitter == eventEmitter) { - event.targetTouches.insert(pair.second.touch); - } - } - - switch (eventType) { - case RCTTouchEventTypeTouchStart: - eventEmitter->onTouchStart(event); - break; - case RCTTouchEventTypeTouchMove: - eventEmitter->onTouchMove(event); - break; - case RCTTouchEventTypeTouchEnd: - eventEmitter->onTouchEnd(event); - break; - case RCTTouchEventTypeTouchCancel: - eventEmitter->onTouchCancel(event); - break; - } - } -} - -#pragma mark - `UIResponder`-ish touch-delivery methods - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesBegan:touches withEvent:event]; - - [self _registerTouches:touches]; - [self _dispatchActiveTouches:[self _activeTouchesFromTouches:touches] - eventType:RCTTouchEventTypeTouchStart]; - - if (self.state == UIGestureRecognizerStatePossible) { - self.state = UIGestureRecognizerStateBegan; - } else if (self.state == UIGestureRecognizerStateBegan) { - self.state = UIGestureRecognizerStateChanged; - } -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesMoved:touches withEvent:event]; - - [self _updateTouches:touches]; - [self _dispatchActiveTouches:[self _activeTouchesFromTouches:touches] - eventType:RCTTouchEventTypeTouchMove]; - - self.state = UIGestureRecognizerStateChanged; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesEnded:touches withEvent:event]; - - [self _updateTouches:touches]; - [self _dispatchActiveTouches:[self _activeTouchesFromTouches:touches] - eventType:RCTTouchEventTypeTouchEnd]; - [self _unregisterTouches:touches]; - - if (AllTouchesAreCancelledOrEnded(event.allTouches)) { - self.state = UIGestureRecognizerStateEnded; - } else if (AnyTouchesChanged(event.allTouches)) { - self.state = UIGestureRecognizerStateChanged; - } -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesCancelled:touches withEvent:event]; - - [self _updateTouches:touches]; - [self _dispatchActiveTouches:[self _activeTouchesFromTouches:touches] - eventType:RCTTouchEventTypeTouchCancel]; - [self _unregisterTouches:touches]; - - if (AllTouchesAreCancelledOrEnded(event.allTouches)) { - self.state = UIGestureRecognizerStateCancelled; - } else if (AnyTouchesChanged(event.allTouches)) { - self.state = UIGestureRecognizerStateChanged; - } -} - -- (void)reset -{ - [super reset]; - - if (_activeTouches.size() != 0) { - std::vector activeTouches; - activeTouches.reserve(_activeTouches.size()); - - for (auto const &pair : _activeTouches) { - activeTouches.push_back(pair.second); - } - - [self _dispatchActiveTouches:activeTouches - eventType:RCTTouchEventTypeTouchCancel]; - - // Force-unregistering all the touches. - _activeTouches.clear(); - _identifierPool.reset(); - } -} - -- (BOOL)canPreventGestureRecognizer:(__unused UIGestureRecognizer *)preventedGestureRecognizer -{ - return NO; -} - -- (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)preventingGestureRecognizer -{ - // We fail in favour of other external gesture recognizers. - // iOS will ask `delegate`'s opinion about this gesture recognizer little bit later. - return ![preventingGestureRecognizer.view isDescendantOfView:self.view]; -} - -#pragma mark - UIGestureRecognizerDelegate - -- (BOOL)gestureRecognizer:(__unused UIGestureRecognizer *)gestureRecognizer shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer -{ - // Same condition for `failure of` as for `be prevented by`. - return [self canBePreventedByGestureRecognizer:otherGestureRecognizer]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTTouchableComponentViewProtocol.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTTouchableComponentViewProtocol.h deleted file mode 100644 index b1142b05..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/RCTTouchableComponentViewProtocol.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -@protocol RCTTouchableComponentViewProtocol -- (facebook::react::SharedTouchEventEmitter)touchEventEmitterAtPoint:(CGPoint)point; -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Surface/RCTFabricSurface.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Surface/RCTFabricSurface.h deleted file mode 100644 index cbc2cf25..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Surface/RCTFabricSurface.h +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RCTBridge; -@class RCTSurfaceView; -@class RCTSurfacePresenter; -@protocol RCTSurfaceDelegate; - -/** - * (This is Fabric-compatible RCTSurface implementation.) - * - * RCTSurface instance represents React Native-powered piece of a user interface - * which can be a full-screen app, separate modal view controller, - * or even small widget. - * It is called "Surface". - * - * The RCTSurface instance is completely thread-safe by design; - * it can be created on any thread, and any its method can be called from - * any thread (if the opposite is not mentioned explicitly). - * - * The primary goals of the RCTSurface are: - * * ability to measure and layout the surface in a thread-safe - * and synchronous manner; - * * ability to create a UIView instance on demand (later); - * * ability to communicate the current stage of the surface granularly. - */ -@interface RCTFabricSurface : NSObject - -@property (atomic, readonly) RCTSurfaceStage stage; -@property (atomic, readonly) NSString *moduleName; -@property (atomic, readonly) ReactTag rootTag; - -@property (atomic, readwrite, weak, nullable) id delegate; - -@property (atomic, copy, readwrite) NSDictionary *properties; - -- (instancetype)initWithSurfacePresenter:(RCTSurfacePresenter *)surfacePresenter - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties; - -#pragma mark - Dealing with UIView representation, the Main thread only access - -/** - * Creates (if needed) and returns `UIView` instance which represents the Surface. - * The Surface will cache and *retain* this object. - * Returning the UIView instance does not mean that the Surface is ready - * to execute and layout. It can be just a handler which Surface will use later - * to mount the actual views. - * RCTSurface does not control (or influence in any way) the size or origin - * of this view. Some superview (or another owner) must use other methods - * of this class to setup proper layout and interop interactions with UIKit - * or another UI framework. - * This method must be called only from the main queue. - */ -- (RCTSurfaceView *)view; - -#pragma mark - Start & Stop - -/** - * Starts or stops the Surface. - * A Surface object can be stopped and then restarted. - * The starting process includes initializing all underlying React Native - * infrastructure and running React app. - * Just initialized Surface object starts automatically, there is no need - * to call `start` explicitly. Surface also stops itself on deallocation - * automatically. - * Returns YES in case of success. Returns NO if the Surface is already - * started or stopped. - */ -- (BOOL)start; -- (BOOL)stop; - -#pragma mark - Layout: Setting the size constrains - -/** - * Sets `minimumSize` and `maximumSize` layout constraints for the Surface. - */ -- (void)setMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximumSize; - -/** - * Previously set `minimumSize` layout constraint. - * Defaults to `{0, 0}`. - */ -@property (atomic, assign, readonly) CGSize minimumSize; - -/** - * Previously set `maximumSize` layout constraint. - * Defaults to `{CGFLOAT_MAX, CGFLOAT_MAX}`. - */ -@property (atomic, assign, readonly) CGSize maximumSize; - -/** - * Simple shortcut to `-[RCTSurface setMinimumSize:size maximumSize:size]`. - */ -- (void)setSize:(CGSize)size; - -#pragma mark - Layout: Measuring - -/** - * Measures the Surface with given constraints. - * This method does not cause any side effects on the surface object. - */ -- (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximumSize; - -/** - * Return the current size of the root view based on (but not clamp by) current - * size constraints. - */ -@property (atomic, assign, readonly) CGSize intrinsicSize; - -#pragma mark - Synchronous waiting - -/** - * Synchronously blocks the current thread up to given `timeout` until - * the Surface reaches `stage`. - * NOT SUPPORTED IN FABRIC YET. - */ -- (BOOL)synchronouslyWaitForStage:(RCTSurfaceStage)stage timeout:(NSTimeInterval)timeout; - -@end - -@interface RCTFabricSurface (Internal) - -/** - * Sets and clears given stage flags (bitmask). - * Returns `YES` if the actual state was changed. - */ -- (BOOL)_setStage:(RCTSurfaceStage)stage; -- (BOOL)_unsetStage:(RCTSurfaceStage)stage; - -@end - -@interface RCTFabricSurface (Deprecated) - -/** - * Deprecated. Use `initWithSurfacePresenter:moduleName:initialProperties` instead. - */ -- (instancetype)initWithBridge:(RCTBridge *)bridge - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties; - -/** - * Deprecated. Use `rootTag` instead. - */ -@property (atomic, readonly) NSNumber *rootViewTag; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Surface/RCTFabricSurface.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Surface/RCTFabricSurface.mm deleted file mode 100644 index 044139fb..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Surface/RCTFabricSurface.mm +++ /dev/null @@ -1,281 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTFabricSurface.h" - -#import - -#import -#import -#import -#import -#import -#import -#import -#import - -#import "RCTSurfacePresenter.h" - -@implementation RCTFabricSurface { - // Immutable - RCTSurfacePresenter *_surfacePresenter; - NSString *_moduleName; - - // Protected by the `_mutex` - std::mutex _mutex; - RCTSurfaceStage _stage; - NSDictionary *_properties; - CGSize _minimumSize; - CGSize _maximumSize; - CGSize _intrinsicSize; - - // The Main thread only - RCTSurfaceView *_Nullable _view; - RCTSurfaceTouchHandler *_Nullable _touchHandler; -} - -- (instancetype)initWithSurfacePresenter:(RCTSurfacePresenter *)surfacePresenter - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties -{ - if (self = [super init]) { - _surfacePresenter = surfacePresenter; - _moduleName = moduleName; - _properties = [initialProperties copy]; - _rootTag = [RCTAllocateRootViewTag() integerValue]; - - _minimumSize = CGSizeZero; - // FIXME: Replace with `_maximumSize = CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX);`. - _maximumSize = RCTScreenSize(); - - _touchHandler = [RCTSurfaceTouchHandler new]; - - _stage = RCTSurfaceStageSurfaceDidInitialize; - - [_surfacePresenter registerSurface:self]; - } - - return self; -} - -- (BOOL)start -{ - if (![self _setStage:RCTSurfaceStageStarted]) { - return NO; - } - - [_surfacePresenter startSurface:self]; - - return YES; -} - -- (BOOL)stop -{ - if (![self _unsetStage:RCTSurfaceStageStarted]) { - return NO; - } - - [_surfacePresenter unregisterSurface:self]; - return YES; -} - -- (void)dealloc -{ - [self stop]; -} - -#pragma mark - Immutable Properties (no need to enforce synchonization) - -- (NSString *)moduleName -{ - return _moduleName; -} - -#pragma mark - Main-Threaded Routines - -- (RCTSurfaceView *)view -{ - RCTAssertMainQueue(); - - if (!_view) { - _view = [[RCTSurfaceView alloc] initWithSurface:(RCTSurface *)self]; - [_touchHandler attachToView:_view]; - } - - return _view; -} - -#pragma mark - Stage management - -- (RCTSurfaceStage)stage -{ - std::lock_guard lock(_mutex); - return _stage; -} - -- (BOOL)_setStage:(RCTSurfaceStage)stage -{ - return [self _setStage:stage setOrUnset:YES]; -} - -- (BOOL)_unsetStage:(RCTSurfaceStage)stage -{ - return [self _setStage:stage setOrUnset:NO]; -} - -- (BOOL)_setStage:(RCTSurfaceStage)stage setOrUnset:(BOOL)setOrUnset -{ - RCTSurfaceStage updatedStage; - { - std::lock_guard lock(_mutex); - - if (setOrUnset) { - updatedStage = (RCTSurfaceStage)(_stage | stage); - } else { - updatedStage = (RCTSurfaceStage)(_stage & ~stage); - } - - if (updatedStage == _stage) { - return NO; - } - - _stage = updatedStage; - } - - [self _propagateStageChange:updatedStage]; - return YES; -} - -- (void)_propagateStageChange:(RCTSurfaceStage)stage -{ - // Updating the `view` - RCTExecuteOnMainQueue(^{ - self->_view.stage = stage; - }); - - // Notifying the `delegate` - id delegate = self.delegate; - if ([delegate respondsToSelector:@selector(surface:didChangeStage:)]) { - [delegate surface:(RCTSurface *)self didChangeStage:stage]; - } -} - -#pragma mark - Properties Management - -- (NSDictionary *)properties -{ - std::lock_guard lock(_mutex); - return _properties; -} - -- (void)setProperties:(NSDictionary *)properties -{ - { - std::lock_guard lock(_mutex); - - if ([properties isEqualToDictionary:_properties]) { - return; - } - - _properties = [properties copy]; - } - - [_surfacePresenter setProps:properties surface:self]; -} - -#pragma mark - Layout - -- (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximumSize -{ - return [_surfacePresenter sizeThatFitsMinimumSize:minimumSize maximumSize:maximumSize surface:self]; -} - -#pragma mark - Size Constraints - -- (void)setSize:(CGSize)size -{ - [self setMinimumSize:size maximumSize:size]; -} - -- (void)setMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximumSize -{ - { - std::lock_guard lock(_mutex); - if (CGSizeEqualToSize(minimumSize, _minimumSize) && CGSizeEqualToSize(maximumSize, _maximumSize)) { - return; - } - - _maximumSize = maximumSize; - _minimumSize = minimumSize; - } - - [_surfacePresenter setMinimumSize:minimumSize maximumSize:maximumSize surface:self]; -} - -- (CGSize)minimumSize -{ - std::lock_guard lock(_mutex); - return _minimumSize; -} - -- (CGSize)maximumSize -{ - std::lock_guard lock(_mutex); - return _maximumSize; -} - -#pragma mark - intrinsicSize - -- (void)setIntrinsicSize:(CGSize)intrinsicSize -{ - { - std::lock_guard lock(_mutex); - if (CGSizeEqualToSize(intrinsicSize, _intrinsicSize)) { - return; - } - - _intrinsicSize = intrinsicSize; - } - - // Notifying `delegate` - id delegate = self.delegate; - if ([delegate respondsToSelector:@selector(surface:didChangeIntrinsicSize:)]) { - [delegate surface:(RCTSurface *)(id)self didChangeIntrinsicSize:intrinsicSize]; - } -} - -- (CGSize)intrinsicSize -{ - std::lock_guard lock(_mutex); - return _intrinsicSize; -} - -#pragma mark - Synchronous Waiting - -- (BOOL)synchronouslyWaitForStage:(RCTSurfaceStage)stage timeout:(NSTimeInterval)timeout -{ - // TODO: Not supported yet. - return NO; -} - -#pragma mark - Deprecated - -- (instancetype)initWithBridge:(RCTBridge *)bridge - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties -{ - return [self initWithSurfacePresenter:bridge.surfacePresenter - moduleName:moduleName - initialProperties:initialProperties]; -} - -- (NSNumber *)rootViewTag -{ - return @(_rootTag); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.h deleted file mode 100644 index bd653909..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.h +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -/** - * Fabric-compatible RCTSurfaceHostingProxyRootView implementation. - */ -@interface RCTFabricSurfaceHostingProxyRootView : RCTSurfaceHostingProxyRootView - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.mm deleted file mode 100644 index ac76e023..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.mm +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTFabricSurfaceHostingProxyRootView.h" - -#import "RCTFabricSurface.h" - -@implementation RCTFabricSurfaceHostingProxyRootView - -+ (RCTSurface *)createSurfaceWithBridge:(RCTBridge *)bridge - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties -{ - return (RCTSurface *)[[RCTFabricSurface alloc] initWithBridge:bridge - moduleName:moduleName - initialProperties:initialProperties]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Surface/RCTFabricSurfaceHostingView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Surface/RCTFabricSurfaceHostingView.h deleted file mode 100644 index 76de83ea..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Surface/RCTFabricSurfaceHostingView.h +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -/** - * Fabric-compatible RCTSurfaceHostingView implementation. - */ -@interface RCTFabricSurfaceHostingView : RCTSurfaceHostingView - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Surface/RCTFabricSurfaceHostingView.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Surface/RCTFabricSurfaceHostingView.mm deleted file mode 100644 index ebc21df8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Surface/RCTFabricSurfaceHostingView.mm +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTFabricSurfaceHostingView.h" - -#import -#import "RCTFabricSurface.h" - -@implementation RCTFabricSurfaceHostingView - -- (instancetype)initWithBridge:(RCTBridge *)bridge - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties - sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode -{ - RCTSurface *surface = (RCTSurface *)[[RCTFabricSurface alloc] initWithBridge:bridge - moduleName:moduleName - initialProperties:initialProperties]; - [surface start]; - return [self initWithSurface:surface sizeMeasureMode:sizeMeasureMode]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Utils/MainQueueExecutor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Utils/MainQueueExecutor.h deleted file mode 100644 index 5864e58e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Utils/MainQueueExecutor.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -namespace facebook { -namespace react { - -class MainQueueExecutor : public folly::Executor { - public: - static MainQueueExecutor &instance(); - - void add(folly::Func function) override; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Utils/MainQueueExecutor.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Utils/MainQueueExecutor.mm deleted file mode 100644 index 55749261..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Utils/MainQueueExecutor.mm +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "MainQueueExecutor.h" - -#include -#include - -namespace facebook { -namespace react { - -MainQueueExecutor &MainQueueExecutor::instance() -{ - static auto instance = folly::Indestructible{}; - return *instance; -} - -void MainQueueExecutor::add(folly::Func function) -{ - __block folly::Func blockFunction = std::move(function); - dispatch_async(dispatch_get_main_queue(), ^{ - blockFunction(); - }); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Utils/MainRunLoopEventBeat.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Utils/MainRunLoopEventBeat.h deleted file mode 100644 index eb7c9469..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Utils/MainRunLoopEventBeat.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * Event beat associated with main run loop cycle. - * The callback is always called on the main thread. - */ -class MainRunLoopEventBeat final : public EventBeat { - public: - MainRunLoopEventBeat(RuntimeExecutor runtimeExecutor); - ~MainRunLoopEventBeat(); - - void induce() const override; - - private: - void lockExecutorAndBeat() const; - - const RuntimeExecutor runtimeExecutor_; - CFRunLoopObserverRef mainRunLoopObserver_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Utils/MainRunLoopEventBeat.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Utils/MainRunLoopEventBeat.mm deleted file mode 100644 index 1585e28a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Utils/MainRunLoopEventBeat.mm +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#import "MainRunLoopEventBeat.h" - -#import -#import - -namespace facebook { -namespace react { - -MainRunLoopEventBeat::MainRunLoopEventBeat(RuntimeExecutor runtimeExecutor) - : runtimeExecutor_(std::move(runtimeExecutor)) -{ - mainRunLoopObserver_ = CFRunLoopObserverCreateWithHandler( - NULL /* allocator */, - kCFRunLoopBeforeWaiting /* activities */, - true /* repeats */, - 0 /* order */, - ^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) { - if (!this->isRequested_) { - return; - } - - this->lockExecutorAndBeat(); - }); - - assert(mainRunLoopObserver_); - - CFRunLoopAddObserver(CFRunLoopGetMain(), mainRunLoopObserver_, kCFRunLoopCommonModes); -} - -MainRunLoopEventBeat::~MainRunLoopEventBeat() -{ - CFRunLoopRemoveObserver(CFRunLoopGetMain(), mainRunLoopObserver_, kCFRunLoopCommonModes); - CFRelease(mainRunLoopObserver_); -} - -void MainRunLoopEventBeat::induce() const -{ - if (!this->isRequested_) { - return; - } - - RCTExecuteOnMainQueue(^{ - this->lockExecutorAndBeat(); - }); -} - -void MainRunLoopEventBeat::lockExecutorAndBeat() const -{ - // Note: We need the third mutex to get back to the main thread before - // the lambda is finished (because all mutexes are allocated on the stack). - - std::mutex mutex1; - std::mutex mutex2; - std::mutex mutex3; - - mutex1.lock(); - mutex2.lock(); - mutex3.lock(); - - jsi::Runtime *runtimePtr; - - runtimeExecutor_([&](jsi::Runtime &runtime) { - runtimePtr = &runtime; - mutex1.unlock(); - // `beat` is called somewhere here. - mutex2.lock(); - mutex3.unlock(); - }); - - mutex1.lock(); - beat(*runtimePtr); - mutex2.unlock(); - mutex3.lock(); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Utils/RuntimeEventBeat.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Utils/RuntimeEventBeat.h deleted file mode 100644 index ed7055a3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Utils/RuntimeEventBeat.h +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * Event beat associated with JavaScript runtime. - * The beat is called on `RuntimeExecutor`'s thread induced by the main thread - * event loop. - */ -class RuntimeEventBeat : public EventBeat { - public: - RuntimeEventBeat(RuntimeExecutor runtimeExecutor); - ~RuntimeEventBeat(); - - void induce() const override; - - private: - const RuntimeExecutor runtimeExecutor_; - CFRunLoopObserverRef mainRunLoopObserver_; - mutable std::atomic isBusy_{false}; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Utils/RuntimeEventBeat.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Utils/RuntimeEventBeat.mm deleted file mode 100644 index 6b05f2c6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Fabric/Utils/RuntimeEventBeat.mm +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "RuntimeEventBeat.h" - -namespace facebook { -namespace react { - -RuntimeEventBeat::RuntimeEventBeat(RuntimeExecutor runtimeExecutor) : runtimeExecutor_(std::move(runtimeExecutor)) -{ - mainRunLoopObserver_ = CFRunLoopObserverCreateWithHandler( - NULL /* allocator */, - kCFRunLoopBeforeWaiting /* activities */, - true /* repeats */, - 0 /* order */, - ^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) { - // Note: We only `induce` beat here; actual beat will be performed on - // a different thread. - this->induce(); - }); - - assert(mainRunLoopObserver_); - - CFRunLoopAddObserver(CFRunLoopGetMain(), mainRunLoopObserver_, kCFRunLoopCommonModes); -} - -RuntimeEventBeat::~RuntimeEventBeat() -{ - CFRunLoopRemoveObserver(CFRunLoopGetMain(), mainRunLoopObserver_, kCFRunLoopCommonModes); - CFRelease(mainRunLoopObserver_); -} - -void RuntimeEventBeat::induce() const -{ - if (!isRequested_ || isBusy_) { - return; - } - -#ifndef NDEBUG - // We do a trick here. - // If `wasExecuted` was destroyed before set to `true`, - // it means that the execution block was deallocated not being executed. - // This indicates that `messageQueueThread_` is being deallocated. - // This trick is quite expensive due to deallocation and messing with atomic - // counters. Seems we need this only for making hot-reloading mechanism - // thread-safe. Hence, let's leave it to be DEBUG-only for now. - auto wasExecuted = std::shared_ptr(new bool{false}, [this](bool *wasExecuted) { - if (!*wasExecuted && failCallback_) { - failCallback_(); - } - delete wasExecuted; - }); -#endif - - isBusy_ = true; - runtimeExecutor_([=](jsi::Runtime &runtime) mutable { - this->beat(runtime); - isBusy_ = false; -#ifndef NDEBUG - *wasExecuted = true; -#endif - }); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Inspector/RCTInspector.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Inspector/RCTInspector.h deleted file mode 100644 index d346934e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Inspector/RCTInspector.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#import -#import - -#if RCT_DEV - -@class RCTInspectorRemoteConnection; - -@interface RCTInspectorLocalConnection : NSObject -- (void)sendMessage:(NSString *)message; -- (void)disconnect; -@end - -@interface RCTInspectorPage : NSObject -@property (nonatomic, readonly) NSInteger id; -@property (nonatomic, readonly) NSString *title; -@property (nonatomic, readonly) NSString *vm; -@end - -@interface RCTInspector : NSObject -+ (NSArray *)pages; -+ (RCTInspectorLocalConnection *)connectPage:(NSInteger)pageId - forRemoteConnection:(RCTInspectorRemoteConnection *)remote; -@end - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Inspector/RCTInspector.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Inspector/RCTInspector.mm deleted file mode 100644 index 32201f76..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Inspector/RCTInspector.mm +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#import "RCTInspector.h" - -#if RCT_DEV - -#include - -#import "RCTDefines.h" -#import "RCTInspectorPackagerConnection.h" -#import "RCTLog.h" -#import "RCTSRWebSocket.h" -#import "RCTUtils.h" - -using namespace facebook::react; - -// This is a port of the Android impl, at -// react-native-github/ReactAndroid/src/main/java/com/facebook/react/bridge/Inspector.java -// react-native-github/ReactAndroid/src/main/jni/react/jni/JInspector.cpp -// please keep consistent :) - -class RemoteConnection : public IRemoteConnection { -public: -RemoteConnection(RCTInspectorRemoteConnection *connection) : - _connection(connection) {} - - virtual void onMessage(std::string message) override { - [_connection onMessage:@(message.c_str())]; - } - - virtual void onDisconnect() override { - [_connection onDisconnect]; - } -private: - const RCTInspectorRemoteConnection *_connection; -}; - -@interface RCTInspectorPage () { - NSInteger _id; - NSString *_title; - NSString *_vm; -} -- (instancetype)initWithId:(NSInteger)id - title:(NSString *)title - vm:(NSString *)vm; -@end - -@interface RCTInspectorLocalConnection () { - std::unique_ptr _connection; -} -- (instancetype)initWithConnection:(std::unique_ptr)connection; -@end - -static IInspector *getInstance() -{ - return &facebook::react::getInspectorInstance(); -} - -@implementation RCTInspector - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -+ (NSArray *)pages -{ - std::vector pages = getInstance()->getPages(); - NSMutableArray *array = [NSMutableArray arrayWithCapacity:pages.size()]; - for (size_t i = 0; i < pages.size(); i++) { - RCTInspectorPage *pageWrapper = [[RCTInspectorPage alloc] initWithId:pages[i].id - title:@(pages[i].title.c_str()) - vm:@(pages[i].vm.c_str())]; - [array addObject:pageWrapper]; - - } - return array; -} - -+ (RCTInspectorLocalConnection *)connectPage:(NSInteger)pageId - forRemoteConnection:(RCTInspectorRemoteConnection *)remote -{ - auto localConnection = getInstance()->connect(pageId, std::make_unique(remote)); - return [[RCTInspectorLocalConnection alloc] initWithConnection:std::move(localConnection)]; -} - -@end - -@implementation RCTInspectorPage - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (instancetype)initWithId:(NSInteger)id - title:(NSString *)title - vm:(NSString *)vm -{ - if (self = [super init]) { - _id = id; - _title = title; - _vm = vm; - } - return self; -} - -@end - -@implementation RCTInspectorLocalConnection - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (instancetype)initWithConnection:(std::unique_ptr)connection -{ - if (self = [super init]) { - _connection = std::move(connection); - } - return self; -} - -- (void)sendMessage:(NSString *)message -{ - _connection->sendMessage([message UTF8String]); -} - -- (void)disconnect -{ - _connection->disconnect(); -} - -@end - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Inspector/RCTInspectorPackagerConnection.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Inspector/RCTInspectorPackagerConnection.h deleted file mode 100644 index 22592936..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Inspector/RCTInspectorPackagerConnection.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#import -#import - -#if RCT_DEV - -@interface RCTBundleStatus : NSObject -@property (atomic, assign) BOOL isLastBundleDownloadSuccess; -@property (atomic, assign) NSTimeInterval bundleUpdateTimestamp; -@end - -typedef RCTBundleStatus *(^RCTBundleStatusProvider)(void); - -@interface RCTInspectorPackagerConnection : NSObject -- (instancetype)initWithURL:(NSURL *)url; - -- (void)connect; -- (void)closeQuietly; -- (void)sendEventToAllConnections:(NSString *)event; -- (void)setBundleStatusProvider:(RCTBundleStatusProvider)bundleStatusProvider; -@end - -@interface RCTInspectorRemoteConnection : NSObject -- (void)onMessage:(NSString *)message; -- (void)onDisconnect; -@end - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Inspector/RCTInspectorPackagerConnection.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Inspector/RCTInspectorPackagerConnection.m deleted file mode 100644 index d3d97d0e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Inspector/RCTInspectorPackagerConnection.m +++ /dev/null @@ -1,360 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#import "RCTInspectorPackagerConnection.h" - -#if RCT_DEV - -#import "RCTDefines.h" -#import "RCTInspector.h" -#import "RCTLog.h" -#import "RCTSRWebSocket.h" -#import "RCTUtils.h" - -// This is a port of the Android impl, at -// ReactAndroid/src/main/java/com/facebook/react/devsupport/InspectorPackagerConnection.java -// please keep consistent :) - -const int RECONNECT_DELAY_MS = 2000; - -@implementation RCTBundleStatus -@end - -@interface RCTInspectorPackagerConnection () { - NSURL *_url; - NSMutableDictionary *_inspectorConnections; - RCTSRWebSocket *_webSocket; - dispatch_queue_t _jsQueue; - BOOL _closed; - BOOL _suppressConnectionErrors; - RCTBundleStatusProvider _bundleStatusProvider; -} -@end - -@interface RCTInspectorRemoteConnection () { - __weak RCTInspectorPackagerConnection *_owningPackagerConnection; - NSString *_pageId; -} -- (instancetype)initWithPackagerConnection:(RCTInspectorPackagerConnection *)owningPackagerConnection - pageId:(NSString *)pageId; -@end - -static NSDictionary *makePageIdPayload(NSString *pageId) -{ - return @{ @"pageId": pageId }; -} - -@implementation RCTInspectorPackagerConnection - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (instancetype)initWithURL:(NSURL *)url -{ - if (self = [super init]) { - _url = url; - _inspectorConnections = [NSMutableDictionary new]; - _jsQueue = dispatch_queue_create("com.facebook.react.WebSocketExecutor", DISPATCH_QUEUE_SERIAL); - } - return self; -} - -- (void)setBundleStatusProvider:(RCTBundleStatusProvider)bundleStatusProvider -{ - _bundleStatusProvider = bundleStatusProvider; -} - -- (void)handleProxyMessage:(NSDictionary *)message -{ - NSString *event = message[@"event"]; - NSDictionary *payload = message[@"payload"]; - if ([@"getPages" isEqualToString:event]) { - [self sendEvent:event payload:[self pages]]; - } else if ([@"wrappedEvent" isEqualToString:event]) { - [self handleWrappedEvent:payload]; - } else if ([@"connect" isEqualToString:event]) { - [self handleConnect:payload]; - } else if ([@"disconnect" isEqualToString:event]) { - [self handleDisconnect:payload]; - } else { - RCTLogError(@"Unknown event: %@", event); - } -} - -- (void)sendEventToAllConnections:(NSString *)event -{ - for (NSString *pageId in _inspectorConnections) { - [_inspectorConnections[pageId] sendMessage:event]; - } -} - -- (void)closeAllConnections -{ - for (NSString *pageId in _inspectorConnections){ - [[_inspectorConnections objectForKey:pageId] disconnect]; - } - [_inspectorConnections removeAllObjects]; -} - -- (void)handleConnect:(NSDictionary *)payload -{ - NSString *pageId = payload[@"pageId"]; - RCTInspectorLocalConnection *existingConnection = _inspectorConnections[pageId]; - if (existingConnection) { - [_inspectorConnections removeObjectForKey:pageId]; - [existingConnection disconnect]; - RCTLogWarn(@"Already connected: %@", pageId); - return; - } - - RCTInspectorRemoteConnection *remoteConnection = - [[RCTInspectorRemoteConnection alloc] initWithPackagerConnection:self - pageId:pageId]; - - RCTInspectorLocalConnection *inspectorConnection = [RCTInspector connectPage:[pageId integerValue] - forRemoteConnection:remoteConnection]; - _inspectorConnections[pageId] = inspectorConnection; -} - -- (void)handleDisconnect:(NSDictionary *)payload -{ - NSString *pageId = payload[@"pageId"]; - RCTInspectorLocalConnection *inspectorConnection = _inspectorConnections[pageId]; - if (inspectorConnection) { - [self removeConnectionForPage:pageId]; - [inspectorConnection disconnect]; - } -} - -- (void)removeConnectionForPage:(NSString *)pageId -{ - [_inspectorConnections removeObjectForKey:pageId]; -} - -- (void)handleWrappedEvent:(NSDictionary *)payload -{ - NSString *pageId = payload[@"pageId"]; - NSString *wrappedEvent = payload[@"wrappedEvent"]; - RCTInspectorLocalConnection *inspectorConnection = _inspectorConnections[pageId]; - if (!inspectorConnection) { - RCTLogWarn( - @"Not connected to page: %@ , failed trying to handle event: %@", - pageId, - wrappedEvent); - return; - } - [inspectorConnection sendMessage:wrappedEvent]; -} - -- (NSArray *)pages -{ - NSArray *pages = [RCTInspector pages]; - NSMutableArray *array = [NSMutableArray arrayWithCapacity:pages.count]; - - RCTBundleStatusProvider statusProvider = _bundleStatusProvider; - RCTBundleStatus *bundleStatus = statusProvider == nil - ? nil - : statusProvider(); - - for (RCTInspectorPage *page in pages) { - NSDictionary *jsonPage = @{ - @"id": [@(page.id) stringValue], - @"title": page.title, - @"app": [[NSBundle mainBundle] bundleIdentifier], - @"vm": page.vm, - @"isLastBundleDownloadSuccess": bundleStatus == nil - ? [NSNull null] - : @(bundleStatus.isLastBundleDownloadSuccess), - @"bundleUpdateTimestamp": bundleStatus == nil - ? [NSNull null] - : @((long)bundleStatus.bundleUpdateTimestamp * 1000), - }; - [array addObject:jsonPage]; - } - return array; -} - -- (void)sendWrappedEvent:(NSString *)pageId - message:(NSString *)message -{ - NSDictionary *payload = @{ - @"pageId": pageId, - @"wrappedEvent": message, - }; - [self sendEvent:@"wrappedEvent" payload:payload]; -} - -- (void)sendEvent:(NSString *)name payload:(id)payload -{ - NSDictionary *jsonMessage = @{ - @"event": name, - @"payload": payload, - }; - [self sendToPackager:jsonMessage]; -} - -// analogous to InspectorPackagerConnection.Connection.onFailure(...) -- (void)webSocket:(RCTSRWebSocket *)webSocket didFailWithError:(NSError *)error -{ - if (_webSocket) { - [self abort:@"Websocket exception" - withCause:error]; - } - if (!_closed && [error code] != ECONNREFUSED) { - [self reconnect]; - } -} - -// analogous to InspectorPackagerConnection.Connection.onMessage(...) -- (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)opaqueMessage -{ - // warn but don't die on unrecognized messages - if (![opaqueMessage isKindOfClass:[NSString class]]) { - RCTLogWarn(@"Unrecognized inspector message, object is of type: %@", [opaqueMessage class]); - return; - } - - NSString *messageText = opaqueMessage; - NSError *error = nil; - id parsedJSON = RCTJSONParse(messageText, &error); - if (error) { - RCTLogWarn(@"Unrecognized inspector message, string was not valid JSON: %@", - messageText); - return; - } - - [self handleProxyMessage:parsedJSON]; -} - -// analogous to InspectorPackagerConnection.Connection.onClosed(...) -- (void)webSocket:(RCTSRWebSocket *)webSocket didCloseWithCode:(NSInteger)code - reason:(NSString *)reason - wasClean:(BOOL)wasClean -{ - _webSocket = nil; - [self closeAllConnections]; - if (!_closed) { - [self reconnect]; - } -} - -- (void)connect -{ - if (_closed) { - RCTLogError(@"Illegal state: Can't connect after having previously been closed."); - return; - } - - // The corresopnding android code has a lot of custom config options for - // timeouts, but it appears the iOS RCTSRWebSocket API doesn't have the same - // implemented options. - _webSocket = [[RCTSRWebSocket alloc] initWithURL:_url]; - [_webSocket setDelegateDispatchQueue:_jsQueue]; - _webSocket.delegate = self; - [_webSocket open]; -} - -- (void)reconnect -{ - if (_closed) { - RCTLogError(@"Illegal state: Can't reconnect after having previously been closed."); - return; - } - - if (_suppressConnectionErrors) { - RCTLogWarn(@"Couldn't connect to packager, will silently retry"); - _suppressConnectionErrors = true; - } - - __weak RCTInspectorPackagerConnection *weakSelf = self; - dispatch_after( - dispatch_time(DISPATCH_TIME_NOW, RECONNECT_DELAY_MS *NSEC_PER_MSEC), - dispatch_get_main_queue(), ^{ - RCTInspectorPackagerConnection *strongSelf = weakSelf; - if (strongSelf && !strongSelf->_closed) { - [strongSelf connect]; - } - }); -} - -- (void)closeQuietly -{ - _closed = true; - [self disposeWebSocket]; -} - -- (void)sendToPackager:(NSDictionary *)messageObject -{ - __weak RCTInspectorPackagerConnection *weakSelf = self; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - RCTInspectorPackagerConnection *strongSelf = weakSelf; - if (strongSelf && !strongSelf->_closed) { - NSError *error; - NSString *messageText = RCTJSONStringify(messageObject, &error); - if (error) { - RCTLogWarn(@"Couldn't send event to packager: %@", error); - } else { - [strongSelf->_webSocket send:messageText]; - } - } - }); -} - -- (void)abort:(NSString *)message - withCause:(NSError *)cause -{ - // Don't log ECONNREFUSED at all; it's expected in cases where the server isn't listening. - if (![cause.domain isEqual:NSPOSIXErrorDomain] || cause.code != ECONNREFUSED) { - RCTLogInfo(@"Error occurred, shutting down websocket connection: %@ %@", message, cause); - } - - [self closeAllConnections]; - [self disposeWebSocket]; -} - -- (void)disposeWebSocket -{ - if (_webSocket) { - [_webSocket closeWithCode:1000 - reason:@"End of session"]; - _webSocket.delegate = nil; - _webSocket = nil; - } -} - -@end - -@implementation RCTInspectorRemoteConnection - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (instancetype)initWithPackagerConnection:(RCTInspectorPackagerConnection *)owningPackagerConnection - pageId:(NSString *)pageId -{ - if (self = [super init]) { - _owningPackagerConnection = owningPackagerConnection; - _pageId = pageId; - } - return self; -} - -- (void)onMessage:(NSString *)message -{ - [_owningPackagerConnection sendWrappedEvent:_pageId - message:message]; -} - -- (void)onDisconnect -{ - RCTInspectorPackagerConnection *owningPackagerConnectionStrong = _owningPackagerConnection; - if (owningPackagerConnectionStrong) { - [owningPackagerConnectionStrong removeConnectionForPage:_pageId]; - [owningPackagerConnectionStrong sendEvent:@"disconnect" - payload:makePageIdPayload(_pageId)]; - } -} - -@end - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAccessibilityManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAccessibilityManager.h deleted file mode 100644 index 35f03280..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAccessibilityManager.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -extern NSString *const RCTAccessibilityManagerDidUpdateMultiplierNotification; // posted when multiplier is changed - -@interface RCTAccessibilityManager : NSObject - -@property (nonatomic, readonly) CGFloat multiplier; - -/// map from UIKit categories to multipliers -@property (nonatomic, copy) NSDictionary *multipliers; - -@property (nonatomic, assign) BOOL isVoiceOverEnabled; - -@end - -@interface RCTBridge (RCTAccessibilityManager) - -@property (nonatomic, readonly) RCTAccessibilityManager *accessibilityManager; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAccessibilityManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAccessibilityManager.m deleted file mode 100644 index 74adf9e4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAccessibilityManager.m +++ /dev/null @@ -1,219 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAccessibilityManager.h" - -#import "RCTUIManager.h" -#import "RCTBridge.h" -#import "RCTConvert.h" -#import "RCTEventDispatcher.h" -#import "RCTLog.h" - -NSString *const RCTAccessibilityManagerDidUpdateMultiplierNotification = @"RCTAccessibilityManagerDidUpdateMultiplierNotification"; - -static NSString *UIKitCategoryFromJSCategory(NSString *JSCategory) -{ - static NSDictionary *map = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - map = @{@"extraSmall": UIContentSizeCategoryExtraSmall, - @"small": UIContentSizeCategorySmall, - @"medium": UIContentSizeCategoryMedium, - @"large": UIContentSizeCategoryLarge, - @"extraLarge": UIContentSizeCategoryExtraLarge, - @"extraExtraLarge": UIContentSizeCategoryExtraExtraLarge, - @"extraExtraExtraLarge": UIContentSizeCategoryExtraExtraExtraLarge, - @"accessibilityMedium": UIContentSizeCategoryAccessibilityMedium, - @"accessibilityLarge": UIContentSizeCategoryAccessibilityLarge, - @"accessibilityExtraLarge": UIContentSizeCategoryAccessibilityExtraLarge, - @"accessibilityExtraExtraLarge": UIContentSizeCategoryAccessibilityExtraExtraLarge, - @"accessibilityExtraExtraExtraLarge": UIContentSizeCategoryAccessibilityExtraExtraExtraLarge}; - }); - return map[JSCategory]; -} - -@interface RCTAccessibilityManager () - -@property (nonatomic, copy) NSString *contentSizeCategory; -@property (nonatomic, assign) CGFloat multiplier; - -@end - -@implementation RCTAccessibilityManager - -@synthesize bridge = _bridge; -@synthesize multipliers = _multipliers; - -RCT_EXPORT_MODULE() - -+ (BOOL)requiresMainQueueSetup -{ - return YES; -} - -- (instancetype)init -{ - if (self = [super init]) { - _multiplier = 1.0; - - // TODO: can this be moved out of the startup path? - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(didReceiveNewContentSizeCategory:) - name:UIContentSizeCategoryDidChangeNotification - object:nil]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(didReceiveNewVoiceOverStatus:) - name:UIAccessibilityVoiceOverStatusChanged - object:nil]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(accessibilityAnnouncementDidFinish:) - name:UIAccessibilityAnnouncementDidFinishNotification - object:nil]; - - self.contentSizeCategory = RCTSharedApplication().preferredContentSizeCategory; - _isVoiceOverEnabled = UIAccessibilityIsVoiceOverRunning(); - } - return self; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (void)didReceiveNewContentSizeCategory:(NSNotification *)note -{ - self.contentSizeCategory = note.userInfo[UIContentSizeCategoryNewValueKey]; -} - -- (void)didReceiveNewVoiceOverStatus:(__unused NSNotification *)notification -{ - BOOL newIsVoiceOverEnabled = UIAccessibilityIsVoiceOverRunning(); - if (_isVoiceOverEnabled != newIsVoiceOverEnabled) { - _isVoiceOverEnabled = newIsVoiceOverEnabled; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_bridge.eventDispatcher sendDeviceEventWithName:@"voiceOverDidChange" - body:@(_isVoiceOverEnabled)]; -#pragma clang diagnostic pop - } -} - -- (void)accessibilityAnnouncementDidFinish:(__unused NSNotification *)notification -{ - NSDictionary *userInfo = notification.userInfo; - // Response dictionary to populate the event with. - NSDictionary *response = @{@"announcement": userInfo[UIAccessibilityAnnouncementKeyStringValue], - @"success": userInfo[UIAccessibilityAnnouncementKeyWasSuccessful]}; - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_bridge.eventDispatcher sendDeviceEventWithName:@"announcementDidFinish" - body:response]; -#pragma clang diagnostic pop -} - -- (void)setContentSizeCategory:(NSString *)contentSizeCategory -{ - if (_contentSizeCategory != contentSizeCategory) { - _contentSizeCategory = [contentSizeCategory copy]; - [self invalidateMultiplier]; - } -} - -- (void)invalidateMultiplier -{ - self.multiplier = [self multiplierForContentSizeCategory:_contentSizeCategory]; - [[NSNotificationCenter defaultCenter] postNotificationName:RCTAccessibilityManagerDidUpdateMultiplierNotification object:self]; -} - -- (CGFloat)multiplierForContentSizeCategory:(NSString *)category -{ - NSNumber *m = self.multipliers[category]; - if (m.doubleValue <= 0.0) { - RCTLogError(@"Can't determinte multiplier for category %@. Using 1.0.", category); - m = @1.0; - } - return m.doubleValue; -} - -- (void)setMultipliers:(NSDictionary *)multipliers -{ - if (_multipliers != multipliers) { - _multipliers = [multipliers copy]; - [self invalidateMultiplier]; - } -} - -- (NSDictionary *)multipliers -{ - if (_multipliers == nil) { - _multipliers = @{UIContentSizeCategoryExtraSmall: @0.823, - UIContentSizeCategorySmall: @0.882, - UIContentSizeCategoryMedium: @0.941, - UIContentSizeCategoryLarge: @1.0, - UIContentSizeCategoryExtraLarge: @1.118, - UIContentSizeCategoryExtraExtraLarge: @1.235, - UIContentSizeCategoryExtraExtraExtraLarge: @1.353, - UIContentSizeCategoryAccessibilityMedium: @1.786, - UIContentSizeCategoryAccessibilityLarge: @2.143, - UIContentSizeCategoryAccessibilityExtraLarge: @2.643, - UIContentSizeCategoryAccessibilityExtraExtraLarge: @3.143, - UIContentSizeCategoryAccessibilityExtraExtraExtraLarge: @3.571}; - } - return _multipliers; -} - -RCT_EXPORT_METHOD(setAccessibilityContentSizeMultipliers:(NSDictionary *)JSMultipliers) -{ - NSMutableDictionary *multipliers = [NSMutableDictionary new]; - for (NSString *__nonnull JSCategory in JSMultipliers) { - NSNumber *m = [RCTConvert NSNumber:JSMultipliers[JSCategory]]; - NSString *UIKitCategory = UIKitCategoryFromJSCategory(JSCategory); - multipliers[UIKitCategory] = m; - } - self.multipliers = multipliers; -} - -RCT_EXPORT_METHOD(setAccessibilityFocus:(nonnull NSNumber *)reactTag) -{ - dispatch_async(dispatch_get_main_queue(), ^{ - UIView *view = [self.bridge.uiManager viewForReactTag:reactTag]; - UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, view); - }); -} - -RCT_EXPORT_METHOD(announceForAccessibility:(NSString *)announcement) -{ - UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, announcement); -} - -RCT_EXPORT_METHOD(getMultiplier:(RCTResponseSenderBlock)callback) -{ - if (callback) { - callback(@[ @(self.multiplier) ]); - } -} - -RCT_EXPORT_METHOD(getCurrentVoiceOverState:(RCTResponseSenderBlock)callback - error:(__unused RCTResponseSenderBlock)error) -{ - callback(@[@(_isVoiceOverEnabled)]); -} - -@end - -@implementation RCTBridge (RCTAccessibilityManager) - -- (RCTAccessibilityManager *)accessibilityManager -{ - return [self moduleForClass:[RCTAccessibilityManager class]]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAlertManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAlertManager.h deleted file mode 100644 index 520481e3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAlertManager.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -typedef NS_ENUM(NSInteger, RCTAlertViewStyle) { - RCTAlertViewStyleDefault = 0, - RCTAlertViewStyleSecureTextInput, - RCTAlertViewStylePlainTextInput, - RCTAlertViewStyleLoginAndPasswordInput -}; - - -@interface RCTAlertManager : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAlertManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAlertManager.m deleted file mode 100644 index bb1f3cea..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAlertManager.m +++ /dev/null @@ -1,185 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAlertManager.h" - -#import "RCTAssert.h" -#import "RCTConvert.h" -#import "RCTLog.h" -#import "RCTUtils.h" - -@implementation RCTConvert (UIAlertViewStyle) - -RCT_ENUM_CONVERTER(RCTAlertViewStyle, (@{ - @"default": @(RCTAlertViewStyleDefault), - @"secure-text": @(RCTAlertViewStyleSecureTextInput), - @"plain-text": @(RCTAlertViewStylePlainTextInput), - @"login-password": @(RCTAlertViewStyleLoginAndPasswordInput), -}), RCTAlertViewStyleDefault, integerValue) - -@end - -@interface RCTAlertManager() - -@end - -@implementation RCTAlertManager -{ - NSHashTable *_alertControllers; -} - -RCT_EXPORT_MODULE() - -- (dispatch_queue_t)methodQueue -{ - return dispatch_get_main_queue(); -} - -- (void)invalidate -{ - for (UIAlertController *alertController in _alertControllers) { - [alertController.presentingViewController dismissViewControllerAnimated:YES completion:nil]; - } -} - -/** - * @param {NSDictionary} args Dictionary of the form - * - * @{ - * @"message": @"", - * @"buttons": @[ - * @{@"": @""}, - * @{@"": @""}, - * ], - * @"cancelButtonKey": @"", - * } - * The key from the `buttons` dictionary is passed back in the callback on click. - * Buttons are displayed in the order they are specified. - */ -RCT_EXPORT_METHOD(alertWithArgs:(NSDictionary *)args - callback:(RCTResponseSenderBlock)callback) -{ - NSString *title = [RCTConvert NSString:args[@"title"]]; - NSString *message = [RCTConvert NSString:args[@"message"]]; - RCTAlertViewStyle type = [RCTConvert RCTAlertViewStyle:args[@"type"]]; - NSArray *buttons = [RCTConvert NSDictionaryArray:args[@"buttons"]]; - NSString *defaultValue = [RCTConvert NSString:args[@"defaultValue"]]; - NSString *cancelButtonKey = [RCTConvert NSString:args[@"cancelButtonKey"]]; - NSString *destructiveButtonKey = [RCTConvert NSString:args[@"destructiveButtonKey"]]; - UIKeyboardType keyboardType = [RCTConvert UIKeyboardType:args[@"keyboardType"]]; - - if (!title && !message) { - RCTLogError(@"Must specify either an alert title, or message, or both"); - return; - } - - if (buttons.count == 0) { - if (type == RCTAlertViewStyleDefault) { - buttons = @[@{@"0": RCTUIKitLocalizedString(@"OK")}]; - cancelButtonKey = @"0"; - } else { - buttons = @[ - @{@"0": RCTUIKitLocalizedString(@"OK")}, - @{@"1": RCTUIKitLocalizedString(@"Cancel")}, - ]; - cancelButtonKey = @"1"; - } - } - - UIViewController *presentingController = RCTPresentedViewController(); - if (presentingController == nil) { - RCTLogError(@"Tried to display alert view but there is no application window. args: %@", args); - return; - } - - UIAlertController *alertController = [UIAlertController - alertControllerWithTitle:title - message:nil - preferredStyle:UIAlertControllerStyleAlert]; - switch (type) { - case RCTAlertViewStylePlainTextInput: { - [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { - textField.secureTextEntry = NO; - textField.text = defaultValue; - textField.keyboardType = keyboardType; - }]; - break; - } - case RCTAlertViewStyleSecureTextInput: { - [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { - textField.placeholder = RCTUIKitLocalizedString(@"Password"); - textField.secureTextEntry = YES; - textField.text = defaultValue; - textField.keyboardType = keyboardType; - }]; - break; - } - case RCTAlertViewStyleLoginAndPasswordInput: { - [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { - textField.placeholder = RCTUIKitLocalizedString(@"Login"); - textField.text = defaultValue; - textField.keyboardType = keyboardType; - }]; - [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { - textField.placeholder = RCTUIKitLocalizedString(@"Password"); - textField.secureTextEntry = YES; - }]; - break; - } - case RCTAlertViewStyleDefault: - break; - } - - alertController.message = message; - - for (NSDictionary *button in buttons) { - if (button.count != 1) { - RCTLogError(@"Button definitions should have exactly one key."); - } - NSString *buttonKey = button.allKeys.firstObject; - NSString *buttonTitle = [RCTConvert NSString:button[buttonKey]]; - UIAlertActionStyle buttonStyle = UIAlertActionStyleDefault; - if ([buttonKey isEqualToString:cancelButtonKey]) { - buttonStyle = UIAlertActionStyleCancel; - } else if ([buttonKey isEqualToString:destructiveButtonKey]) { - buttonStyle = UIAlertActionStyleDestructive; - } - __weak UIAlertController *weakAlertController = alertController; - [alertController addAction:[UIAlertAction actionWithTitle:buttonTitle - style:buttonStyle - handler:^(__unused UIAlertAction *action) { - switch (type) { - case RCTAlertViewStylePlainTextInput: - case RCTAlertViewStyleSecureTextInput: - callback(@[buttonKey, [weakAlertController.textFields.firstObject text]]); - break; - case RCTAlertViewStyleLoginAndPasswordInput: { - NSDictionary *loginCredentials = @{ - @"login": [weakAlertController.textFields.firstObject text], - @"password": [weakAlertController.textFields.lastObject text] - }; - callback(@[buttonKey, loginCredentials]); - break; - } - case RCTAlertViewStyleDefault: - callback(@[buttonKey]); - break; - } - }]]; - } - - if (!_alertControllers) { - _alertControllers = [NSHashTable weakObjectsHashTable]; - } - [_alertControllers addObject:alertController]; - - dispatch_async(dispatch_get_main_queue(), ^{ - [presentingController presentViewController:alertController animated:YES completion:nil]; - }); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAppState.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAppState.h deleted file mode 100644 index 9f8f9987..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAppState.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTAppState : RCTEventEmitter - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAppState.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAppState.m deleted file mode 100644 index ce8c12c0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAppState.m +++ /dev/null @@ -1,129 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAppState.h" - -#import "RCTAssert.h" -#import "RCTBridge.h" -#import "RCTEventDispatcher.h" -#import "RCTUtils.h" - -static NSString *RCTCurrentAppBackgroundState() -{ - static NSDictionary *states; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - states = @{ - @(UIApplicationStateActive): @"active", - @(UIApplicationStateBackground): @"background" - }; - }); - - if (RCTRunningInAppExtension()) { - return @"extension"; - } - - return states[@(RCTSharedApplication().applicationState)] ?: @"unknown"; -} - -@implementation RCTAppState -{ - NSString *_lastKnownState; -} - -RCT_EXPORT_MODULE() - -+ (BOOL)requiresMainQueueSetup -{ - return YES; -} - -- (dispatch_queue_t)methodQueue -{ - return dispatch_get_main_queue(); -} - -- (NSDictionary *)constantsToExport -{ - return [self getConstants]; -} - -- (NSDictionary *)getConstants -{ - return @{@"initialAppState": RCTCurrentAppBackgroundState()}; -} - -#pragma mark - Lifecycle - -- (NSArray *)supportedEvents -{ - return @[@"appStateDidChange", @"memoryWarning"]; -} - -- (void)startObserving -{ - for (NSString *name in @[UIApplicationDidBecomeActiveNotification, - UIApplicationDidEnterBackgroundNotification, - UIApplicationDidFinishLaunchingNotification, - UIApplicationWillResignActiveNotification, - UIApplicationWillEnterForegroundNotification]) { - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleAppStateDidChange:) - name:name - object:nil]; - } - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleMemoryWarning) - name:UIApplicationDidReceiveMemoryWarningNotification - object:nil]; -} - -- (void)stopObserving -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -#pragma mark - App Notification Methods - -- (void)handleMemoryWarning -{ - [self sendEventWithName:@"memoryWarning" body:nil]; -} - -- (void)handleAppStateDidChange:(NSNotification *)notification -{ - NSString *newState; - - if ([notification.name isEqualToString:UIApplicationWillResignActiveNotification]) { - newState = @"inactive"; - } else if ([notification.name isEqualToString:UIApplicationWillEnterForegroundNotification]) { - newState = @"background"; - } else { - newState = RCTCurrentAppBackgroundState(); - } - - if (![newState isEqualToString:_lastKnownState]) { - _lastKnownState = newState; - [self sendEventWithName:@"appStateDidChange" - body:@{@"app_state": _lastKnownState}]; - } -} - -#pragma mark - Public API - -/** - * Get the current background/foreground state of the app - */ -RCT_EXPORT_METHOD(getCurrentAppState:(RCTResponseSenderBlock)callback - error:(__unused RCTResponseSenderBlock)error) -{ - callback(@[@{@"app_state": RCTCurrentAppBackgroundState()}]); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAsyncLocalStorage.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAsyncLocalStorage.h deleted file mode 100644 index f079484a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAsyncLocalStorage.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -/** - * A simple, asynchronous, persistent, key-value storage system designed as a - * backend to the AsyncStorage JS module, which is modeled after LocalStorage. - * - * Current implementation stores small values in serialized dictionary and - * larger values in separate files. Since we use a serial file queue - * `RKFileQueue`, reading/writing from multiple threads should be perceived as - * being atomic, unless someone bypasses the `RCTAsyncLocalStorage` API. - * - * Keys and values must always be strings or an error is returned. - */ -@interface RCTAsyncLocalStorage : NSObject - -@property (nonatomic, assign) BOOL clearOnInvalidate; - -@property (nonatomic, readonly, getter=isValid) BOOL valid; - -// Clear the RCTAsyncLocalStorage data from native code -- (void)clearAllData; - -// For clearing data when the bridge may not exist, e.g. when logging out. -+ (void)clearAllData; - -// Grab data from the cache. ResponseBlock result array will have an error at position 0, and an array of arrays at position 1. -- (void)multiGet:(NSArray *)keys callback:(RCTResponseSenderBlock)callback; - -// Add multiple key value pairs to the cache. -- (void)multiSet:(NSArray *> *)kvPairs callback:(RCTResponseSenderBlock)callback; - - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAsyncLocalStorage.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAsyncLocalStorage.m deleted file mode 100644 index c77fac40..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTAsyncLocalStorage.m +++ /dev/null @@ -1,458 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAsyncLocalStorage.h" - -#import - -#import -#import - -#import "RCTConvert.h" -#import "RCTLog.h" -#import "RCTUtils.h" - -static NSString *const RCTStorageDirectory = @"RCTAsyncLocalStorage_V1"; -static NSString *const RCTManifestFileName = @"manifest.json"; -static const NSUInteger RCTInlineValueThreshold = 1024; - -#pragma mark - Static helper functions - -static NSDictionary *RCTErrorForKey(NSString *key) -{ - if (![key isKindOfClass:[NSString class]]) { - return RCTMakeAndLogError(@"Invalid key - must be a string. Key: ", key, @{@"key": key}); - } else if (key.length < 1) { - return RCTMakeAndLogError(@"Invalid key - must be at least one character. Key: ", key, @{@"key": key}); - } else { - return nil; - } -} - -static void RCTAppendError(NSDictionary *error, NSMutableArray **errors) -{ - if (error && errors) { - if (!*errors) { - *errors = [NSMutableArray new]; - } - [*errors addObject:error]; - } -} - -static NSString *RCTReadFile(NSString *filePath, NSString *key, NSDictionary **errorOut) -{ - if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) { - NSError *error; - NSStringEncoding encoding; - NSString *entryString = [NSString stringWithContentsOfFile:filePath usedEncoding:&encoding error:&error]; - NSDictionary *extraData = @{@"key": RCTNullIfNil(key)}; - - if (error) { - if (errorOut) *errorOut = RCTMakeError(@"Failed to read storage file.", error, extraData); - return nil; - } - - if (encoding != NSUTF8StringEncoding) { - if (errorOut) *errorOut = RCTMakeError(@"Incorrect encoding of storage file: ", @(encoding), extraData); - return nil; - } - return entryString; - } - - return nil; -} - -static NSString *RCTGetStorageDirectory() -{ - static NSString *storageDirectory = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ -#if TARGET_OS_TV - storageDirectory = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject; -#else - storageDirectory = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject; -#endif - storageDirectory = [storageDirectory stringByAppendingPathComponent:RCTStorageDirectory]; - }); - return storageDirectory; -} - -static NSString *RCTGetManifestFilePath() -{ - static NSString *manifestFilePath = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - manifestFilePath = [RCTGetStorageDirectory() stringByAppendingPathComponent:RCTManifestFileName]; - }); - return manifestFilePath; -} - -// Only merges objects - all other types are just clobbered (including arrays) -static BOOL RCTMergeRecursive(NSMutableDictionary *destination, NSDictionary *source) -{ - BOOL modified = NO; - for (NSString *key in source) { - id sourceValue = source[key]; - id destinationValue = destination[key]; - if ([sourceValue isKindOfClass:[NSDictionary class]]) { - if ([destinationValue isKindOfClass:[NSDictionary class]]) { - if ([destinationValue classForCoder] != [NSMutableDictionary class]) { - destinationValue = [destinationValue mutableCopy]; - } - if (RCTMergeRecursive(destinationValue, sourceValue)) { - destination[key] = destinationValue; - modified = YES; - } - } else { - destination[key] = [sourceValue copy]; - modified = YES; - } - } else if (![source isEqual:destinationValue]) { - destination[key] = [sourceValue copy]; - modified = YES; - } - } - return modified; -} - -static dispatch_queue_t RCTGetMethodQueue() -{ - // We want all instances to share the same queue since they will be reading/writing the same files. - static dispatch_queue_t queue; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - queue = dispatch_queue_create("com.facebook.react.AsyncLocalStorageQueue", DISPATCH_QUEUE_SERIAL); - }); - return queue; -} - -static NSCache *RCTGetCache() -{ - // We want all instances to share the same cache since they will be reading/writing the same files. - static NSCache *cache; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - cache = [NSCache new]; - cache.totalCostLimit = 2 * 1024 * 1024; // 2MB - - // Clear cache in the event of a memory warning - [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidReceiveMemoryWarningNotification object:nil queue:nil usingBlock:^(__unused NSNotification *note) { - [cache removeAllObjects]; - }]; - }); - return cache; -} - -static BOOL RCTHasCreatedStorageDirectory = NO; -static NSDictionary *RCTDeleteStorageDirectory() -{ - NSError *error; - [[NSFileManager defaultManager] removeItemAtPath:RCTGetStorageDirectory() error:&error]; - RCTHasCreatedStorageDirectory = NO; - return error ? RCTMakeError(@"Failed to delete storage directory.", error, nil) : nil; -} - -#pragma mark - RCTAsyncLocalStorage - -@implementation RCTAsyncLocalStorage -{ - BOOL _haveSetup; - // The manifest is a dictionary of all keys with small values inlined. Null values indicate values that are stored - // in separate files (as opposed to nil values which don't exist). The manifest is read off disk at startup, and - // written to disk after all mutations. - NSMutableDictionary *_manifest; -} - -RCT_EXPORT_MODULE() - -- (dispatch_queue_t)methodQueue -{ - return RCTGetMethodQueue(); -} - -- (void)clearAllData -{ - dispatch_async(RCTGetMethodQueue(), ^{ - [self->_manifest removeAllObjects]; - [RCTGetCache() removeAllObjects]; - RCTDeleteStorageDirectory(); - }); -} - -+ (void)clearAllData -{ - dispatch_async(RCTGetMethodQueue(), ^{ - [RCTGetCache() removeAllObjects]; - RCTDeleteStorageDirectory(); - }); -} - -- (void)invalidate -{ - if (_clearOnInvalidate) { - [RCTGetCache() removeAllObjects]; - RCTDeleteStorageDirectory(); - } - _clearOnInvalidate = NO; - [_manifest removeAllObjects]; - _haveSetup = NO; -} - -- (BOOL)isValid -{ - return _haveSetup; -} - -- (void)dealloc -{ - [self invalidate]; -} - -- (NSString *)_filePathForKey:(NSString *)key -{ - NSString *safeFileName = RCTMD5Hash(key); - return [RCTGetStorageDirectory() stringByAppendingPathComponent:safeFileName]; -} - -- (NSDictionary *)_ensureSetup -{ - RCTAssertThread(RCTGetMethodQueue(), @"Must be executed on storage thread"); - -#if TARGET_OS_TV - RCTLogWarn(@"Persistent storage is not supported on tvOS, your data may be removed at any point."); -#endif - - NSError *error = nil; - if (!RCTHasCreatedStorageDirectory) { - [[NSFileManager defaultManager] createDirectoryAtPath:RCTGetStorageDirectory() - withIntermediateDirectories:YES - attributes:nil - error:&error]; - if (error) { - return RCTMakeError(@"Failed to create storage directory.", error, nil); - } - RCTHasCreatedStorageDirectory = YES; - } - if (!_haveSetup) { - NSDictionary *errorOut; - NSString *serialized = RCTReadFile(RCTGetManifestFilePath(), RCTManifestFileName, &errorOut); - _manifest = serialized ? RCTJSONParseMutable(serialized, &error) : [NSMutableDictionary new]; - if (error) { - RCTLogWarn(@"Failed to parse manifest - creating new one.\n\n%@", error); - _manifest = [NSMutableDictionary new]; - } - _haveSetup = YES; - } - return nil; -} - -- (NSDictionary *)_writeManifest:(NSMutableArray **)errors -{ - NSError *error; - NSString *serialized = RCTJSONStringify(_manifest, &error); - [serialized writeToFile:RCTGetManifestFilePath() atomically:YES encoding:NSUTF8StringEncoding error:&error]; - NSDictionary *errorOut; - if (error) { - errorOut = RCTMakeError(@"Failed to write manifest file.", error, nil); - RCTAppendError(errorOut, errors); - } - return errorOut; -} - -- (NSDictionary *)_appendItemForKey:(NSString *)key - toArray:(NSMutableArray *> *)result -{ - NSDictionary *errorOut = RCTErrorForKey(key); - if (errorOut) { - return errorOut; - } - NSString *value = [self _getValueForKey:key errorOut:&errorOut]; - [result addObject:@[key, RCTNullIfNil(value)]]; // Insert null if missing or failure. - return errorOut; -} - -- (NSString *)_getValueForKey:(NSString *)key errorOut:(NSDictionary **)errorOut -{ - NSString *value = _manifest[key]; // nil means missing, null means there may be a data file, else: NSString - if (value == (id)kCFNull) { - value = [RCTGetCache() objectForKey:key]; - if (!value) { - NSString *filePath = [self _filePathForKey:key]; - value = RCTReadFile(filePath, key, errorOut); - if (value) { - [RCTGetCache() setObject:value forKey:key cost:value.length]; - } else { - // file does not exist after all, so remove from manifest (no need to save - // manifest immediately though, as cost of checking again next time is negligible) - [_manifest removeObjectForKey:key]; - } - } - } - return value; -} - -- (NSDictionary *)_writeEntry:(NSArray *)entry changedManifest:(BOOL *)changedManifest -{ - if (entry.count != 2) { - return RCTMakeAndLogError(@"Entries must be arrays of the form [key: string, value: string], got: ", entry, nil); - } - NSString *key = entry[0]; - NSDictionary *errorOut = RCTErrorForKey(key); - if (errorOut) { - return errorOut; - } - NSString *value = entry[1]; - NSString *filePath = [self _filePathForKey:key]; - NSError *error; - if (value.length <= RCTInlineValueThreshold) { - if (_manifest[key] == (id)kCFNull) { - // If the value already existed but wasn't inlined, remove the old file. - [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil]; - [RCTGetCache() removeObjectForKey:key]; - } - *changedManifest = YES; - _manifest[key] = value; - return nil; - } - [value writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:&error]; - [RCTGetCache() setObject:value forKey:key cost:value.length]; - if (error) { - errorOut = RCTMakeError(@"Failed to write value.", error, @{@"key": key}); - } else if (_manifest[key] != (id)kCFNull) { - *changedManifest = YES; - _manifest[key] = (id)kCFNull; - } - return errorOut; -} - -#pragma mark - Exported JS Functions - -RCT_EXPORT_METHOD(multiGet:(NSArray *)keys - callback:(RCTResponseSenderBlock)callback) -{ - NSDictionary *errorOut = [self _ensureSetup]; - if (errorOut) { - callback(@[@[errorOut], (id)kCFNull]); - return; - } - NSMutableArray *errors; - NSMutableArray *> *result = [[NSMutableArray alloc] initWithCapacity:keys.count]; - for (NSString *key in keys) { - id keyError; - id value = [self _getValueForKey:key errorOut:&keyError]; - [result addObject:@[key, RCTNullIfNil(value)]]; - RCTAppendError(keyError, &errors); - } - callback(@[RCTNullIfNil(errors), result]); -} - -RCT_EXPORT_METHOD(multiSet:(NSArray *> *)kvPairs - callback:(RCTResponseSenderBlock)callback) -{ - NSDictionary *errorOut = [self _ensureSetup]; - if (errorOut) { - callback(@[@[errorOut]]); - return; - } - BOOL changedManifest = NO; - NSMutableArray *errors; - for (NSArray *entry in kvPairs) { - NSDictionary *keyError = [self _writeEntry:entry changedManifest:&changedManifest]; - RCTAppendError(keyError, &errors); - } - if (changedManifest) { - [self _writeManifest:&errors]; - } - callback(@[RCTNullIfNil(errors)]); -} - -RCT_EXPORT_METHOD(multiMerge:(NSArray *> *)kvPairs - callback:(RCTResponseSenderBlock)callback) -{ - NSDictionary *errorOut = [self _ensureSetup]; - if (errorOut) { - callback(@[@[errorOut]]); - return; - } - BOOL changedManifest = NO; - NSMutableArray *errors; - for (__strong NSArray *entry in kvPairs) { - NSDictionary *keyError; - NSString *value = [self _getValueForKey:entry[0] errorOut:&keyError]; - if (!keyError) { - if (value) { - NSError *jsonError; - NSMutableDictionary *mergedVal = RCTJSONParseMutable(value, &jsonError); - if (RCTMergeRecursive(mergedVal, RCTJSONParse(entry[1], &jsonError))) { - entry = @[entry[0], RCTNullIfNil(RCTJSONStringify(mergedVal, NULL))]; - } - if (jsonError) { - keyError = RCTJSErrorFromNSError(jsonError); - } - } - if (!keyError) { - keyError = [self _writeEntry:entry changedManifest:&changedManifest]; - } - } - RCTAppendError(keyError, &errors); - } - if (changedManifest) { - [self _writeManifest:&errors]; - } - callback(@[RCTNullIfNil(errors)]); -} - -RCT_EXPORT_METHOD(multiRemove:(NSArray *)keys - callback:(RCTResponseSenderBlock)callback) -{ - NSDictionary *errorOut = [self _ensureSetup]; - if (errorOut) { - callback(@[@[errorOut]]); - return; - } - NSMutableArray *errors; - BOOL changedManifest = NO; - for (NSString *key in keys) { - NSDictionary *keyError = RCTErrorForKey(key); - if (!keyError) { - if (_manifest[key] == (id)kCFNull) { - NSString *filePath = [self _filePathForKey:key]; - [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil]; - [RCTGetCache() removeObjectForKey:key]; - } - if (_manifest[key]) { - changedManifest = YES; - [_manifest removeObjectForKey:key]; - } - } - RCTAppendError(keyError, &errors); - } - if (changedManifest) { - [self _writeManifest:&errors]; - } - callback(@[RCTNullIfNil(errors)]); -} - -RCT_EXPORT_METHOD(clear:(RCTResponseSenderBlock)callback) -{ - [_manifest removeAllObjects]; - [RCTGetCache() removeAllObjects]; - NSDictionary *error = RCTDeleteStorageDirectory(); - callback(@[RCTNullIfNil(error)]); -} - -RCT_EXPORT_METHOD(getAllKeys:(RCTResponseSenderBlock)callback) -{ - NSDictionary *errorOut = [self _ensureSetup]; - if (errorOut) { - callback(@[errorOut, (id)kCFNull]); - } else { - callback(@[(id)kCFNull, _manifest.allKeys]); - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTClipboard.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTClipboard.h deleted file mode 100644 index 49374d0a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTClipboard.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTClipboard : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTClipboard.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTClipboard.m deleted file mode 100644 index 47805acd..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTClipboard.m +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTClipboard.h" - -#import - -@implementation RCTClipboard - -RCT_EXPORT_MODULE() - -- (dispatch_queue_t)methodQueue -{ - return dispatch_get_main_queue(); -} - - -RCT_EXPORT_METHOD(setString:(NSString *)content) -{ - UIPasteboard *clipboard = [UIPasteboard generalPasteboard]; - clipboard.string = (content ? : @""); -} - -RCT_EXPORT_METHOD(getString:(RCTPromiseResolveBlock)resolve - rejecter:(__unused RCTPromiseRejectBlock)reject) -{ - UIPasteboard *clipboard = [UIPasteboard generalPasteboard]; - resolve((clipboard.string ? : @"")); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTDevSettings.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTDevSettings.h deleted file mode 100644 index 24c14a4c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTDevSettings.h +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -@protocol RCTPackagerClientMethod; - -/** - * An abstraction for a key-value store to manage RCTDevSettings behavior. - * The default implementation persists settings using NSUserDefaults. - */ -@protocol RCTDevSettingsDataSource - -/** - * Updates the setting with the given key to the given value. - * How the data source's state changes depends on the implementation. - */ -- (void)updateSettingWithValue:(id)value forKey:(NSString *)key; - -/** - * Returns the value for the setting with the given key. - */ -- (id)settingForKey:(NSString *)key; - -@end - -@interface RCTDevSettings : NSObject - -- (instancetype)initWithDataSource:(id)dataSource; - -@property (nonatomic, readonly) BOOL isHotLoadingAvailable; -@property (nonatomic, readonly) BOOL isLiveReloadAvailable; -@property (nonatomic, readonly) BOOL isRemoteDebuggingAvailable; -@property (nonatomic, readonly) BOOL isNuclideDebuggingAvailable; -@property (nonatomic, readonly) BOOL isJSCSamplingProfilerAvailable; - -/** - * Whether the bridge is connected to a remote JS executor. - */ -@property (nonatomic, assign) BOOL isDebuggingRemotely; - -/* - * Whether shaking will show RCTDevMenu. The menu is enabled by default if RCT_DEV=1, but - * you may wish to disable it so that you can provide your own shake handler. - */ -@property (nonatomic, assign) BOOL isShakeToShowDevMenuEnabled; - -/** - * Whether performance profiling is enabled. - */ -@property (nonatomic, assign, setter=setProfilingEnabled:) BOOL isProfilingEnabled; - -/** - * Whether automatic polling for JS code changes is enabled. Only applicable when - * running the app from a server. - */ -@property (nonatomic, assign, setter=setLiveReloadEnabled:) BOOL isLiveReloadEnabled; - -/** - * Whether hot loading is enabled. - */ -@property (nonatomic, assign, setter=setHotLoadingEnabled:) BOOL isHotLoadingEnabled; - -/** - * Toggle the element inspector. - */ -- (void)toggleElementInspector; - -/** - * Enables starting of profiling sampler on launch - */ -@property (nonatomic, assign) BOOL startSamplingProfilerOnLaunch; - -/** - * Whether the element inspector is visible. - */ -@property (nonatomic, readonly) BOOL isElementInspectorShown; - -/** - * Whether the performance monitor is visible. - */ -@property (nonatomic, assign) BOOL isPerfMonitorShown; - -#if RCT_DEV -- (void)addHandler:(id)handler forPackagerMethod:(NSString *)name __deprecated_msg("Use RCTPackagerConnection directly instead"); -#endif - -@end - -@interface RCTBridge (RCTDevSettings) - -@property (nonatomic, readonly) RCTDevSettings *devSettings; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTDevSettings.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTDevSettings.mm deleted file mode 100644 index 70454aeb..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTDevSettings.mm +++ /dev/null @@ -1,501 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTDevSettings.h" - -#import - -#import "RCTBridge+Private.h" -#import "RCTBridgeModule.h" -#import "RCTEventDispatcher.h" -#import "RCTLog.h" -#import "RCTProfile.h" -#import "RCTUtils.h" - -static NSString *const kRCTDevSettingProfilingEnabled = @"profilingEnabled"; -static NSString *const kRCTDevSettingHotLoadingEnabled = @"hotLoadingEnabled"; -static NSString *const kRCTDevSettingLiveReloadEnabled = @"liveReloadEnabled"; -static NSString *const kRCTDevSettingIsInspectorShown = @"showInspector"; -static NSString *const kRCTDevSettingIsDebuggingRemotely = @"isDebuggingRemotely"; -static NSString *const kRCTDevSettingExecutorOverrideClass = @"executor-override"; -static NSString *const kRCTDevSettingShakeToShowDevMenu = @"shakeToShow"; -static NSString *const kRCTDevSettingIsPerfMonitorShown = @"RCTPerfMonitorKey"; - -static NSString *const kRCTDevSettingsUserDefaultsKey = @"RCTDevMenu"; - -#if ENABLE_PACKAGER_CONNECTION -#import "RCTPackagerClient.h" -#import "RCTPackagerConnection.h" -#endif - -#if RCT_ENABLE_INSPECTOR -#import "RCTInspectorDevServerHelper.h" -#endif - -#if RCT_DEV - -@interface RCTDevSettingsUserDefaultsDataSource : NSObject - -@end - -@implementation RCTDevSettingsUserDefaultsDataSource { - NSMutableDictionary *_settings; - NSUserDefaults *_userDefaults; -} - -- (instancetype)init -{ - return [self initWithDefaultValues:nil]; -} - -- (instancetype)initWithDefaultValues:(NSDictionary *)defaultValues -{ - if (self = [super init]) { - _userDefaults = [NSUserDefaults standardUserDefaults]; - if (defaultValues) { - [self _reloadWithDefaults:defaultValues]; - } - } - return self; -} - -- (void)updateSettingWithValue:(id)value forKey:(NSString *)key -{ - RCTAssert((key != nil), @"%@", [NSString stringWithFormat:@"%@: Tried to update nil key", [self class]]); - - id currentValue = [self settingForKey:key]; - if (currentValue == value || [currentValue isEqual:value]) { - return; - } - if (value) { - _settings[key] = value; - } else { - [_settings removeObjectForKey:key]; - } - [_userDefaults setObject:_settings forKey:kRCTDevSettingsUserDefaultsKey]; -} - -- (id)settingForKey:(NSString *)key -{ - return _settings[key]; -} - -- (void)_reloadWithDefaults:(NSDictionary *)defaultValues -{ - NSDictionary *existingSettings = [_userDefaults objectForKey:kRCTDevSettingsUserDefaultsKey]; - _settings = existingSettings ? [existingSettings mutableCopy] : [NSMutableDictionary dictionary]; - for (NSString *key in [defaultValues keyEnumerator]) { - if (!_settings[key]) { - _settings[key] = defaultValues[key]; - } - } - [_userDefaults setObject:_settings forKey:kRCTDevSettingsUserDefaultsKey]; -} - -@end - -@interface RCTDevSettings () -{ - NSURLSessionDataTask *_liveReloadUpdateTask; - NSURL *_liveReloadURL; - BOOL _isJSLoaded; -#if ENABLE_PACKAGER_CONNECTION - RCTHandlerToken _reloadToken; -#endif -} - -@property (nonatomic, strong) Class executorClass; -@property (nonatomic, readwrite, strong) id dataSource; - -@end - -@implementation RCTDevSettings - -@synthesize bridge = _bridge; - -RCT_EXPORT_MODULE() - -+ (BOOL)requiresMainQueueSetup -{ - return YES; // RCT_DEV-only -} - -- (instancetype)init -{ - // default behavior is to use NSUserDefaults - NSDictionary *defaultValues = @{ - kRCTDevSettingShakeToShowDevMenu: @YES, - }; - RCTDevSettingsUserDefaultsDataSource *dataSource = [[RCTDevSettingsUserDefaultsDataSource alloc] initWithDefaultValues:defaultValues]; - return [self initWithDataSource:dataSource]; -} - -- (instancetype)initWithDataSource:(id)dataSource -{ - if (self = [super init]) { - _dataSource = dataSource; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(jsLoaded:) - name:RCTJavaScriptDidLoadNotification - object:nil]; - - // Delay setup until after Bridge init - dispatch_async(dispatch_get_main_queue(), ^{ - [self _synchronizeAllSettings]; - }); - } - return self; -} - -- (void)setBridge:(RCTBridge *)bridge -{ - RCTAssert(_bridge == nil, @"RCTDevSettings module should not be reused"); - _bridge = bridge; - -#if ENABLE_PACKAGER_CONNECTION - RCTBridge *__weak weakBridge = bridge; - _reloadToken = - [[RCTPackagerConnection sharedPackagerConnection] - addNotificationHandler:^(id params) { - if (params != (id)kCFNull && [params[@"debug"] boolValue]) { - weakBridge.executorClass = objc_lookUpClass("RCTWebSocketExecutor"); - } - [weakBridge reload]; - } - queue:dispatch_get_main_queue() - forMethod:@"reload"]; -#endif - -#if RCT_ENABLE_INSPECTOR - // we need this dispatch back to the main thread because even though this - // is executed on the main thread, at this point the bridge is not yet - // finished with its initialisation. But it does finish by the time it - // relinquishes control of the main thread, so only queue on the JS thread - // after the current main thread operation is done. - dispatch_async(dispatch_get_main_queue(), ^{ - [bridge dispatchBlock:^{ - [RCTInspectorDevServerHelper connectWithBundleURL:bridge.bundleURL]; - } queue:RCTJSThread]; - }); -#endif -} - -- (dispatch_queue_t)methodQueue -{ - return dispatch_get_main_queue(); -} - -- (void)invalidate -{ - [_liveReloadUpdateTask cancel]; -#if ENABLE_PACKAGER_CONNECTION - [[RCTPackagerConnection sharedPackagerConnection] removeHandler:_reloadToken]; -#endif - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (void)_updateSettingWithValue:(id)value forKey:(NSString *)key -{ - [_dataSource updateSettingWithValue:value forKey:key]; -} - -- (id)settingForKey:(NSString *)key -{ - return [_dataSource settingForKey:key]; -} - -- (BOOL)isNuclideDebuggingAvailable -{ -#if RCT_ENABLE_INSPECTOR - return _bridge.isInspectable; -#else - return false; -#endif // RCT_ENABLE_INSPECTOR -} - -- (BOOL)isRemoteDebuggingAvailable -{ - Class jsDebuggingExecutorClass = objc_lookUpClass("RCTWebSocketExecutor"); - return (jsDebuggingExecutorClass != nil); -} - -- (BOOL)isHotLoadingAvailable -{ - return _bridge.bundleURL && !_bridge.bundleURL.fileURL; // Only works when running from server -} - -- (BOOL)isLiveReloadAvailable -{ - return (_liveReloadURL != nil); -} - -RCT_EXPORT_METHOD(reload) -{ - [_bridge reload]; -} - -RCT_EXPORT_METHOD(setIsShakeToShowDevMenuEnabled:(BOOL)enabled) -{ - [self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingShakeToShowDevMenu]; -} - -- (BOOL)isShakeToShowDevMenuEnabled -{ - return [[self settingForKey:kRCTDevSettingShakeToShowDevMenu] boolValue]; -} - -RCT_EXPORT_METHOD(setIsDebuggingRemotely:(BOOL)enabled) -{ - [self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingIsDebuggingRemotely]; - [self _remoteDebugSettingDidChange]; -} - -- (BOOL)isDebuggingRemotely -{ - return [[self settingForKey:kRCTDevSettingIsDebuggingRemotely] boolValue]; -} - -- (void)_remoteDebugSettingDidChange -{ - // This value is passed as a command-line argument, so fall back to reading from NSUserDefaults directly - NSString *executorOverride = [[NSUserDefaults standardUserDefaults] stringForKey:kRCTDevSettingExecutorOverrideClass]; - Class executorOverrideClass = executorOverride ? NSClassFromString(executorOverride) : nil; - if (executorOverrideClass) { - self.executorClass = executorOverrideClass; - } else { - BOOL enabled = self.isRemoteDebuggingAvailable && self.isDebuggingRemotely; - self.executorClass = enabled ? objc_getClass("RCTWebSocketExecutor") : nil; - } -} - -RCT_EXPORT_METHOD(setProfilingEnabled:(BOOL)enabled) -{ - [self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingProfilingEnabled]; - [self _profilingSettingDidChange]; -} - -- (BOOL)isProfilingEnabled -{ - return [[self settingForKey:kRCTDevSettingProfilingEnabled] boolValue]; -} - -- (void)_profilingSettingDidChange -{ - BOOL enabled = self.isProfilingEnabled; - if (_liveReloadURL && enabled != RCTProfileIsProfiling()) { - if (enabled) { - [_bridge startProfiling]; - } else { - [_bridge stopProfiling:^(NSData *logData) { - RCTProfileSendResult(self->_bridge, @"systrace", logData); - }]; - } - } -} - -RCT_EXPORT_METHOD(setLiveReloadEnabled:(BOOL)enabled) -{ - [self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingLiveReloadEnabled]; - [self _liveReloadSettingDidChange]; -} - -- (BOOL)isLiveReloadEnabled -{ - return [[self settingForKey:kRCTDevSettingLiveReloadEnabled] boolValue]; -} - -- (void)_liveReloadSettingDidChange -{ - BOOL liveReloadEnabled = (self.isLiveReloadAvailable && self.isLiveReloadEnabled); - if (liveReloadEnabled) { - [self _pollForLiveReload]; - } else { - [_liveReloadUpdateTask cancel]; - _liveReloadUpdateTask = nil; - } -} - -RCT_EXPORT_METHOD(setHotLoadingEnabled:(BOOL)enabled) -{ - if (self.isHotLoadingEnabled != enabled) { - [self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingHotLoadingEnabled]; - [_bridge reload]; - } -} - -- (BOOL)isHotLoadingEnabled -{ - return [[self settingForKey:kRCTDevSettingHotLoadingEnabled] boolValue]; -} - -RCT_EXPORT_METHOD(toggleElementInspector) -{ - BOOL value = [[self settingForKey:kRCTDevSettingIsInspectorShown] boolValue]; - [self _updateSettingWithValue:@(!value) forKey:kRCTDevSettingIsInspectorShown]; - - if (_isJSLoaded) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [self.bridge.eventDispatcher sendDeviceEventWithName:@"toggleElementInspector" body:nil]; -#pragma clang diagnostic pop - } -} - -- (BOOL)isElementInspectorShown -{ - return [[self settingForKey:kRCTDevSettingIsInspectorShown] boolValue]; -} - -- (void)setIsPerfMonitorShown:(BOOL)isPerfMonitorShown -{ - [self _updateSettingWithValue:@(isPerfMonitorShown) forKey:kRCTDevSettingIsPerfMonitorShown]; -} - -- (BOOL)isPerfMonitorShown -{ - return [[self settingForKey:kRCTDevSettingIsPerfMonitorShown] boolValue]; -} - -- (void)setExecutorClass:(Class)executorClass -{ - _executorClass = executorClass; - if (_bridge.executorClass != executorClass) { - - // TODO (6929129): we can remove this special case test once we have better - // support for custom executors in the dev menu. But right now this is - // needed to prevent overriding a custom executor with the default if a - // custom executor has been set directly on the bridge - if (executorClass == Nil && - _bridge.executorClass != objc_lookUpClass("RCTWebSocketExecutor")) { - return; - } - - _bridge.executorClass = executorClass; - [_bridge reload]; - } -} - -#if RCT_DEV - -- (void)addHandler:(id)handler forPackagerMethod:(NSString *)name -{ -#if ENABLE_PACKAGER_CONNECTION - [[RCTPackagerConnection sharedPackagerConnection] addHandler:handler forMethod:name]; -#endif -} - -#endif - -#pragma mark - Internal - -/** - * Query the data source for all possible settings and make sure we're doing the right - * thing for the state of each setting. - */ -- (void)_synchronizeAllSettings -{ - [self _liveReloadSettingDidChange]; - [self _remoteDebugSettingDidChange]; - [self _profilingSettingDidChange]; -} - -- (void)_pollForLiveReload -{ - if (!_isJSLoaded || ![[self settingForKey:kRCTDevSettingLiveReloadEnabled] boolValue] || !_liveReloadURL) { - return; - } - - if (_liveReloadUpdateTask) { - return; - } - - __weak RCTDevSettings *weakSelf = self; - _liveReloadUpdateTask = [[NSURLSession sharedSession] dataTaskWithURL:_liveReloadURL completionHandler: - ^(__unused NSData *data, NSURLResponse *response, NSError *error) { - - dispatch_async(dispatch_get_main_queue(), ^{ - __strong RCTDevSettings *strongSelf = weakSelf; - if (strongSelf && [[strongSelf settingForKey:kRCTDevSettingLiveReloadEnabled] boolValue]) { - NSHTTPURLResponse *HTTPResponse = (NSHTTPURLResponse *)response; - if (!error && HTTPResponse.statusCode == 205) { - [strongSelf reload]; - } else { - if (error.code != NSURLErrorCancelled) { - strongSelf->_liveReloadUpdateTask = nil; - [strongSelf _pollForLiveReload]; - } - } - } - }); - - }]; - - [_liveReloadUpdateTask resume]; -} - -- (void)jsLoaded:(NSNotification *)notification -{ - if (notification.userInfo[@"bridge"] != _bridge) { - return; - } - - _isJSLoaded = YES; - - // Check if live reloading is available - NSURL *scriptURL = _bridge.bundleURL; - if (![scriptURL isFileURL]) { - // Live reloading is disabled when running from bundled JS file - _liveReloadURL = [[NSURL alloc] initWithString:@"/onchange" relativeToURL:scriptURL]; - } else { - _liveReloadURL = nil; - } - - dispatch_async(dispatch_get_main_queue(), ^{ - // update state again after the bridge has finished loading - [self _synchronizeAllSettings]; - - // Inspector can only be shown after JS has loaded - if ([self isElementInspectorShown]) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [self.bridge.eventDispatcher sendDeviceEventWithName:@"toggleElementInspector" body:nil]; -#pragma clang diagnostic pop - } - }); -} - -@end - -#else // #if RCT_DEV - -@implementation RCTDevSettings - -- (instancetype)initWithDataSource:(id)dataSource { return [super init]; } -- (BOOL)isHotLoadingAvailable { return NO; } -- (BOOL)isLiveReloadAvailable { return NO; } -- (BOOL)isRemoteDebuggingAvailable { return NO; } -- (id)settingForKey:(NSString *)key { return nil; } -- (void)reload {} -- (void)toggleElementInspector {} - -@end - -#endif - -@implementation RCTBridge (RCTDevSettings) - -- (RCTDevSettings *)devSettings -{ -#if RCT_DEV - return [self moduleForClass:[RCTDevSettings class]]; -#else - return nil; -#endif -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTDeviceInfo.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTDeviceInfo.h deleted file mode 100644 index e245c8ed..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTDeviceInfo.h +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -@interface RCTDeviceInfo : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTDeviceInfo.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTDeviceInfo.m deleted file mode 100644 index 8feb87f2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTDeviceInfo.m +++ /dev/null @@ -1,169 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTDeviceInfo.h" - -#import "RCTAccessibilityManager.h" -#import "RCTAssert.h" -#import "RCTEventDispatcher.h" -#import "RCTUIUtils.h" -#import "RCTUtils.h" - -@implementation RCTDeviceInfo { -#if !TARGET_OS_TV - UIInterfaceOrientation _currentInterfaceOrientation; -#endif -} - -@synthesize bridge = _bridge; - -RCT_EXPORT_MODULE() - -+ (BOOL)requiresMainQueueSetup -{ - return YES; -} - -- (dispatch_queue_t)methodQueue -{ - return dispatch_get_main_queue(); -} - -- (void)setBridge:(RCTBridge *)bridge -{ - _bridge = bridge; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(didReceiveNewContentSizeMultiplier) - name:RCTAccessibilityManagerDidUpdateMultiplierNotification - object:_bridge.accessibilityManager]; -#if !TARGET_OS_TV - _currentInterfaceOrientation = [RCTSharedApplication() statusBarOrientation]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(interfaceOrientationDidChange) - name:UIApplicationDidChangeStatusBarOrientationNotification - object:nil]; -#endif -} - -static BOOL RCTIsIPhoneX() { - static BOOL isIPhoneX = NO; - static dispatch_once_t onceToken; - - dispatch_once(&onceToken, ^{ - RCTAssertMainQueue(); - - CGSize screenSize = [UIScreen mainScreen].nativeBounds.size; - CGSize iPhoneXScreenSize = CGSizeMake(1125, 2436); - CGSize iPhoneXMaxScreenSize = CGSizeMake(1242, 2688); - CGSize iPhoneXRScreenSize = CGSizeMake(828, 1792); - - isIPhoneX = - CGSizeEqualToSize(screenSize, iPhoneXScreenSize) || - CGSizeEqualToSize(screenSize, iPhoneXMaxScreenSize) || - CGSizeEqualToSize(screenSize, iPhoneXRScreenSize); - }); - - return isIPhoneX; -} - -static NSDictionary *RCTExportedDimensions(RCTBridge *bridge) -{ - RCTAssertMainQueue(); - - RCTDimensions dimensions = RCTGetDimensions(bridge.accessibilityManager.multiplier); - typeof (dimensions.window) window = dimensions.window; // Window and Screen are considered equal for iOS. - NSDictionary *dims = @{ - @"width": @(window.width), - @"height": @(window.height), - @"scale": @(window.scale), - @"fontScale": @(window.fontScale) - }; - return @{ - @"window": dims, - @"screen": dims - }; -} - -- (void)dealloc -{ - [NSNotificationCenter.defaultCenter removeObserver:self]; -} - -- (void)invalidate -{ - RCTExecuteOnMainQueue(^{ - self->_bridge = nil; - [[NSNotificationCenter defaultCenter] removeObserver:self]; - }); -} - -- (NSDictionary *)constantsToExport -{ - return [self getConstants]; -} - -- (NSDictionary *)getConstants -{ - return @{ - @"Dimensions": RCTExportedDimensions(_bridge), - // Note: - // This prop is deprecated and will be removed in a future release. - // Please use this only for a quick and temporary solution. - // Use instead. - @"isIPhoneX_deprecated": @(RCTIsIPhoneX()), - }; -} - -- (void)didReceiveNewContentSizeMultiplier -{ - RCTBridge *bridge = _bridge; - RCTExecuteOnMainQueue(^{ - // Report the event across the bridge. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [bridge.eventDispatcher sendDeviceEventWithName:@"didUpdateDimensions" - body:RCTExportedDimensions(bridge)]; -#pragma clang diagnostic pop - }); -} - -#if !TARGET_OS_TV - -- (void)interfaceOrientationDidChange -{ - __weak typeof(self) weakSelf = self; - RCTExecuteOnMainQueue(^{ - [weakSelf _interfaceOrientationDidChange]; - }); -} - - -- (void)_interfaceOrientationDidChange -{ - UIInterfaceOrientation nextOrientation = [RCTSharedApplication() statusBarOrientation]; - - // Update when we go from portrait to landscape, or landscape to portrait - if ((UIInterfaceOrientationIsPortrait(_currentInterfaceOrientation) && - !UIInterfaceOrientationIsPortrait(nextOrientation)) || - (UIInterfaceOrientationIsLandscape(_currentInterfaceOrientation) && - !UIInterfaceOrientationIsLandscape(nextOrientation))) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_bridge.eventDispatcher sendDeviceEventWithName:@"didUpdateDimensions" - body:RCTExportedDimensions(_bridge)]; -#pragma clang diagnostic pop - } - - _currentInterfaceOrientation = nextOrientation; -} - -#endif // TARGET_OS_TV - - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTEventEmitter.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTEventEmitter.h deleted file mode 100644 index fa04fc24..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTEventEmitter.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#if __has_include() -#import -#elif __has_include("RCTBridge.h") -#import "RCTBridge.h" -#else -#import "React/RCTBridge.h" -#endif - -/** - * RCTEventEmitter is an abstract base class to be used for modules that emit - * events to be observed by JS. - */ -@interface RCTEventEmitter : NSObject - -@property (nonatomic, weak) RCTBridge *bridge; - -/** - * Override this method to return an array of supported event names. Attempting - * to observe or send an event that isn't included in this list will result in - * an error. - */ -- (NSArray *)supportedEvents; - -/** - * Send an event that does not relate to a specific view, e.g. a navigation - * or data update notification. - */ -- (void)sendEventWithName:(NSString *)name body:(id)body; - -/** - * These methods will be called when the first observer is added and when the - * last observer is removed (or when dealloc is called), respectively. These - * should be overridden in your subclass in order to start/stop sending events. - */ -- (void)startObserving; -- (void)stopObserving; - -- (void)addListener:(NSString *)eventName; -- (void)removeListeners:(double)count; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTEventEmitter.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTEventEmitter.m deleted file mode 100644 index 01116f89..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTEventEmitter.m +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTEventEmitter.h" -#import "RCTAssert.h" -#import "RCTUtils.h" -#import "RCTLog.h" - -@implementation RCTEventEmitter -{ - NSInteger _listenerCount; -} - -+ (NSString *)moduleName -{ - return @""; -} - -+ (void)initialize -{ - if (self != [RCTEventEmitter class]) { - RCTAssert(RCTClassOverridesInstanceMethod(self, @selector(supportedEvents)), - @"You must override the `supportedEvents` method of %@", self); - } -} - -- (NSArray *)supportedEvents -{ - return nil; -} - -- (void)sendEventWithName:(NSString *)eventName body:(id)body -{ - RCTAssert(_bridge != nil, @"Error when sending event: %@ with body: %@. " - "Bridge is not set. This is probably because you've " - "explicitly synthesized the bridge in %@, even though it's inherited " - "from RCTEventEmitter.", eventName, body, [self class]); - - if (RCT_DEBUG && ![[self supportedEvents] containsObject:eventName]) { - RCTLogError(@"`%@` is not a supported event type for %@. Supported events are: `%@`", - eventName, [self class], [[self supportedEvents] componentsJoinedByString:@"`, `"]); - } - if (_listenerCount > 0) { - [_bridge enqueueJSCall:@"RCTDeviceEventEmitter" - method:@"emit" - args:body ? @[eventName, body] : @[eventName] - completion:NULL]; - } else { - RCTLogWarn(@"Sending `%@` with no listeners registered.", eventName); - } -} - -- (void)startObserving -{ - // Does nothing -} - -- (void)stopObserving -{ - // Does nothing -} - -- (void)dealloc -{ - if (_listenerCount > 0) { - [self stopObserving]; - } -} - -RCT_EXPORT_METHOD(addListener:(NSString *)eventName) -{ - if (RCT_DEBUG && ![[self supportedEvents] containsObject:eventName]) { - RCTLogError(@"`%@` is not a supported event type for %@. Supported events are: `%@`", - eventName, [self class], [[self supportedEvents] componentsJoinedByString:@"`, `"]); - } - _listenerCount++; - if (_listenerCount == 1) { - [self startObserving]; - } -} - -RCT_EXPORT_METHOD(removeListeners:(double)count) -{ - int currentCount = (int)count; - if (RCT_DEBUG && currentCount > _listenerCount) { - RCTLogError(@"Attempted to remove more %@ listeners than added", [self class]); - } - _listenerCount = MAX(_listenerCount - currentCount, 0); - if (_listenerCount == 0) { - [self stopObserving]; - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTExceptionsManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTExceptionsManager.h deleted file mode 100644 index 3574bc71..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTExceptionsManager.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@protocol RCTExceptionsManagerDelegate - -- (void)handleSoftJSExceptionWithMessage:(NSString *)message stack:(NSArray *)stack exceptionId:(NSNumber *)exceptionId; -- (void)handleFatalJSExceptionWithMessage:(NSString *)message stack:(NSArray *)stack exceptionId:(NSNumber *)exceptionId; - -@optional -- (void)updateJSExceptionWithMessage:(NSString *)message stack:(NSArray *)stack exceptionId:(NSNumber *)exceptionId; - -@end - -@interface RCTExceptionsManager : NSObject - -- (instancetype)initWithDelegate:(id)delegate; - -- (void)reportSoftException:(NSString *)message stack:(NSArray *)stack exceptionId:(nonnull NSNumber *)exceptionId; -- (void)reportFatalException:(NSString *)message stack:(NSArray *)stack exceptionId:(nonnull NSNumber *)exceptionId; - -@property (nonatomic, weak) id delegate; - -@property (nonatomic, assign) NSUInteger maxReloadAttempts; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTExceptionsManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTExceptionsManager.m deleted file mode 100644 index 5108f36e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTExceptionsManager.m +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTExceptionsManager.h" - -#import "RCTConvert.h" -#import "RCTDefines.h" -#import "RCTLog.h" -#import "RCTRedBox.h" -#import "RCTRootView.h" - -@implementation RCTExceptionsManager - -@synthesize bridge = _bridge; - -RCT_EXPORT_MODULE() - -- (instancetype)initWithDelegate:(id)delegate -{ - if ((self = [self init])) { - _delegate = delegate; - } - return self; -} - -RCT_EXPORT_METHOD(reportSoftException:(NSString *)message - stack:(NSArray *)stack - exceptionId:(nonnull NSNumber *)exceptionId) -{ - [_bridge.redBox showErrorMessage:message withStack:stack]; - - if (_delegate) { - [_delegate handleSoftJSExceptionWithMessage:message stack:stack exceptionId:exceptionId]; - } -} - -RCT_EXPORT_METHOD(reportFatalException:(NSString *)message - stack:(NSArray *)stack - exceptionId:(nonnull NSNumber *)exceptionId) -{ - [_bridge.redBox showErrorMessage:message withStack:stack]; - - if (_delegate) { - [_delegate handleFatalJSExceptionWithMessage:message stack:stack exceptionId:exceptionId]; - } - - static NSUInteger reloadRetries = 0; - if (!RCT_DEBUG && reloadRetries < _maxReloadAttempts) { - reloadRetries++; - [_bridge reload]; - } else { - NSString *description = [@"Unhandled JS Exception: " stringByAppendingString:message]; - NSDictionary *errorInfo = @{ NSLocalizedDescriptionKey: description, RCTJSStackTraceKey: stack }; - RCTFatal([NSError errorWithDomain:RCTErrorDomain code:0 userInfo:errorInfo]); - } -} - -RCT_EXPORT_METHOD(updateExceptionMessage:(NSString *)message - stack:(NSArray *)stack - exceptionId:(nonnull NSNumber *)exceptionId) -{ - [_bridge.redBox updateErrorMessage:message withStack:stack]; - - if (_delegate && [_delegate respondsToSelector:@selector(updateJSExceptionWithMessage:stack:exceptionId:)]) { - [_delegate updateJSExceptionWithMessage:message stack:stack exceptionId:exceptionId]; - } -} - -// Deprecated. Use reportFatalException directly instead. -RCT_EXPORT_METHOD(reportUnhandledException:(NSString *)message - stack:(NSArray *)stack) -{ - [self reportFatalException:message stack:stack exceptionId:@-1]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTI18nManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTI18nManager.h deleted file mode 100644 index b4afa995..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTI18nManager.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -/** - * @experimental - * This is a experimental module for RTL support - * This module bridges the i18n utility from RCTI18nUtil - */ -@interface RCTI18nManager : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTI18nManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTI18nManager.m deleted file mode 100644 index f933470a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTI18nManager.m +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTI18nManager.h" -#import "RCTI18nUtil.h" - -@implementation RCTI18nManager - -RCT_EXPORT_MODULE() - -+ (BOOL)requiresMainQueueSetup -{ - return NO; -} - -RCT_EXPORT_METHOD(allowRTL:(BOOL)value) -{ - [[RCTI18nUtil sharedInstance] allowRTL:value]; -} - -RCT_EXPORT_METHOD(forceRTL:(BOOL)value) -{ - [[RCTI18nUtil sharedInstance] forceRTL:value]; -} - -RCT_EXPORT_METHOD(swapLeftAndRightInRTL:(BOOL)value) -{ - [[RCTI18nUtil sharedInstance] swapLeftAndRightInRTL:value]; -} - -- (NSDictionary *)constantsToExport -{ - return [self getConstants]; -} - -- (NSDictionary *)getConstants -{ - return @{ - @"isRTL": @([[RCTI18nUtil sharedInstance] isRTL]), - @"doLeftAndRightSwapInRTL": @([[RCTI18nUtil sharedInstance] doLeftAndRightSwapInRTL]) - }; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTI18nUtil.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTI18nUtil.h deleted file mode 100644 index 791d911e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTI18nUtil.h +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -/** - * @experimental - * This is a experimental module for to expose constance IsRTL to js about the RTL status. - * And it allows js to force RLT status for development propose. - * This will also provide other i18n related utilities in the future. - */ -@interface RCTI18nUtil : NSObject - -+ (instancetype)sharedInstance; - -- (BOOL)isRTL; -- (BOOL)isRTLAllowed; -- (void)allowRTL:(BOOL)value; -- (BOOL)isRTLForced; -- (void)forceRTL:(BOOL)value; -- (BOOL)doLeftAndRightSwapInRTL; -- (void)swapLeftAndRightInRTL:(BOOL)value; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTI18nUtil.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTI18nUtil.m deleted file mode 100644 index 0206f1a0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTI18nUtil.m +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTI18nUtil.h" - -#import - -@implementation RCTI18nUtil - -+ (instancetype)sharedInstance -{ - static RCTI18nUtil *sharedInstance; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedInstance = [self new]; - [sharedInstance swapLeftAndRightInRTL: true]; - }); - - return sharedInstance; -} - -/** - * Check if the app is currently running on an RTL locale. - * This only happens when the app: - * - is forcing RTL layout, regardless of the active language (for development purpose) - * - allows RTL layout when using RTL locale - */ -- (BOOL)isRTL -{ - if ([self isRTLForced]) { - return YES; - } - if ([self isRTLAllowed] && [self isApplicationPreferredLanguageRTL]) { - return YES; - } - return NO; -} - -/** - * Should be used very early during app start up - * Before the bridge is initialized - * @return whether the app allows RTL layout, default is true - */ -- (BOOL)isRTLAllowed -{ - NSNumber *value = [[NSUserDefaults standardUserDefaults] objectForKey:@"RCTI18nUtil_allowRTL"]; - if (value == nil) { - return YES; - } - return [value boolValue]; -} - -- (void)allowRTL:(BOOL)rtlStatus -{ - [[NSUserDefaults standardUserDefaults] setBool:rtlStatus forKey:@"RCTI18nUtil_allowRTL"]; - [[NSUserDefaults standardUserDefaults] synchronize]; -} - -/** - * Could be used to test RTL layout with English - * Used for development and testing purpose - */ -- (BOOL)isRTLForced -{ - BOOL rtlStatus = [[NSUserDefaults standardUserDefaults] - boolForKey:@"RCTI18nUtil_forceRTL"]; - return rtlStatus; -} - -- (void)forceRTL:(BOOL)rtlStatus -{ - [[NSUserDefaults standardUserDefaults] setBool:rtlStatus forKey:@"RCTI18nUtil_forceRTL"]; - [[NSUserDefaults standardUserDefaults] synchronize]; -} - -- (BOOL)doLeftAndRightSwapInRTL -{ - return [[NSUserDefaults standardUserDefaults] boolForKey:@"RCTI18nUtil_makeRTLFlipLeftAndRightStyles"]; -} - -- (void)swapLeftAndRightInRTL:(BOOL)value -{ - [[NSUserDefaults standardUserDefaults] setBool:value forKey:@"RCTI18nUtil_makeRTLFlipLeftAndRightStyles"]; - [[NSUserDefaults standardUserDefaults] synchronize]; -} - -// Check if the current device language is RTL -- (BOOL)isDevicePreferredLanguageRTL -{ - NSLocaleLanguageDirection direction = [NSLocale characterDirectionForLanguage:[[NSLocale preferredLanguages] objectAtIndex:0]]; - return direction == NSLocaleLanguageDirectionRightToLeft; -} - -// Check if the current application language is RTL -- (BOOL)isApplicationPreferredLanguageRTL -{ - NSWritingDirection direction = [NSParagraphStyle defaultWritingDirectionForLanguage:nil]; - return direction == NSWritingDirectionRightToLeft; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTKeyboardObserver.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTKeyboardObserver.h deleted file mode 100644 index 1ea35d53..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTKeyboardObserver.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTKeyboardObserver : RCTEventEmitter - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTKeyboardObserver.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTKeyboardObserver.m deleted file mode 100644 index 999083c1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTKeyboardObserver.m +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTKeyboardObserver.h" - -#import "RCTEventDispatcher.h" - -static NSDictionary *RCTParseKeyboardNotification(NSNotification *notification); - -@implementation RCTKeyboardObserver - -RCT_EXPORT_MODULE() - -- (void)startObserving -{ -#if !TARGET_OS_TV - - NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - -#define ADD_KEYBOARD_HANDLER(NAME, SELECTOR) \ - [nc addObserver:self selector:@selector(SELECTOR:) name:NAME object:nil] - - ADD_KEYBOARD_HANDLER(UIKeyboardWillShowNotification, keyboardWillShow); - ADD_KEYBOARD_HANDLER(UIKeyboardDidShowNotification, keyboardDidShow); - ADD_KEYBOARD_HANDLER(UIKeyboardWillHideNotification, keyboardWillHide); - ADD_KEYBOARD_HANDLER(UIKeyboardDidHideNotification, keyboardDidHide); - ADD_KEYBOARD_HANDLER(UIKeyboardWillChangeFrameNotification, keyboardWillChangeFrame); - ADD_KEYBOARD_HANDLER(UIKeyboardDidChangeFrameNotification, keyboardDidChangeFrame); - -#undef ADD_KEYBOARD_HANDLER - -#endif - -} - -- (NSArray *)supportedEvents -{ - return @[@"keyboardWillShow", - @"keyboardDidShow", - @"keyboardWillHide", - @"keyboardDidHide", - @"keyboardWillChangeFrame", - @"keyboardDidChangeFrame"]; -} - -- (void)stopObserving -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -// Bridge might be already invalidated by the time the keyboard is about to be dismissed. -// This might happen, for example, when reload from the packager is performed. -// Thus we need to check against nil here. -#define IMPLEMENT_KEYBOARD_HANDLER(EVENT) \ -- (void)EVENT:(NSNotification *)notification \ -{ \ - if (!self.bridge) { \ - return; \ - } \ - [self sendEventWithName:@#EVENT \ - body:RCTParseKeyboardNotification(notification)]; \ -} - -IMPLEMENT_KEYBOARD_HANDLER(keyboardWillShow) -IMPLEMENT_KEYBOARD_HANDLER(keyboardDidShow) -IMPLEMENT_KEYBOARD_HANDLER(keyboardWillHide) -IMPLEMENT_KEYBOARD_HANDLER(keyboardDidHide) -IMPLEMENT_KEYBOARD_HANDLER(keyboardWillChangeFrame) -IMPLEMENT_KEYBOARD_HANDLER(keyboardDidChangeFrame) - -@end - -NS_INLINE NSDictionary *RCTRectDictionaryValue(CGRect rect) -{ - return @{ - @"screenX": @(rect.origin.x), - @"screenY": @(rect.origin.y), - @"width": @(rect.size.width), - @"height": @(rect.size.height), - }; -} - -static NSString *RCTAnimationNameForCurve(UIViewAnimationCurve curve) -{ - switch (curve) { - case UIViewAnimationCurveEaseIn: - return @"easeIn"; - case UIViewAnimationCurveEaseInOut: - return @"easeInEaseOut"; - case UIViewAnimationCurveEaseOut: - return @"easeOut"; - case UIViewAnimationCurveLinear: - return @"linear"; - default: - return @"keyboard"; - } -} - -static NSDictionary *RCTParseKeyboardNotification(NSNotification *notification) -{ -#if TARGET_OS_TV - return @{}; -#else - NSDictionary *userInfo = notification.userInfo; - CGRect beginFrame = [userInfo[UIKeyboardFrameBeginUserInfoKey] CGRectValue]; - CGRect endFrame = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; - NSTimeInterval duration = [userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]; - UIViewAnimationCurve curve = [userInfo[UIKeyboardAnimationCurveUserInfoKey] integerValue]; - NSInteger isLocalUserInfoKey = [userInfo[UIKeyboardIsLocalUserInfoKey] integerValue]; - - return @{ - @"startCoordinates": RCTRectDictionaryValue(beginFrame), - @"endCoordinates": RCTRectDictionaryValue(endFrame), - @"duration": @(duration * 1000.0), // ms - @"easing": RCTAnimationNameForCurve(curve), - @"isEventFromThisApp": isLocalUserInfoKey == 1 ? @YES : @NO, - }; -#endif -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTLayoutAnimation.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTLayoutAnimation.h deleted file mode 100644 index 9f33e3b7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTLayoutAnimation.h +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTLayoutAnimation : NSObject - -@property (nonatomic, readonly) NSTimeInterval duration; -@property (nonatomic, readonly) NSTimeInterval delay; -@property (nonatomic, readonly, copy) NSString *property; -@property (nonatomic, readonly) CGFloat springDamping; -@property (nonatomic, readonly) CGFloat initialVelocity; -@property (nonatomic, readonly) RCTAnimationType animationType; - -+ (void)initializeStatics; - -- (instancetype)initWithDuration:(NSTimeInterval)duration - delay:(NSTimeInterval)delay - property:(NSString *)property - springDamping:(CGFloat)springDamping - initialVelocity:(CGFloat)initialVelocity - animationType:(RCTAnimationType)animationType; - -- (instancetype)initWithDuration:(NSTimeInterval)duration - config:(NSDictionary *)config; - -- (void)performAnimations:(void (^)(void))animations - withCompletionBlock:(void (^)(BOOL completed))completionBlock; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTLayoutAnimation.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTLayoutAnimation.m deleted file mode 100644 index 65eca543..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTLayoutAnimation.m +++ /dev/null @@ -1,153 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTLayoutAnimation.h" - -#import "RCTConvert.h" - -@implementation RCTLayoutAnimation - -static UIViewAnimationCurve _currentKeyboardAnimationCurve; - -static UIViewAnimationOptions UIViewAnimationOptionsFromRCTAnimationType(RCTAnimationType type) -{ - switch (type) { - case RCTAnimationTypeLinear: - return UIViewAnimationOptionCurveLinear; - case RCTAnimationTypeEaseIn: - return UIViewAnimationOptionCurveEaseIn; - case RCTAnimationTypeEaseOut: - return UIViewAnimationOptionCurveEaseOut; - case RCTAnimationTypeEaseInEaseOut: - return UIViewAnimationOptionCurveEaseInOut; - case RCTAnimationTypeKeyboard: - // http://stackoverflow.com/questions/18870447/how-to-use-the-default-ios7-uianimation-curve - return (UIViewAnimationOptions)(_currentKeyboardAnimationCurve << 16); - default: - RCTLogError(@"Unsupported animation type %lld", (long long)type); - return UIViewAnimationOptionCurveEaseInOut; - } -} - -// Use a custom initialization function rather than implementing `+initialize` so that we can control -// when the initialization code runs. `+initialize` runs immediately before the first message is sent -// to the class which may be too late for us. By this time, we may have missed some -// `UIKeyboardWillChangeFrameNotification`s. -+ (void)initializeStatics -{ -#if !TARGET_OS_TV - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(keyboardWillChangeFrame:) - name:UIKeyboardWillChangeFrameNotification - object:nil]; - }); -#endif -} - -+ (void)keyboardWillChangeFrame:(NSNotification *)notification -{ -#if !TARGET_OS_TV - NSDictionary *userInfo = notification.userInfo; - _currentKeyboardAnimationCurve = [userInfo[UIKeyboardAnimationCurveUserInfoKey] integerValue]; -#endif -} - -- (instancetype)initWithDuration:(NSTimeInterval)duration - delay:(NSTimeInterval)delay - property:(NSString *)property - springDamping:(CGFloat)springDamping - initialVelocity:(CGFloat)initialVelocity - animationType:(RCTAnimationType)animationType -{ - if (self = [super init]) { - _duration = duration; - _delay = delay; - _property = property; - _springDamping = springDamping; - _initialVelocity = initialVelocity; - _animationType = animationType; - } - - return self; -} - -- (instancetype)initWithDuration:(NSTimeInterval)duration - config:(NSDictionary *)config -{ - if (!config) { - return nil; - } - - if (self = [super init]) { - _property = [RCTConvert NSString:config[@"property"]]; - - _duration = [RCTConvert NSTimeInterval:config[@"duration"]] ?: duration; - if (_duration > 0.0 && _duration < 0.01) { - RCTLogError(@"RCTLayoutAnimationGroup expects timings to be in ms, not seconds."); - _duration = _duration * 1000.0; - } - - _delay = [RCTConvert NSTimeInterval:config[@"delay"]]; - if (_delay > 0.0 && _delay < 0.01) { - RCTLogError(@"RCTLayoutAnimationGroup expects timings to be in ms, not seconds."); - _delay = _delay * 1000.0; - } - - _animationType = [RCTConvert RCTAnimationType:config[@"type"]]; - if (_animationType == RCTAnimationTypeSpring) { - _springDamping = [RCTConvert CGFloat:config[@"springDamping"]]; - _initialVelocity = [RCTConvert CGFloat:config[@"initialVelocity"]]; - } - } - - return self; -} - -- (void)performAnimations:(void (^)(void))animations - withCompletionBlock:(void (^)(BOOL completed))completionBlock -{ - if (_animationType == RCTAnimationTypeSpring) { - [UIView animateWithDuration:_duration - delay:_delay - usingSpringWithDamping:_springDamping - initialSpringVelocity:_initialVelocity - options:UIViewAnimationOptionBeginFromCurrentState - animations:animations - completion:completionBlock]; - } else { - UIViewAnimationOptions options = - UIViewAnimationOptionBeginFromCurrentState | - UIViewAnimationOptionsFromRCTAnimationType(_animationType); - - [UIView animateWithDuration:_duration - delay:_delay - options:options - animations:animations - completion:completionBlock]; - } -} - -- (BOOL)isEqual:(RCTLayoutAnimation *)animation -{ - return - _duration == animation.duration && - _delay == animation.delay && - (_property == animation.property || [_property isEqualToString:animation.property]) && - _springDamping == animation.springDamping && - _initialVelocity == animation.initialVelocity && - _animationType == animation.animationType; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"<%@: %p; duration: %f; delay: %f; property: %@; springDamping: %f; initialVelocity: %f; animationType: %li;>", - NSStringFromClass([self class]), self, _duration, _delay, _property, _springDamping, _initialVelocity, (long)_animationType]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTLayoutAnimationGroup.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTLayoutAnimationGroup.h deleted file mode 100644 index c593cb64..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTLayoutAnimationGroup.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@class RCTLayoutAnimation; - -@interface RCTLayoutAnimationGroup : NSObject - -@property (nonatomic, readonly) RCTLayoutAnimation *creatingLayoutAnimation; -@property (nonatomic, readonly) RCTLayoutAnimation *updatingLayoutAnimation; -@property (nonatomic, readonly) RCTLayoutAnimation *deletingLayoutAnimation; - -@property (nonatomic, copy) RCTResponseSenderBlock callback; - -- (instancetype)initWithCreatingLayoutAnimation:(RCTLayoutAnimation *)creatingLayoutAnimation - updatingLayoutAnimation:(RCTLayoutAnimation *)updatingLayoutAnimation - deletingLayoutAnimation:(RCTLayoutAnimation *)deletingLayoutAnimation - callback:(RCTResponseSenderBlock)callback; - -- (instancetype)initWithConfig:(NSDictionary *)config - callback:(RCTResponseSenderBlock)callback; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTLayoutAnimationGroup.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTLayoutAnimationGroup.m deleted file mode 100644 index ac72ccf7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTLayoutAnimationGroup.m +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTLayoutAnimationGroup.h" - -#import "RCTLayoutAnimation.h" -#import "RCTConvert.h" - -@implementation RCTLayoutAnimationGroup - -- (instancetype)initWithCreatingLayoutAnimation:(RCTLayoutAnimation *)creatingLayoutAnimation - updatingLayoutAnimation:(RCTLayoutAnimation *)updatingLayoutAnimation - deletingLayoutAnimation:(RCTLayoutAnimation *)deletingLayoutAnimation - callback:(RCTResponseSenderBlock)callback -{ - if (self = [super init]) { - _creatingLayoutAnimation = creatingLayoutAnimation; - _updatingLayoutAnimation = updatingLayoutAnimation; - _deletingLayoutAnimation = deletingLayoutAnimation; - _callback = callback; - } - - return self; -} - -- (instancetype)initWithConfig:(NSDictionary *)config - callback:(RCTResponseSenderBlock)callback -{ - if (!config) { - return nil; - } - - if (self = [super init]) { - NSTimeInterval duration = [RCTConvert NSTimeInterval:config[@"duration"]]; - - if (duration > 0.0 && duration < 0.01) { - RCTLogError(@"RCTLayoutAnimationGroup expects timings to be in ms, not seconds."); - duration = duration * 1000.0; - } - - _creatingLayoutAnimation = [[RCTLayoutAnimation alloc] initWithDuration:duration config:config[@"create"]]; - _updatingLayoutAnimation = [[RCTLayoutAnimation alloc] initWithDuration:duration config:config[@"update"]]; - _deletingLayoutAnimation = [[RCTLayoutAnimation alloc] initWithDuration:duration config:config[@"delete"]]; - _callback = callback; - } - - return self; -} - -- (BOOL)isEqual:(RCTLayoutAnimationGroup *)layoutAnimation -{ - RCTLayoutAnimation *creatingLayoutAnimation = layoutAnimation.creatingLayoutAnimation; - RCTLayoutAnimation *updatingLayoutAnimation = layoutAnimation.updatingLayoutAnimation; - RCTLayoutAnimation *deletingLayoutAnimation = layoutAnimation.deletingLayoutAnimation; - - return - (_creatingLayoutAnimation == creatingLayoutAnimation || [_creatingLayoutAnimation isEqual:creatingLayoutAnimation]) && - (_updatingLayoutAnimation == updatingLayoutAnimation || [_updatingLayoutAnimation isEqual:updatingLayoutAnimation]) && - (_deletingLayoutAnimation == deletingLayoutAnimation || [_deletingLayoutAnimation isEqual:deletingLayoutAnimation]); -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"<%@: %p; creatingLayoutAnimation: %@; updatingLayoutAnimation: %@; deletingLayoutAnimation: %@>", - NSStringFromClass([self class]), self, [_creatingLayoutAnimation description], [_updatingLayoutAnimation description], [_deletingLayoutAnimation description]]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTRedBox.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTRedBox.h deleted file mode 100644 index 0f434953..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTRedBox.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import - -@class RCTJSStackFrame; - -@interface RCTRedBox : NSObject - -- (void)registerErrorCustomizer:(id)errorCustomizer; -- (void)showError:(NSError *)error; -- (void)showErrorMessage:(NSString *)message; -- (void)showErrorMessage:(NSString *)message withDetails:(NSString *)details; -- (void)showErrorMessage:(NSString *)message withRawStack:(NSString *)rawStack; -- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack; -- (void)updateErrorMessage:(NSString *)message withStack:(NSArray *)stack; -- (void)showErrorMessage:(NSString *)message withParsedStack:(NSArray *)stack; -- (void)updateErrorMessage:(NSString *)message withParsedStack:(NSArray *)stack; - -- (void)dismiss; - -/** Overrides bridge.bundleURL. Modify on main thread only. You shouldn't need to use this. */ -@property (nonatomic, strong) NSURL *overrideBundleURL; - -/** Overrides the default behavior of calling [bridge reload] on reload. You shouldn't need to use this. */ -@property (nonatomic, strong) dispatch_block_t overrideReloadAction; - -@end - -/** - * This category makes the red box instance available via the RCTBridge, which - * is useful for any class that needs to access the red box or error log. - */ -@interface RCTBridge (RCTRedBox) - -@property (nonatomic, readonly) RCTRedBox *redBox; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTRedBox.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTRedBox.m deleted file mode 100644 index b7a3433e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTRedBox.m +++ /dev/null @@ -1,600 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTRedBox.h" - -#import "RCTBridge.h" -#import "RCTConvert.h" -#import "RCTDefines.h" -#import "RCTErrorInfo.h" -#import "RCTEventDispatcher.h" -#import "RCTJSStackFrame.h" -#import "RCTRedBoxExtraDataViewController.h" -#import "RCTUtils.h" - -#if RCT_DEBUG - -@class RCTRedBoxWindow; - -@protocol RCTRedBoxWindowActionDelegate - -- (void)redBoxWindow:(RCTRedBoxWindow *)redBoxWindow openStackFrameInEditor:(RCTJSStackFrame *)stackFrame; -- (void)reloadFromRedBoxWindow:(RCTRedBoxWindow *)redBoxWindow; -- (void)loadExtraDataViewController; - -@end - -@interface RCTRedBoxWindow : UIWindow -@property (nonatomic, weak) id actionDelegate; -@end - -@implementation RCTRedBoxWindow -{ - UITableView *_stackTraceTableView; - NSString *_lastErrorMessage; - NSArray *_lastStackTrace; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if ((self = [super initWithFrame:frame])) { -#if TARGET_OS_TV - self.windowLevel = UIWindowLevelAlert + 1000; -#else - self.windowLevel = UIWindowLevelStatusBar - 1; -#endif - self.backgroundColor = [UIColor colorWithRed:0.1 green:0.1 blue:0.1 alpha:1]; - self.hidden = YES; - - UIViewController *rootController = [UIViewController new]; - self.rootViewController = rootController; - UIView *rootView = rootController.view; - rootView.backgroundColor = [UIColor clearColor]; - - const CGFloat buttonHeight = 60; - - CGRect detailsFrame = rootView.bounds; - detailsFrame.size.height -= buttonHeight + [self bottomSafeViewHeight]; - - _stackTraceTableView = [[UITableView alloc] initWithFrame:detailsFrame style:UITableViewStylePlain]; - _stackTraceTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - _stackTraceTableView.delegate = self; - _stackTraceTableView.dataSource = self; - _stackTraceTableView.backgroundColor = [UIColor clearColor]; -#if !TARGET_OS_TV - _stackTraceTableView.separatorColor = [UIColor colorWithWhite:1 alpha:0.3]; - _stackTraceTableView.separatorStyle = UITableViewCellSeparatorStyleNone; -#endif - _stackTraceTableView.indicatorStyle = UIScrollViewIndicatorStyleWhite; - [rootView addSubview:_stackTraceTableView]; - -#if TARGET_OS_SIMULATOR - NSString *reloadText = @"Reload\n(\u2318R)"; - NSString *dismissText = @"Dismiss\n(ESC)"; - NSString *copyText = @"Copy\n(\u2325\u2318C)"; - NSString *extraText = @"Extra Info\n(\u2318E)"; -#else - NSString *reloadText = @"Reload JS"; - NSString *dismissText = @"Dismiss"; - NSString *copyText = @"Copy"; - NSString *extraText = @"Extra Info"; -#endif - - UIButton *dismissButton = [UIButton buttonWithType:UIButtonTypeCustom]; - dismissButton.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin; - dismissButton.accessibilityIdentifier = @"redbox-dismiss"; - dismissButton.titleLabel.font = [UIFont systemFontOfSize:13]; - dismissButton.titleLabel.lineBreakMode = NSLineBreakByWordWrapping; - dismissButton.titleLabel.textAlignment = NSTextAlignmentCenter; - dismissButton.backgroundColor = [UIColor colorWithRed:0.1 green:0.1 blue:0.1 alpha:1]; - [dismissButton setTitle:dismissText forState:UIControlStateNormal]; - [dismissButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; - [dismissButton setTitleColor:[UIColor colorWithWhite:1 alpha:0.5] forState:UIControlStateHighlighted]; - [dismissButton addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside]; - - UIButton *reloadButton = [UIButton buttonWithType:UIButtonTypeCustom]; - reloadButton.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin; - reloadButton.accessibilityIdentifier = @"redbox-reload"; - reloadButton.titleLabel.font = [UIFont systemFontOfSize:13]; - reloadButton.titleLabel.lineBreakMode = NSLineBreakByWordWrapping; - reloadButton.titleLabel.textAlignment = NSTextAlignmentCenter; - reloadButton.backgroundColor = [UIColor colorWithRed:0.1 green:0.1 blue:0.1 alpha:1]; - [reloadButton setTitle:reloadText forState:UIControlStateNormal]; - [reloadButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; - [reloadButton setTitleColor:[UIColor colorWithWhite:1 alpha:0.5] forState:UIControlStateHighlighted]; - [reloadButton addTarget:self action:@selector(reload) forControlEvents:UIControlEventTouchUpInside]; - - UIButton *copyButton = [UIButton buttonWithType:UIButtonTypeCustom]; - copyButton.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin; - copyButton.accessibilityIdentifier = @"redbox-copy"; - copyButton.titleLabel.font = [UIFont systemFontOfSize:13]; - copyButton.titleLabel.lineBreakMode = NSLineBreakByWordWrapping; - copyButton.titleLabel.textAlignment = NSTextAlignmentCenter; - copyButton.backgroundColor = [UIColor colorWithRed:0.1 green:0.1 blue:0.1 alpha:1]; - [copyButton setTitle:copyText forState:UIControlStateNormal]; - [copyButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; - [copyButton setTitleColor:[UIColor colorWithWhite:1 alpha:0.5] forState:UIControlStateHighlighted]; - [copyButton addTarget:self action:@selector(copyStack) forControlEvents:UIControlEventTouchUpInside]; - - UIButton *extraButton = [UIButton buttonWithType:UIButtonTypeCustom]; - extraButton.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin; - extraButton.accessibilityIdentifier = @"redbox-extra"; - extraButton.titleLabel.font = [UIFont systemFontOfSize:13]; - extraButton.titleLabel.lineBreakMode = NSLineBreakByWordWrapping; - extraButton.titleLabel.textAlignment = NSTextAlignmentCenter; - extraButton.backgroundColor = [UIColor colorWithRed:0.1 green:0.1 blue:0.1 alpha:1]; - [extraButton setTitle:extraText forState:UIControlStateNormal]; - [extraButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; - [extraButton setTitleColor:[UIColor colorWithWhite:1 alpha:0.5] forState:UIControlStateHighlighted]; - [extraButton addTarget:self action:@selector(showExtraDataViewController) forControlEvents:UIControlEventTouchUpInside]; - - CGFloat buttonWidth = self.bounds.size.width / 4; - CGFloat bottomButtonHeight = self.bounds.size.height - buttonHeight - [self bottomSafeViewHeight]; - - dismissButton.frame = CGRectMake(0, bottomButtonHeight, buttonWidth, buttonHeight); - reloadButton.frame = CGRectMake(buttonWidth, bottomButtonHeight, buttonWidth, buttonHeight); - copyButton.frame = CGRectMake(buttonWidth * 2, bottomButtonHeight, buttonWidth, buttonHeight); - extraButton.frame = CGRectMake(buttonWidth * 3, bottomButtonHeight, buttonWidth, buttonHeight); - - UIView *topBorder = [[UIView alloc] initWithFrame:CGRectMake(0, bottomButtonHeight + 1, rootView.frame.size.width, 1)]; - topBorder.backgroundColor = [UIColor colorWithRed:0.70 green:0.70 blue:0.70 alpha:1.0]; - - [rootView addSubview:dismissButton]; - [rootView addSubview:reloadButton]; - [rootView addSubview:copyButton]; - [rootView addSubview:extraButton]; - [rootView addSubview:topBorder]; - - UIView *bottomSafeView = [UIView new]; - bottomSafeView.backgroundColor = [UIColor colorWithRed:0.1 green:0.1 blue:0.1 alpha:1]; - bottomSafeView.frame = CGRectMake(0, self.bounds.size.height - [self bottomSafeViewHeight], self.bounds.size.width, [self bottomSafeViewHeight]); - - [rootView addSubview:bottomSafeView]; - } - return self; -} - -- (NSInteger)bottomSafeViewHeight -{ - if (@available(iOS 11.0, *)) { - return [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom; - } else { - return 0; - } -} - -RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) - -- (void)dealloc -{ - _stackTraceTableView.dataSource = nil; - _stackTraceTableView.delegate = nil; - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack isUpdate:(BOOL)isUpdate -{ - // Show if this is a new message, or if we're updating the previous message - if ((self.hidden && !isUpdate) || (!self.hidden && isUpdate && [_lastErrorMessage isEqualToString:message])) { - _lastStackTrace = stack; - // message is displayed using UILabel, which is unable to render text of - // unlimited length, so we truncate it - _lastErrorMessage = [message substringToIndex:MIN((NSUInteger)10000, message.length)]; - - [_stackTraceTableView reloadData]; - - if (self.hidden) { - [_stackTraceTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] - atScrollPosition:UITableViewScrollPositionTop - animated:NO]; - } - - [self makeKeyAndVisible]; - [self becomeFirstResponder]; - } -} - -- (void)dismiss -{ - self.hidden = YES; - [self resignFirstResponder]; - [RCTSharedApplication().delegate.window makeKeyWindow]; -} - -- (void)reload -{ - [_actionDelegate reloadFromRedBoxWindow:self]; -} - -- (void)showExtraDataViewController -{ - [_actionDelegate loadExtraDataViewController]; -} - -- (void)copyStack -{ - NSMutableString *fullStackTrace; - - if (_lastErrorMessage != nil) { - fullStackTrace = [_lastErrorMessage mutableCopy]; - [fullStackTrace appendString:@"\n\n"]; - } - else { - fullStackTrace = [NSMutableString string]; - } - - for (RCTJSStackFrame *stackFrame in _lastStackTrace) { - [fullStackTrace appendString:[NSString stringWithFormat:@"%@\n", stackFrame.methodName]]; - if (stackFrame.file) { - [fullStackTrace appendFormat:@" %@\n", [self formatFrameSource:stackFrame]]; - } - } -#if !TARGET_OS_TV - UIPasteboard *pb = [UIPasteboard generalPasteboard]; - [pb setString:fullStackTrace]; -#endif -} - -- (NSString *)formatFrameSource:(RCTJSStackFrame *)stackFrame -{ - NSString *fileName = RCTNilIfNull(stackFrame.file) ? [stackFrame.file lastPathComponent] : @""; - NSString *lineInfo = [NSString stringWithFormat:@"%@:%lld", - fileName, - (long long)stackFrame.lineNumber]; - - if (stackFrame.column != 0) { - lineInfo = [lineInfo stringByAppendingFormat:@":%lld", (long long)stackFrame.column]; - } - return lineInfo; -} - -#pragma mark - TableView - -- (NSInteger)numberOfSectionsInTableView:(__unused UITableView *)tableView -{ - return 2; -} - -- (NSInteger)tableView:(__unused UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - return section == 0 ? 1 : _lastStackTrace.count; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -{ - if (indexPath.section == 0) { - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"msg-cell"]; - return [self reuseCell:cell forErrorMessage:_lastErrorMessage]; - } - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; - NSUInteger index = indexPath.row; - RCTJSStackFrame *stackFrame = _lastStackTrace[index]; - return [self reuseCell:cell forStackFrame:stackFrame]; -} - -- (UITableViewCell *)reuseCell:(UITableViewCell *)cell forErrorMessage:(NSString *)message -{ - if (!cell) { - cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"msg-cell"]; - cell.textLabel.accessibilityIdentifier = @"redbox-error"; - cell.textLabel.textColor = [UIColor whiteColor]; - cell.textLabel.font = [UIFont boldSystemFontOfSize:16]; - cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping; - cell.textLabel.numberOfLines = 0; - cell.detailTextLabel.textColor = [UIColor whiteColor]; - cell.backgroundColor = [UIColor colorWithRed:0.82 green:0.10 blue:0.15 alpha:1.0]; - cell.selectionStyle = UITableViewCellSelectionStyleNone; - } - - cell.textLabel.text = message; - - return cell; -} - -- (UITableViewCell *)reuseCell:(UITableViewCell *)cell forStackFrame:(RCTJSStackFrame *)stackFrame -{ - if (!cell) { - cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"]; - cell.textLabel.textColor = [UIColor whiteColor]; - cell.textLabel.font = [UIFont fontWithName:@"Menlo-Regular" size:14]; - cell.textLabel.lineBreakMode = NSLineBreakByCharWrapping; - cell.textLabel.numberOfLines = 2; - cell.detailTextLabel.textColor = [UIColor colorWithRed:0.70 green:0.70 blue:0.70 alpha:1.0]; - cell.detailTextLabel.font = [UIFont fontWithName:@"Menlo-Regular" size:11]; - cell.detailTextLabel.lineBreakMode = NSLineBreakByTruncatingMiddle; - cell.backgroundColor = [UIColor clearColor]; - cell.selectedBackgroundView = [UIView new]; - cell.selectedBackgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.2]; - } - - cell.textLabel.text = stackFrame.methodName ?: @"(unnamed method)"; - if (stackFrame.file) { - cell.detailTextLabel.text = [self formatFrameSource:stackFrame]; - } else { - cell.detailTextLabel.text = @""; - } - return cell; -} - -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath -{ - if (indexPath.section == 0) { - NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; - paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping; - - NSDictionary *attributes = @{NSFontAttributeName: [UIFont boldSystemFontOfSize:16], - NSParagraphStyleAttributeName: paragraphStyle}; - CGRect boundingRect = [_lastErrorMessage boundingRectWithSize:CGSizeMake(tableView.frame.size.width - 30, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil]; - return ceil(boundingRect.size.height) + 40; - } else { - return 50; - } -} - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath -{ - if (indexPath.section == 1) { - NSUInteger row = indexPath.row; - RCTJSStackFrame *stackFrame = _lastStackTrace[row]; - [_actionDelegate redBoxWindow:self openStackFrameInEditor:stackFrame]; - } - [tableView deselectRowAtIndexPath:indexPath animated:YES]; -} - -#pragma mark - Key commands - -- (NSArray *)keyCommands -{ - // NOTE: We could use RCTKeyCommands for this, but since - // we control this window, we can use the standard, non-hacky - // mechanism instead - - return @[ - // Dismiss red box - [UIKeyCommand keyCommandWithInput:UIKeyInputEscape - modifierFlags:0 - action:@selector(dismiss)], - - // Reload - [UIKeyCommand keyCommandWithInput:@"r" - modifierFlags:UIKeyModifierCommand - action:@selector(reload)], - - // Copy = Cmd-Option C since Cmd-C in the simulator copies the pasteboard from - // the simulator to the desktop pasteboard. - [UIKeyCommand keyCommandWithInput:@"c" - modifierFlags:UIKeyModifierCommand | UIKeyModifierAlternate - action:@selector(copyStack)], - - // Extra data - [UIKeyCommand keyCommandWithInput:@"e" - modifierFlags:UIKeyModifierCommand - action:@selector(showExtraDataViewController)] - ]; -} - -- (BOOL)canBecomeFirstResponder -{ - return YES; -} - -@end - -@interface RCTRedBox () -@end - -@implementation RCTRedBox -{ - RCTRedBoxWindow *_window; - NSMutableArray> *_errorCustomizers; - RCTRedBoxExtraDataViewController *_extraDataViewController; -} - -@synthesize bridge = _bridge; - -RCT_EXPORT_MODULE() - -- (void)registerErrorCustomizer:(id)errorCustomizer -{ - dispatch_async(dispatch_get_main_queue(), ^{ - if (!self->_errorCustomizers) { - self->_errorCustomizers = [NSMutableArray array]; - } - if (![self->_errorCustomizers containsObject:errorCustomizer]) { - [self->_errorCustomizers addObject:errorCustomizer]; - } - }); -} - -// WARNING: Should only be called from the main thread/dispatch queue. -- (RCTErrorInfo *)_customizeError:(RCTErrorInfo *)error -{ - RCTAssertMainQueue(); - if (!self->_errorCustomizers) { - return error; - } - for (id customizer in self->_errorCustomizers) { - RCTErrorInfo *newInfo = [customizer customizeErrorInfo:error]; - if (newInfo) { - error = newInfo; - } - } - return error; -} - -- (void)showError:(NSError *)error -{ - [self showErrorMessage:error.localizedDescription - withDetails:error.localizedFailureReason - stack:error.userInfo[RCTJSStackTraceKey]]; -} - -- (void)showErrorMessage:(NSString *)message -{ - [self showErrorMessage:message withParsedStack:nil isUpdate:NO]; -} - -- (void)showErrorMessage:(NSString *)message withDetails:(NSString *)details -{ - [self showErrorMessage:message withDetails:details stack:nil]; -} - -- (void)showErrorMessage:(NSString *)message withDetails:(NSString *)details stack:(NSArray *)stack { - NSString *combinedMessage = message; - if (details) { - combinedMessage = [NSString stringWithFormat:@"%@\n\n%@", message, details]; - } - [self showErrorMessage:combinedMessage withParsedStack:stack isUpdate:NO]; -} - -- (void)showErrorMessage:(NSString *)message withRawStack:(NSString *)rawStack -{ - NSArray *stack = [RCTJSStackFrame stackFramesWithLines:rawStack]; - [self showErrorMessage:message withParsedStack:stack isUpdate:NO]; -} - -- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack -{ - [self showErrorMessage:message withParsedStack:[RCTJSStackFrame stackFramesWithDictionaries:stack] isUpdate:NO]; -} - -- (void)updateErrorMessage:(NSString *)message withStack:(NSArray *)stack -{ - [self showErrorMessage:message withParsedStack:[RCTJSStackFrame stackFramesWithDictionaries:stack] isUpdate:YES]; -} - -- (void)showErrorMessage:(NSString *)message withParsedStack:(NSArray *)stack -{ - [self showErrorMessage:message withParsedStack:stack isUpdate:NO]; -} - -- (void)updateErrorMessage:(NSString *)message withParsedStack:(NSArray *)stack -{ - [self showErrorMessage:message withParsedStack:stack isUpdate:YES]; -} - -- (void)showErrorMessage:(NSString *)message withParsedStack:(NSArray *)stack isUpdate:(BOOL)isUpdate -{ - dispatch_async(dispatch_get_main_queue(), ^{ - if (self->_extraDataViewController == nil) { - self->_extraDataViewController = [RCTRedBoxExtraDataViewController new]; - self->_extraDataViewController.actionDelegate = self; - } - [self->_bridge.eventDispatcher sendDeviceEventWithName:@"collectRedBoxExtraData" body:nil]; - - if (!self->_window) { - self->_window = [[RCTRedBoxWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - self->_window.actionDelegate = self; - } - - RCTErrorInfo *errorInfo = [[RCTErrorInfo alloc] initWithErrorMessage:message - stack:stack]; - errorInfo = [self _customizeError:errorInfo]; - [self->_window showErrorMessage:errorInfo.errorMessage - withStack:errorInfo.stack - isUpdate:isUpdate]; - }); -} - -- (void)loadExtraDataViewController { - dispatch_async(dispatch_get_main_queue(), ^{ - // Make sure the CMD+E shortcut doesn't call this twice - if (self->_extraDataViewController != nil && ![self->_window.rootViewController presentedViewController]) { - [self->_window.rootViewController presentViewController:self->_extraDataViewController animated:YES completion:nil]; - } - }); -} - -RCT_EXPORT_METHOD(setExtraData:(NSDictionary *)extraData forIdentifier:(NSString *)identifier) { - [_extraDataViewController addExtraData:extraData forIdentifier:identifier]; -} - -RCT_EXPORT_METHOD(dismiss) -{ - dispatch_async(dispatch_get_main_queue(), ^{ - [self->_window dismiss]; - }); -} - -- (void)invalidate -{ - [self dismiss]; -} - -- (void)redBoxWindow:(__unused RCTRedBoxWindow *)redBoxWindow openStackFrameInEditor:(RCTJSStackFrame *)stackFrame -{ - NSURL *const bundleURL = _overrideBundleURL ?: _bridge.bundleURL; - if (![bundleURL.scheme hasPrefix:@"http"]) { - RCTLogWarn(@"Cannot open stack frame in editor because you're not connected to the packager."); - return; - } - - NSData *stackFrameJSON = [RCTJSONStringify([stackFrame toDictionary], NULL) dataUsingEncoding:NSUTF8StringEncoding]; - NSString *postLength = [NSString stringWithFormat:@"%tu", stackFrameJSON.length]; - NSMutableURLRequest *request = [NSMutableURLRequest new]; - request.URL = [NSURL URLWithString:@"/open-stack-frame" relativeToURL:bundleURL]; - request.HTTPMethod = @"POST"; - request.HTTPBody = stackFrameJSON; - [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; - [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; - - [[[NSURLSession sharedSession] dataTaskWithRequest:request] resume]; -} - -- (void)reload -{ - // Window is not used and can be nil - [self reloadFromRedBoxWindow:nil]; -} - -- (void)reloadFromRedBoxWindow:(__unused RCTRedBoxWindow *)redBoxWindow -{ - if (_overrideReloadAction) { - _overrideReloadAction(); - } else { - [_bridge reload]; - } - [self dismiss]; -} - -@end - -@implementation RCTBridge (RCTRedBox) - -- (RCTRedBox *)redBox -{ - return [self moduleForClass:[RCTRedBox class]]; -} - -@end - -#else // Disabled - -@implementation RCTRedBox - -+ (NSString *)moduleName { return nil; } -- (void)registerErrorCustomizer:(id)errorCustomizer {} -- (void)showError:(NSError *)message {} -- (void)showErrorMessage:(NSString *)message {} -- (void)showErrorMessage:(NSString *)message withDetails:(NSString *)details {} -- (void)showErrorMessage:(NSString *)message withRawStack:(NSString *)rawStack {} -- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack {} -- (void)updateErrorMessage:(NSString *)message withStack:(NSArray *)stack {} -- (void)showErrorMessage:(NSString *)message withParsedStack:(NSArray *)stack {} -- (void)updateErrorMessage:(NSString *)message withParsedStack:(NSArray *)stack {} -- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack isUpdate:(BOOL)isUpdate {} -- (void)dismiss {} - -@end - -@implementation RCTBridge (RCTRedBox) - -- (RCTRedBox *)redBox { return nil; } - -@end - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTRedBoxExtraDataViewController.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTRedBoxExtraDataViewController.h deleted file mode 100644 index 00ba25a8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTRedBoxExtraDataViewController.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@protocol RCTRedBoxExtraDataActionDelegate -- (void)reload; -@end - -@interface RCTRedBoxExtraDataViewController : UIViewController - -@property (nonatomic, weak) id actionDelegate; - -- (void)addExtraData:(NSDictionary *)data forIdentifier:(NSString *)identifier; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTRedBoxExtraDataViewController.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTRedBoxExtraDataViewController.m deleted file mode 100644 index c9e1274a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTRedBoxExtraDataViewController.m +++ /dev/null @@ -1,292 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTRedBoxExtraDataViewController.h" - -@interface RCTRedBoxExtraDataCell : UITableViewCell - -@property (nonatomic, strong) UILabel *keyLabel; -@property (nonatomic, strong) UILabel *valueLabel; - -@end - -@implementation RCTRedBoxExtraDataCell - -- (instancetype)initWithStyle:(UITableViewCellStyle)style - reuseIdentifier:(NSString *)reuseIdentifier -{ - if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { - self.backgroundColor = [UIColor colorWithRed:0.8 - green:0 blue:0 - alpha:1]; - UILayoutGuide *contentLayout = self.contentView.layoutMarginsGuide; - - self.keyLabel = [UILabel new]; - [self.contentView addSubview:self.keyLabel]; - - self.keyLabel.translatesAutoresizingMaskIntoConstraints = NO; - [self.keyLabel.leadingAnchor - constraintEqualToAnchor:contentLayout.leadingAnchor].active = YES; - [self.keyLabel.topAnchor - constraintEqualToAnchor:contentLayout.topAnchor].active = YES; - [self.keyLabel.bottomAnchor - constraintEqualToAnchor:contentLayout.bottomAnchor].active = YES; - [self.keyLabel.widthAnchor - constraintEqualToAnchor:contentLayout.widthAnchor - multiplier:0.3].active = YES; - - - self.keyLabel.textColor = [UIColor whiteColor]; - self.keyLabel.numberOfLines = 0; -#if !TARGET_OS_TV - self.keyLabel.lineBreakMode = NSLineBreakByWordWrapping; - self.keyLabel.font = [UIFont fontWithName:@"Menlo-Regular" size:12.0f]; -#endif - self.valueLabel = [UILabel new]; - [self.contentView addSubview:self.valueLabel]; - - self.valueLabel.translatesAutoresizingMaskIntoConstraints = NO; - [self.valueLabel.leadingAnchor - constraintEqualToAnchor:self.keyLabel.trailingAnchor - constant:10.f].active = YES; - [self.valueLabel.trailingAnchor - constraintEqualToAnchor:contentLayout.trailingAnchor].active = YES; - [self.valueLabel.topAnchor - constraintEqualToAnchor:contentLayout.topAnchor].active = YES; - [self.valueLabel.bottomAnchor - constraintEqualToAnchor:contentLayout.bottomAnchor].active = YES; - - self.valueLabel.textColor = [UIColor whiteColor]; - self.valueLabel.numberOfLines = 0; -#if !TARGET_OS_TV - self.valueLabel.lineBreakMode = NSLineBreakByWordWrapping; - self.valueLabel.font = [UIFont fontWithName:@"Menlo-Regular" size:12.0f]; -#endif - } - return self; -} - -@end - -@interface RCTRedBoxExtraDataViewController () - -@end - -@implementation RCTRedBoxExtraDataViewController -{ - UITableView *_tableView; - NSMutableArray *_extraDataTitle; - NSMutableArray *_extraData; -} - -@synthesize actionDelegate = _actionDelegate; - -- (instancetype)init -{ - if (self = [super init]) { - _extraData = [NSMutableArray new]; - _extraDataTitle = [NSMutableArray new]; - self.view.backgroundColor = [UIColor colorWithRed:0.8 - green:0 - blue:0 - alpha:1]; - - _tableView = [UITableView new]; - _tableView.delegate = self; - _tableView.dataSource = self; - _tableView.backgroundColor = [UIColor clearColor]; - _tableView.estimatedRowHeight = 200; -#if !TARGET_OS_TV - _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; -#endif - _tableView.rowHeight = UITableViewAutomaticDimension; - _tableView.allowsSelection = NO; - -#if TARGET_OS_SIMULATOR - NSString *reloadText = @"Reload JS (\u2318R)"; - NSString *dismissText = @"Dismiss (ESC)"; -#else - NSString *reloadText = @"Reload JS"; - NSString *dismissText = @"Dismiss"; -#endif - - UIButton *dismissButton = [UIButton buttonWithType:UIButtonTypeCustom]; - dismissButton.translatesAutoresizingMaskIntoConstraints = NO; - dismissButton.accessibilityIdentifier = @"redbox-extra-data-dismiss"; - dismissButton.titleLabel.font = [UIFont systemFontOfSize:13]; - [dismissButton setTitle:dismissText forState:UIControlStateNormal]; - [dismissButton setTitleColor:[UIColor colorWithWhite:1 alpha:0.5] - forState:UIControlStateNormal]; - [dismissButton setTitleColor:[UIColor whiteColor] - forState:UIControlStateHighlighted]; - [dismissButton addTarget:self - action:@selector(dismiss) - forControlEvents:UIControlEventTouchUpInside]; - - UIButton *reloadButton = [UIButton buttonWithType:UIButtonTypeCustom]; - reloadButton.accessibilityIdentifier = @"redbox-reload"; - reloadButton.titleLabel.font = [UIFont systemFontOfSize:13]; - [reloadButton setTitle:reloadText forState:UIControlStateNormal]; - [reloadButton setTitleColor:[UIColor colorWithWhite:1 alpha:0.5] - forState:UIControlStateNormal]; - [reloadButton setTitleColor:[UIColor whiteColor] - forState:UIControlStateHighlighted]; - [reloadButton addTarget:self - action:@selector(reload) - forControlEvents:UIControlEventTouchUpInside]; - - UIStackView *buttonStackView = [UIStackView new]; - buttonStackView.axis = UILayoutConstraintAxisHorizontal; - buttonStackView.distribution = UIStackViewDistributionEqualSpacing; - buttonStackView.alignment = UIStackViewAlignmentFill; - buttonStackView.spacing = 20; - - [buttonStackView addArrangedSubview:dismissButton]; - [buttonStackView addArrangedSubview:reloadButton]; - buttonStackView.translatesAutoresizingMaskIntoConstraints = NO; - - UIStackView *mainStackView = [UIStackView new]; - mainStackView.axis = UILayoutConstraintAxisVertical; - mainStackView.backgroundColor = [UIColor colorWithRed:0.8 - green:0 blue:0 - alpha:1]; - [mainStackView addArrangedSubview:_tableView]; - [mainStackView addArrangedSubview:buttonStackView]; - mainStackView.translatesAutoresizingMaskIntoConstraints = NO; - - [self.view addSubview:mainStackView]; - - CGFloat tableHeight = self.view.bounds.size.height - 60.f; - [_tableView.heightAnchor constraintEqualToConstant:tableHeight].active = YES; - [_tableView.widthAnchor constraintEqualToAnchor:self.view.widthAnchor].active = YES; - - CGFloat buttonWidth = self.view.bounds.size.width / 4; - [dismissButton.heightAnchor constraintEqualToConstant:60].active = YES; - [dismissButton.widthAnchor - constraintEqualToConstant:buttonWidth].active = YES; - [reloadButton.heightAnchor constraintEqualToConstant:60].active = YES; - [reloadButton.widthAnchor - constraintEqualToConstant:buttonWidth].active = YES; - } - return self; -} - -- (void)viewDidAppear:(BOOL)animated -{ - [super viewDidAppear:animated]; - [_tableView reloadData]; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - return [[_extraData objectAtIndex:section] count]; -} - -- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section -{ - return 40; -} - -- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section -{ - UIView *view = [UIView new]; - view.backgroundColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1]; - - UILabel *header = [UILabel new]; - [view addSubview:header]; - - header.translatesAutoresizingMaskIntoConstraints = NO; - [header.leadingAnchor - constraintEqualToAnchor:view.leadingAnchor constant:5].active = YES; - [header.trailingAnchor - constraintEqualToAnchor:view.trailingAnchor].active = YES; - [header.topAnchor - constraintEqualToAnchor:view.topAnchor].active = YES; - [header.bottomAnchor - constraintEqualToAnchor:view.bottomAnchor].active = YES; - - header.textColor = [UIColor whiteColor]; - header.font = [UIFont fontWithName:@"Menlo-Bold" size:14.0f]; - header.text = [_extraDataTitle[section] uppercaseString]; - - return view; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -{ - static NSString *reuseIdentifier = @"RedBoxExtraData"; - - RCTRedBoxExtraDataCell *cell = - (RCTRedBoxExtraDataCell *)[tableView - dequeueReusableCellWithIdentifier:reuseIdentifier]; - - if (cell == nil) { - cell = [[RCTRedBoxExtraDataCell alloc] - initWithStyle:UITableViewCellStyleDefault - reuseIdentifier:reuseIdentifier]; - } - - NSArray *dataKVPair = _extraData[indexPath.section][indexPath.row]; - cell.keyLabel.text = dataKVPair[0]; - cell.valueLabel.text = dataKVPair[1]; - - return cell; -} - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView -{ - return _extraDataTitle.count; -} - -- (void)addExtraData:(NSDictionary *)data forIdentifier:(NSString *)identifier -{ - dispatch_async(dispatch_get_main_queue(), ^{ - NSMutableArray *newData = [NSMutableArray new]; - for (id key in data) { - [newData addObject:@[[NSString stringWithFormat:@"%@", key], - [NSString stringWithFormat:@"%@", [data objectForKey:key]]]]; - } - - NSInteger idx = [self->_extraDataTitle indexOfObject:identifier]; - if (idx == NSNotFound) { - [self->_extraDataTitle addObject:identifier]; - [self->_extraData addObject:newData]; - } else { - [self->_extraData replaceObjectAtIndex:idx withObject:newData]; - } - - [self->_tableView reloadData]; - }); -} - -- (void)dismiss -{ - [self dismissViewControllerAnimated:YES completion:nil]; -} - -- (void)reload -{ - [_actionDelegate reload]; -} - -#pragma mark - Key commands - -- (NSArray *)keyCommands -{ - return @[ - // Dismiss - [UIKeyCommand keyCommandWithInput:UIKeyInputEscape - modifierFlags:0 - action:@selector(dismiss)], - // Reload - [UIKeyCommand keyCommandWithInput:@"r" - modifierFlags:UIKeyModifierCommand - action:@selector(reload)] - ]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTSourceCode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTSourceCode.h deleted file mode 100644 index 6ed602cb..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTSourceCode.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTSourceCode : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTSourceCode.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTSourceCode.m deleted file mode 100644 index 805f1e33..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTSourceCode.m +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSourceCode.h" - -#import "RCTBridge.h" - -@implementation RCTSourceCode - -RCT_EXPORT_MODULE() - -@synthesize bridge = _bridge; - -+ (BOOL)requiresMainQueueSetup -{ - return NO; -} - -- (NSDictionary *)constantsToExport -{ - return [self getConstants]; -} - -- (NSDictionary *)getConstants -{ - return @{ - @"scriptURL": self.bridge.bundleURL.absoluteString ?: @"", - }; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTStatusBarManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTStatusBarManager.h deleted file mode 100644 index 74893bc6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTStatusBarManager.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -@interface RCTConvert (UIStatusBar) - -#if !TARGET_OS_TV -+ (UIStatusBarStyle)UIStatusBarStyle:(id)json; -+ (UIStatusBarAnimation)UIStatusBarAnimation:(id)json; -#endif - -@end - -@interface RCTStatusBarManager : RCTEventEmitter - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTStatusBarManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTStatusBarManager.m deleted file mode 100644 index 5136b369..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTStatusBarManager.m +++ /dev/null @@ -1,135 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTStatusBarManager.h" - -#import "RCTEventDispatcher.h" -#import "RCTLog.h" -#import "RCTUtils.h" - -#if !TARGET_OS_TV -@implementation RCTConvert (UIStatusBar) - -RCT_ENUM_CONVERTER(UIStatusBarStyle, (@{ - @"default": @(UIStatusBarStyleDefault), - @"light-content": @(UIStatusBarStyleLightContent), - @"dark-content": @(UIStatusBarStyleDefault), -}), UIStatusBarStyleDefault, integerValue); - -RCT_ENUM_CONVERTER(UIStatusBarAnimation, (@{ - @"none": @(UIStatusBarAnimationNone), - @"fade": @(UIStatusBarAnimationFade), - @"slide": @(UIStatusBarAnimationSlide), -}), UIStatusBarAnimationNone, integerValue); - -@end -#endif - -@implementation RCTStatusBarManager - -static BOOL RCTViewControllerBasedStatusBarAppearance() -{ - static BOOL value; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - value = [[[NSBundle mainBundle] objectForInfoDictionaryKey: - @"UIViewControllerBasedStatusBarAppearance"] ?: @YES boolValue]; - }); - - return value; -} - -RCT_EXPORT_MODULE() - -- (NSArray *)supportedEvents -{ - return @[@"statusBarFrameDidChange", - @"statusBarFrameWillChange"]; -} - -#if !TARGET_OS_TV - -- (void)startObserving -{ - NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - [nc addObserver:self selector:@selector(applicationDidChangeStatusBarFrame:) name:UIApplicationDidChangeStatusBarFrameNotification object:nil]; - [nc addObserver:self selector:@selector(applicationWillChangeStatusBarFrame:) name:UIApplicationWillChangeStatusBarFrameNotification object:nil]; -} - -- (void)stopObserving -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (dispatch_queue_t)methodQueue -{ - return dispatch_get_main_queue(); -} - -- (void)emitEvent:(NSString *)eventName forNotification:(NSNotification *)notification -{ - CGRect frame = [notification.userInfo[UIApplicationStatusBarFrameUserInfoKey] CGRectValue]; - NSDictionary *event = @{ - @"frame": @{ - @"x": @(frame.origin.x), - @"y": @(frame.origin.y), - @"width": @(frame.size.width), - @"height": @(frame.size.height), - }, - }; - [self sendEventWithName:eventName body:event]; -} - -- (void)applicationDidChangeStatusBarFrame:(NSNotification *)notification -{ - [self emitEvent:@"statusBarFrameDidChange" forNotification:notification]; -} - -- (void)applicationWillChangeStatusBarFrame:(NSNotification *)notification -{ - [self emitEvent:@"statusBarFrameWillChange" forNotification:notification]; -} - -RCT_EXPORT_METHOD(getHeight:(RCTResponseSenderBlock)callback) -{ - callback(@[@{ - @"height": @(RCTSharedApplication().statusBarFrame.size.height), - }]); -} - -RCT_EXPORT_METHOD(setStyle:(UIStatusBarStyle)statusBarStyle - animated:(BOOL)animated) -{ - if (RCTViewControllerBasedStatusBarAppearance()) { - RCTLogError(@"RCTStatusBarManager module requires that the \ - UIViewControllerBasedStatusBarAppearance key in the Info.plist is set to NO"); - } else { - [RCTSharedApplication() setStatusBarStyle:statusBarStyle - animated:animated]; - } -} - -RCT_EXPORT_METHOD(setHidden:(BOOL)hidden - withAnimation:(UIStatusBarAnimation)animation) -{ - if (RCTViewControllerBasedStatusBarAppearance()) { - RCTLogError(@"RCTStatusBarManager module requires that the \ - UIViewControllerBasedStatusBarAppearance key in the Info.plist is set to NO"); - } else { - [RCTSharedApplication() setStatusBarHidden:hidden - withAnimation:animation]; - } -} - -RCT_EXPORT_METHOD(setNetworkActivityIndicatorVisible:(BOOL)visible) -{ - RCTSharedApplication().networkActivityIndicatorVisible = visible; -} - -#endif //TARGET_OS_TV - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTTVNavigationEventEmitter.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTTVNavigationEventEmitter.h deleted file mode 100644 index 78dfcae1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTTVNavigationEventEmitter.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTEventEmitter.h" - -RCT_EXTERN NSString *const RCTTVNavigationEventNotification; - -@interface RCTTVNavigationEventEmitter : RCTEventEmitter - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTTVNavigationEventEmitter.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTTVNavigationEventEmitter.m deleted file mode 100644 index cd92d187..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTTVNavigationEventEmitter.m +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTVNavigationEventEmitter.h" - -NSString *const RCTTVNavigationEventNotification = @"RCTTVNavigationEventNotification"; - -static NSString *const TVNavigationEventName = @"onHWKeyEvent"; - -@implementation RCTTVNavigationEventEmitter - -RCT_EXPORT_MODULE() - -+ (BOOL)requiresMainQueueSetup -{ - return NO; -} - -- (instancetype)init -{ - if (self = [super init]) { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleTVNavigationEventNotification:) - name:RCTTVNavigationEventNotification - object:nil]; - - } - return self; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (NSArray *)supportedEvents -{ - return @[TVNavigationEventName]; -} - -- (void)handleTVNavigationEventNotification:(NSNotification *)notif -{ - if (self.bridge) { - [self sendEventWithName:TVNavigationEventName body:notif.object]; - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTTiming.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTTiming.h deleted file mode 100644 index 5130b633..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTTiming.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import - -@interface RCTTiming : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTTiming.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTTiming.m deleted file mode 100644 index 3a2474af..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTTiming.m +++ /dev/null @@ -1,325 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTiming.h" - -#import "RCTAssert.h" -#import "RCTBridge+Private.h" -#import "RCTBridge.h" -#import "RCTLog.h" -#import "RCTUtils.h" - -static const NSTimeInterval kMinimumSleepInterval = 1; - -// These timing contants should be kept in sync with the ones in `JSTimers.js`. -// The duration of a frame. This assumes that we want to run at 60 fps. -static const NSTimeInterval kFrameDuration = 1.0 / 60.0; -// The minimum time left in a frame to trigger the idle callback. -static const NSTimeInterval kIdleCallbackFrameDeadline = 0.001; - -@interface _RCTTimer : NSObject - -@property (nonatomic, strong, readonly) NSDate *target; -@property (nonatomic, assign, readonly) BOOL repeats; -@property (nonatomic, copy, readonly) NSNumber *callbackID; -@property (nonatomic, assign, readonly) NSTimeInterval interval; - -@end - -@implementation _RCTTimer - -- (instancetype)initWithCallbackID:(NSNumber *)callbackID - interval:(NSTimeInterval)interval - targetTime:(NSTimeInterval)targetTime - repeats:(BOOL)repeats -{ - if ((self = [super init])) { - _interval = interval; - _repeats = repeats; - _callbackID = callbackID; - _target = [NSDate dateWithTimeIntervalSinceNow:targetTime]; - } - return self; -} - -/** - * Returns `YES` if we should invoke the JS callback. - */ -- (BOOL)shouldFire:(NSDate *)now -{ - if (_target && [_target timeIntervalSinceDate:now] <= 0) { - return YES; - } - return NO; -} - -- (void)reschedule -{ - // The JS Timers will do fine grained calculating of expired timeouts. - _target = [NSDate dateWithTimeIntervalSinceNow:_interval]; -} - -@end - -@interface _RCTTimingProxy : NSObject - -@end - -// NSTimer retains its target, insert this class to break potential retain cycles -@implementation _RCTTimingProxy -{ - __weak id _target; -} - -+ (instancetype)proxyWithTarget:(id)target -{ - _RCTTimingProxy *proxy = [self new]; - if (proxy) { - proxy->_target = target; - } - return proxy; -} - -- (void)timerDidFire -{ - [_target timerDidFire]; -} - -@end - -@implementation RCTTiming -{ - NSMutableDictionary *_timers; - NSTimer *_sleepTimer; - BOOL _sendIdleEvents; -} - -@synthesize bridge = _bridge; -@synthesize paused = _paused; -@synthesize pauseCallback = _pauseCallback; - -RCT_EXPORT_MODULE() - -- (void)setBridge:(RCTBridge *)bridge -{ - RCTAssert(!_bridge, @"Should never be initialized twice!"); - - _paused = YES; - _timers = [NSMutableDictionary new]; - - for (NSString *name in @[UIApplicationWillResignActiveNotification, - UIApplicationDidEnterBackgroundNotification, - UIApplicationWillTerminateNotification]) { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(stopTimers) - name:name - object:nil]; - } - - for (NSString *name in @[UIApplicationDidBecomeActiveNotification, - UIApplicationWillEnterForegroundNotification]) { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(startTimers) - name:name - object:nil]; - } - - _bridge = bridge; -} - -- (void)dealloc -{ - [_sleepTimer invalidate]; - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (dispatch_queue_t)methodQueue -{ - return RCTJSThread; -} - -- (void)invalidate -{ - [self stopTimers]; - _bridge = nil; -} - -- (void)stopTimers -{ - if (!_paused) { - _paused = YES; - if (_pauseCallback) { - _pauseCallback(); - } - } -} - -- (void)startTimers -{ - if (!_bridge || ![self hasPendingTimers]) { - return; - } - - if (_paused) { - _paused = NO; - if (_pauseCallback) { - _pauseCallback(); - } - } -} - -- (BOOL)hasPendingTimers -{ - return _sendIdleEvents || _timers.count > 0; -} - -- (void)didUpdateFrame:(RCTFrameUpdate *)update -{ - NSDate *nextScheduledTarget = [NSDate distantFuture]; - NSMutableArray<_RCTTimer *> *timersToCall = [NSMutableArray new]; - NSDate *now = [NSDate date]; // compare all the timers to the same base time - for (_RCTTimer *timer in _timers.allValues) { - if ([timer shouldFire:now]) { - [timersToCall addObject:timer]; - } else { - nextScheduledTarget = [nextScheduledTarget earlierDate:timer.target]; - } - } - - // Call timers that need to be called - if (timersToCall.count > 0) { - NSArray *sortedTimers = [[timersToCall sortedArrayUsingComparator:^(_RCTTimer *a, _RCTTimer *b) { - return [a.target compare:b.target]; - }] valueForKey:@"callbackID"]; - [_bridge enqueueJSCall:@"JSTimers" - method:@"callTimers" - args:@[sortedTimers] - completion:NULL]; - } - - for (_RCTTimer *timer in timersToCall) { - if (timer.repeats) { - [timer reschedule]; - nextScheduledTarget = [nextScheduledTarget earlierDate:timer.target]; - } else { - [_timers removeObjectForKey:timer.callbackID]; - } - } - - if (_sendIdleEvents) { - NSTimeInterval frameElapsed = (CACurrentMediaTime() - update.timestamp); - if (kFrameDuration - frameElapsed >= kIdleCallbackFrameDeadline) { - NSTimeInterval currentTimestamp = [[NSDate date] timeIntervalSince1970]; - NSNumber *absoluteFrameStartMS = @((currentTimestamp - frameElapsed) * 1000); - [_bridge enqueueJSCall:@"JSTimers" - method:@"callIdleCallbacks" - args:@[absoluteFrameStartMS] - completion:NULL]; - } - } - - // Switch to a paused state only if we didn't call any timer this frame, so if - // in response to this timer another timer is scheduled, we don't pause and unpause - // the displaylink frivolously. - if (!_sendIdleEvents && timersToCall.count == 0) { - // No need to call the pauseCallback as RCTDisplayLink will ask us about our paused - // status immediately after completing this call - if (_timers.count == 0) { - _paused = YES; - } - // If the next timer is more than 1 second out, pause and schedule an NSTimer; - else if ([nextScheduledTarget timeIntervalSinceNow] > kMinimumSleepInterval) { - [self scheduleSleepTimer:nextScheduledTarget]; - _paused = YES; - } - } -} - -- (void)scheduleSleepTimer:(NSDate *)sleepTarget -{ - if (!_sleepTimer || !_sleepTimer.valid) { - _sleepTimer = [[NSTimer alloc] initWithFireDate:sleepTarget - interval:0 - target:[_RCTTimingProxy proxyWithTarget:self] - selector:@selector(timerDidFire) - userInfo:nil - repeats:NO]; - [[NSRunLoop currentRunLoop] addTimer:_sleepTimer forMode:NSDefaultRunLoopMode]; - } else { - _sleepTimer.fireDate = [_sleepTimer.fireDate earlierDate:sleepTarget]; - } -} - -- (void)timerDidFire -{ - _sleepTimer = nil; - if (_paused) { - [self startTimers]; - - // Immediately dispatch frame, so we don't have to wait on the displaylink. - [self didUpdateFrame:nil]; - } -} - -/** - * There's a small difference between the time when we call - * setTimeout/setInterval/requestAnimation frame and the time it actually makes - * it here. This is important and needs to be taken into account when - * calculating the timer's target time. We calculate this by passing in - * Date.now() from JS and then subtracting that from the current time here. - */ -RCT_EXPORT_METHOD(createTimer:(nonnull NSNumber *)callbackID - duration:(NSTimeInterval)jsDuration - jsSchedulingTime:(NSDate *)jsSchedulingTime - repeats:(BOOL)repeats) -{ - if (jsDuration == 0 && repeats == NO) { - // For super fast, one-off timers, just enqueue them immediately rather than waiting a frame. - [_bridge _immediatelyCallTimer:callbackID]; - return; - } - - NSTimeInterval jsSchedulingOverhead = MAX(-jsSchedulingTime.timeIntervalSinceNow, 0); - - NSTimeInterval targetTime = jsDuration - jsSchedulingOverhead; - if (jsDuration < 0.018) { // Make sure short intervals run each frame - jsDuration = 0; - } - - _RCTTimer *timer = [[_RCTTimer alloc] initWithCallbackID:callbackID - interval:jsDuration - targetTime:targetTime - repeats:repeats]; - _timers[callbackID] = timer; - if (_paused) { - if ([timer.target timeIntervalSinceNow] > kMinimumSleepInterval) { - [self scheduleSleepTimer:timer.target]; - } else { - [self startTimers]; - } - } -} - -RCT_EXPORT_METHOD(deleteTimer:(nonnull NSNumber *)timerID) -{ - [_timers removeObjectForKey:timerID]; - if (![self hasPendingTimers]) { - [self stopTimers]; - } -} - -RCT_EXPORT_METHOD(setSendIdleEvents:(BOOL)sendIdleEvents) -{ - _sendIdleEvents = sendIdleEvents; - if (sendIdleEvents) { - [self startTimers]; - } else if (![self hasPendingTimers]) { - [self stopTimers]; - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTUIManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTUIManager.h deleted file mode 100644 index 63f85bd1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTUIManager.h +++ /dev/null @@ -1,166 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import -#import -#import - -/** - * Posted right before re-render happens. This is a chance for views to invalidate their state so - * next render cycle will pick up updated views and layout appropriately. - */ -RCT_EXTERN NSString *const RCTUIManagerWillUpdateViewsDueToContentSizeMultiplierChangeNotification; - -@class RCTLayoutAnimationGroup; -@class RCTUIManagerObserverCoordinator; - -/** - * The RCTUIManager is the module responsible for updating the view hierarchy. - */ -@interface RCTUIManager : NSObject - -/** - * Register a root view tag and creates corresponding `rootView` and - * `rootShadowView`. - */ -- (void)registerRootViewTag:(NSNumber *)rootTag; - -/** - * Register a root view with the RCTUIManager. - */ -- (void)registerRootView:(UIView *)rootView; - -/** - * Gets the view name associated with a reactTag. - */ -- (NSString *)viewNameForReactTag:(NSNumber *)reactTag; - -/** - * Gets the view associated with a reactTag. - */ -- (UIView *)viewForReactTag:(NSNumber *)reactTag; - -/** - * Gets the shadow view associated with a reactTag. - */ -- (RCTShadowView *)shadowViewForReactTag:(NSNumber *)reactTag; - -/** - * Set the available size (`availableSize` property) for a root view. - * This might be used in response to changes in external layout constraints. - * This value will be directly trasmitted to layout engine and defines how big viewport is; - * this value does not affect root node size style properties. - * Can be considered as something similar to `setSize:forView:` but applicable only for root view. - */ -- (void)setAvailableSize:(CGSize)availableSize forRootView:(UIView *)rootView; - -/** - * Sets local data for a shadow view corresponded with given view. - * In some cases we need a way to specify some environmental data to shadow view - * to improve layout (or do something similar), so `localData` serves these needs. - * For example, any stateful embedded native views may benefit from this. - * Have in mind that this data is not supposed to interfere with the state of - * the shadow view. - * Please respect one-directional data flow of React. - */ -- (void)setLocalData:(NSObject *)localData forView:(UIView *)view; - -/** - * Set the size of a view. This might be in response to a screen rotation - * or some other layout event outside of the React-managed view hierarchy. - */ -- (void)setSize:(CGSize)size forView:(UIView *)view; - -/** - * Set the natural size of a view, which is used when no explicit size is set. - * Use `UIViewNoIntrinsicMetric` to ignore a dimension. - * The `size` must NOT include padding and border. - */ -- (void)setIntrinsicContentSize:(CGSize)intrinsicContentSize forView:(UIView *)view; - -/** - * Sets up layout animation which will perform on next layout pass. - * The animation will affect only one next layout pass. - * Must be called on the main queue. - */ -- (void)setNextLayoutAnimationGroup:(RCTLayoutAnimationGroup *)layoutAnimationGroup; - -/** - * Schedule a block to be executed on the UI thread. Useful if you need to execute - * view logic after all currently queued view updates have completed. - */ -- (void)addUIBlock:(RCTViewManagerUIBlock)block; - -/** - * Schedule a block to be executed on the UI thread. Useful if you need to execute - * view logic before all currently queued view updates have completed. - */ -- (void)prependUIBlock:(RCTViewManagerUIBlock)block; - -/** - * Used by native animated module to bypass the process of updating the values through the shadow - * view hierarchy. This method will directly update native views, which means that updates for - * layout-related propertied won't be handled properly. - * Make sure you know what you're doing before calling this method :) - */ -- (void)synchronouslyUpdateViewOnUIThread:(NSNumber *)reactTag - viewName:(NSString *)viewName - props:(NSDictionary *)props; - -/** - * Given a reactTag from a component, find its root view, if possible. - * Otherwise, this will give back nil. - * - * @param reactTag the component tag - * @param completion the completion block that will hand over the rootView, if any. - * - */ -- (void)rootViewForReactTag:(NSNumber *)reactTag withCompletion:(void (^)(UIView *view))completion; - -/** - * Finds a view that is tagged with nativeID as its nativeID prop - * with the associated rootTag root tag view hierarchy. Returns the - * view if found, nil otherwise. - * - * @param nativeID the id reference to native component relative to root view. - * @param rootTag the react tag of root view hierarchy from which to find the view. - */ -- (UIView *)viewForNativeID:(NSString *)nativeID withRootTag:(NSNumber *)rootTag; - -/** - * The view that is currently first responder, according to the JS context. - */ -+ (UIView *)JSResponder; - -/** - * In some cases we might want to trigger layout from native side. - * React won't be aware of this, so we need to make sure it happens. - */ -- (void)setNeedsLayout; - -/** - * Dedicated object for subscribing for UIManager events. - * See `RCTUIManagerObserver` protocol for more details. - */ -@property (atomic, retain, readonly) RCTUIManagerObserverCoordinator *observerCoordinator; - -@end - -/** - * This category makes the current RCTUIManager instance available via the - * RCTBridge, which is useful for RCTBridgeModules or RCTViewManagers that - * need to access the RCTUIManager. - */ -@interface RCTBridge (RCTUIManager) - -@property (nonatomic, readonly) RCTUIManager *uiManager; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTUIManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTUIManager.m deleted file mode 100644 index dfac9a87..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTUIManager.m +++ /dev/null @@ -1,1612 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTUIManager.h" - -#import - -#import "RCTAccessibilityManager.h" -#import "RCTAssert.h" -#import "RCTBridge+Private.h" -#import "RCTBridge.h" -#import "RCTComponent.h" -#import "RCTComponentData.h" -#import "RCTConvert.h" -#import "RCTDefines.h" -#import "RCTEventDispatcher.h" -#import "RCTLayoutAnimation.h" -#import "RCTLayoutAnimationGroup.h" -#import "RCTLog.h" -#import "RCTModuleData.h" -#import "RCTModuleMethod.h" -#import "RCTProfile.h" -#import "RCTRootContentView.h" -#import "RCTRootShadowView.h" -#import "RCTRootViewInternal.h" -#import "RCTScrollableProtocol.h" -#import "RCTShadowView+Internal.h" -#import "RCTShadowView.h" -#import "RCTSurfaceRootShadowView.h" -#import "RCTSurfaceRootView.h" -#import "RCTUIManagerObserverCoordinator.h" -#import "RCTUIManagerUtils.h" -#import "RCTUtils.h" -#import "RCTView.h" -#import "RCTViewManager.h" -#import "UIView+React.h" - -static void RCTTraverseViewNodes(id view, void (^block)(id)) -{ - if (view.reactTag) { - block(view); - - for (id subview in view.reactSubviews) { - RCTTraverseViewNodes(subview, block); - } - } -} - -NSString *const RCTUIManagerWillUpdateViewsDueToContentSizeMultiplierChangeNotification = @"RCTUIManagerWillUpdateViewsDueToContentSizeMultiplierChangeNotification"; - -@implementation RCTUIManager -{ - // Root views are only mutated on the shadow queue - NSMutableSet *_rootViewTags; - NSMutableArray *_pendingUIBlocks; - - // Animation - RCTLayoutAnimationGroup *_layoutAnimationGroup; // Main thread only - - NSMutableDictionary *_shadowViewRegistry; // RCT thread only - NSMutableDictionary *_viewRegistry; // Main thread only - - NSMapTable *> *_shadowViewsWithUpdatedProps; // UIManager queue only. - NSHashTable *_shadowViewsWithUpdatedChildren; // UIManager queue only. - - // Keyed by viewName - NSMutableDictionary *_componentDataByName; -} - -@synthesize bridge = _bridge; - -RCT_EXPORT_MODULE() - -+ (BOOL)requiresMainQueueSetup -{ - return NO; -} - -- (void)dealloc -{ - [NSNotificationCenter.defaultCenter removeObserver:self]; -} - -- (void)invalidate -{ - /** - * Called on the JS Thread since all modules are invalidated on the JS thread - */ - - // This only accessed from the shadow queue - _pendingUIBlocks = nil; - - RCTExecuteOnMainQueue(^{ - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"UIManager invalidate", nil); - for (NSNumber *rootViewTag in self->_rootViewTags) { - UIView *rootView = self->_viewRegistry[rootViewTag]; - if ([rootView conformsToProtocol:@protocol(RCTInvalidating)]) { - [(id)rootView invalidate]; - } - } - - self->_rootViewTags = nil; - self->_shadowViewRegistry = nil; - self->_viewRegistry = nil; - self->_bridge = nil; - - [[NSNotificationCenter defaultCenter] removeObserver:self]; - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - }); -} - -- (NSMutableDictionary *)shadowViewRegistry -{ - // NOTE: this method only exists so that it can be accessed by unit tests - if (!_shadowViewRegistry) { - _shadowViewRegistry = [NSMutableDictionary new]; - } - return _shadowViewRegistry; -} - -- (NSMutableDictionary *)viewRegistry -{ - // NOTE: this method only exists so that it can be accessed by unit tests - if (!_viewRegistry) { - _viewRegistry = [NSMutableDictionary new]; - } - return _viewRegistry; -} - -- (void)setBridge:(RCTBridge *)bridge -{ - RCTAssert(_bridge == nil, @"Should not re-use same UIIManager instance"); - _bridge = bridge; - - _shadowViewRegistry = [NSMutableDictionary new]; - _viewRegistry = [NSMutableDictionary new]; - - _shadowViewsWithUpdatedProps = [NSMapTable weakToStrongObjectsMapTable]; - _shadowViewsWithUpdatedChildren = [NSHashTable weakObjectsHashTable]; - - // Internal resources - _pendingUIBlocks = [NSMutableArray new]; - _rootViewTags = [NSMutableSet new]; - - _observerCoordinator = [RCTUIManagerObserverCoordinator new]; - - // Get view managers from bridge= - _componentDataByName = [NSMutableDictionary new]; - for (Class moduleClass in _bridge.moduleClasses) { - if ([moduleClass isSubclassOfClass:[RCTViewManager class]]) { - RCTComponentData *componentData = [[RCTComponentData alloc] initWithManagerClass:moduleClass - bridge:_bridge]; - _componentDataByName[componentData.name] = componentData; - } - } - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(didReceiveNewContentSizeMultiplier) - name:RCTAccessibilityManagerDidUpdateMultiplierNotification - object:_bridge.accessibilityManager]; -#if !TARGET_OS_TV - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(namedOrientationDidChange) - name:UIDeviceOrientationDidChangeNotification - object:nil]; -#endif - [RCTLayoutAnimation initializeStatics]; -} - -#pragma mark - Event emitting - -- (void)didReceiveNewContentSizeMultiplier -{ - // Report the event across the bridge. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_bridge.eventDispatcher sendDeviceEventWithName:@"didUpdateContentSizeMultiplier" - body:@([_bridge.accessibilityManager multiplier])]; -#pragma clang diagnostic pop - - RCTExecuteOnUIManagerQueue(^{ - [[NSNotificationCenter defaultCenter] postNotificationName:RCTUIManagerWillUpdateViewsDueToContentSizeMultiplierChangeNotification - object:self]; - [self setNeedsLayout]; - }); -} - -#if !TARGET_OS_TV -// Names and coordinate system from html5 spec: -// https://developer.mozilla.org/en-US/docs/Web/API/Screen.orientation -// https://developer.mozilla.org/en-US/docs/Web/API/Screen.lockOrientation -static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation) -{ - NSString *name; - NSNumber *degrees = @0; - BOOL isLandscape = NO; - switch(orientation) { - case UIDeviceOrientationPortrait: - name = @"portrait-primary"; - break; - case UIDeviceOrientationPortraitUpsideDown: - name = @"portrait-secondary"; - degrees = @180; - break; - case UIDeviceOrientationLandscapeRight: - name = @"landscape-primary"; - degrees = @-90; - isLandscape = YES; - break; - case UIDeviceOrientationLandscapeLeft: - name = @"landscape-secondary"; - degrees = @90; - isLandscape = YES; - break; - case UIDeviceOrientationFaceDown: - case UIDeviceOrientationFaceUp: - case UIDeviceOrientationUnknown: - // Unsupported - return nil; - } - return @{ - @"name": name, - @"rotationDegrees": degrees, - @"isLandscape": @(isLandscape), - }; -} - -- (void)namedOrientationDidChange -{ - NSDictionary *orientationEvent = deviceOrientationEventBody([UIDevice currentDevice].orientation); - if (!orientationEvent) { - return; - } - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_bridge.eventDispatcher sendDeviceEventWithName:@"namedOrientationDidChange" - body:orientationEvent]; -#pragma clang diagnostic pop -} -#endif - -- (dispatch_queue_t)methodQueue -{ - return RCTGetUIManagerQueue(); -} - -- (void)registerRootViewTag:(NSNumber *)rootTag -{ - RCTAssertUIManagerQueue(); - - RCTAssert(RCTIsReactRootView(rootTag), - @"Attempt to register rootTag (%@) which is not actually root tag.", rootTag); - - RCTAssert(![_rootViewTags containsObject:rootTag], - @"Attempt to register rootTag (%@) which was already registred.", rootTag); - - [_rootViewTags addObject:rootTag]; - - // Registering root shadow view - RCTSurfaceRootShadowView *shadowView = [RCTSurfaceRootShadowView new]; - shadowView.reactTag = rootTag; - _shadowViewRegistry[rootTag] = shadowView; - - // Registering root view - RCTExecuteOnMainQueue(^{ - RCTSurfaceRootView *rootView = [RCTSurfaceRootView new]; - rootView.reactTag = rootTag; - self->_viewRegistry[rootTag] = rootView; - }); -} - -- (void)registerRootView:(RCTRootContentView *)rootView -{ - RCTAssertMainQueue(); - - NSNumber *reactTag = rootView.reactTag; - RCTAssert(RCTIsReactRootView(reactTag), - @"View %@ with tag #%@ is not a root view", rootView, reactTag); - - UIView *existingView = _viewRegistry[reactTag]; - RCTAssert(existingView == nil || existingView == rootView, - @"Expect all root views to have unique tag. Added %@ twice", reactTag); - - CGSize availableSize = rootView.availableSize; - - // Register view - _viewRegistry[reactTag] = rootView; - - // Register shadow view - RCTExecuteOnUIManagerQueue(^{ - if (!self->_viewRegistry) { - return; - } - - RCTRootShadowView *shadowView = [RCTRootShadowView new]; - shadowView.availableSize = availableSize; - shadowView.reactTag = reactTag; - shadowView.viewName = NSStringFromClass([rootView class]); - self->_shadowViewRegistry[shadowView.reactTag] = shadowView; - [self->_rootViewTags addObject:reactTag]; - }); -} - -- (NSString *)viewNameForReactTag:(NSNumber *)reactTag -{ - RCTAssertUIManagerQueue(); - return _shadowViewRegistry[reactTag].viewName; -} - -- (UIView *)viewForReactTag:(NSNumber *)reactTag -{ - RCTAssertMainQueue(); - return _viewRegistry[reactTag]; -} - -- (RCTShadowView *)shadowViewForReactTag:(NSNumber *)reactTag -{ - RCTAssertUIManagerQueue(); - return _shadowViewRegistry[reactTag]; -} - -- (void)_executeBlockWithShadowView:(void (^)(RCTShadowView *shadowView))block forTag:(NSNumber *)tag -{ - RCTAssertMainQueue(); - - RCTExecuteOnUIManagerQueue(^{ - RCTShadowView *shadowView = self->_shadowViewRegistry[tag]; - - if (shadowView == nil) { - RCTLogInfo(@"Could not locate shadow view with tag #%@, this is probably caused by a temporary inconsistency between native views and shadow views.", tag); - return; - } - - block(shadowView); - }); -} - -- (void)setAvailableSize:(CGSize)availableSize forRootView:(UIView *)rootView -{ - RCTAssertMainQueue(); - [self _executeBlockWithShadowView:^(RCTShadowView *shadowView) { - RCTAssert([shadowView isKindOfClass:[RCTRootShadowView class]], @"Located shadow view is actually not root view."); - - RCTRootShadowView *rootShadowView = (RCTRootShadowView *)shadowView; - - if (CGSizeEqualToSize(availableSize, rootShadowView.availableSize)) { - return; - } - - rootShadowView.availableSize = availableSize; - [self setNeedsLayout]; - } forTag:rootView.reactTag]; -} - -- (void)setLocalData:(NSObject *)localData forView:(UIView *)view -{ - RCTAssertMainQueue(); - [self _executeBlockWithShadowView:^(RCTShadowView *shadowView) { - shadowView.localData = localData; - [self setNeedsLayout]; - } forTag:view.reactTag]; -} - -/** - * TODO(yuwang): implement the nativeID functionality in a more efficient way - * instead of searching the whole view tree - */ -- (UIView *)viewForNativeID:(NSString *)nativeID withRootTag:(NSNumber *)rootTag -{ - RCTAssertMainQueue(); - UIView *view = [self viewForReactTag:rootTag]; - return [self _lookupViewForNativeID:nativeID inView:view]; -} - -- (UIView *)_lookupViewForNativeID:(NSString *)nativeID inView:(UIView *)view -{ - RCTAssertMainQueue(); - if (view != nil && [nativeID isEqualToString:view.nativeID]) { - return view; - } - - for (UIView *subview in view.subviews) { - UIView *targetView = [self _lookupViewForNativeID:nativeID inView:subview]; - if (targetView != nil) { - return targetView; - } - } - return nil; -} - -- (void)setSize:(CGSize)size forView:(UIView *)view -{ - RCTAssertMainQueue(); - [self _executeBlockWithShadowView:^(RCTShadowView *shadowView) { - if (CGSizeEqualToSize(size, shadowView.size)) { - return; - } - - shadowView.size = size; - [self setNeedsLayout]; - } forTag:view.reactTag]; -} - -- (void)setIntrinsicContentSize:(CGSize)intrinsicContentSize forView:(UIView *)view -{ - RCTAssertMainQueue(); - [self _executeBlockWithShadowView:^(RCTShadowView *shadowView) { - if (CGSizeEqualToSize(shadowView.intrinsicContentSize, intrinsicContentSize)) { - return; - } - - shadowView.intrinsicContentSize = intrinsicContentSize; - [self setNeedsLayout]; - } forTag:view.reactTag]; -} - -/** - * Unregisters views from registries - */ -- (void)_purgeChildren:(NSArray> *)children - fromRegistry:(NSMutableDictionary> *)registry -{ - for (id child in children) { - RCTTraverseViewNodes(registry[child.reactTag], ^(id subview) { - RCTAssert(![subview isReactRootView], @"Root views should not be unregistered"); - if ([subview conformsToProtocol:@protocol(RCTInvalidating)]) { - [(id)subview invalidate]; - } - [registry removeObjectForKey:subview.reactTag]; - }); - } -} - -- (void)addUIBlock:(RCTViewManagerUIBlock)block -{ - RCTAssertUIManagerQueue(); - - if (!block || !_viewRegistry) { - return; - } - - [_pendingUIBlocks addObject:block]; -} - -- (void)prependUIBlock:(RCTViewManagerUIBlock)block -{ - RCTAssertUIManagerQueue(); - - if (!block || !_viewRegistry) { - return; - } - - [_pendingUIBlocks insertObject:block atIndex:0]; -} - -- (void)setNextLayoutAnimationGroup:(RCTLayoutAnimationGroup *)layoutAnimationGroup -{ - RCTAssertMainQueue(); - - if (_layoutAnimationGroup && ![_layoutAnimationGroup isEqual:layoutAnimationGroup]) { - RCTLogWarn(@"Warning: Overriding previous layout animation with new one before the first began:\n%@ -> %@.", - [_layoutAnimationGroup description], - [layoutAnimationGroup description]); - } - - _layoutAnimationGroup = layoutAnimationGroup; -} - -- (RCTViewManagerUIBlock)uiBlockWithLayoutUpdateForRootView:(RCTRootShadowView *)rootShadowView -{ - RCTAssertUIManagerQueue(); - - NSHashTable *affectedShadowViews = [NSHashTable weakObjectsHashTable]; - [rootShadowView layoutWithAffectedShadowViews:affectedShadowViews]; - - if (!affectedShadowViews.count) { - // no frame change results in no UI update block - return nil; - } - - typedef struct { - CGRect frame; - UIUserInterfaceLayoutDirection layoutDirection; - BOOL isNew; - BOOL parentIsNew; - RCTDisplayType displayType; - } RCTFrameData; - - // Construct arrays then hand off to main thread - NSUInteger count = affectedShadowViews.count; - NSMutableArray *reactTags = [[NSMutableArray alloc] initWithCapacity:count]; - NSMutableData *framesData = [[NSMutableData alloc] initWithLength:sizeof(RCTFrameData) * count]; - { - NSUInteger index = 0; - RCTFrameData *frameDataArray = (RCTFrameData *)framesData.mutableBytes; - for (RCTShadowView *shadowView in affectedShadowViews) { - reactTags[index] = shadowView.reactTag; - RCTLayoutMetrics layoutMetrics = shadowView.layoutMetrics; - frameDataArray[index++] = (RCTFrameData){ - layoutMetrics.frame, - layoutMetrics.layoutDirection, - shadowView.isNewView, - shadowView.superview.isNewView, - layoutMetrics.displayType - }; - } - } - - for (RCTShadowView *shadowView in affectedShadowViews) { - - // We have to do this after we build the parentsAreNew array. - shadowView.newView = NO; - - NSNumber *reactTag = shadowView.reactTag; - - if (shadowView.onLayout) { - CGRect frame = shadowView.layoutMetrics.frame; - shadowView.onLayout(@{ - @"layout": @{ - @"x": @(frame.origin.x), - @"y": @(frame.origin.y), - @"width": @(frame.size.width), - @"height": @(frame.size.height), - }, - }); - } - - if ( - RCTIsReactRootView(reactTag) && - [shadowView isKindOfClass:[RCTRootShadowView class]] - ) { - CGSize contentSize = shadowView.layoutMetrics.frame.size; - - RCTExecuteOnMainQueue(^{ - UIView *view = self->_viewRegistry[reactTag]; - RCTAssert(view != nil, @"view (for ID %@) not found", reactTag); - - RCTRootView *rootView = (RCTRootView *)[view superview]; - if ([rootView isKindOfClass:[RCTRootView class]]) { - rootView.intrinsicContentSize = contentSize; - } - }); - } - } - - // Perform layout (possibly animated) - return ^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - - const RCTFrameData *frameDataArray = (const RCTFrameData *)framesData.bytes; - RCTLayoutAnimationGroup *layoutAnimationGroup = uiManager->_layoutAnimationGroup; - - __block NSUInteger completionsCalled = 0; - - NSInteger index = 0; - for (NSNumber *reactTag in reactTags) { - RCTFrameData frameData = frameDataArray[index++]; - - UIView *view = viewRegistry[reactTag]; - CGRect frame = frameData.frame; - - UIUserInterfaceLayoutDirection layoutDirection = frameData.layoutDirection; - BOOL isNew = frameData.isNew; - RCTLayoutAnimation *updatingLayoutAnimation = isNew ? nil : layoutAnimationGroup.updatingLayoutAnimation; - BOOL shouldAnimateCreation = isNew && !frameData.parentIsNew; - RCTLayoutAnimation *creatingLayoutAnimation = shouldAnimateCreation ? layoutAnimationGroup.creatingLayoutAnimation : nil; - BOOL isHidden = frameData.displayType == RCTDisplayTypeNone; - - void (^completion)(BOOL) = ^(BOOL finished) { - completionsCalled++; - if (layoutAnimationGroup.callback && completionsCalled == count) { - layoutAnimationGroup.callback(@[@(finished)]); - - // It's unsafe to call this callback more than once, so we nil it out here - // to make sure that doesn't happen. - layoutAnimationGroup.callback = nil; - } - }; - - if (view.reactLayoutDirection != layoutDirection) { - view.reactLayoutDirection = layoutDirection; - } - - if (view.isHidden != isHidden) { - view.hidden = isHidden; - } - - if (creatingLayoutAnimation) { - - // Animate view creation - [view reactSetFrame:frame]; - - CATransform3D finalTransform = view.layer.transform; - CGFloat finalOpacity = view.layer.opacity; - - NSString *property = creatingLayoutAnimation.property; - if ([property isEqualToString:@"scaleXY"]) { - view.layer.transform = CATransform3DMakeScale(0, 0, 0); - } else if ([property isEqualToString:@"scaleX"]) { - view.layer.transform = CATransform3DMakeScale(0, 1, 0); - } else if ([property isEqualToString:@"scaleY"]) { - view.layer.transform = CATransform3DMakeScale(1, 0, 0); - } else if ([property isEqualToString:@"opacity"]) { - view.layer.opacity = 0.0; - } else { - RCTLogError(@"Unsupported layout animation createConfig property %@", - creatingLayoutAnimation.property); - } - - [creatingLayoutAnimation performAnimations:^{ - if ( - [property isEqualToString:@"scaleX"] || - [property isEqualToString:@"scaleY"] || - [property isEqualToString:@"scaleXY"] - ) { - view.layer.transform = finalTransform; - } else if ([property isEqualToString:@"opacity"]) { - view.layer.opacity = finalOpacity; - } - } withCompletionBlock:completion]; - - } else if (updatingLayoutAnimation) { - - // Animate view update - [updatingLayoutAnimation performAnimations:^{ - [view reactSetFrame:frame]; - } withCompletionBlock:completion]; - - } else { - - // Update without animation - [view reactSetFrame:frame]; - completion(YES); - } - } - - // Clean up - uiManager->_layoutAnimationGroup = nil; - }; -} - -/** - * A method to be called from JS, which takes a container ID and then releases - * all subviews for that container upon receipt. - */ -RCT_EXPORT_METHOD(removeSubviewsFromContainerWithID:(nonnull NSNumber *)containerID) -{ - id container = _shadowViewRegistry[containerID]; - RCTAssert(container != nil, @"container view (for ID %@) not found", containerID); - - NSUInteger subviewsCount = [container reactSubviews].count; - NSMutableArray *indices = [[NSMutableArray alloc] initWithCapacity:subviewsCount]; - for (NSUInteger childIndex = 0; childIndex < subviewsCount; childIndex++) { - [indices addObject:@(childIndex)]; - } - - [self manageChildren:containerID - moveFromIndices:nil - moveToIndices:nil - addChildReactTags:nil - addAtIndices:nil - removeAtIndices:indices]; -} - -/** - * Disassociates children from container. Doesn't remove from registries. - * TODO: use [NSArray getObjects:buffer] to reuse same fast buffer each time. - * - * @returns Array of removed items. - */ -- (NSArray> *)_childrenToRemoveFromContainer:(id)container - atIndices:(NSArray *)atIndices -{ - // If there are no indices to move or the container has no subviews don't bother - // We support parents with nil subviews so long as they're all nil so this allows for this behavior - if (atIndices.count == 0 || [container reactSubviews].count == 0) { - return nil; - } - // Construction of removed children must be done "up front", before indices are disturbed by removals. - NSMutableArray> *removedChildren = [NSMutableArray arrayWithCapacity:atIndices.count]; - RCTAssert(container != nil, @"container view (for ID %@) not found", container); - for (NSNumber *indexNumber in atIndices) { - NSUInteger index = indexNumber.unsignedIntegerValue; - if (index < [container reactSubviews].count) { - [removedChildren addObject:[container reactSubviews][index]]; - } - } - if (removedChildren.count != atIndices.count) { - NSString *message = [NSString stringWithFormat:@"removedChildren count (%tu) was not what we expected (%tu)", - removedChildren.count, atIndices.count]; - RCTFatal(RCTErrorWithMessage(message)); - } - return removedChildren; -} - -- (void)_removeChildren:(NSArray> *)children - fromContainer:(id)container -{ - for (id removedChild in children) { - [container removeReactSubview:removedChild]; - } -} - -/** - * Remove subviews from their parent with an animation. - */ -- (void)_removeChildren:(NSArray *)children - fromContainer:(UIView *)container - withAnimation:(RCTLayoutAnimationGroup *)animation -{ - RCTAssertMainQueue(); - RCTLayoutAnimation *deletingLayoutAnimation = animation.deletingLayoutAnimation; - - __block NSUInteger completionsCalled = 0; - for (UIView *removedChild in children) { - - void (^completion)(BOOL) = ^(BOOL finished) { - completionsCalled++; - - [removedChild removeFromSuperview]; - - if (animation.callback && completionsCalled == children.count) { - animation.callback(@[@(finished)]); - - // It's unsafe to call this callback more than once, so we nil it out here - // to make sure that doesn't happen. - animation.callback = nil; - } - }; - - // Hack: At this moment we have two contradict intents. - // First one: We want to delete the view from view hierarchy. - // Second one: We want to animate this view, which implies the existence of this view in the hierarchy. - // So, we have to remove this view from React's view hierarchy but postpone removing from UIKit's hierarchy. - // Here the problem: the default implementation of `-[UIView removeReactSubview:]` also removes the view from UIKit's hierarchy. - // So, let's temporary restore the view back after removing. - // To do so, we have to memorize original `superview` (which can differ from `container`) and an index of removed view. - UIView *originalSuperview = removedChild.superview; - NSUInteger originalIndex = [originalSuperview.subviews indexOfObjectIdenticalTo:removedChild]; - [container removeReactSubview:removedChild]; - // Disable user interaction while the view is animating - // since the view is (conceptually) deleted and not supposed to be interactive. - removedChild.userInteractionEnabled = NO; - [originalSuperview insertSubview:removedChild atIndex:originalIndex]; - - NSString *property = deletingLayoutAnimation.property; - [deletingLayoutAnimation performAnimations:^{ - if ([property isEqualToString:@"scaleXY"]) { - removedChild.layer.transform = CATransform3DMakeScale(0.001, 0.001, 0.001); - } else if ([property isEqualToString:@"scaleX"]) { - removedChild.layer.transform = CATransform3DMakeScale(0.001, 1, 0.001); - } else if ([property isEqualToString:@"scaleY"]) { - removedChild.layer.transform = CATransform3DMakeScale(1, 0.001, 0.001); - } else if ([property isEqualToString:@"opacity"]) { - removedChild.layer.opacity = 0.0; - } else { - RCTLogError(@"Unsupported layout animation createConfig property %@", - deletingLayoutAnimation.property); - } - } withCompletionBlock:completion]; - } -} - - -RCT_EXPORT_METHOD(removeRootView:(nonnull NSNumber *)rootReactTag) -{ - RCTShadowView *rootShadowView = _shadowViewRegistry[rootReactTag]; - RCTAssert(rootShadowView.superview == nil, @"root view cannot have superview (ID %@)", rootReactTag); - [self _purgeChildren:(NSArray> *)rootShadowView.reactSubviews - fromRegistry:(NSMutableDictionary> *)_shadowViewRegistry]; - [_shadowViewRegistry removeObjectForKey:rootReactTag]; - [_rootViewTags removeObject:rootReactTag]; - - [self addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry){ - RCTAssertMainQueue(); - UIView *rootView = viewRegistry[rootReactTag]; - [uiManager _purgeChildren:(NSArray> *)rootView.reactSubviews - fromRegistry:(NSMutableDictionary> *)viewRegistry]; - [(NSMutableDictionary *)viewRegistry removeObjectForKey:rootReactTag]; - }]; -} - -RCT_EXPORT_METHOD(replaceExistingNonRootView:(nonnull NSNumber *)reactTag - withView:(nonnull NSNumber *)newReactTag) -{ - RCTShadowView *shadowView = _shadowViewRegistry[reactTag]; - RCTAssert(shadowView != nil, @"shadowView (for ID %@) not found", reactTag); - - RCTShadowView *superShadowView = shadowView.superview; - if (!superShadowView) { - RCTAssert(NO, @"shadowView super (of ID %@) not found", reactTag); - return; - } - - NSUInteger indexOfView = [superShadowView.reactSubviews indexOfObjectIdenticalTo:shadowView]; - RCTAssert(indexOfView != NSNotFound, @"View's superview doesn't claim it as subview (id %@)", reactTag); - NSArray *removeAtIndices = @[@(indexOfView)]; - NSArray *addTags = @[newReactTag]; - [self manageChildren:superShadowView.reactTag - moveFromIndices:nil - moveToIndices:nil - addChildReactTags:addTags - addAtIndices:removeAtIndices - removeAtIndices:removeAtIndices]; -} - -RCT_EXPORT_METHOD(setChildren:(nonnull NSNumber *)containerTag - reactTags:(NSArray *)reactTags) -{ - RCTSetChildren(containerTag, reactTags, - (NSDictionary> *)_shadowViewRegistry); - - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry){ - - RCTSetChildren(containerTag, reactTags, - (NSDictionary> *)viewRegistry); - }]; - - [self _shadowViewDidReceiveUpdatedChildren:_shadowViewRegistry[containerTag]]; -} - -static void RCTSetChildren(NSNumber *containerTag, - NSArray *reactTags, - NSDictionary> *registry) -{ - id container = registry[containerTag]; - NSInteger index = 0; - for (NSNumber *reactTag in reactTags) { - id view = registry[reactTag]; - if (view) { - [container insertReactSubview:view atIndex:index++]; - } - } -} - -RCT_EXPORT_METHOD(manageChildren:(nonnull NSNumber *)containerTag - moveFromIndices:(NSArray *)moveFromIndices - moveToIndices:(NSArray *)moveToIndices - addChildReactTags:(NSArray *)addChildReactTags - addAtIndices:(NSArray *)addAtIndices - removeAtIndices:(NSArray *)removeAtIndices) -{ - [self _manageChildren:containerTag - moveFromIndices:moveFromIndices - moveToIndices:moveToIndices - addChildReactTags:addChildReactTags - addAtIndices:addAtIndices - removeAtIndices:removeAtIndices - registry:(NSMutableDictionary> *)_shadowViewRegistry]; - - [self addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry){ - [uiManager _manageChildren:containerTag - moveFromIndices:moveFromIndices - moveToIndices:moveToIndices - addChildReactTags:addChildReactTags - addAtIndices:addAtIndices - removeAtIndices:removeAtIndices - registry:(NSMutableDictionary> *)viewRegistry]; - }]; - - [self _shadowViewDidReceiveUpdatedChildren:_shadowViewRegistry[containerTag]]; -} - -- (void)_manageChildren:(NSNumber *)containerTag - moveFromIndices:(NSArray *)moveFromIndices - moveToIndices:(NSArray *)moveToIndices - addChildReactTags:(NSArray *)addChildReactTags - addAtIndices:(NSArray *)addAtIndices - removeAtIndices:(NSArray *)removeAtIndices - registry:(NSMutableDictionary> *)registry -{ - id container = registry[containerTag]; - RCTAssert(moveFromIndices.count == moveToIndices.count, @"moveFromIndices had size %tu, moveToIndices had size %tu", moveFromIndices.count, moveToIndices.count); - RCTAssert(addChildReactTags.count == addAtIndices.count, @"there should be at least one React child to add"); - - // Removes (both permanent and temporary moves) are using "before" indices - NSArray> *permanentlyRemovedChildren = - [self _childrenToRemoveFromContainer:container atIndices:removeAtIndices]; - NSArray> *temporarilyRemovedChildren = - [self _childrenToRemoveFromContainer:container atIndices:moveFromIndices]; - - BOOL isUIViewRegistry = ((id)registry == (id)_viewRegistry); - if (isUIViewRegistry && _layoutAnimationGroup.deletingLayoutAnimation) { - [self _removeChildren:(NSArray *)permanentlyRemovedChildren - fromContainer:(UIView *)container - withAnimation:_layoutAnimationGroup]; - } else { - [self _removeChildren:permanentlyRemovedChildren fromContainer:container]; - } - - [self _removeChildren:temporarilyRemovedChildren fromContainer:container]; - [self _purgeChildren:permanentlyRemovedChildren fromRegistry:registry]; - - // Figure out what to insert - merge temporary inserts and adds - NSMutableDictionary *destinationsToChildrenToAdd = [NSMutableDictionary dictionary]; - for (NSInteger index = 0, length = temporarilyRemovedChildren.count; index < length; index++) { - destinationsToChildrenToAdd[moveToIndices[index]] = temporarilyRemovedChildren[index]; - } - - for (NSInteger index = 0, length = addAtIndices.count; index < length; index++) { - id view = registry[addChildReactTags[index]]; - if (view) { - destinationsToChildrenToAdd[addAtIndices[index]] = view; - } - } - - NSArray *sortedIndices = - [destinationsToChildrenToAdd.allKeys sortedArrayUsingSelector:@selector(compare:)]; - for (NSNumber *reactIndex in sortedIndices) { - [container insertReactSubview:destinationsToChildrenToAdd[reactIndex] - atIndex:reactIndex.integerValue]; - } -} - -RCT_EXPORT_METHOD(createView:(nonnull NSNumber *)reactTag - viewName:(NSString *)viewName - rootTag:(nonnull NSNumber *)rootTag - props:(NSDictionary *)props) -{ - RCTComponentData *componentData = _componentDataByName[viewName]; - if (componentData == nil) { - RCTLogError(@"No component found for view with name \"%@\"", viewName); - } - - // Register shadow view - RCTShadowView *shadowView = [componentData createShadowViewWithTag:reactTag]; - if (shadowView) { - [componentData setProps:props forShadowView:shadowView]; - _shadowViewRegistry[reactTag] = shadowView; - RCTShadowView *rootView = _shadowViewRegistry[rootTag]; - RCTAssert([rootView isKindOfClass:[RCTRootShadowView class]] || - [rootView isKindOfClass:[RCTSurfaceRootShadowView class]], - @"Given `rootTag` (%@) does not correspond to a valid root shadow view instance.", rootTag); - shadowView.rootView = (RCTRootShadowView *)rootView; - } - - // Dispatch view creation directly to the main thread instead of adding to - // UIBlocks array. This way, it doesn't get deferred until after layout. - __block UIView *preliminaryCreatedView = nil; - - void (^createViewBlock)(void) = ^{ - // Do nothing on the second run. - if (preliminaryCreatedView) { - return; - } - - preliminaryCreatedView = [componentData createViewWithTag:reactTag]; - - if (preliminaryCreatedView) { - self->_viewRegistry[reactTag] = preliminaryCreatedView; - } - }; - - // We cannot guarantee that asynchronously scheduled block will be executed - // *before* a block is added to the regular mounting process (simply because - // mounting process can be managed externally while the main queue is - // locked). - // So, we positively dispatch it asynchronously and double check inside - // the regular mounting block. - - RCTExecuteOnMainQueue(createViewBlock); - - [self addUIBlock:^(__unused RCTUIManager *uiManager, __unused NSDictionary *viewRegistry) { - createViewBlock(); - - if (preliminaryCreatedView) { - [componentData setProps:props forView:preliminaryCreatedView]; - } - }]; - - [self _shadowView:shadowView didReceiveUpdatedProps:[props allKeys]]; -} - -RCT_EXPORT_METHOD(updateView:(nonnull NSNumber *)reactTag - viewName:(NSString *)viewName // not always reliable, use shadowView.viewName if available - props:(NSDictionary *)props) -{ - RCTShadowView *shadowView = _shadowViewRegistry[reactTag]; - RCTComponentData *componentData = _componentDataByName[shadowView.viewName ?: viewName]; - [componentData setProps:props forShadowView:shadowView]; - - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - UIView *view = viewRegistry[reactTag]; - [componentData setProps:props forView:view]; - }]; - - [self _shadowView:shadowView didReceiveUpdatedProps:[props allKeys]]; -} - -- (void)synchronouslyUpdateViewOnUIThread:(NSNumber *)reactTag - viewName:(NSString *)viewName - props:(NSDictionary *)props -{ - RCTAssertMainQueue(); - RCTComponentData *componentData = _componentDataByName[viewName]; - UIView *view = _viewRegistry[reactTag]; - [componentData setProps:props forView:view]; -} - -RCT_EXPORT_METHOD(focus:(nonnull NSNumber *)reactTag) -{ - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - UIView *newResponder = viewRegistry[reactTag]; - [newResponder reactFocus]; - }]; -} - -RCT_EXPORT_METHOD(blur:(nonnull NSNumber *)reactTag) -{ - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry){ - UIView *currentResponder = viewRegistry[reactTag]; - [currentResponder reactBlur]; - }]; -} - -RCT_EXPORT_METHOD(findSubviewIn:(nonnull NSNumber *)reactTag atPoint:(CGPoint)point callback:(RCTResponseSenderBlock)callback) -{ - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - UIView *view = viewRegistry[reactTag]; - UIView *target = [view hitTest:point withEvent:nil]; - CGRect frame = [target convertRect:target.bounds toView:view]; - - while (target.reactTag == nil && target.superview != nil) { - target = target.superview; - } - - callback(@[ - RCTNullIfNil(target.reactTag), - @(frame.origin.x), - @(frame.origin.y), - @(frame.size.width), - @(frame.size.height), - ]); - }]; -} - -RCT_EXPORT_METHOD(dispatchViewManagerCommand:(nonnull NSNumber *)reactTag - commandID:(NSInteger)commandID - commandArgs:(NSArray *)commandArgs) -{ - RCTShadowView *shadowView = _shadowViewRegistry[reactTag]; - RCTComponentData *componentData = _componentDataByName[shadowView.viewName]; - Class managerClass = componentData.managerClass; - RCTModuleData *moduleData = [_bridge moduleDataForName:RCTBridgeModuleNameForClass(managerClass)]; - id method = moduleData.methods[commandID]; - - NSArray *args = [@[reactTag] arrayByAddingObjectsFromArray:commandArgs]; - [method invokeWithBridge:_bridge module:componentData.manager arguments:args]; -} - -- (void)batchDidComplete -{ - [self _layoutAndMount]; -} - -/** - * Sets up animations, computes layout, creates UI mounting blocks for computed layout, - * runs these blocks and all other already existing blocks. - */ -- (void)_layoutAndMount -{ - [self _dispatchPropsDidChangeEvents]; - [self _dispatchChildrenDidChangeEvents]; - - [_observerCoordinator uiManagerWillPerformLayout:self]; - - // Perform layout - for (NSNumber *reactTag in _rootViewTags) { - RCTRootShadowView *rootView = (RCTRootShadowView *)_shadowViewRegistry[reactTag]; - [self addUIBlock:[self uiBlockWithLayoutUpdateForRootView:rootView]]; - } - - [_observerCoordinator uiManagerDidPerformLayout:self]; - - [_observerCoordinator uiManagerWillPerformMounting:self]; - - [self flushUIBlocksWithCompletion:^{ - [self->_observerCoordinator uiManagerDidPerformMounting:self]; - }]; -} - -- (void)flushUIBlocksWithCompletion:(void (^)(void))completion; -{ - RCTAssertUIManagerQueue(); - - // First copy the previous blocks into a temporary variable, then reset the - // pending blocks to a new array. This guards against mutation while - // processing the pending blocks in another thread. - NSArray *previousPendingUIBlocks = _pendingUIBlocks; - _pendingUIBlocks = [NSMutableArray new]; - - if (previousPendingUIBlocks.count == 0) { - completion(); - return; - } - - __weak typeof(self) weakSelf = self; - - void (^mountingBlock)(void) = ^{ - typeof(self) strongSelf = weakSelf; - - @try { - for (RCTViewManagerUIBlock block in previousPendingUIBlocks) { - block(strongSelf, strongSelf->_viewRegistry); - } - } - @catch (NSException *exception) { - RCTLogError(@"Exception thrown while executing UI block: %@", exception); - } - }; - - if ([self.observerCoordinator uiManager:self performMountingWithBlock:mountingBlock]) { - completion(); - return; - } - - // Execute the previously queued UI blocks - RCTProfileBeginFlowEvent(); - RCTExecuteOnMainQueue(^{ - RCTProfileEndFlowEvent(); - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[UIManager flushUIBlocks]", (@{ - @"count": [@(previousPendingUIBlocks.count) stringValue], - })); - - mountingBlock(); - - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); - - RCTExecuteOnUIManagerQueue(completion); - }); -} - -- (void)setNeedsLayout -{ - // If there is an active batch layout will happen when batch finished, so we will wait for that. - // Otherwise we immediately trigger layout. - if (![_bridge isBatchActive] && ![_bridge isLoading]) { - [self _layoutAndMount]; - } -} - -- (void)_shadowView:(RCTShadowView *)shadowView didReceiveUpdatedProps:(NSArray *)props -{ - // We collect a set with changed `shadowViews` and its changed props, - // so we have to maintain this collection properly. - NSArray *previousProps; - if ((previousProps = [_shadowViewsWithUpdatedProps objectForKey:shadowView])) { - // Merging already registred changed props and new ones. - NSMutableSet *set = [NSMutableSet setWithArray:previousProps]; - [set addObjectsFromArray:props]; - props = [set allObjects]; - } - - [_shadowViewsWithUpdatedProps setObject:props forKey:shadowView]; -} - -- (void)_shadowViewDidReceiveUpdatedChildren:(RCTShadowView *)shadowView -{ - [_shadowViewsWithUpdatedChildren addObject:shadowView]; -} - -- (void)_dispatchChildrenDidChangeEvents -{ - if (_shadowViewsWithUpdatedChildren.count == 0) { - return; - } - - NSHashTable *shadowViews = _shadowViewsWithUpdatedChildren; - _shadowViewsWithUpdatedChildren = [NSHashTable weakObjectsHashTable]; - - NSMutableArray *tags = [NSMutableArray arrayWithCapacity:shadowViews.count]; - - for (RCTShadowView *shadowView in shadowViews) { - [shadowView didUpdateReactSubviews]; - [tags addObject:shadowView.reactTag]; - } - - [self addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { - for (NSNumber *tag in tags) { - UIView *view = viewRegistry[tag]; - [view didUpdateReactSubviews]; - } - }]; -} - -- (void)_dispatchPropsDidChangeEvents -{ - if (_shadowViewsWithUpdatedProps.count == 0) { - return; - } - - NSMapTable *> *shadowViews = _shadowViewsWithUpdatedProps; - _shadowViewsWithUpdatedProps = [NSMapTable weakToStrongObjectsMapTable]; - - NSMapTable *> *tags = [NSMapTable strongToStrongObjectsMapTable]; - - for (RCTShadowView *shadowView in shadowViews) { - NSArray *props = [shadowViews objectForKey:shadowView]; - [shadowView didSetProps:props]; - [tags setObject:props forKey:shadowView.reactTag]; - } - - [self addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { - for (NSNumber *tag in tags) { - UIView *view = viewRegistry[tag]; - [view didSetProps:[tags objectForKey:tag]]; - } - }]; -} - -RCT_EXPORT_METHOD(measure:(nonnull NSNumber *)reactTag - callback:(RCTResponseSenderBlock)callback) -{ - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - UIView *view = viewRegistry[reactTag]; - if (!view) { - // this view was probably collapsed out - RCTLogWarn(@"measure cannot find view with tag #%@", reactTag); - callback(@[]); - return; - } - - // If in a , rootView will be the root of the modal container. - UIView *rootView = view; - while (rootView.superview && ![rootView isReactRootView]) { - rootView = rootView.superview; - } - - // By convention, all coordinates, whether they be touch coordinates, or - // measurement coordinates are with respect to the root view. - CGRect frame = view.frame; - CGRect globalBounds = [view convertRect:view.bounds toView:rootView]; - - callback(@[ - @(frame.origin.x), - @(frame.origin.y), - @(globalBounds.size.width), - @(globalBounds.size.height), - @(globalBounds.origin.x), - @(globalBounds.origin.y), - ]); - }]; -} - -RCT_EXPORT_METHOD(measureInWindow:(nonnull NSNumber *)reactTag - callback:(RCTResponseSenderBlock)callback) -{ - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - UIView *view = viewRegistry[reactTag]; - if (!view) { - // this view was probably collapsed out - RCTLogWarn(@"measure cannot find view with tag #%@", reactTag); - callback(@[]); - return; - } - - // Return frame coordinates in window - CGRect windowFrame = [view.window convertRect:view.frame fromView:view.superview]; - callback(@[ - @(windowFrame.origin.x), - @(windowFrame.origin.y), - @(windowFrame.size.width), - @(windowFrame.size.height), - ]); - }]; -} - -/** - * Returs if the shadow view provided has the `ancestor` shadow view as - * an actual ancestor. - */ -RCT_EXPORT_METHOD(viewIsDescendantOf:(nonnull NSNumber *)reactTag - ancestor:(nonnull NSNumber *)ancestorReactTag - callback:(RCTResponseSenderBlock)callback) -{ - RCTShadowView *shadowView = _shadowViewRegistry[reactTag]; - RCTShadowView *ancestorShadowView = _shadowViewRegistry[ancestorReactTag]; - if (!shadowView) { - return; - } - if (!ancestorShadowView) { - return; - } - BOOL viewIsAncestor = [shadowView viewIsDescendantOf:ancestorShadowView]; - callback(@[@(viewIsAncestor)]); -} - -static void RCTMeasureLayout(RCTShadowView *view, - RCTShadowView *ancestor, - RCTResponseSenderBlock callback) -{ - if (!view) { - return; - } - if (!ancestor) { - return; - } - CGRect result = [view measureLayoutRelativeToAncestor:ancestor]; - if (CGRectIsNull(result)) { - RCTLogError(@"view %@ (tag #%@) is not a descendant of %@ (tag #%@)", - view, view.reactTag, ancestor, ancestor.reactTag); - return; - } - CGFloat leftOffset = result.origin.x; - CGFloat topOffset = result.origin.y; - CGFloat width = result.size.width; - CGFloat height = result.size.height; - if (isnan(leftOffset) || isnan(topOffset) || isnan(width) || isnan(height)) { - RCTLogError(@"Attempted to measure layout but offset or dimensions were NaN"); - return; - } - callback(@[@(leftOffset), @(topOffset), @(width), @(height)]); -} - -/** - * Returns the computed recursive offset layout in a dictionary form. The - * returned values are relative to the `ancestor` shadow view. Returns `nil`, if - * the `ancestor` shadow view is not actually an `ancestor`. Does not touch - * anything on the main UI thread. Invokes supplied callback with (x, y, width, - * height). - */ -RCT_EXPORT_METHOD(measureLayout:(nonnull NSNumber *)reactTag - relativeTo:(nonnull NSNumber *)ancestorReactTag - errorCallback:(__unused RCTResponseSenderBlock)errorCallback - callback:(RCTResponseSenderBlock)callback) -{ - RCTShadowView *shadowView = _shadowViewRegistry[reactTag]; - RCTShadowView *ancestorShadowView = _shadowViewRegistry[ancestorReactTag]; - RCTMeasureLayout(shadowView, ancestorShadowView, callback); -} - -/** - * Returns the computed recursive offset layout in a dictionary form. The - * returned values are relative to the `ancestor` shadow view. Returns `nil`, if - * the `ancestor` shadow view is not actually an `ancestor`. Does not touch - * anything on the main UI thread. Invokes supplied callback with (x, y, width, - * height). - */ -RCT_EXPORT_METHOD(measureLayoutRelativeToParent:(nonnull NSNumber *)reactTag - errorCallback:(__unused RCTResponseSenderBlock)errorCallback - callback:(RCTResponseSenderBlock)callback) -{ - RCTShadowView *shadowView = _shadowViewRegistry[reactTag]; - RCTMeasureLayout(shadowView, shadowView.reactSuperview, callback); -} - -RCT_EXPORT_METHOD(takeSnapshot:(id /* NSString or NSNumber */)target - withOptions:(NSDictionary *)options - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject) -{ - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - - // Get view - UIView *view; - if (target == nil || [target isEqual:@"window"]) { - view = RCTKeyWindow(); - } else if ([target isKindOfClass:[NSNumber class]]) { - view = viewRegistry[target]; - if (!view) { - RCTLogError(@"No view found with reactTag: %@", target); - return; - } - } - - // Get options - CGSize size = [RCTConvert CGSize:options]; - NSString *format = [RCTConvert NSString:options[@"format"] ?: @"png"]; - - // Capture image - if (size.width < 0.1 || size.height < 0.1) { - size = view.bounds.size; - } - UIGraphicsBeginImageContextWithOptions(size, NO, 0); - BOOL success = [view drawViewHierarchyInRect:(CGRect){CGPointZero, size} afterScreenUpdates:YES]; - UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - - if (!success || !image) { - reject(RCTErrorUnspecified, @"Failed to capture view snapshot.", nil); - return; - } - - // Convert image to data (on a background thread) - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - - NSData *data; - if ([format isEqualToString:@"png"]) { - data = UIImagePNGRepresentation(image); - } else if ([format isEqualToString:@"jpeg"]) { - CGFloat quality = [RCTConvert CGFloat:options[@"quality"] ?: @1]; - data = UIImageJPEGRepresentation(image, quality); - } else { - RCTLogError(@"Unsupported image format: %@", format); - return; - } - - // Save to a temp file - NSError *error = nil; - NSString *tempFilePath = RCTTempFilePath(format, &error); - if (tempFilePath) { - if ([data writeToFile:tempFilePath options:(NSDataWritingOptions)0 error:&error]) { - resolve(tempFilePath); - return; - } - } - - // If we reached here, something went wrong - reject(RCTErrorUnspecified, error.localizedDescription, error); - }); - }]; -} - -/** - * JS sets what *it* considers to be the responder. Later, scroll views can use - * this in order to determine if scrolling is appropriate. - */ -RCT_EXPORT_METHOD(setJSResponder:(nonnull NSNumber *)reactTag - blockNativeResponder:(__unused BOOL)blockNativeResponder) -{ - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - _jsResponder = viewRegistry[reactTag]; - if (!_jsResponder) { - RCTLogWarn(@"Invalid view set to be the JS responder - tag %@", reactTag); - } - }]; -} - -RCT_EXPORT_METHOD(clearJSResponder) -{ - [self addUIBlock:^(__unused RCTUIManager *uiManager, __unused NSDictionary *viewRegistry) { - _jsResponder = nil; - }]; -} - -static NSMutableDictionary *moduleConstantsForComponent( - NSMutableDictionary *directEvents, - NSMutableDictionary *bubblingEvents, - RCTComponentData *componentData) { - NSMutableDictionary *moduleConstants = [NSMutableDictionary new]; - - // Register which event-types this view dispatches. - // React needs this for the event plugin. - NSMutableDictionary *bubblingEventTypes = [NSMutableDictionary new]; - NSMutableDictionary *directEventTypes = [NSMutableDictionary new]; - - // Add manager class - moduleConstants[@"Manager"] = RCTBridgeModuleNameForClass(componentData.managerClass); - - // Add native props - NSDictionary *viewConfig = [componentData viewConfig]; - moduleConstants[@"NativeProps"] = viewConfig[@"propTypes"]; - moduleConstants[@"baseModuleName"] = viewConfig[@"baseModuleName"]; - moduleConstants[@"bubblingEventTypes"] = bubblingEventTypes; - moduleConstants[@"directEventTypes"] = directEventTypes; - - // Add direct events - for (NSString *eventName in viewConfig[@"directEvents"]) { - if (!directEvents[eventName]) { - directEvents[eventName] = @{ - @"registrationName": [eventName stringByReplacingCharactersInRange:(NSRange){0, 3} withString:@"on"], - }; - } - directEventTypes[eventName] = directEvents[eventName]; - if (RCT_DEBUG && bubblingEvents[eventName]) { - RCTLogError(@"Component '%@' re-registered bubbling event '%@' as a " - "direct event", componentData.name, eventName); - } - } - - // Add bubbling events - for (NSString *eventName in viewConfig[@"bubblingEvents"]) { - if (!bubblingEvents[eventName]) { - NSString *bubbleName = [eventName stringByReplacingCharactersInRange:(NSRange){0, 3} withString:@"on"]; - bubblingEvents[eventName] = @{ - @"phasedRegistrationNames": @{ - @"bubbled": bubbleName, - @"captured": [bubbleName stringByAppendingString:@"Capture"], - } - }; - } - bubblingEventTypes[eventName] = bubblingEvents[eventName]; - if (RCT_DEBUG && directEvents[eventName]) { - RCTLogError(@"Component '%@' re-registered direct event '%@' as a " - "bubbling event", componentData.name, eventName); - } - } - - return moduleConstants; -} - -- (NSDictionary *)constantsToExport -{ - return [self getConstants]; -} - -- (NSDictionary *)getConstants -{ - NSMutableDictionary *constants = [NSMutableDictionary new]; - NSMutableDictionary *directEvents = [NSMutableDictionary new]; - NSMutableDictionary *bubblingEvents = [NSMutableDictionary new]; - - [_componentDataByName enumerateKeysAndObjectsUsingBlock:^(NSString *name, RCTComponentData *componentData, __unused BOOL *stop) { - RCTAssert(!constants[name], @"UIManager already has constants for %@", componentData.name); - NSMutableDictionary *moduleConstants = moduleConstantsForComponent(directEvents, bubblingEvents, componentData); - constants[name] = moduleConstants; - }]; - - return constants; -} - -RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(lazilyLoadView:(NSString *)name) -{ - if (_componentDataByName[name]) { - return @{}; - } - - id delegate = self.bridge.delegate; - if (![delegate respondsToSelector:@selector(bridge:didNotFindModule:)]) { - return @{}; - } - - NSString *moduleName = name; - BOOL result = [delegate bridge:self.bridge didNotFindModule:moduleName]; - if (!result) { - moduleName = [name stringByAppendingString:@"Manager"]; - result = [delegate bridge:self.bridge didNotFindModule:moduleName]; - } - if (!result) { - return @{}; - } - - id module = [self.bridge moduleForName:moduleName]; - if (module == nil) { - // There is all sorts of code in this codebase that drops prefixes. - // - // If we didn't find a module, it's possible because it's stored under a key - // which had RCT Prefixes stripped. Lets check one more time... - module = [self.bridge moduleForName:RCTDropReactPrefixes(moduleName)]; - } - - if (!module) { - return @{}; - } - - RCTComponentData *componentData = [[RCTComponentData alloc] initWithManagerClass:[module class] bridge:self.bridge]; - _componentDataByName[componentData.name] = componentData; - NSMutableDictionary *directEvents = [NSMutableDictionary new]; - NSMutableDictionary *bubblingEvents = [NSMutableDictionary new]; - NSMutableDictionary *moduleConstants = moduleConstantsForComponent(directEvents, bubblingEvents, componentData); - return - @{ - @"viewConfig": moduleConstants, - }; -} - -RCT_EXPORT_METHOD(configureNextLayoutAnimation:(NSDictionary *)config - withCallback:(RCTResponseSenderBlock)callback - errorCallback:(__unused RCTResponseSenderBlock)errorCallback) -{ - RCTLayoutAnimationGroup *layoutAnimationGroup = - [[RCTLayoutAnimationGroup alloc] initWithConfig:config - callback:callback]; - - [self addUIBlock:^(RCTUIManager *uiManager, __unused NSDictionary *viewRegistry) { - [uiManager setNextLayoutAnimationGroup:layoutAnimationGroup]; - }]; -} - -- (void)rootViewForReactTag:(NSNumber *)reactTag withCompletion:(void (^)(UIView *view))completion -{ - RCTAssertMainQueue(); - RCTAssert(completion != nil, @"Attempted to resolve rootView for tag %@ without a completion block", reactTag); - - if (reactTag == nil) { - completion(nil); - return; - } - - RCTExecuteOnUIManagerQueue(^{ - NSNumber *rootTag = [self shadowViewForReactTag:reactTag].rootView.reactTag; - RCTExecuteOnMainQueue(^{ - UIView *rootView = nil; - if (rootTag != nil) { - rootView = [self viewForReactTag:rootTag]; - } - completion(rootView); - }); - }); -} - -static UIView *_jsResponder; - -+ (UIView *)JSResponder -{ - return _jsResponder; -} - -@end - -@implementation RCTBridge (RCTUIManager) - -- (RCTUIManager *)uiManager -{ - return [self moduleForClass:[RCTUIManager class]]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTUIManagerObserverCoordinator.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTUIManagerObserverCoordinator.h deleted file mode 100644 index efbcdeed..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTUIManagerObserverCoordinator.h +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -typedef dispatch_block_t RCTUIManagerMountingBlock; - -/** - * Allows hooking into UIManager internals. This can be used to execute code at - * specific points during the view updating process. - * New observers must not be added inside observer handlers. - * The particular order of handler invocation is not guaranteed. - * All observer handlers are called on UIManager queue. - */ -@protocol RCTUIManagerObserver - -@optional - -/** - * Called just before the UIManager layout views. - * It allows performing some operation for components which contain custom - * layout logic right before regular Yoga based layout. So, for instance, - * some components which have own React-independent state can compute and cache - * own intrinsic content size (which will be used by Yoga) at this point. - */ -- (void)uiManagerWillPerformLayout:(RCTUIManager *)manager; - -/** - * Called just after the UIManager layout views. - * It allows performing custom layout logic right after regular Yoga based layout. - * So, for instance, this can be used for computing final layout for a component, - * since it has its final frame set by Yoga at this point. - */ -- (void)uiManagerDidPerformLayout:(RCTUIManager *)manager; - -/** - * Called before flushing UI blocks at the end of a batch. - * This is called from the UIManager queue. Can be used to add UI operations in that batch. - */ -- (void)uiManagerWillPerformMounting:(RCTUIManager *)manager; - -/** - * Called right before flushing UI blocks and allows to intercept the mounting process. - * Return `YES` to cancel default execution of the `block` (and perform the - * execution later). - */ -- (BOOL)uiManager:(RCTUIManager *)manager performMountingWithBlock:(RCTUIManagerMountingBlock)block; - -/** - * Called just after flushing UI blocks. - * This is called from the UIManager queue. - */ -- (void)uiManagerDidPerformMounting:(RCTUIManager *)manager; - -@end - -/** - * Simple helper which take care of RCTUIManager's observers. - */ -@interface RCTUIManagerObserverCoordinator : NSObject - -/** - * Add a UIManagerObserver. See the `RCTUIManagerObserver` protocol for more info. - * References to observers are held weakly. - * This method can be called safely from any queue. - */ -- (void)addObserver:(id)observer; - -/** - * Remove a `UIManagerObserver`. - * This method can be called safely from any queue. - */ -- (void)removeObserver:(id)observer; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTUIManagerObserverCoordinator.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTUIManagerObserverCoordinator.mm deleted file mode 100644 index 1a08cd69..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTUIManagerObserverCoordinator.mm +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTUIManagerObserverCoordinator.h" - -#import - -#import "RCTUIManager.h" - -@implementation RCTUIManagerObserverCoordinator { - NSHashTable> *_observers; - std::mutex _mutex; -} - -- (instancetype)init -{ - if (self = [super init]) { - _observers = [[NSHashTable alloc] initWithOptions:NSHashTableWeakMemory capacity:0]; - } - - return self; -} - -- (void)addObserver:(id)observer -{ - std::lock_guard lock(_mutex); - [self->_observers addObject:observer]; -} - -- (void)removeObserver:(id)observer -{ - std::lock_guard lock(_mutex); - [self->_observers removeObject:observer]; -} - -#pragma mark - RCTUIManagerObserver - -- (void)uiManagerWillPerformLayout:(RCTUIManager *)manager -{ - std::lock_guard lock(_mutex); - - for (id observer in _observers) { - if ([observer respondsToSelector:@selector(uiManagerWillPerformLayout:)]) { - [observer uiManagerWillPerformLayout:manager]; - } - } -} - -- (void)uiManagerDidPerformLayout:(RCTUIManager *)manager -{ - std::lock_guard lock(_mutex); - - for (id observer in _observers) { - if ([observer respondsToSelector:@selector(uiManagerDidPerformLayout:)]) { - [observer uiManagerDidPerformLayout:manager]; - } - } -} - -- (void)uiManagerWillPerformMounting:(RCTUIManager *)manager -{ - std::lock_guard lock(_mutex); - - for (id observer in _observers) { - if ([observer respondsToSelector:@selector(uiManagerWillPerformMounting:)]) { - [observer uiManagerWillPerformMounting:manager]; - } - } -} - -- (BOOL)uiManager:(RCTUIManager *)manager performMountingWithBlock:(RCTUIManagerMountingBlock)block -{ - std::lock_guard lock(_mutex); - - for (id observer in _observers) { - if ([observer respondsToSelector:@selector(uiManager:performMountingWithBlock:)]) { - if ([observer uiManager:manager performMountingWithBlock:block]) { - return YES; - } - } - } - return NO; -} - -- (void)uiManagerDidPerformMounting:(RCTUIManager *)manager -{ - std::lock_guard lock(_mutex); - - for (id observer in _observers) { - if ([observer respondsToSelector:@selector(uiManagerDidPerformMounting:)]) { - [observer uiManagerDidPerformMounting:manager]; - } - } -} - - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTUIManagerUtils.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTUIManagerUtils.h deleted file mode 100644 index 9edbe4b1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTUIManagerUtils.h +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -/** - * Queues Problem Intro: - * UIManager queue is a special queue because it has a special relationship with - * the Main queue. - * - * This particular relationship comes from two key factors: - * 1. UIManager initiates execution of many blocks on the Main queue; - * 2. In some cases, we want to initiate (and wait for) some UIManager's work *synchronously* from - * the Main queue. - * - * So, how can we meet these criteria? - * "Pseudo UIManager queue" comes to rescue! - * - * "Pseudo UIManager queue" means the safe execution of typical UIManager's work - * on the Main queue while the UIManager queue is explicitly blocked for preventing - * simultaneous/concurrent memory access. - * - * So, how can we technically do this? - * 1. `RCTAssertUIManagerQueue` is okay with execution on both actual UIManager and - * Pseudo UIManager queues. - * 2. Both `RCTExecuteOnUIManagerQueue` and `RCTUnsafeExecuteOnUIManagerQueueSync` - * execute given block *synchronously* if they were called on actual UIManager - * or Pseudo UIManager queues. - * 3. `RCTExecuteOnMainQueue` executes given block *synchronously* if we already on - * the Main queue. - * 4. `RCTUnsafeExecuteOnUIManagerQueueSync` is smart enough to do the trick: - * It detects calling on the Main queue and in this case, instead of doing - * trivial *synchronous* dispatch, it does: - * - Block the Main queue; - * - Dispatch the special block on UIManager queue to block the queue and - * concurrent memory access; - * - Execute the given block on the Main queue; - * - Unblock the UIManager queue. - * - * Imagine the analogy: We have two queues: the Main one and UIManager one. - * And these queues are two lanes of railway that go in parallel. Then, - * at some point, we merge UIManager lane with the Main lane, and all cars use - * the unified the Main lane. - * And then we split lanes again. - * - * This solution assumes that the code running on UIManager queue will never - * *explicitly* block the Main queue via calling `RCTUnsafeExecuteOnMainQueueSync`. - * Otherwise, it can cause a deadlock. - */ - -/** - * Returns UIManager queue. - */ -RCT_EXTERN dispatch_queue_t RCTGetUIManagerQueue(void); - -/** - * Default name for the UIManager queue. - */ -RCT_EXTERN char *const RCTUIManagerQueueName; - -/** - * Check if we are currently on UIManager queue. - * Please do not use this unless you really know what you're doing. - */ -RCT_EXTERN BOOL RCTIsUIManagerQueue(void); - -/** - * Check if we are currently on Pseudo UIManager queue. - * Please do not use this unless you really know what you're doing. - */ -RCT_EXTERN BOOL RCTIsPseudoUIManagerQueue(void); - -/** - * *Asynchronously* executes the specified block on the UIManager queue. - * Unlike `dispatch_async()` this will execute the block immediately - * if we're already on the UIManager queue. - */ -RCT_EXTERN void RCTExecuteOnUIManagerQueue(dispatch_block_t block); - -/** - * *Synchorously* executes the specified block on the UIManager queue. - * Unlike `dispatch_sync()` this will execute the block immediately - * if we're already on the UIManager queue. - * Please do not use this unless you really know what you're doing. - */ -RCT_EXTERN void RCTUnsafeExecuteOnUIManagerQueueSync(dispatch_block_t block); - -/** - * Convenience macro for asserting that we're running on UIManager queue. - */ -#define RCTAssertUIManagerQueue() RCTAssert(RCTIsUIManagerQueue() || RCTIsPseudoUIManagerQueue(), \ -@"This function must be called on the UIManager queue") - -/** - * Returns new unique root view tag. - */ -RCT_EXTERN NSNumber *RCTAllocateRootViewTag(void); diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTUIManagerUtils.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTUIManagerUtils.m deleted file mode 100644 index 48e71eb8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Modules/RCTUIManagerUtils.m +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTUIManagerUtils.h" - -#import - -#import "RCTAssert.h" - -char *const RCTUIManagerQueueName = "com.facebook.react.ShadowQueue"; - -static BOOL pseudoUIManagerQueueFlag = NO; - -dispatch_queue_t RCTGetUIManagerQueue(void) -{ - static dispatch_queue_t shadowQueue; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - if ([NSOperation instancesRespondToSelector:@selector(qualityOfService)]) { - dispatch_queue_attr_t attr = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_USER_INTERACTIVE, 0); - shadowQueue = dispatch_queue_create(RCTUIManagerQueueName, attr); - } else { - shadowQueue = dispatch_queue_create(RCTUIManagerQueueName, DISPATCH_QUEUE_SERIAL); - dispatch_set_target_queue(shadowQueue, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0)); - } - }); - return shadowQueue; -} - -BOOL RCTIsUIManagerQueue() -{ - static void *queueKey = &queueKey; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - dispatch_queue_set_specific(RCTGetUIManagerQueue(), queueKey, queueKey, NULL); - }); - return dispatch_get_specific(queueKey) == queueKey; -} - -BOOL RCTIsPseudoUIManagerQueue() -{ - if (RCTIsMainQueue()) { - return pseudoUIManagerQueueFlag; - } - - return NO; -} - -void RCTExecuteOnUIManagerQueue(dispatch_block_t block) -{ - if (RCTIsUIManagerQueue() || RCTIsPseudoUIManagerQueue()) { - block(); - } else { - dispatch_async(RCTGetUIManagerQueue(), ^{ - block(); - }); - } -} - -void RCTUnsafeExecuteOnUIManagerQueueSync(dispatch_block_t block) -{ - if (RCTIsUIManagerQueue() || RCTIsPseudoUIManagerQueue()) { - block(); - } else { - if (RCTIsMainQueue()) { - dispatch_semaphore_t mainQueueBlockingSemaphore = dispatch_semaphore_create(0); - dispatch_semaphore_t uiManagerQueueBlockingSemaphore = dispatch_semaphore_create(0); - - // Dispatching block which blocks UI Manager queue. - dispatch_async(RCTGetUIManagerQueue(), ^{ - // Initiating `block` execution on main queue. - dispatch_semaphore_signal(mainQueueBlockingSemaphore); - // Waiting for finishing `block`. - dispatch_semaphore_wait(uiManagerQueueBlockingSemaphore, DISPATCH_TIME_FOREVER); - }); - - // Waiting for block on UIManager queue. - dispatch_semaphore_wait(mainQueueBlockingSemaphore, DISPATCH_TIME_FOREVER); - pseudoUIManagerQueueFlag = YES; - // `block` execution while UIManager queue is blocked by semaphore. - block(); - pseudoUIManagerQueueFlag = NO; - // Signalling UIManager block. - dispatch_semaphore_signal(uiManagerQueueBlockingSemaphore); - } else { - dispatch_sync(RCTGetUIManagerQueue(), ^{ - block(); - }); - } - } -} - -NSNumber *RCTAllocateRootViewTag() -{ - // Numbering of these tags goes from 1, 11, 21, 31, ..., 100501, ... - static int64_t rootViewTagCounter = -1; - return @(OSAtomicIncrement64(&rootViewTagCounter) * 10 + 1); -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTFPSGraph.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTFPSGraph.h deleted file mode 100644 index b3092aba..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTFPSGraph.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#if RCT_DEV - -@interface RCTFPSGraph : UIView - -@property (nonatomic, assign, readonly) NSUInteger FPS; -@property (nonatomic, assign, readonly) NSUInteger maxFPS; -@property (nonatomic, assign, readonly) NSUInteger minFPS; - -- (instancetype)initWithFrame:(CGRect)frame - color:(UIColor *)color NS_DESIGNATED_INITIALIZER; - -- (void)onTick:(NSTimeInterval)timestamp; - -@end - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTFPSGraph.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTFPSGraph.m deleted file mode 100644 index 63467133..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTFPSGraph.m +++ /dev/null @@ -1,124 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTFPSGraph.h" - -#import "RCTAssert.h" - -#if RCT_DEV - -@interface RCTFPSGraph() - -@property (nonatomic, strong, readonly) CAShapeLayer *graph; -@property (nonatomic, strong, readonly) UILabel *label; - -@end - -@implementation RCTFPSGraph -{ - CAShapeLayer *_graph; - UILabel *_label; - - CGFloat *_frames; - UIColor *_color; - - NSTimeInterval _prevTime; - NSUInteger _frameCount; - NSUInteger _FPS; - NSUInteger _maxFPS; - NSUInteger _minFPS; - NSUInteger _length; - NSUInteger _height; -} - -- (instancetype)initWithFrame:(CGRect)frame color:(UIColor *)color -{ - if ((self = [super initWithFrame:frame])) { - _frameCount = -1; - _prevTime = -1; - _maxFPS = 0; - _minFPS = 60; - _length = (NSUInteger)floor(frame.size.width); - _height = (NSUInteger)floor(frame.size.height); - _frames = calloc(sizeof(CGFloat), _length); - _color = color; - - [self.layer addSublayer:self.graph]; - [self addSubview:self.label]; - } - return self; -} - -- (void)dealloc -{ - free(_frames); -} - -RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) -RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) - -- (CAShapeLayer *)graph -{ - if (!_graph) { - _graph = [CAShapeLayer new]; - _graph.frame = self.bounds; - _graph.backgroundColor = [_color colorWithAlphaComponent:0.2].CGColor; - _graph.fillColor = _color.CGColor; - } - - return _graph; -} - -- (UILabel *)label -{ - if (!_label) { - _label = [[UILabel alloc] initWithFrame:self.bounds]; - _label.font = [UIFont boldSystemFontOfSize:13]; - _label.textAlignment = NSTextAlignmentCenter; - } - - return _label; -} - -- (void)onTick:(NSTimeInterval)timestamp -{ - _frameCount++; - if (_prevTime == -1) { - _prevTime = timestamp; - } else if (timestamp - _prevTime >= 1) { - _FPS = round(_frameCount / (timestamp - _prevTime)); - _minFPS = MIN(_minFPS, _FPS); - _maxFPS = MAX(_maxFPS, _FPS); - - dispatch_async(dispatch_get_main_queue(), ^{ - self->_label.text = [NSString stringWithFormat:@"%lu", (unsigned long)self->_FPS]; - }); - - CGFloat scale = 60.0 / _height; - for (NSUInteger i = 0; i < _length - 1; i++) { - _frames[i] = _frames[i + 1]; - } - _frames[_length - 1] = _FPS / scale; - - CGMutablePathRef path = CGPathCreateMutable(); - CGPathMoveToPoint(path, NULL, 0, _height); - for (NSUInteger i = 0; i < _length; i++) { - CGPathAddLineToPoint(path, NULL, i, _height - _frames[i]); - } - CGPathAddLineToPoint(path, NULL, _length - 1, _height); - - _graph.path = path; - CGPathRelease(path); - - _prevTime = timestamp; - _frameCount = 0; - } -} - -@end - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTMacros.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTMacros.h deleted file mode 100644 index 1eb53431..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTMacros.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#define _CONCAT(A, B) A##B -#define CONCAT(A, B) _CONCAT(A, B) - -#if !defined(PIC_MODIFIER) -#define PIC_MODIFIER -#endif - -#define SYMBOL_NAME(name) CONCAT(__USER_LABEL_PREFIX__, name) -#define SYMBOL_NAME_PIC(name) CONCAT(SYMBOL_NAME(name), PIC_MODIFIER) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTPerfMonitor.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTPerfMonitor.m deleted file mode 100644 index 1db32322..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTPerfMonitor.m +++ /dev/null @@ -1,578 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTDefines.h" - -#if RCT_DEV - -#import - -#import - -#import "RCTBridge.h" -#import "RCTDevSettings.h" -#import "RCTFPSGraph.h" -#import "RCTInvalidating.h" -#import "RCTJavaScriptExecutor.h" -#import "RCTPerformanceLogger.h" -#import "RCTRootView.h" -#import "RCTUIManager.h" -#import "RCTBridge+Private.h" -#import "RCTUtils.h" - -#if __has_include("RCTDevMenu.h") -#import "RCTDevMenu.h" -#endif - -static NSString *const RCTPerfMonitorCellIdentifier = @"RCTPerfMonitorCellIdentifier"; - -static CGFloat const RCTPerfMonitorBarHeight = 50; -static CGFloat const RCTPerfMonitorExpandHeight = 250; - -typedef BOOL (*RCTJSCSetOptionType)(const char *); - -static BOOL RCTJSCSetOption(const char *option) -{ - static RCTJSCSetOptionType setOption; - static dispatch_once_t onceToken; - - dispatch_once(&onceToken, ^{ - /** - * JSC private C++ static method to toggle options at runtime - * - * JSC::Options::setOptions - JavaScriptCore/runtime/Options.h - */ - setOption = dlsym(RTLD_DEFAULT, "_ZN3JSC7Options9setOptionEPKc"); - - if (RCT_DEBUG && setOption == NULL) { - RCTLogWarn(@"The symbol used to enable JSC runtime options is not available in this iOS version"); - } - }); - - if (setOption) { - return setOption(option); - } else { - return NO; - } -} - -static vm_size_t RCTGetResidentMemorySize(void) -{ - vm_size_t memoryUsageInByte = 0; - task_vm_info_data_t vmInfo; - mach_msg_type_number_t count = TASK_VM_INFO_COUNT; - kern_return_t kernelReturn = task_info(mach_task_self(), TASK_VM_INFO, (task_info_t) &vmInfo, &count); - if(kernelReturn == KERN_SUCCESS) { - memoryUsageInByte = (vm_size_t) vmInfo.phys_footprint; - } - return memoryUsageInByte; -} - -@interface RCTPerfMonitor : NSObject - -#if __has_include("RCTDevMenu.h") -@property (nonatomic, strong, readonly) RCTDevMenuItem *devMenuItem; -#endif -@property (nonatomic, strong, readonly) UIPanGestureRecognizer *gestureRecognizer; -@property (nonatomic, strong, readonly) UIView *container; -@property (nonatomic, strong, readonly) UILabel *memory; -@property (nonatomic, strong, readonly) UILabel *heap; -@property (nonatomic, strong, readonly) UILabel *views; -@property (nonatomic, strong, readonly) UITableView *metrics; -@property (nonatomic, strong, readonly) RCTFPSGraph *jsGraph; -@property (nonatomic, strong, readonly) RCTFPSGraph *uiGraph; -@property (nonatomic, strong, readonly) UILabel *jsGraphLabel; -@property (nonatomic, strong, readonly) UILabel *uiGraphLabel; - -@end - -@implementation RCTPerfMonitor { -#if __has_include("RCTDevMenu.h") - RCTDevMenuItem *_devMenuItem; -#endif - UIPanGestureRecognizer *_gestureRecognizer; - UIView *_container; - UILabel *_memory; - UILabel *_heap; - UILabel *_views; - UILabel *_uiGraphLabel; - UILabel *_jsGraphLabel; - UITableView *_metrics; - - RCTFPSGraph *_uiGraph; - RCTFPSGraph *_jsGraph; - - CADisplayLink *_uiDisplayLink; - CADisplayLink *_jsDisplayLink; - - NSUInteger _heapSize; - - dispatch_queue_t _queue; - dispatch_io_t _io; - int _stderr; - int _pipe[2]; - NSString *_remaining; - - CGRect _storedMonitorFrame; - - NSArray *_perfLoggerMarks; -} - -@synthesize bridge = _bridge; - -RCT_EXPORT_MODULE() - -+ (BOOL)requiresMainQueueSetup -{ - return YES; -} - -- (dispatch_queue_t)methodQueue -{ - return dispatch_get_main_queue(); -} - -- (void)setBridge:(RCTBridge *)bridge -{ - _bridge = bridge; - -#if __has_include("RCTDevMenu.h") - [_bridge.devMenu addItem:self.devMenuItem]; -#endif -} - -- (void)invalidate -{ - [self hide]; -} - -#if __has_include("RCTDevMenu.h") -- (RCTDevMenuItem *)devMenuItem -{ - if (!_devMenuItem) { - __weak __typeof__(self) weakSelf = self; - __weak RCTDevSettings *devSettings = self.bridge.devSettings; - if (devSettings.isPerfMonitorShown) { - [weakSelf show]; - } - _devMenuItem = - [RCTDevMenuItem buttonItemWithTitleBlock:^NSString *{ - return (devSettings.isPerfMonitorShown) ? - @"Hide Perf Monitor" : - @"Show Perf Monitor"; - } handler:^{ - if (devSettings.isPerfMonitorShown) { - [weakSelf hide]; - devSettings.isPerfMonitorShown = NO; - } else { - [weakSelf show]; - devSettings.isPerfMonitorShown = YES; - } - }]; - } - - return _devMenuItem; -} -#endif - -- (UIPanGestureRecognizer *)gestureRecognizer -{ - if (!_gestureRecognizer) { - _gestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self - action:@selector(gesture:)]; - } - - return _gestureRecognizer; -} - -- (UIView *)container -{ - if (!_container) { - _container = [[UIView alloc] initWithFrame:CGRectMake(10, 25, 180, RCTPerfMonitorBarHeight)]; - _container.backgroundColor = UIColor.whiteColor; - _container.layer.borderWidth = 2; - _container.layer.borderColor = [UIColor lightGrayColor].CGColor; - [_container addGestureRecognizer:self.gestureRecognizer]; - [_container addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self - action:@selector(tap)]]; - } - - return _container; -} - -- (UILabel *)memory -{ - if (!_memory) { - _memory = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 44, RCTPerfMonitorBarHeight)]; - _memory.font = [UIFont systemFontOfSize:12]; - _memory.numberOfLines = 3; - _memory.textAlignment = NSTextAlignmentCenter; - } - - return _memory; -} - -- (UILabel *)heap -{ - if (!_heap) { - _heap = [[UILabel alloc] initWithFrame:CGRectMake(44, 0, 44, RCTPerfMonitorBarHeight)]; - _heap.font = [UIFont systemFontOfSize:12]; - _heap.numberOfLines = 3; - _heap.textAlignment = NSTextAlignmentCenter; - } - - return _heap; -} - -- (UILabel *)views -{ - if (!_views) { - _views = [[UILabel alloc] initWithFrame:CGRectMake(88, 0, 44, RCTPerfMonitorBarHeight)]; - _views.font = [UIFont systemFontOfSize:12]; - _views.numberOfLines = 3; - _views.textAlignment = NSTextAlignmentCenter; - } - - return _views; -} - -- (RCTFPSGraph *)uiGraph -{ - if (!_uiGraph) { - _uiGraph = [[RCTFPSGraph alloc] initWithFrame:CGRectMake(134, 14, 40, 30) - color:[UIColor lightGrayColor]]; - } - return _uiGraph; -} - -- (RCTFPSGraph *)jsGraph -{ - if (!_jsGraph) { - _jsGraph = [[RCTFPSGraph alloc] initWithFrame:CGRectMake(178, 14, 40, 30) - color:[UIColor lightGrayColor]]; - } - return _jsGraph; -} - -- (UILabel *)uiGraphLabel -{ - if (!_uiGraphLabel) { - _uiGraphLabel = [[UILabel alloc] initWithFrame:CGRectMake(134, 3, 40, 10)]; - _uiGraphLabel.font = [UIFont systemFontOfSize:11]; - _uiGraphLabel.textAlignment = NSTextAlignmentCenter; - _uiGraphLabel.text = @"UI"; - } - - return _uiGraphLabel; -} - -- (UILabel *)jsGraphLabel -{ - if (!_jsGraphLabel) { - _jsGraphLabel = [[UILabel alloc] initWithFrame:CGRectMake(178, 3, 38, 10)]; - _jsGraphLabel.font = [UIFont systemFontOfSize:11]; - _jsGraphLabel.textAlignment = NSTextAlignmentCenter; - _jsGraphLabel.text = @"JS"; - } - - return _jsGraphLabel; -} - -- (UITableView *)metrics -{ - if (!_metrics) { - _metrics = [[UITableView alloc] initWithFrame:CGRectMake( - 0, - RCTPerfMonitorBarHeight, - self.container.frame.size.width, - self.container.frame.size.height - RCTPerfMonitorBarHeight - )]; - _metrics.dataSource = self; - _metrics.delegate = self; - _metrics.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; - [_metrics registerClass:[UITableViewCell class] forCellReuseIdentifier:RCTPerfMonitorCellIdentifier]; - } - - return _metrics; -} - -- (void)show -{ - if (_container) { - return; - } - - [self.container addSubview:self.memory]; - [self.container addSubview:self.heap]; - [self.container addSubview:self.views]; - [self.container addSubview:self.uiGraph]; - [self.container addSubview:self.uiGraphLabel]; - - [self redirectLogs]; - - RCTJSCSetOption("logGC=1"); - - [self updateStats]; - - UIWindow *window = RCTSharedApplication().delegate.window; - [window addSubview:self.container]; - - - _uiDisplayLink = [CADisplayLink displayLinkWithTarget:self - selector:@selector(threadUpdate:)]; - [_uiDisplayLink addToRunLoop:[NSRunLoop mainRunLoop] - forMode:NSRunLoopCommonModes]; - - self.container.frame = (CGRect) { - self.container.frame.origin, { - self.container.frame.size.width + 44, - self.container.frame.size.height - } - }; - [self.container addSubview:self.jsGraph]; - [self.container addSubview:self.jsGraphLabel]; - - [_bridge dispatchBlock:^{ - self->_jsDisplayLink = [CADisplayLink displayLinkWithTarget:self - selector:@selector(threadUpdate:)]; - [self->_jsDisplayLink addToRunLoop:[NSRunLoop currentRunLoop] - forMode:NSRunLoopCommonModes]; - } queue:RCTJSThread]; -} - -- (void)hide -{ - if (!_container) { - return; - } - - [self.container removeFromSuperview]; - _container = nil; - _jsGraph = nil; - _uiGraph = nil; - - RCTJSCSetOption("logGC=0"); - - [self stopLogs]; - - [_uiDisplayLink invalidate]; - [_jsDisplayLink invalidate]; - - _uiDisplayLink = nil; - _jsDisplayLink = nil; -} - -- (void)redirectLogs -{ - _stderr = dup(STDERR_FILENO); - - if (pipe(_pipe) != 0) { - return; - } - - dup2(_pipe[1], STDERR_FILENO); - close(_pipe[1]); - - __weak __typeof__(self) weakSelf = self; - _queue = dispatch_queue_create("com.facebook.react.RCTPerfMonitor", DISPATCH_QUEUE_SERIAL); - _io = dispatch_io_create( - DISPATCH_IO_STREAM, - _pipe[0], - _queue, - ^(__unused int error) {}); - - dispatch_io_set_low_water(_io, 20); - - dispatch_io_read( - _io, - 0, - SIZE_MAX, - _queue, - ^(__unused bool done, dispatch_data_t data, __unused int error) { - if (!data) { - return; - } - - dispatch_data_apply( - data, - ^bool( - __unused dispatch_data_t region, - __unused size_t offset, - const void *buffer, - size_t size - ) { - write(self->_stderr, buffer, size); - - NSString *log = [[NSString alloc] initWithBytes:buffer - length:size - encoding:NSUTF8StringEncoding]; - [weakSelf parse:log]; - return true; - }); - }); -} - -- (void)stopLogs -{ - dup2(_stderr, STDERR_FILENO); - dispatch_io_close(_io, 0); -} - -- (void)parse:(NSString *)log -{ - static NSRegularExpression *GCRegex; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - NSString *pattern = @"\\[GC: [\\d\\.]+ \\wb => (Eden|Full)Collection, (?:Skipped copying|Did copy), ([\\d\\.]+) \\wb, [\\d.]+ \\ws\\]"; - GCRegex = [NSRegularExpression regularExpressionWithPattern:pattern - options:0 - error:nil]; - }); - - if (_remaining) { - log = [_remaining stringByAppendingString:log]; - _remaining = nil; - } - - NSArray *lines = [log componentsSeparatedByString:@"\n"]; - if (lines.count == 1) { // no newlines - _remaining = log; - return; - } - - for (NSString *line in lines) { - NSTextCheckingResult *match = [GCRegex firstMatchInString:line options:0 range:NSMakeRange(0, line.length)]; - if (match) { - NSString *heapSizeStr = [line substringWithRange:[match rangeAtIndex:2]]; - _heapSize = [heapSizeStr integerValue]; - } - } -} - -- (void)updateStats -{ - NSDictionary *views = [_bridge.uiManager valueForKey:@"viewRegistry"]; - NSUInteger viewCount = views.count; - NSUInteger visibleViewCount = 0; - for (UIView *view in views.allValues) { - if (view.window || view.superview.window) { - visibleViewCount++; - } - } - - double mem = (double)RCTGetResidentMemorySize() / 1024 / 1024; - self.memory.text =[NSString stringWithFormat:@"RAM\n%.2lf\nMB", mem]; - self.heap.text = [NSString stringWithFormat:@"JSC\n%.2lf\nMB", (double)_heapSize / 1024]; - self.views.text = [NSString stringWithFormat:@"Views\n%lu\n%lu", (unsigned long)visibleViewCount, (unsigned long)viewCount]; - - __weak __typeof__(self) weakSelf = self; - dispatch_after( - dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), - dispatch_get_main_queue(), - ^{ - __strong __typeof__(weakSelf) strongSelf = weakSelf; - if (strongSelf && strongSelf->_container.superview) { - [strongSelf updateStats]; - } - }); -} - -- (void)gesture:(UIPanGestureRecognizer *)gestureRecognizer -{ - CGPoint translation = [gestureRecognizer translationInView:self.container.superview]; - self.container.center = CGPointMake( - self.container.center.x + translation.x, - self.container.center.y + translation.y - ); - [gestureRecognizer setTranslation:CGPointMake(0, 0) - inView:self.container.superview]; -} - -- (void)tap -{ - [self loadPerformanceLoggerData]; - if (CGRectIsEmpty(_storedMonitorFrame)) { - _storedMonitorFrame = CGRectMake(0, 20, self.container.window.frame.size.width, RCTPerfMonitorExpandHeight); - [self.container addSubview:self.metrics]; - } else { - [_metrics reloadData]; - } - - [UIView animateWithDuration:.25 animations:^{ - CGRect tmp = self.container.frame; - self.container.frame = self->_storedMonitorFrame; - self->_storedMonitorFrame = tmp; - }]; -} - -- (void)threadUpdate:(CADisplayLink *)displayLink -{ - RCTFPSGraph *graph = displayLink == _jsDisplayLink ? _jsGraph : _uiGraph; - [graph onTick:displayLink.timestamp]; -} - -- (void)loadPerformanceLoggerData -{ - NSUInteger i = 0; - NSMutableArray *data = [NSMutableArray new]; - RCTPerformanceLogger *performanceLogger = [_bridge performanceLogger]; - NSArray *values = [performanceLogger valuesForTags]; - for (NSString *label in [performanceLogger labelsForTags]) { - long long value = values[i+1].longLongValue - values[i].longLongValue; - NSString *unit = @"ms"; - if ([label hasSuffix:@"Size"]) { - unit = @"b"; - } else if ([label hasSuffix:@"Count"]) { - unit = @""; - } - [data addObject:[NSString stringWithFormat:@"%@: %lld%@", label, value, unit]]; - i += 2; - } - _perfLoggerMarks = [data copy]; -} - -#pragma mark - UITableViewDataSource - -- (NSInteger)numberOfSectionsInTableView:(__unused UITableView *)tableView -{ - return 1; -} - -- (NSInteger)tableView:(__unused UITableView *)tableView - numberOfRowsInSection:(__unused NSInteger)section -{ - return _perfLoggerMarks.count; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView - cellForRowAtIndexPath:(NSIndexPath *)indexPath -{ - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:RCTPerfMonitorCellIdentifier - forIndexPath:indexPath]; - - if (!cell) { - cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault - reuseIdentifier:RCTPerfMonitorCellIdentifier]; - } - - cell.textLabel.text = _perfLoggerMarks[indexPath.row]; - cell.textLabel.font = [UIFont systemFontOfSize:12]; - - return cell; -} - -#pragma mark - UITableViewDelegate - -- (CGFloat)tableView:(__unused UITableView *)tableView -heightForRowAtIndexPath:(__unused NSIndexPath *)indexPath -{ - return 20; -} - -@end - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTProfile.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTProfile.h deleted file mode 100644 index 1b07e979..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTProfile.h +++ /dev/null @@ -1,233 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -/** - * RCTProfile - * - * This file provides a set of functions and macros for performance profiling - * - * NOTE: This API is a work in progress, please consider carefully before - * using it. - */ - -RCT_EXTERN NSString *const RCTProfileDidStartProfiling; -RCT_EXTERN NSString *const RCTProfileDidEndProfiling; - -RCT_EXTERN const uint64_t RCTProfileTagAlways; - -#if RCT_PROFILE - -@class RCTBridge; - -#define RCTProfileBeginFlowEvent() \ -_Pragma("clang diagnostic push") \ -_Pragma("clang diagnostic ignored \"-Wshadow\"") \ -NSUInteger __rct_profile_flow_id = _RCTProfileBeginFlowEvent(); \ -_Pragma("clang diagnostic pop") - -#define RCTProfileEndFlowEvent() \ -_RCTProfileEndFlowEvent(__rct_profile_flow_id) - -RCT_EXTERN dispatch_queue_t RCTProfileGetQueue(void); - -RCT_EXTERN NSUInteger _RCTProfileBeginFlowEvent(void); -RCT_EXTERN void _RCTProfileEndFlowEvent(NSUInteger); - -/** - * Returns YES if the profiling information is currently being collected - */ -RCT_EXTERN BOOL RCTProfileIsProfiling(void); - -/** - * Start collecting profiling information - */ -RCT_EXTERN void RCTProfileInit(RCTBridge *); - -/** - * Stop profiling and return a JSON string of the collected data - The data - * returned is compliant with google's trace event format - the format used - * as input to trace-viewer - */ -RCT_EXTERN void RCTProfileEnd(RCTBridge *, void (^)(NSString *)); - -/** - * Collects the initial event information for the event and returns a reference ID - */ -RCT_EXTERN void _RCTProfileBeginEvent(NSThread *calleeThread, - NSTimeInterval time, - uint64_t tag, - NSString *name, - NSDictionary *args); -#define RCT_PROFILE_BEGIN_EVENT(tag, name, args) \ - do { \ - if (RCTProfileIsProfiling()) { \ - NSThread *__calleeThread = [NSThread currentThread]; \ - NSTimeInterval __time = CACurrentMediaTime(); \ - _RCTProfileBeginEvent(__calleeThread, __time, tag, name, args); \ - } \ - } while(0) - -/** - * The ID returned by BeginEvent should then be passed into EndEvent, with the - * rest of the event information. Just at this point the event will actually be - * registered - */ -RCT_EXTERN void _RCTProfileEndEvent(NSThread *calleeThread, - NSString *threadName, - NSTimeInterval time, - uint64_t tag, - NSString *category); - -#define RCT_PROFILE_END_EVENT(tag, category) \ - do { \ - if (RCTProfileIsProfiling()) { \ - NSThread *__calleeThread = [NSThread currentThread]; \ - NSString *__threadName = RCTCurrentThreadName(); \ - NSTimeInterval __time = CACurrentMediaTime(); \ - _RCTProfileEndEvent(__calleeThread, __threadName, __time, tag, category); \ - } \ - } while(0) - -/** - * Collects the initial event information for the event and returns a reference ID - */ -RCT_EXTERN NSUInteger RCTProfileBeginAsyncEvent(uint64_t tag, - NSString *name, - NSDictionary *args); - -/** - * The ID returned by BeginEvent should then be passed into EndEvent, with the - * rest of the event information. Just at this point the event will actually be - * registered - */ -RCT_EXTERN void RCTProfileEndAsyncEvent(uint64_t tag, - NSString *category, - NSUInteger cookie, - NSString *name, - NSString *threadName); - -/** - * An event that doesn't have a duration (i.e. Notification, VSync, etc) - */ -RCT_EXTERN void RCTProfileImmediateEvent(uint64_t tag, - NSString *name, - NSTimeInterval time, - char scope); - -/** - * Helper to profile the duration of the execution of a block. This method uses - * self and _cmd to name this event for simplicity sake. - * - * NOTE: The block can't expect any argument - * - * DEPRECATED: this approach breaks debugging and stepping through instrumented block functions - */ -#define RCTProfileBlock(block, tag, category, arguments) \ -^{ \ - RCT_PROFILE_BEGIN_EVENT(tag, @(__PRETTY_FUNCTION__), nil); \ - block(); \ - RCT_PROFILE_END_EVENT(tag, category, arguments); \ -} - -/** - * Hook into a bridge instance to log all bridge module's method calls - */ -RCT_EXTERN void RCTProfileHookModules(RCTBridge *); - -/** - * Unhook from a given bridge instance's modules - */ -RCT_EXTERN void RCTProfileUnhookModules(RCTBridge *); - -/** - * Hook into all of a module's methods - */ -RCT_EXTERN void RCTProfileHookInstance(id instance); - -/** - * Send systrace or cpu profiling information to the packager - * to present to the user - */ -RCT_EXTERN void RCTProfileSendResult(RCTBridge *bridge, NSString *route, NSData *profileData); - -/** - * Systrace gluecode - * - * allow to use systrace to back RCTProfile - */ - -typedef struct { - const char *key; - int key_len; - const char *value; - int value_len; -} systrace_arg_t; - -typedef struct { - char *(*start)(void); - void (*stop)(void); - - void (*begin_section)(uint64_t tag, const char *name, size_t numArgs, systrace_arg_t *args); - void (*end_section)(uint64_t tag, size_t numArgs, systrace_arg_t *args); - - void (*begin_async_section)(uint64_t tag, const char *name, int cookie, size_t numArgs, systrace_arg_t *args); - void (*end_async_section)(uint64_t tag, const char *name, int cookie, size_t numArgs, systrace_arg_t *args); - - void (*instant_section)(uint64_t tag, const char *name, char scope); - - void (*begin_async_flow)(uint64_t tag, const char *name, int cookie); - void (*end_async_flow)(uint64_t tag, const char *name, int cookie); -} RCTProfileCallbacks; - -RCT_EXTERN void RCTProfileRegisterCallbacks(RCTProfileCallbacks *); - -/** - * Systrace control window - */ -RCT_EXTERN void RCTProfileShowControls(void); -RCT_EXTERN void RCTProfileHideControls(void); - -#else - -#define RCTProfileBeginFlowEvent() -#define _RCTProfileBeginFlowEvent() @0 - -#define RCTProfileEndFlowEvent() -#define _RCTProfileEndFlowEvent(...) - -#define RCTProfileIsProfiling(...) NO -#define RCTProfileInit(...) -#define RCTProfileEnd(...) @"" - -#define _RCTProfileBeginEvent(...) -#define _RCTProfileEndEvent(...) - -#define RCT_PROFILE_BEGIN_EVENT(...) -#define RCT_PROFILE_END_EVENT(...) - -#define RCTProfileBeginAsyncEvent(...) 0 -#define RCTProfileEndAsyncEvent(...) - -#define RCTProfileImmediateEvent(...) - -#define RCTProfileBlock(block, ...) block - -#define RCTProfileHookModules(...) -#define RCTProfileHookInstance(...) -#define RCTProfileUnhookModules(...) - -#define RCTProfileSendResult(...) - -#define RCTProfileShowControls(...) -#define RCTProfileHideControls(...) - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTProfile.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTProfile.m deleted file mode 100644 index 98ba2e84..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTProfile.m +++ /dev/null @@ -1,830 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTProfile.h" - -#import -#import -#import -#import -#import - -#import - -#import "RCTAssert.h" -#import "RCTBridge+Private.h" -#import "RCTBridge.h" -#import "RCTComponentData.h" -#import "RCTDefines.h" -#import "RCTLog.h" -#import "RCTModuleData.h" -#import "RCTUIManager.h" -#import "RCTUIManagerUtils.h" -#import "RCTUtils.h" - -NSString *const RCTProfileDidStartProfiling = @"RCTProfileDidStartProfiling"; -NSString *const RCTProfileDidEndProfiling = @"RCTProfileDidEndProfiling"; - -const uint64_t RCTProfileTagAlways = 1L << 0; - -#if RCT_PROFILE - -#pragma mark - Constants - -static NSString *const kProfileTraceEvents = @"traceEvents"; -static NSString *const kProfileSamples = @"samples"; -static NSString *const kProfilePrefix = @"rct_profile_"; - -#pragma mark - Variables - -static atomic_bool RCTProfileProfiling = ATOMIC_VAR_INIT(NO); - -static NSDictionary *RCTProfileInfo; -static NSMutableDictionary *RCTProfileOngoingEvents; -static NSTimeInterval RCTProfileStartTime; -static NSUInteger RCTProfileEventID = 0; -static CADisplayLink *RCTProfileDisplayLink; -static __weak RCTBridge *_RCTProfilingBridge; -static UIWindow *RCTProfileControlsWindow; - -#pragma mark - Macros - -#define RCTProfileAddEvent(type, props...) \ -[RCTProfileInfo[type] addObject:@{ \ - @"pid": @([[NSProcessInfo processInfo] processIdentifier]), \ - props \ -}]; - -#define CHECK(...) \ -if (!RCTProfileIsProfiling()) { \ - return __VA_ARGS__; \ -} - -#pragma mark - systrace glue code - -static RCTProfileCallbacks *callbacks; -static char *systrace_buffer; - -static systrace_arg_t *newSystraceArgsFromDictionary(NSDictionary *args) -{ - if (args.count == 0) { - return NULL; - } - - systrace_arg_t *systrace_args = malloc(sizeof(systrace_arg_t) * args.count); - if (systrace_args) { - __block size_t i = 0; - [args enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *value, __unused BOOL *stop) { - systrace_args[i].key = [key UTF8String]; - systrace_args[i].key_len = [key length]; - systrace_args[i].value = [value UTF8String]; - systrace_args[i].value_len = [value length]; - i++; - }]; - } - return systrace_args; -} - -void RCTProfileRegisterCallbacks(RCTProfileCallbacks *cb) -{ - callbacks = cb; -} - -#pragma mark - Private Helpers - -static RCTBridge *RCTProfilingBridge(void) -{ - return _RCTProfilingBridge ?: [RCTBridge currentBridge]; -} - -static NSNumber *RCTProfileTimestamp(NSTimeInterval timestamp) -{ - return @((timestamp - RCTProfileStartTime) * 1e6); -} - -static NSString *RCTProfileMemory(vm_size_t memory) -{ - double mem = ((double)memory) / 1024 / 1024; - return [NSString stringWithFormat:@"%.2lfmb", mem]; -} - -static NSDictionary *RCTProfileGetMemoryUsage(void) -{ - struct task_basic_info info; - mach_msg_type_number_t size = sizeof(info); - kern_return_t kerr = task_info(mach_task_self(), - TASK_BASIC_INFO, - (task_info_t)&info, - &size); - if ( kerr == KERN_SUCCESS ) { - return @{ - @"suspend_count": @(info.suspend_count), - @"virtual_size": RCTProfileMemory(info.virtual_size), - @"resident_size": RCTProfileMemory(info.resident_size), - }; - } else { - return @{}; - } -} - -#pragma mark - Module hooks - -static const char *RCTProfileProxyClassName(Class class) -{ - return [kProfilePrefix stringByAppendingString:NSStringFromClass(class)].UTF8String; -} - -static dispatch_group_t RCTProfileGetUnhookGroup(void) -{ - static dispatch_group_t unhookGroup; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - unhookGroup = dispatch_group_create(); - }); - - return unhookGroup; -} - -// Used by RCTProfileTrampoline assembly file to call libc`malloc -RCT_EXTERN void *RCTProfileMalloc(size_t size); -void *RCTProfileMalloc(size_t size) -{ - return malloc(size); -} - -// Used by RCTProfileTrampoline assembly file to call libc`free -RCT_EXTERN void RCTProfileFree(void *buf); -void RCTProfileFree(void *buf) -{ - free(buf); -} - -RCT_EXTERN IMP RCTProfileGetImplementation(id obj, SEL cmd); -IMP RCTProfileGetImplementation(id obj, SEL cmd) -{ - return class_getMethodImplementation([obj class], cmd); -} - -/** - * For the profiling we have to execute some code before and after every - * function being profiled, the only way of doing that with pure Objective-C is - * by using `-forwardInvocation:`, which is slow and could skew the profile - * results. - * - * The alternative in assembly is much simpler, we just need to store all the - * state at the beginning of the function, start the profiler, restore all the - * state, call the actual function we want to profile and stop the profiler. - * - * The implementation can be found in RCTProfileTrampoline-.s where arch - * is one of: i386, x86_64, arm, arm64. - */ -#if defined(__i386__) || \ - defined(__x86_64__) || \ - defined(__arm__) || \ - defined(__arm64__) - - RCT_EXTERN void RCTProfileTrampoline(void); -#else - static void *RCTProfileTrampoline = NULL; -#endif - -RCT_EXTERN void RCTProfileTrampolineStart(id, SEL); -void RCTProfileTrampolineStart(id self, SEL cmd) -{ - /** - * This call might be during dealloc, so we shouldn't retain the object in the - * block. - */ - Class klass = [self class]; - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, ([NSString stringWithFormat:@"-[%s %s]", class_getName(klass), sel_getName(cmd)]), nil); -} - -RCT_EXTERN void RCTProfileTrampolineEnd(void); -void RCTProfileTrampolineEnd(void) -{ - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"objc_call,modules,auto"); -} - -static UIView *(*originalCreateView)(RCTComponentData *, SEL, NSNumber *); -static UIView *RCTProfileCreateView(RCTComponentData *self, SEL _cmd, NSNumber *tag) -{ - UIView *view = originalCreateView(self, _cmd, tag); - RCTProfileHookInstance(view); - return view; -} - -static void RCTProfileHookUIManager(RCTUIManager *uiManager) -{ - dispatch_async(dispatch_get_main_queue(), ^{ - for (id view in [uiManager valueForKey:@"viewRegistry"]) { - RCTProfileHookInstance([uiManager viewForReactTag:view]); - } - - Method createView = class_getInstanceMethod([RCTComponentData class], @selector(createViewWithTag:)); - - if (method_getImplementation(createView) != (IMP)RCTProfileCreateView) { - originalCreateView = (typeof(originalCreateView))method_getImplementation(createView); - method_setImplementation(createView, (IMP)RCTProfileCreateView); - } - }); -} - -void RCTProfileHookInstance(id instance) -{ - Class moduleClass = object_getClass(instance); - - /** - * We swizzle the instance -class method to return the original class, but - * object_getClass will return the actual class. - * - * If they are different, it means that the object is returning the original - * class, but it's actual class is the proxy subclass we created. - */ - if ([instance class] != moduleClass) { - return; - } - - Class proxyClass = objc_allocateClassPair(moduleClass, RCTProfileProxyClassName(moduleClass), 0); - - if (!proxyClass) { - proxyClass = objc_getClass(RCTProfileProxyClassName(moduleClass)); - if (proxyClass) { - object_setClass(instance, proxyClass); - } - return; - } - - unsigned int methodCount; - Method *methods = class_copyMethodList(moduleClass, &methodCount); - for (NSUInteger i = 0; i < methodCount; i++) { - Method method = methods[i]; - SEL selector = method_getName(method); - - /** - * Bail out on struct returns (except arm64) - we don't use it enough - * to justify writing a stret version - */ -#ifdef __arm64__ - BOOL returnsStruct = NO; -#else - const char *typeEncoding = method_getTypeEncoding(method); - // bail out on structs and unions (since they might contain structs) - BOOL returnsStruct = typeEncoding[0] == '{' || typeEncoding[0] == '('; -#endif - - /** - * Avoid hooking into NSObject methods, methods generated by React Native - * and special methods that start `.` (e.g. .cxx_destruct) - */ - if ([NSStringFromSelector(selector) hasPrefix:@"rct"] || [NSObject instancesRespondToSelector:selector] || sel_getName(selector)[0] == '.' || returnsStruct) { - continue; - } - - const char *types = method_getTypeEncoding(method); - class_addMethod(proxyClass, selector, (IMP)RCTProfileTrampoline, types); - } - free(methods); - - class_replaceMethod(object_getClass(proxyClass), @selector(initialize), imp_implementationWithBlock(^{}), "v@:"); - - for (Class cls in @[proxyClass, object_getClass(proxyClass)]) { - Method oldImp = class_getInstanceMethod(cls, @selector(class)); - class_replaceMethod(cls, @selector(class), imp_implementationWithBlock(^{ return moduleClass; }), method_getTypeEncoding(oldImp)); - } - - objc_registerClassPair(proxyClass); - object_setClass(instance, proxyClass); - - if (moduleClass == [RCTUIManager class]) { - RCTProfileHookUIManager((RCTUIManager *)instance); - } -} - -void RCTProfileHookModules(RCTBridge *bridge) -{ - _RCTProfilingBridge = bridge; - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wtautological-pointer-compare" - if (RCTProfileTrampoline == NULL) { - return; - } -#pragma clang diagnostic pop - - RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"RCTProfileHookModules", nil); - for (RCTModuleData *moduleData in [bridge valueForKey:@"moduleDataByID"]) { - // Only hook modules with an instance, to prevent initializing everything - if ([moduleData hasInstance]) { - [bridge dispatchBlock:^{ - RCTProfileHookInstance(moduleData.instance); - } queue:moduleData.methodQueue]; - } - } - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); -} - -static void RCTProfileUnhookInstance(id instance) -{ - if ([instance class] != object_getClass(instance)) { - object_setClass(instance, [instance class]); - } -} - -void RCTProfileUnhookModules(RCTBridge *bridge) -{ - _RCTProfilingBridge = nil; - - dispatch_group_enter(RCTProfileGetUnhookGroup()); - - NSDictionary *moduleDataByID = [bridge valueForKey:@"moduleDataByID"]; - for (RCTModuleData *moduleData in moduleDataByID) { - if ([moduleData hasInstance]) { - RCTProfileUnhookInstance(moduleData.instance); - } - } - - if ([bridge moduleIsInitialized:[RCTUIManager class]]) { - dispatch_async(dispatch_get_main_queue(), ^{ - for (id view in [bridge.uiManager valueForKey:@"viewRegistry"]) { - RCTProfileUnhookInstance(view); - } - - dispatch_group_leave(RCTProfileGetUnhookGroup()); - }); - } -} - -#pragma mark - Private ObjC class only used for the vSYNC CADisplayLink target - -@interface RCTProfile : NSObject -@end - -@implementation RCTProfile - -+ (void)vsync:(CADisplayLink *)displayLink -{ - RCTProfileImmediateEvent(RCTProfileTagAlways, @"VSYNC", displayLink.timestamp, 'g'); -} - -+ (void)reload -{ - [RCTProfilingBridge() reload]; -} - -+ (void)toggle:(UIButton *)target -{ - BOOL isProfiling = RCTProfileIsProfiling(); - - // Start and Stop are switched here, since we're going to toggle isProfiling - [target setTitle:isProfiling ? @"Start" : @"Stop" - forState:UIControlStateNormal]; - - if (isProfiling) { - RCTProfileEnd(RCTProfilingBridge(), ^(NSString *result) { - NSString *outFile = [NSTemporaryDirectory() stringByAppendingString:@"tmp_trace.json"]; - [result writeToFile:outFile - atomically:YES - encoding:NSUTF8StringEncoding - error:nil]; -#if !TARGET_OS_TV - UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[[NSURL fileURLWithPath:outFile]] - applicationActivities:nil]; - activityViewController.completionWithItemsHandler = ^(__unused UIActivityType activityType, - __unused BOOL completed, - __unused NSArray *items, - __unused NSError *error) { - RCTProfileControlsWindow.hidden = NO; - }; - RCTProfileControlsWindow.hidden = YES; - dispatch_async(dispatch_get_main_queue(), ^{ - [[[[RCTSharedApplication() delegate] window] rootViewController] presentViewController:activityViewController - animated:YES - completion:nil]; - }); -#endif - }); - } else { - RCTProfileInit(RCTProfilingBridge()); - } -} - -+ (void)drag:(UIPanGestureRecognizer *)gestureRecognizer -{ - CGPoint translation = [gestureRecognizer translationInView:RCTProfileControlsWindow]; - RCTProfileControlsWindow.center = CGPointMake( - RCTProfileControlsWindow.center.x + translation.x, - RCTProfileControlsWindow.center.y + translation.y - ); - [gestureRecognizer setTranslation:CGPointMake(0, 0) - inView:RCTProfileControlsWindow]; -} - -@end - -#pragma mark - Public Functions - -dispatch_queue_t RCTProfileGetQueue(void) -{ - static dispatch_queue_t queue; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - queue = dispatch_queue_create("com.facebook.react.Profiler", DISPATCH_QUEUE_SERIAL); - }); - return queue; -} - -BOOL RCTProfileIsProfiling(void) -{ - return atomic_load(&RCTProfileProfiling); -} - -void RCTProfileInit(RCTBridge *bridge) -{ - // TODO: enable assert JS thread from any file (and assert here) - BOOL wasProfiling = atomic_fetch_or(&RCTProfileProfiling, 1); - if (wasProfiling) { - return; - } - - if (callbacks != NULL) { - systrace_buffer = callbacks->start(); - } else { - NSTimeInterval time = CACurrentMediaTime(); - dispatch_async(RCTProfileGetQueue(), ^{ - RCTProfileStartTime = time; - RCTProfileOngoingEvents = [NSMutableDictionary new]; - RCTProfileInfo = @{ - kProfileTraceEvents: [NSMutableArray new], - kProfileSamples: [NSMutableArray new], - }; - }); - } - - // Set up thread ordering - dispatch_async(RCTProfileGetQueue(), ^{ - NSArray *orderedThreads = @[@"JS async", @"RCTPerformanceLogger", @"com.facebook.react.JavaScript", - @(RCTUIManagerQueueName), @"main"]; - [orderedThreads enumerateObjectsUsingBlock:^(NSString *thread, NSUInteger idx, __unused BOOL *stop) { - RCTProfileAddEvent(kProfileTraceEvents, - @"ph": @"M", // metadata event - @"name": @"thread_sort_index", - @"tid": thread, - @"args": @{ @"sort_index": @(-1000 + (NSInteger)idx) } - ); - }]; - }); - - RCTProfileHookModules(bridge); - - RCTProfileDisplayLink = [CADisplayLink displayLinkWithTarget:[RCTProfile class] - selector:@selector(vsync:)]; - [RCTProfileDisplayLink addToRunLoop:[NSRunLoop mainRunLoop] - forMode:NSRunLoopCommonModes]; - - [[NSNotificationCenter defaultCenter] postNotificationName:RCTProfileDidStartProfiling - object:bridge]; -} - -void RCTProfileEnd(RCTBridge *bridge, void (^callback)(NSString *)) -{ - // assert JavaScript thread here again - BOOL wasProfiling = atomic_fetch_and(&RCTProfileProfiling, 0); - if (!wasProfiling) { - return; - } - - [[NSNotificationCenter defaultCenter] postNotificationName:RCTProfileDidEndProfiling - object:bridge]; - - [RCTProfileDisplayLink invalidate]; - RCTProfileDisplayLink = nil; - - RCTProfileUnhookModules(bridge); - - if (callbacks != NULL) { - if (systrace_buffer) { - callbacks->stop(); - callback(@(systrace_buffer)); - } - } else { - dispatch_async(RCTProfileGetQueue(), ^{ - NSString *log = RCTJSONStringify(RCTProfileInfo, NULL); - RCTProfileEventID = 0; - RCTProfileInfo = nil; - RCTProfileOngoingEvents = nil; - - callback(log); - }); - } -} - -static NSMutableArray *RCTProfileGetThreadEvents(NSThread *thread) -{ - static NSString *const RCTProfileThreadEventsKey = @"RCTProfileThreadEventsKey"; - NSMutableArray *threadEvents = - thread.threadDictionary[RCTProfileThreadEventsKey]; - if (!threadEvents) { - threadEvents = [NSMutableArray new]; - thread.threadDictionary[RCTProfileThreadEventsKey] = threadEvents; - } - return threadEvents; -} - -void _RCTProfileBeginEvent( - NSThread *calleeThread, - NSTimeInterval time, - uint64_t tag, - NSString *name, - NSDictionary *args -) { - CHECK(); - - if (callbacks != NULL) { - systrace_arg_t *systraceArgs = newSystraceArgsFromDictionary(args); - callbacks->begin_section(tag, name.UTF8String, args.count, systraceArgs); - free(systraceArgs); - return; - } - - dispatch_async(RCTProfileGetQueue(), ^{ - NSMutableArray *events = RCTProfileGetThreadEvents(calleeThread); - [events addObject:@[ - RCTProfileTimestamp(time), - name, - RCTNullIfNil(args), - ]]; - }); -} - -void _RCTProfileEndEvent( - NSThread *calleeThread, - NSString *threadName, - NSTimeInterval time, - uint64_t tag, - NSString *category -) { - CHECK(); - - if (callbacks != NULL) { - callbacks->end_section(tag, 0, nil); - return; - } - - dispatch_async(RCTProfileGetQueue(), ^{ - NSMutableArray *events = RCTProfileGetThreadEvents(calleeThread); - NSArray *event = events.lastObject; - [events removeLastObject]; - - if (!event) { - return; - } - - NSNumber *start = event[0]; - RCTProfileAddEvent(kProfileTraceEvents, - @"tid": threadName, - @"name": event[1], - @"cat": category, - @"ph": @"X", - @"ts": start, - @"dur": @(RCTProfileTimestamp(time).doubleValue - start.doubleValue), - @"args": event[2], - ); - }); -} - -NSUInteger RCTProfileBeginAsyncEvent( - uint64_t tag, - NSString *name, - NSDictionary *args -) { - CHECK(0); - - static NSUInteger eventID = 0; - - NSTimeInterval time = CACurrentMediaTime(); - NSUInteger currentEventID = ++eventID; - - if (callbacks != NULL) { - systrace_arg_t *systraceArgs = newSystraceArgsFromDictionary(args); - callbacks->begin_async_section(tag, name.UTF8String, (int)(currentEventID % INT_MAX), args.count, systraceArgs); - free(systraceArgs); - } else { - dispatch_async(RCTProfileGetQueue(), ^{ - RCTProfileOngoingEvents[@(currentEventID)] = @[ - RCTProfileTimestamp(time), - name, - RCTNullIfNil(args), - ]; - }); - } - - return currentEventID; -} - -void RCTProfileEndAsyncEvent( - uint64_t tag, - NSString *category, - NSUInteger cookie, - NSString *name, - NSString *threadName -) { - CHECK(); - - if (callbacks != NULL) { - callbacks->end_async_section(tag, name.UTF8String, (int)(cookie % INT_MAX), 0, nil); - return; - } - - NSTimeInterval time = CACurrentMediaTime(); - - dispatch_async(RCTProfileGetQueue(), ^{ - NSArray *event = RCTProfileOngoingEvents[@(cookie)]; - - if (event) { - NSNumber *endTimestamp = RCTProfileTimestamp(time); - - RCTProfileAddEvent(kProfileTraceEvents, - @"tid": threadName, - @"name": event[1], - @"cat": category, - @"ph": @"X", - @"ts": event[0], - @"dur": @(endTimestamp.doubleValue - [event[0] doubleValue]), - @"args": event[2], - ); - [RCTProfileOngoingEvents removeObjectForKey:@(cookie)]; - } - }); -} - -void RCTProfileImmediateEvent( - uint64_t tag, - NSString *name, - NSTimeInterval time, - char scope -) { - CHECK(); - - if (callbacks != NULL) { - callbacks->instant_section(tag, name.UTF8String, scope); - return; - } - - NSString *threadName = RCTCurrentThreadName(); - - dispatch_async(RCTProfileGetQueue(), ^{ - RCTProfileAddEvent(kProfileTraceEvents, - @"tid": threadName, - @"name": name, - @"ts": RCTProfileTimestamp(time), - @"scope": @(scope), - @"ph": @"i", - @"args": RCTProfileGetMemoryUsage(), - ); - }); -} - -NSUInteger _RCTProfileBeginFlowEvent(void) -{ - static NSUInteger flowID = 0; - - CHECK(0); - - NSUInteger cookie = ++flowID; - if (callbacks != NULL) { - callbacks->begin_async_flow(1, "flow", (int)cookie); - return cookie; - } - - NSTimeInterval time = CACurrentMediaTime(); - NSString *threadName = RCTCurrentThreadName(); - - dispatch_async(RCTProfileGetQueue(), ^{ - RCTProfileAddEvent(kProfileTraceEvents, - @"tid": threadName, - @"name": @"flow", - @"id": @(cookie), - @"cat": @"flow", - @"ph": @"s", - @"ts": RCTProfileTimestamp(time), - ); - - }); - - return cookie; -} - -void _RCTProfileEndFlowEvent(NSUInteger cookie) -{ - CHECK(); - - if (callbacks != NULL) { - callbacks->end_async_flow(1, "flow", (int)cookie); - return; - } - - NSTimeInterval time = CACurrentMediaTime(); - NSString *threadName = RCTCurrentThreadName(); - - dispatch_async(RCTProfileGetQueue(), ^{ - RCTProfileAddEvent(kProfileTraceEvents, - @"tid": threadName, - @"name": @"flow", - @"id": @(cookie), - @"cat": @"flow", - @"ph": @"f", - @"ts": RCTProfileTimestamp(time), - ); - }); -} - -void RCTProfileSendResult(RCTBridge *bridge, NSString *route, NSData *data) -{ - if (![bridge.bundleURL.scheme hasPrefix:@"http"]) { - RCTLogWarn(@"Cannot upload profile information because you're not connected to the packager. The profiling data is still saved in the app container."); - return; - } - - NSURL *URL = [NSURL URLWithString:[@"/" stringByAppendingString:route] relativeToURL:bridge.bundleURL]; - - NSMutableURLRequest *URLRequest = [NSMutableURLRequest requestWithURL:URL]; - URLRequest.HTTPMethod = @"POST"; - [URLRequest setValue:@"application/json" - forHTTPHeaderField:@"Content-Type"]; - - NSURLSessionTask *task = - [[NSURLSession sharedSession] uploadTaskWithRequest:URLRequest - fromData:data - completionHandler: - ^(NSData *responseData, __unused NSURLResponse *response, NSError *error) { - if (error) { - RCTLogError(@"%@", error.localizedDescription); - } else { - NSString *message = [[NSString alloc] initWithData:responseData - encoding:NSUTF8StringEncoding]; - - if (message.length) { -#if !TARGET_OS_TV - dispatch_async(dispatch_get_main_queue(), ^{ - UIAlertController *alertController = [UIAlertController - alertControllerWithTitle:@"Profile" - message:message - preferredStyle:UIAlertControllerStyleAlert]; - [alertController addAction:[UIAlertAction actionWithTitle:@"OK" - style:UIAlertActionStyleCancel - handler:nil]]; - [RCTPresentedViewController() presentViewController:alertController animated:YES completion:nil]; - }); -#endif - } - } - }]; - - [task resume]; -} - -void RCTProfileShowControls(void) -{ - static const CGFloat height = 30; - static const CGFloat width = 60; - - UIWindow *window = [[UIWindow alloc] initWithFrame:CGRectMake(20, 80, width * 2, height)]; - window.windowLevel = UIWindowLevelAlert + 1000; - window.hidden = NO; - window.backgroundColor = [UIColor lightGrayColor]; - window.layer.borderColor = [UIColor grayColor].CGColor; - window.layer.borderWidth = 1; - window.alpha = 0.8; - - UIButton *startOrStop = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, width, height)]; - [startOrStop setTitle:RCTProfileIsProfiling() ? @"Stop" : @"Start" - forState:UIControlStateNormal]; - [startOrStop addTarget:[RCTProfile class] action:@selector(toggle:) forControlEvents:UIControlEventTouchUpInside]; - startOrStop.titleLabel.font = [UIFont systemFontOfSize:12]; - - UIButton *reload = [[UIButton alloc] initWithFrame:CGRectMake(width, 0, width, height)]; - [reload setTitle:@"Reload" forState:UIControlStateNormal]; - [reload addTarget:[RCTProfile class] action:@selector(reload) forControlEvents:UIControlEventTouchUpInside]; - reload.titleLabel.font = [UIFont systemFontOfSize:12]; - - [window addSubview:startOrStop]; - [window addSubview:reload]; - - UIPanGestureRecognizer *gestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:[RCTProfile class] - action:@selector(drag:)]; - [window addGestureRecognizer:gestureRecognizer]; - - RCTProfileControlsWindow = window; -} - -void RCTProfileHideControls(void) -{ - RCTProfileControlsWindow.hidden = YES; - RCTProfileControlsWindow = nil; -} - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTProfileTrampoline-arm.S b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTProfileTrampoline-arm.S deleted file mode 100644 index 47934922..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTProfileTrampoline-arm.S +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "RCTDefines.h" -#include "RCTMacros.h" - -#if RCT_PROFILE && defined(__arm__) - - .thumb - .thumb_func - .globl SYMBOL_NAME(RCTProfileTrampoline) -SYMBOL_NAME(RCTProfileTrampoline): - /** - * The explanation here is shorter, refer to the x86_64 implementation to a - * richer explanation - */ - - /** - * Save the parameter registers (r0-r3), r7 (frame pointer) and lr (link - * register (contains the address of the caller of RCTProfileTrampoline) - */ - push {r0-r3, r7, lr} - - /** - * Allocate memory to store values across function calls: 12-bytes are - * allocated to store 3 values: the previous value of the callee saved - * register used to save the pointer to the allocated memory, the caller of - * RCTProfileTrampoline and the address of the actual function we want to - * profile - */ - mov r0, #0xc - bl SYMBOL_NAME(RCTProfileMalloc) - /** - * r4 is the callee saved register we'll use to refer to the allocated memory, - * store its initial value, so we can restore it later - */ - str r4, [r0] - mov r4, r0 - - /** - * void RCTProfileGetImplementation(id object, SEL selector) in RCTProfile.m - * - * Load the first 2 argumenters (self and _cmd) used to call - * RCTProfileTrampoline from the stack and put them on the appropriate registers. - */ - ldr r0, [sp] - ldr r1, [sp, #0x4] - bl SYMBOL_NAME(RCTProfileGetImplementation) - // store the actual function address in the allocated memory - str r0, [r4, #0x4] - - /** - * void RCTProfileGetImplementation(id object, SEL selector) in RCTProfile.m - * - * Load the first 2 arguments again to start the profiler - */ - ldr r0, [sp] - ldr r1, [sp, #0x4] - bl SYMBOL_NAME(RCTProfileTrampolineStart) - - /** - * Restore the state to call the actual function we want to profile: pop - * all the registers - */ - pop {r0-r3, r7, lr} - - // store lr (the caller) since it'll be overridden by `blx` (call) - str lr, [r4, #0x8] - ldr r12, [r4, #0x4] // load the function address - blx r12 // call it - push {r0} // save return value - - // void RCTProfileTrampolineEnd(void) in RCTProfile.m - just ends this profile - bl SYMBOL_NAME(RCTProfileTrampolineEnd) - - /** - * Save the value we still need from the allocated memory (caller address), - * restore r4 and free the allocated memory (put its address in r0) - */ - mov r0, r4 - ldr r1, [r4, #0x8] - ldr r4, [r4] - push {r1} // save the caller on the stack - bl SYMBOL_NAME(RCTProfileFree) - - pop {lr} // pop the caller - pop {r0} // pop the return value - bx lr // jump to the calleer - - trap - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTProfileTrampoline-arm64.S b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTProfileTrampoline-arm64.S deleted file mode 100644 index 8aa24ffd..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTProfileTrampoline-arm64.S +++ /dev/null @@ -1,125 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "RCTDefines.h" -#include "RCTMacros.h" - -#if RCT_PROFILE && defined(__arm64__) - - .align 5 - .globl SYMBOL_NAME(RCTProfileTrampoline) -SYMBOL_NAME(RCTProfileTrampoline): - /** - * The explanation here is shorter, refer to the x86_64 implementation to a - * richer explanation - */ - - // Basic prolog: save the frame pointer and the link register (caller address) - stp fp, lr, [sp, #-16]! - mov fp, sp - - /** - * Store the value of all the parameter registers (x0-x8, q0-q7) so we can - * restore everything to the initial state at the time of the actual function - * call - */ - sub sp, sp, #(10*8 + 8*16) - stp q0, q1, [sp, #(0*16)] - stp q2, q3, [sp, #(2*16)] - stp q4, q5, [sp, #(4*16)] - stp q6, q7, [sp, #(6*16)] - stp x0, x1, [sp, #(8*16+0*8)] - stp x2, x3, [sp, #(8*16+2*8)] - stp x4, x5, [sp, #(8*16+4*8)] - stp x6, x7, [sp, #(8*16+6*8)] - str x8, [sp, #(8*16+8*8)] - - /** - * Allocate 16-bytes for the values that have to be preserved across the call - * to the actual function, since the stack has to be in the exact initial - * state. During its lifetimewe use it to store the initial value of the - * callee saved registers we use to point the memory, the actual address of - * the implementation and the caller address. - */ - mov x0, #0x10 - bl SYMBOL_NAME(RCTProfileMalloc) - // store the initial value of r19, the callee saved register we'll use - str x19, [x0] - mov x19, x0 - - /** - * void RCTProfileGetImplementation(id object, SEL selector) - * - * Load the 2 first arguments from the stack, they are the same used to call - * this function - */ - ldp x0, x1, [sp, #(8*16+0*8)] - bl SYMBOL_NAME(RCTProfileGetImplementation) - str x0, [x19, #0x8] // store the actual function address - - /** - * void RCTProfileTrampolineStart(id, SEL) in RCTProfile.m - * - * start the profile, it takes the same first 2 arguments as above. - */ - ldp x0, x1, [sp, #(8*16+0*8)] - bl SYMBOL_NAME(RCTProfileTrampolineStart) - - // Restore all the parameter registers to the initial state. - ldp q0, q1, [sp, #(0*16)] - ldp q2, q3, [sp, #(2*16)] - ldp q4, q5, [sp, #(4*16)] - ldp q6, q7, [sp, #(6*16)] - ldp x0, x1, [sp, #(8*16+0*8)] - ldp x2, x3, [sp, #(8*16+2*8)] - ldp x4, x5, [sp, #(8*16+4*8)] - ldp x6, x7, [sp, #(8*16+6*8)] - ldr x8, [sp, #(8*16+8*8)] - - // Restore the stack pointer, frame pointer and link register - mov sp, fp - ldp fp, lr, [sp], #16 - - - ldr x9, [x19, #0x8] // Load the function - str lr, [x19, #0x8] // store the address of the caller - - blr x9 // call the actual function - - /** - * allocate 32-bytes on the stack, for the 2 return values + the caller - * address that has to preserved across the call to `free` - */ - sub sp, sp, #0x20 - str q0, [sp, #0x0] // 16-byte return value - str x0, [sp, #0x10] // 8-byte return value - - // void RCTProfileTrampolineEnd(void) in RCTProfile.m - just ends this profile - bl SYMBOL_NAME(RCTProfileTrampolineEnd) - - /** - * restore the callee saved registers, move the values we still need to the - * stack and free the allocated memory - */ - mov x0, x19 // move the address of the memory to x0, first argument - ldr x10, [x19, #0x8] // load the caller address - ldr x19, [x19] // restore x19 - str x10, [sp, #0x18] // store x10 on the stack space allocated above - bl SYMBOL_NAME(RCTProfileFree) - - // Load both return values and link register from the stack - ldr q0, [sp, #0x0] - ldr x0, [sp, #0x10] - ldr lr, [sp, #0x18] - - // restore the stack pointer - add sp, sp, #0x20 - - // jump to the calleer, without a link - br lr - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTProfileTrampoline-i386.S b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTProfileTrampoline-i386.S deleted file mode 100644 index d213c463..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTProfileTrampoline-i386.S +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "RCTDefines.h" -#include "RCTMacros.h" - -#if RCT_PROFILE && defined(__i386__) - - .globl SYMBOL_NAME(RCTProfileTrampoline) -SYMBOL_NAME(RCTProfileTrampoline): - /** - * The x86 version is much simpler, since all the arguments are passed in the - * stack, so we just have to preserve the stack pointer (%esp) and the callee - * saved register used to keep the memory allocated - * - * The explanation here is also shorter, refer to the x86_64 implementation to - * a richer explanation - */ - - /** - * Allocate memory to save the caller of RCTProfileTrampoline (used afterwards - * to return at the end of the function) and the initial value for the callee - * saved register (%edi) that will be used to point to the memory allocated. - */ - subl $0x8, %esp // stack padding (16-byte alignment for function calls) - pushl $0xc // allocate 12-bytes - calll SYMBOL_NAME(RCTProfileMalloc) - addl $0xc, %esp // restore stack (8-byte padding + 4-byte argument) - - /** - * actually store the values in the memory allocated - */ - movl %edi, 0x0(%eax) // previous value of edi - popl 0x4(%eax) // caller of RCTProfileTrampoline - - // save the pointer to the allocated memory in %edi - movl %eax, %edi - - /** - * void RCTProfileGetImplementation(id object, SEL selector) in RCTProfile.m - * - * Get the address of the actual C function we have to profile - */ - calll SYMBOL_NAME(RCTProfileGetImplementation) - movl %eax, 0x8(%edi) // Save it in the allocated memory - - /** - * void RCTProfileTrampolineStart(id, SEL) in RCTProfile.m - * - * start profile - the arguments are already in the right position in the - * stack since it takes the same first 2 arguments as the any ObjC function - - * "self" and "_cmd" - */ - calll SYMBOL_NAME(RCTProfileTrampolineStart) - - /** - * Call the actual function and save it's return value, since it should be the - * return value of RCTProfileTrampoline - */ - calll *0x8(%edi) - pushl %eax - - // Align stack and end profile - subl $0xc, %esp - calll SYMBOL_NAME(RCTProfileTrampolineEnd) - addl $0xc, %esp // restore the stack - - /** - * Move the values from the allocated memory to the stack, restore the - * value of %edi, and prepare to free the allocated memory. - */ - pushl 0x4(%edi) // caller of RCTProfileTrampoline - subl $0x4, %esp // Stack padding - pushl %edi // push the memory address - movl 0x0(%edi), %edi // restore the value of %edi - - /** - * Actually free the memory used to store the values across function calls, - * the stack has already been padded and the first and only argument, the - * memory address, is already in the bottom of the stack. - */ - calll SYMBOL_NAME(RCTProfileFree) - addl $0x8, %esp - - /** - * pop the caller address to %ecx and the actual function return value to - * %eax, so it's the return value of RCTProfileTrampoline - */ - popl %ecx - popl %eax - jmpl *%ecx - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTProfileTrampoline-x86_64.S b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTProfileTrampoline-x86_64.S deleted file mode 100644 index a40795c8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Profiler/RCTProfileTrampoline-x86_64.S +++ /dev/null @@ -1,190 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "RCTDefines.h" -#include "RCTMacros.h" - -#if RCT_PROFILE && defined(__x86_64__) - - .globl SYMBOL_NAME(RCTProfileTrampoline) -SYMBOL_NAME(RCTProfileTrampoline): - - /** - * Saves all the state so we can restore it before calling the functions being - * profiled. Registers have the same value at the point of the function call, - * the only thing we can change is the return value, so we return to - * `RCTProfileTrampoline` rather than to its caller. - * - * Save all the parameters registers (%rdi, %rsi, %rdx, %rcx, %r8, %r9), they - * have the 6 first arguments of the function call, and %rax which in special - * cases might be a pointer used for struct returns. - * - * We have to save %r12 since its value should be preserved across function - * calls and we'll use it to keep the stack pointer - */ - subq $0x80+8, %rsp // 8 x 16-bytes xmm registers + 8-bytes alignment - movdqa %xmm0, 0x70(%rsp) - movdqa %xmm1, 0x60(%rsp) - movdqa %xmm2, 0x50(%rsp) - movdqa %xmm3, 0x40(%rsp) - movdqa %xmm4, 0x30(%rsp) - movdqa %xmm5, 0x20(%rsp) - movdqa %xmm6, 0x10(%rsp) - movdqa %xmm7, 0x00(%rsp) - pushq %rdi - pushq %rsi - pushq %rdx - pushq %rcx - pushq %r8 - pushq %r9 - pushq %rax - pushq %r12 - - /** - * Store the stack pointer in the callee saved register %r12 and align the - * stack - it has to 16-byte aligned at the point of the function call - */ - movq %rsp, %r12 - andq $-0x10, %rsp - - /** - * void RCTProfileGetImplementation(id object, SEL selector) - * - * This is a C function defined in `RCTProfile.m`, the object and the selector - * already have to be on %rdi and %rsi respectively, as in any ObjC call. - */ - callq SYMBOL_NAME_PIC(RCTProfileGetImplementation) - - // Restore/unalign the stack pointer, so we can access the registers we stored - movq %r12, %rsp - - /** - * pop %r12 before pushing %rax, which contains the address of the actual - * function we have to call, than we keep %r12 at the bottom of the stack to - * reference the stack pointer - */ - popq %r12 - pushq %rax - pushq %r12 - - // align stack - movq %rsp, %r12 - andq $-0x10, %rsp - - /** - * Allocate memory to save parent before start profiling: the address is put - * at the bottom of the stack at the function call, so ret can actually return - * to the caller. In this case it has the address of RCTProfileTrampoline's - * caller where we'll have to return to after we're finished. - * - * We can't store it on the stack or in any register, since we have to be in - * the exact same state we were at the moment we were called, so the solution - * is to allocate a tiny bit of memory to save this address - */ - - // allocate 16 bytes - movq $0x10, %rdi - callq SYMBOL_NAME_PIC(RCTProfileMalloc) - - // store the initial value of calle saved registers %r13 and %r14 - movq %r13, 0x0(%rax) - movq %r14, 0x8(%rax) - - // mov the pointers we need to the callee saved registers - movq 0xd8(%rsp), %r13 // caller of RCTProfileTrampoline (0xd8 is stack top) - movq %rax, %r14 // allocated memory's address - - /** - * Move self and cmd back to the registers and call start profile: it uses - * the object and the selector to label the call in the profile. - */ - movq 0x40(%r12), %rdi // object - movq 0x38(%r12), %rsi // selector - - // void RCTProfileTrampolineStart(id, SEL) in RCTProfile.m - callq SYMBOL_NAME_PIC(RCTProfileTrampolineStart) - - // unalign the stack and restore %r12 - movq %r12, %rsp - popq %r12 - - // Restore registers for actual function call - popq %r11 - popq %rax - popq %r9 - popq %r8 - popq %rcx - popq %rdx - popq %rsi - popq %rdi - movdqa 0x00(%rsp), %xmm7 - movdqa 0x10(%rsp), %xmm6 - movdqa 0x20(%rsp), %xmm5 - movdqa 0x30(%rsp), %xmm4 - movdqa 0x40(%rsp), %xmm3 - movdqa 0x50(%rsp), %xmm2 - movdqa 0x60(%rsp), %xmm1 - movdqa 0x70(%rsp), %xmm0 - addq $0x80+8, %rsp - - /** - * delete parent caller (saved in %r13) `call` will add the new address so - * we return to RCTProfileTrampoline rather than to its caller - */ - addq $0x8, %rsp - - // call the actual function and save the return value - callq *%r11 - pushq %rax - pushq %rdx - subq $0x20, %rsp // 2 16-bytes xmm register - movdqa %xmm0, 0x00(%rsp) - movdqa %xmm1, 0x10(%rsp) - - // void RCTProfileTrampolineEnd(void) in RCTProfile.m - just ends this profile - callq SYMBOL_NAME_PIC(RCTProfileTrampolineEnd) - - /** - * Restore the initial value of the callee saved registers, saved in the - * memory allocated. - */ - movq %r13, %rcx - movq %r14, %rdi - movq 0x0(%r14), %r13 - movq 0x8(%r14), %r14 - - /** - * save caller address and actual function return (previously in the allocated - * memory) and align the stack - */ - pushq %rcx - pushq %r12 - movq %rsp, %r12 - andq $-0x10, %rsp - - // Free the memory allocated to stash callee saved registers - callq SYMBOL_NAME_PIC(RCTProfileFree) - - // unalign stack and restore %r12 - movq %r12, %rsp - popq %r12 - - /** - * pop the caller address to %rcx and the actual function return value(s) - * so it's the return value of RCTProfileTrampoline - */ - popq %rcx - movdqa 0x00(%rsp), %xmm0 - movdqa 0x10(%rsp), %xmm1 - addq $0x20, %rsp - popq %rdx - popq %rax - - // jump to caller - jmpq *%rcx - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/React.xcodeproj/project.pbxproj b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/React.xcodeproj/project.pbxproj deleted file mode 100644 index 5a364cba..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/React.xcodeproj/project.pbxproj +++ /dev/null @@ -1,5610 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 000E6CEB1AB0E980000CDF4D /* RCTSourceCode.m in Sources */ = {isa = PBXBuildFile; fileRef = 000E6CEA1AB0E980000CDF4D /* RCTSourceCode.m */; }; - 001BFCD01D8381DE008E587E /* RCTMultipartStreamReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 001BFCCF1D8381DE008E587E /* RCTMultipartStreamReader.m */; }; - 006FC4141D9B20820057AAAD /* RCTMultipartDataTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 006FC4131D9B20820057AAAD /* RCTMultipartDataTask.m */; }; - 008341F61D1DB34400876D9A /* RCTJSStackFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 008341F41D1DB34400876D9A /* RCTJSStackFrame.m */; }; - 130443A11E3FEAA900D93A67 /* RCTFollyConvert.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304439F1E3FEAA900D93A67 /* RCTFollyConvert.h */; }; - 130443A21E3FEAA900D93A67 /* RCTFollyConvert.mm in Sources */ = {isa = PBXBuildFile; fileRef = 130443A01E3FEAA900D93A67 /* RCTFollyConvert.mm */; }; - 130443A31E3FEAAE00D93A67 /* RCTFollyConvert.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304439F1E3FEAA900D93A67 /* RCTFollyConvert.h */; }; - 130443A41E3FEAC600D93A67 /* RCTFollyConvert.mm in Sources */ = {isa = PBXBuildFile; fileRef = 130443A01E3FEAA900D93A67 /* RCTFollyConvert.mm */; }; - 130443C61E401A8C00D93A67 /* RCTConvert+Transform.m in Sources */ = {isa = PBXBuildFile; fileRef = 130443C41E401A8C00D93A67 /* RCTConvert+Transform.m */; }; - 130443DB1E401ADD00D93A67 /* RCTConvert+Transform.m in Sources */ = {isa = PBXBuildFile; fileRef = 130443C41E401A8C00D93A67 /* RCTConvert+Transform.m */; }; - 130443DC1E401AF400D93A67 /* RCTConvert+Transform.h in Headers */ = {isa = PBXBuildFile; fileRef = 130443C31E401A8C00D93A67 /* RCTConvert+Transform.h */; }; - 130443DD1E401AF500D93A67 /* RCTConvert+Transform.h in Headers */ = {isa = PBXBuildFile; fileRef = 130443C31E401A8C00D93A67 /* RCTConvert+Transform.h */; }; - 130443DE1E401B0D00D93A67 /* RCTTVView.h in Headers */ = {isa = PBXBuildFile; fileRef = 130443D61E401AD800D93A67 /* RCTTVView.h */; }; - 130E3D881E6A082100ACE484 /* RCTDevSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 130E3D861E6A082100ACE484 /* RCTDevSettings.h */; }; - 130E3D891E6A082100ACE484 /* RCTDevSettings.mm in Sources */ = {isa = PBXBuildFile; fileRef = 130E3D871E6A082100ACE484 /* RCTDevSettings.mm */; }; - 130E3D8A1E6A083600ACE484 /* RCTDevSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 130E3D861E6A082100ACE484 /* RCTDevSettings.h */; }; - 130E3D8B1E6A083900ACE484 /* RCTDevSettings.mm in Sources */ = {isa = PBXBuildFile; fileRef = 130E3D871E6A082100ACE484 /* RCTDevSettings.mm */; }; - 13134C861E296B2A00B9F3CB /* RCTCxxBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C741E296B2A00B9F3CB /* RCTCxxBridge.mm */; }; - 13134C871E296B2A00B9F3CB /* RCTCxxBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C741E296B2A00B9F3CB /* RCTCxxBridge.mm */; }; - 13134C8C1E296B2A00B9F3CB /* RCTMessageThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 13134C771E296B2A00B9F3CB /* RCTMessageThread.h */; }; - 13134C8D1E296B2A00B9F3CB /* RCTMessageThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 13134C771E296B2A00B9F3CB /* RCTMessageThread.h */; }; - 13134C8E1E296B2A00B9F3CB /* RCTMessageThread.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C781E296B2A00B9F3CB /* RCTMessageThread.mm */; }; - 13134C8F1E296B2A00B9F3CB /* RCTMessageThread.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C781E296B2A00B9F3CB /* RCTMessageThread.mm */; }; - 13134C941E296B2A00B9F3CB /* RCTObjcExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 13134C7B1E296B2A00B9F3CB /* RCTObjcExecutor.h */; }; - 13134C951E296B2A00B9F3CB /* RCTObjcExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 13134C7B1E296B2A00B9F3CB /* RCTObjcExecutor.h */; }; - 13134C961E296B2A00B9F3CB /* RCTObjcExecutor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C7C1E296B2A00B9F3CB /* RCTObjcExecutor.mm */; }; - 13134C971E296B2A00B9F3CB /* RCTObjcExecutor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C7C1E296B2A00B9F3CB /* RCTObjcExecutor.mm */; }; - 13134C981E296B2A00B9F3CB /* RCTCxxMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = 13134C7E1E296B2A00B9F3CB /* RCTCxxMethod.h */; }; - 13134C991E296B2A00B9F3CB /* RCTCxxMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = 13134C7E1E296B2A00B9F3CB /* RCTCxxMethod.h */; }; - 13134C9A1E296B2A00B9F3CB /* RCTCxxMethod.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C7F1E296B2A00B9F3CB /* RCTCxxMethod.mm */; }; - 13134C9B1E296B2A00B9F3CB /* RCTCxxMethod.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C7F1E296B2A00B9F3CB /* RCTCxxMethod.mm */; }; - 13134C9C1E296B2A00B9F3CB /* RCTCxxModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 13134C801E296B2A00B9F3CB /* RCTCxxModule.h */; }; - 13134C9D1E296B2A00B9F3CB /* RCTCxxModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 13134C801E296B2A00B9F3CB /* RCTCxxModule.h */; }; - 13134C9E1E296B2A00B9F3CB /* RCTCxxModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C811E296B2A00B9F3CB /* RCTCxxModule.mm */; }; - 13134C9F1E296B2A00B9F3CB /* RCTCxxModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C811E296B2A00B9F3CB /* RCTCxxModule.mm */; }; - 13134CA01E296B2A00B9F3CB /* RCTCxxUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 13134C821E296B2A00B9F3CB /* RCTCxxUtils.h */; }; - 13134CA11E296B2A00B9F3CB /* RCTCxxUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 13134C821E296B2A00B9F3CB /* RCTCxxUtils.h */; }; - 13134CA21E296B2A00B9F3CB /* RCTCxxUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C831E296B2A00B9F3CB /* RCTCxxUtils.mm */; }; - 13134CA31E296B2A00B9F3CB /* RCTCxxUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C831E296B2A00B9F3CB /* RCTCxxUtils.mm */; }; - 131B6AF41AF1093D00FFC3E0 /* RCTSegmentedControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 131B6AF11AF1093D00FFC3E0 /* RCTSegmentedControl.m */; }; - 131B6AF51AF1093D00FFC3E0 /* RCTSegmentedControlManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 131B6AF31AF1093D00FFC3E0 /* RCTSegmentedControlManager.m */; }; - 133957881DF76D3500EC27BE /* YGEnums.h in Headers */ = {isa = PBXBuildFile; fileRef = 130A77031DF767AF001F9587 /* YGEnums.h */; }; - 133957891DF76D3500EC27BE /* YGMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 130A77041DF767AF001F9587 /* YGMacros.h */; }; - 1339578B1DF76D3500EC27BE /* Yoga.h in Headers */ = {isa = PBXBuildFile; fileRef = 130A77081DF767AF001F9587 /* Yoga.h */; }; - 133EA4E52098F6E30035B1D8 /* ReactMarker.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13DA8A2F2097A90A00276ED4 /* ReactMarker.h */; }; - 13456E931ADAD2DE009F94A7 /* RCTConvert+CoreLocation.m in Sources */ = {isa = PBXBuildFile; fileRef = 13456E921ADAD2DE009F94A7 /* RCTConvert+CoreLocation.m */; }; - 134D63C31F1FEC4B008872B5 /* RCTCxxBridgeDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 134D63C21F1FEC4B008872B5 /* RCTCxxBridgeDelegate.h */; }; - 134D63C41F1FEC65008872B5 /* RCTCxxBridgeDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 134D63C21F1FEC4B008872B5 /* RCTCxxBridgeDelegate.h */; }; - 13513F3C1B1F43F400FCE529 /* RCTProgressViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13513F3B1B1F43F400FCE529 /* RCTProgressViewManager.m */; }; - 13723B501A82FD3C00F88898 /* RCTStatusBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13723B4F1A82FD3C00F88898 /* RCTStatusBarManager.m */; }; - 1372B70A1AB030C200659ED6 /* RCTAppState.m in Sources */ = {isa = PBXBuildFile; fileRef = 1372B7091AB030C200659ED6 /* RCTAppState.m */; }; - 1384E2081E806D4E00545659 /* RCTNativeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 1384E2061E806D4E00545659 /* RCTNativeModule.h */; }; - 1384E2091E806D4E00545659 /* RCTNativeModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1384E2071E806D4E00545659 /* RCTNativeModule.mm */; }; - 1384E20A1E806D5700545659 /* RCTNativeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 1384E2061E806D4E00545659 /* RCTNativeModule.h */; }; - 1384E20B1E806D5B00545659 /* RCTNativeModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1384E2071E806D4E00545659 /* RCTNativeModule.mm */; }; - 139D7E911E25C70B00323FB7 /* bignum-dtoa.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7E391E25C5A300323FB7 /* bignum-dtoa.cc */; }; - 139D7E931E25C70B00323FB7 /* bignum.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7E3B1E25C5A300323FB7 /* bignum.cc */; }; - 139D7E951E25C70B00323FB7 /* cached-powers.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7E3D1E25C5A300323FB7 /* cached-powers.cc */; }; - 139D7E971E25C70B00323FB7 /* diy-fp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7E3F1E25C5A300323FB7 /* diy-fp.cc */; }; - 139D7E991E25C70B00323FB7 /* double-conversion.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7E411E25C5A300323FB7 /* double-conversion.cc */; }; - 139D7E9B1E25C70B00323FB7 /* fast-dtoa.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7E431E25C5A300323FB7 /* fast-dtoa.cc */; }; - 139D7E9D1E25C70B00323FB7 /* fixed-dtoa.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7E451E25C5A300323FB7 /* fixed-dtoa.cc */; }; - 139D7EA01E25C70B00323FB7 /* strtod.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7E481E25C5A300323FB7 /* strtod.cc */; }; - 139D7EA51E25C85300323FB7 /* bignum-dtoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E3A1E25C5A300323FB7 /* bignum-dtoa.h */; }; - 139D7EA61E25C85300323FB7 /* bignum.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E3C1E25C5A300323FB7 /* bignum.h */; }; - 139D7EA71E25C85300323FB7 /* cached-powers.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E3E1E25C5A300323FB7 /* cached-powers.h */; }; - 139D7EA81E25C85300323FB7 /* diy-fp.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E401E25C5A300323FB7 /* diy-fp.h */; }; - 139D7EA91E25C85300323FB7 /* double-conversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E421E25C5A300323FB7 /* double-conversion.h */; }; - 139D7EAA1E25C85300323FB7 /* fast-dtoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E441E25C5A300323FB7 /* fast-dtoa.h */; }; - 139D7EAB1E25C85300323FB7 /* fixed-dtoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E461E25C5A300323FB7 /* fixed-dtoa.h */; }; - 139D7EAC1E25C85300323FB7 /* ieee.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E471E25C5A300323FB7 /* ieee.h */; }; - 139D7EAD1E25C85300323FB7 /* strtod.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E491E25C5A300323FB7 /* strtod.h */; }; - 139D7EAE1E25C85300323FB7 /* utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E4A1E25C5A300323FB7 /* utils.h */; }; - 139D7F021E25DE1100323FB7 /* logging.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7EDA1E25DBDC00323FB7 /* logging.cc */; }; - 139D7F031E25DE1100323FB7 /* raw_logging.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7EDB1E25DBDC00323FB7 /* raw_logging.cc */; }; - 139D7F041E25DE1100323FB7 /* signalhandler.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7EDC1E25DBDC00323FB7 /* signalhandler.cc */; }; - 139D7F051E25DE1100323FB7 /* symbolize.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7EDE1E25DBDC00323FB7 /* symbolize.cc */; }; - 139D7F061E25DE1100323FB7 /* utilities.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7EE01E25DBDC00323FB7 /* utilities.cc */; }; - 139D7F071E25DE1100323FB7 /* vlog_is_on.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7EE21E25DBDC00323FB7 /* vlog_is_on.cc */; }; - 139D7F091E25DE3700323FB7 /* demangle.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7F081E25DE3700323FB7 /* demangle.cc */; }; - 139D84B01E273B5600323FB7 /* Conv.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 139D849F1E273B5600323FB7 /* Conv.cpp */; }; - 139D84B11E273B5600323FB7 /* dynamic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 139D84A21E273B5600323FB7 /* dynamic.cpp */; }; - 139D84B31E273B5600323FB7 /* json.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 139D84A71E273B5600323FB7 /* json.cpp */; }; - 13A0C2891B74F71200B29F6F /* RCTDevLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 13A0C2861B74F71200B29F6F /* RCTDevLoadingView.m */; }; - 13A0C28A1B74F71200B29F6F /* RCTDevMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 13A0C2881B74F71200B29F6F /* RCTDevMenu.m */; }; - 13A1F71E1A75392D00D3D453 /* RCTKeyCommands.m in Sources */ = {isa = PBXBuildFile; fileRef = 13A1F71D1A75392D00D3D453 /* RCTKeyCommands.m */; }; - 13A6E20E1C19AA0C00845B82 /* RCTParserUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 13A6E20D1C19AA0C00845B82 /* RCTParserUtils.m */; }; - 13AB90C11B6FA36700713B4F /* RCTComponentData.m in Sources */ = {isa = PBXBuildFile; fileRef = 13AB90C01B6FA36700713B4F /* RCTComponentData.m */; }; - 13AF20451AE707F9005F5298 /* RCTSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = 13AF20441AE707F9005F5298 /* RCTSlider.m */; }; - 13B07FEF1A69327A00A75B9A /* RCTAlertManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FE81A69327A00A75B9A /* RCTAlertManager.m */; }; - 13B07FF01A69327A00A75B9A /* RCTExceptionsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FEA1A69327A00A75B9A /* RCTExceptionsManager.m */; }; - 13B07FF21A69327A00A75B9A /* RCTTiming.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FEE1A69327A00A75B9A /* RCTTiming.m */; }; - 13B080201A69489C00A75B9A /* RCTActivityIndicatorViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B080191A69489C00A75B9A /* RCTActivityIndicatorViewManager.m */; }; - 13B080261A694A8400A75B9A /* RCTWrapperViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B080241A694A8400A75B9A /* RCTWrapperViewController.m */; }; - 13BB3D021BECD54500932C10 /* RCTImageSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BB3D011BECD54500932C10 /* RCTImageSource.m */; }; - 13BCE8091C99CB9D00DD7AAD /* RCTRootShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BCE8081C99CB9D00DD7AAD /* RCTRootShadowView.m */; }; - 13C156051AB1A2840079392D /* RCTWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 13C156021AB1A2840079392D /* RCTWebView.m */; }; - 13C156061AB1A2840079392D /* RCTWebViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13C156041AB1A2840079392D /* RCTWebViewManager.m */; }; - 13CC8A821B17642100940AE7 /* RCTBorderDrawing.m in Sources */ = {isa = PBXBuildFile; fileRef = 13CC8A811B17642100940AE7 /* RCTBorderDrawing.m */; }; - 13D033631C1837FE0021DC29 /* RCTClipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D033621C1837FE0021DC29 /* RCTClipboard.m */; }; - 13D9FEEB1CDCCECF00158BD7 /* RCTEventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D9FEEA1CDCCECF00158BD7 /* RCTEventEmitter.m */; }; - 13D9FEEE1CDCD93000158BD7 /* RCTKeyboardObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D9FEED1CDCD93000158BD7 /* RCTKeyboardObserver.m */; }; - 13DA8A312097A90B00276ED4 /* ReactMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = 13DA8A2F2097A90A00276ED4 /* ReactMarker.h */; }; - 13DA8A322097A90B00276ED4 /* ReactMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = 13DA8A2F2097A90A00276ED4 /* ReactMarker.h */; }; - 13DA8A332097A90B00276ED4 /* ReactMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13DA8A302097A90B00276ED4 /* ReactMarker.cpp */; }; - 13DA8A342097A90B00276ED4 /* ReactMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13DA8A302097A90B00276ED4 /* ReactMarker.cpp */; }; - 13E0674A1A70F434002CDEE1 /* RCTUIManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E067491A70F434002CDEE1 /* RCTUIManager.m */; }; - 13E067561A70F44B002CDEE1 /* RCTViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E0674E1A70F44B002CDEE1 /* RCTViewManager.m */; }; - 13E067571A70F44B002CDEE1 /* RCTView.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E067501A70F44B002CDEE1 /* RCTView.m */; }; - 13E067591A70F44B002CDEE1 /* UIView+React.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E067541A70F44B002CDEE1 /* UIView+React.m */; }; - 13E41EEB1C05CA0B00CD8DAC /* RCTProfileTrampoline-i386.S in Sources */ = {isa = PBXBuildFile; fileRef = 14BF717F1C04793D00C97D0C /* RCTProfileTrampoline-i386.S */; }; - 13F17A851B8493E5007D4C75 /* RCTRedBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 13F17A841B8493E5007D4C75 /* RCTRedBox.m */; }; - 13F887581E2971D400C3C7A1 /* Demangle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13F887521E2971C500C3C7A1 /* Demangle.cpp */; }; - 13F8875A1E2971D400C3C7A1 /* Unicode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13F887541E2971C500C3C7A1 /* Unicode.cpp */; }; - 13F8876E1E29726200C3C7A1 /* CxxNativeModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0A81E03699D0018521A /* CxxNativeModule.cpp */; }; - 13F887701E29726200C3C7A1 /* Instance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0AE1E03699D0018521A /* Instance.cpp */; }; - 13F887711E29726200C3C7A1 /* JSBundleType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC70D2EB1DE48A22002E6351 /* JSBundleType.cpp */; }; - 13F8877B1E29726200C3C7A1 /* JSIndexedRAMBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0C61E03699D0018521A /* JSIndexedRAMBundle.cpp */; }; - 13F8877C1E29726200C3C7A1 /* MethodCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CA1E03699D0018521A /* MethodCall.cpp */; }; - 13F8877D1E29726200C3C7A1 /* ModuleRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CC1E03699D0018521A /* ModuleRegistry.cpp */; }; - 13F8877E1E29726200C3C7A1 /* NativeToJsBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CF1E03699D0018521A /* NativeToJsBridge.cpp */; }; - 13F887801E29726200C3C7A1 /* SampleCxxModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0D31E03699D0018521A /* SampleCxxModule.cpp */; }; - 13F887821E29726300C3C7A1 /* CxxNativeModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0A81E03699D0018521A /* CxxNativeModule.cpp */; }; - 13F887841E29726300C3C7A1 /* Instance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0AE1E03699D0018521A /* Instance.cpp */; }; - 13F8878E1E29726300C3C7A1 /* JSIndexedRAMBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0C61E03699D0018521A /* JSIndexedRAMBundle.cpp */; }; - 13F8878F1E29726300C3C7A1 /* MethodCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CA1E03699D0018521A /* MethodCall.cpp */; }; - 13F887901E29726300C3C7A1 /* ModuleRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CC1E03699D0018521A /* ModuleRegistry.cpp */; }; - 13F887911E29726300C3C7A1 /* NativeToJsBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CF1E03699D0018521A /* NativeToJsBridge.cpp */; }; - 13F887931E29726300C3C7A1 /* SampleCxxModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0D31E03699D0018521A /* SampleCxxModule.cpp */; }; - 142014191B32094000CC17BA /* RCTPerformanceLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 142014171B32094000CC17BA /* RCTPerformanceLogger.m */; }; - 1450FF861BCFF28A00208362 /* RCTProfile.m in Sources */ = {isa = PBXBuildFile; fileRef = 1450FF811BCFF28A00208362 /* RCTProfile.m */; }; - 1450FF871BCFF28A00208362 /* RCTProfileTrampoline-arm.S in Sources */ = {isa = PBXBuildFile; fileRef = 1450FF821BCFF28A00208362 /* RCTProfileTrampoline-arm.S */; }; - 1450FF881BCFF28A00208362 /* RCTProfileTrampoline-arm64.S in Sources */ = {isa = PBXBuildFile; fileRef = 1450FF831BCFF28A00208362 /* RCTProfileTrampoline-arm64.S */; }; - 1450FF8A1BCFF28A00208362 /* RCTProfileTrampoline-x86_64.S in Sources */ = {isa = PBXBuildFile; fileRef = 1450FF851BCFF28A00208362 /* RCTProfileTrampoline-x86_64.S */; }; - 14C2CA741B3AC64300E6CBB2 /* RCTModuleData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 14C2CA731B3AC64300E6CBB2 /* RCTModuleData.mm */; }; - 14C2CA761B3AC64F00E6CBB2 /* RCTFrameUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C2CA751B3AC64F00E6CBB2 /* RCTFrameUpdate.m */; }; - 14F3620D1AABD06A001CE568 /* RCTSwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = 14F362081AABD06A001CE568 /* RCTSwitch.m */; }; - 14F3620E1AABD06A001CE568 /* RCTSwitchManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 14F3620A1AABD06A001CE568 /* RCTSwitchManager.m */; }; - 14F484561AABFCE100FDF6B9 /* RCTSliderManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 14F484551AABFCE100FDF6B9 /* RCTSliderManager.m */; }; - 14F7A0EC1BDA3B3C003C6C10 /* RCTPerfMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = 14F7A0EB1BDA3B3C003C6C10 /* RCTPerfMonitor.m */; }; - 14F7A0F01BDA714B003C6C10 /* RCTFPSGraph.m in Sources */ = {isa = PBXBuildFile; fileRef = 14F7A0EF1BDA714B003C6C10 /* RCTFPSGraph.m */; }; - 191E3EBE1C29D9AF00C180A6 /* RCTRefreshControlManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 191E3EBD1C29D9AF00C180A6 /* RCTRefreshControlManager.m */; }; - 191E3EC11C29DC3800C180A6 /* RCTRefreshControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 191E3EC01C29DC3800C180A6 /* RCTRefreshControl.m */; }; - 199B8A6F1F44DB16005DEF67 /* RCTVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = 199B8A6E1F44DB16005DEF67 /* RCTVersion.h */; }; - 199B8A761F44DEDA005DEF67 /* RCTVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = 199B8A6E1F44DB16005DEF67 /* RCTVersion.h */; }; - 19F61BFA1E8495CD00571D81 /* bignum-dtoa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E3A1E25C5A300323FB7 /* bignum-dtoa.h */; }; - 19F61BFB1E8495CD00571D81 /* bignum.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E3C1E25C5A300323FB7 /* bignum.h */; }; - 19F61BFC1E8495CD00571D81 /* cached-powers.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E3E1E25C5A300323FB7 /* cached-powers.h */; }; - 19F61BFD1E8495CD00571D81 /* diy-fp.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E401E25C5A300323FB7 /* diy-fp.h */; }; - 19F61BFE1E8495CD00571D81 /* double-conversion.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E421E25C5A300323FB7 /* double-conversion.h */; }; - 19F61BFF1E8495CD00571D81 /* fast-dtoa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E441E25C5A300323FB7 /* fast-dtoa.h */; }; - 19F61C001E8495CD00571D81 /* fixed-dtoa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E461E25C5A300323FB7 /* fixed-dtoa.h */; }; - 19F61C011E8495CD00571D81 /* ieee.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E471E25C5A300323FB7 /* ieee.h */; }; - 19F61C021E8495CD00571D81 /* strtod.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E491E25C5A300323FB7 /* strtod.h */; }; - 19F61C031E8495CD00571D81 /* utils.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E4A1E25C5A300323FB7 /* utils.h */; }; - 27595AA41E575C7800CCE2B1 /* CxxModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A71E03699D0018521A /* CxxModule.h */; }; - 27595AA51E575C7800CCE2B1 /* CxxNativeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A91E03699D0018521A /* CxxNativeModule.h */; }; - 27595AA61E575C7800CCE2B1 /* JSExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AB1E03699D0018521A /* JSExecutor.h */; }; - 27595AA91E575C7800CCE2B1 /* Instance.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AF1E03699D0018521A /* Instance.h */; }; - 27595AAA1E575C7800CCE2B1 /* JsArgumentHelpers-inl.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */; }; - 27595AAB1E575C7800CCE2B1 /* JsArgumentHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */; }; - 27595AB51E575C7800CCE2B1 /* JSIndexedRAMBundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C71E03699D0018521A /* JSIndexedRAMBundle.h */; }; - 27595AB61E575C7800CCE2B1 /* MessageQueueThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C91E03699D0018521A /* MessageQueueThread.h */; }; - 27595AB71E575C7800CCE2B1 /* MethodCall.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CB1E03699D0018521A /* MethodCall.h */; }; - 27595AB81E575C7800CCE2B1 /* ModuleRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CD1E03699D0018521A /* ModuleRegistry.h */; }; - 27595AB91E575C7800CCE2B1 /* NativeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CE1E03699D0018521A /* NativeModule.h */; }; - 27595ABA1E575C7800CCE2B1 /* NativeToJsBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D01E03699D0018521A /* NativeToJsBridge.h */; }; - 27595ABC1E575C7800CCE2B1 /* SampleCxxModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D41E03699D0018521A /* SampleCxxModule.h */; }; - 27595ABD1E575C7800CCE2B1 /* SystraceSection.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D51E03699D0018521A /* SystraceSection.h */; }; - 27595ABF1E575C7800CCE2B1 /* CxxModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A71E03699D0018521A /* CxxModule.h */; }; - 27595AC01E575C7800CCE2B1 /* CxxNativeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A91E03699D0018521A /* CxxNativeModule.h */; }; - 27595AC11E575C7800CCE2B1 /* JSExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AB1E03699D0018521A /* JSExecutor.h */; }; - 27595AC41E575C7800CCE2B1 /* Instance.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AF1E03699D0018521A /* Instance.h */; }; - 27595AC51E575C7800CCE2B1 /* JsArgumentHelpers-inl.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */; }; - 27595AC61E575C7800CCE2B1 /* JsArgumentHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */; }; - 27595AD01E575C7800CCE2B1 /* JSIndexedRAMBundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C71E03699D0018521A /* JSIndexedRAMBundle.h */; }; - 27595AD11E575C7800CCE2B1 /* MessageQueueThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C91E03699D0018521A /* MessageQueueThread.h */; }; - 27595AD21E575C7800CCE2B1 /* MethodCall.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CB1E03699D0018521A /* MethodCall.h */; }; - 27595AD31E575C7800CCE2B1 /* ModuleRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CD1E03699D0018521A /* ModuleRegistry.h */; }; - 27595AD41E575C7800CCE2B1 /* NativeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CE1E03699D0018521A /* NativeModule.h */; }; - 27595AD51E575C7800CCE2B1 /* NativeToJsBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D01E03699D0018521A /* NativeToJsBridge.h */; }; - 27595AD71E575C7800CCE2B1 /* SampleCxxModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D41E03699D0018521A /* SampleCxxModule.h */; }; - 27595AD81E575C7800CCE2B1 /* SystraceSection.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D51E03699D0018521A /* SystraceSection.h */; }; - 2D0EB9F32021067800CAF88A /* RCTUIUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = F1EFDA4E201F660F00EE6E4C /* RCTUIUtils.m */; }; - 2D16E68E1FA4FD3900B85C8A /* RCTTVNavigationEventEmitter.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D0B842D1EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.h */; }; - 2D1D83CE1F74E2DA00615550 /* libdouble-conversion.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D383D621EBD27B9005632C8 /* libdouble-conversion.a */; }; - 2D3B5E931D9B087300451313 /* RCTErrorInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 3EDCA8A41D3591E700450C31 /* RCTErrorInfo.m */; }; - 2D3B5E941D9B087900451313 /* RCTBundleURLProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 68EFE4ED1CF6EB3900A1DE13 /* RCTBundleURLProvider.m */; }; - 2D3B5E951D9B087C00451313 /* RCTAssert.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA4B1A601E3B00E9B192 /* RCTAssert.m */; }; - 2D3B5E971D9B089000451313 /* RCTBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA5F1A601EAA00E9B192 /* RCTBridge.m */; }; - 2D3B5E981D9B089500451313 /* RCTConvert.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBACB1A6023D300E9B192 /* RCTConvert.m */; }; - 2D3B5E991D9B089A00451313 /* RCTDisplayLink.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D1E68D91CABD13900DD7465 /* RCTDisplayLink.m */; }; - 2D3B5E9A1D9B089D00451313 /* RCTEventDispatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA661A601EF300E9B192 /* RCTEventDispatcher.m */; }; - 2D3B5E9B1D9B08A000451313 /* RCTFrameUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C2CA751B3AC64F00E6CBB2 /* RCTFrameUpdate.m */; }; - 2D3B5E9C1D9B08A300451313 /* RCTImageSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BB3D011BECD54500932C10 /* RCTImageSource.m */; }; - 2D3B5E9E1D9B08AD00451313 /* RCTJSStackFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 008341F41D1DB34400876D9A /* RCTJSStackFrame.m */; }; - 2D3B5E9F1D9B08AF00451313 /* RCTKeyCommands.m in Sources */ = {isa = PBXBuildFile; fileRef = 13A1F71D1A75392D00D3D453 /* RCTKeyCommands.m */; }; - 2D3B5EA01D9B08B200451313 /* RCTLog.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA4E1A601E3B00E9B192 /* RCTLog.mm */; }; - 2D3B5EA11D9B08B600451313 /* RCTModuleData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 14C2CA731B3AC64300E6CBB2 /* RCTModuleData.mm */; }; - 2D3B5EA31D9B08BE00451313 /* RCTParserUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 13A6E20D1C19AA0C00845B82 /* RCTParserUtils.m */; }; - 2D3B5EA41D9B08C200451313 /* RCTPerformanceLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 142014171B32094000CC17BA /* RCTPerformanceLogger.m */; }; - 2D3B5EA51D9B08C700451313 /* RCTRootView.m in Sources */ = {isa = PBXBuildFile; fileRef = 830A229D1A66C68A008503DA /* RCTRootView.m */; }; - 2D3B5EA61D9B08CA00451313 /* RCTTouchEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 391E86A21C623EC800009732 /* RCTTouchEvent.m */; }; - 2D3B5EA71D9B08CE00451313 /* RCTTouchHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA971A6020BB00E9B192 /* RCTTouchHandler.m */; }; - 2D3B5EA81D9B08D300451313 /* RCTUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA501A601E3B00E9B192 /* RCTUtils.m */; }; - 2D3B5EAE1D9B08F800451313 /* RCTEventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D9FEEA1CDCCECF00158BD7 /* RCTEventEmitter.m */; }; - 2D3B5EAF1D9B08FB00451313 /* RCTAccessibilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E9B20B7A1B500126007A2DA7 /* RCTAccessibilityManager.m */; }; - 2D3B5EB01D9B08FE00451313 /* RCTAlertManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FE81A69327A00A75B9A /* RCTAlertManager.m */; }; - 2D3B5EB11D9B090100451313 /* RCTAppState.m in Sources */ = {isa = PBXBuildFile; fileRef = 1372B7091AB030C200659ED6 /* RCTAppState.m */; }; - 2D3B5EB21D9B090300451313 /* RCTAsyncLocalStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 58114A4E1AAE93D500E7D092 /* RCTAsyncLocalStorage.m */; }; - 2D3B5EB41D9B090A00451313 /* RCTDevLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 13A0C2861B74F71200B29F6F /* RCTDevLoadingView.m */; }; - 2D3B5EB51D9B091100451313 /* RCTDevMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 13A0C2881B74F71200B29F6F /* RCTDevMenu.m */; }; - 2D3B5EB61D9B091400451313 /* RCTExceptionsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FEA1A69327A00A75B9A /* RCTExceptionsManager.m */; }; - 2D3B5EB71D9B091800451313 /* RCTRedBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 13F17A841B8493E5007D4C75 /* RCTRedBox.m */; }; - 2D3B5EB81D9B091B00451313 /* RCTSourceCode.m in Sources */ = {isa = PBXBuildFile; fileRef = 000E6CEA1AB0E980000CDF4D /* RCTSourceCode.m */; }; - 2D3B5EBA1D9B092100451313 /* RCTI18nUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 352DCFEF1D19F4C20056D623 /* RCTI18nUtil.m */; }; - 2D3B5EBB1D9B092300451313 /* RCTI18nManager.m in Sources */ = {isa = PBXBuildFile; fileRef = B233E6E91D2D845D00BC68BA /* RCTI18nManager.m */; }; - 2D3B5EBC1D9B092600451313 /* RCTKeyboardObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D9FEED1CDCD93000158BD7 /* RCTKeyboardObserver.m */; }; - 2D3B5EBD1D9B092A00451313 /* RCTTiming.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FEE1A69327A00A75B9A /* RCTTiming.m */; }; - 2D3B5EBE1D9B092D00451313 /* RCTUIManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E067491A70F434002CDEE1 /* RCTUIManager.m */; }; - 2D3B5EC01D9B093600451313 /* RCTPerfMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = 14F7A0EB1BDA3B3C003C6C10 /* RCTPerfMonitor.m */; }; - 2D3B5EC11D9B093900451313 /* RCTFPSGraph.m in Sources */ = {isa = PBXBuildFile; fileRef = 14F7A0EF1BDA714B003C6C10 /* RCTFPSGraph.m */; }; - 2D3B5EC21D9B093B00451313 /* RCTProfile.m in Sources */ = {isa = PBXBuildFile; fileRef = 1450FF811BCFF28A00208362 /* RCTProfile.m */; }; - 2D3B5EC31D9B094800451313 /* RCTProfileTrampoline-arm.S in Sources */ = {isa = PBXBuildFile; fileRef = 1450FF821BCFF28A00208362 /* RCTProfileTrampoline-arm.S */; }; - 2D3B5EC41D9B094B00451313 /* RCTProfileTrampoline-arm64.S in Sources */ = {isa = PBXBuildFile; fileRef = 1450FF831BCFF28A00208362 /* RCTProfileTrampoline-arm64.S */; }; - 2D3B5EC51D9B094D00451313 /* RCTProfileTrampoline-i386.S in Sources */ = {isa = PBXBuildFile; fileRef = 14BF717F1C04793D00C97D0C /* RCTProfileTrampoline-i386.S */; }; - 2D3B5EC61D9B095000451313 /* RCTProfileTrampoline-x86_64.S in Sources */ = {isa = PBXBuildFile; fileRef = 1450FF851BCFF28A00208362 /* RCTProfileTrampoline-x86_64.S */; }; - 2D3B5EC71D9B095600451313 /* RCTActivityIndicatorView.m in Sources */ = {isa = PBXBuildFile; fileRef = B95154311D1B34B200FE7B80 /* RCTActivityIndicatorView.m */; }; - 2D3B5EC81D9B095800451313 /* RCTActivityIndicatorViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B080191A69489C00A75B9A /* RCTActivityIndicatorViewManager.m */; }; - 2D3B5EC91D9B095C00451313 /* RCTBorderDrawing.m in Sources */ = {isa = PBXBuildFile; fileRef = 13CC8A811B17642100940AE7 /* RCTBorderDrawing.m */; }; - 2D3B5ECA1D9B095F00451313 /* RCTComponentData.m in Sources */ = {isa = PBXBuildFile; fileRef = 13AB90C01B6FA36700713B4F /* RCTComponentData.m */; }; - 2D3B5ECB1D9B096200451313 /* RCTConvert+CoreLocation.m in Sources */ = {isa = PBXBuildFile; fileRef = 13456E921ADAD2DE009F94A7 /* RCTConvert+CoreLocation.m */; }; - 2D3B5ECF1D9B096F00451313 /* RCTFont.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D37B5811D522B190042D5B5 /* RCTFont.mm */; }; - 2D3B5ED41D9B097D00451313 /* RCTModalHostView.m in Sources */ = {isa = PBXBuildFile; fileRef = 83A1FE8B1B62640A00BE0E65 /* RCTModalHostView.m */; }; - 2D3B5ED51D9B098000451313 /* RCTModalHostViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 83392EB21B6634E10013B15F /* RCTModalHostViewController.m */; }; - 2D3B5ED61D9B098400451313 /* RCTModalHostViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 83A1FE8E1B62643A00BE0E65 /* RCTModalHostViewManager.m */; }; - 2D3B5EDD1D9B09A300451313 /* RCTProgressViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13513F3B1B1F43F400FCE529 /* RCTProgressViewManager.m */; }; - 2D3B5EE01D9B09AD00451313 /* RCTRootShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BCE8081C99CB9D00DD7AAD /* RCTRootShadowView.m */; }; - 2D3B5EE31D9B09B700451313 /* RCTSegmentedControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 131B6AF11AF1093D00FFC3E0 /* RCTSegmentedControl.m */; }; - 2D3B5EE41D9B09BB00451313 /* RCTSegmentedControlManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 131B6AF31AF1093D00FFC3E0 /* RCTSegmentedControlManager.m */; }; - 2D3B5EEE1D9B09DA00451313 /* RCTView.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E067501A70F44B002CDEE1 /* RCTView.m */; }; - 2D3B5EEF1D9B09DC00451313 /* RCTViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E0674E1A70F44B002CDEE1 /* RCTViewManager.m */; }; - 2D3B5EF01D9B09E300451313 /* RCTWrapperViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B080241A694A8400A75B9A /* RCTWrapperViewController.m */; }; - 2D3B5EF11D9B09E700451313 /* UIView+React.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E067541A70F44B002CDEE1 /* UIView+React.m */; }; - 2D74EAFA1DAE9590003B751B /* RCTMultipartDataTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 006FC4131D9B20820057AAAD /* RCTMultipartDataTask.m */; }; - 2D8C2E331DA40441000EE098 /* RCTMultipartStreamReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 001BFCCF1D8381DE008E587E /* RCTMultipartStreamReader.m */; }; - 2DD0EFE11DA84F2800B0C975 /* RCTStatusBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13723B4F1A82FD3C00F88898 /* RCTStatusBarManager.m */; }; - 352DCFF01D19F4C20056D623 /* RCTI18nUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 352DCFEF1D19F4C20056D623 /* RCTI18nUtil.m */; }; - 391E86A41C623EC800009732 /* RCTTouchEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 391E86A21C623EC800009732 /* RCTTouchEvent.m */; }; - 39C50FF92046EACF00CEE534 /* RCTVersion.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 199B8A6E1F44DB16005DEF67 /* RCTVersion.h */; }; - 39C50FFB2046EE3500CEE534 /* RCTVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = 39C50FFA2046EE3500CEE534 /* RCTVersion.m */; }; - 39C50FFC2046EE3500CEE534 /* RCTVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = 39C50FFA2046EE3500CEE534 /* RCTVersion.m */; }; - 3D05745A1DE5FFF500184BB4 /* RCTJavaScriptLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = AC70D2E81DE489E4002E6351 /* RCTJavaScriptLoader.mm */; }; - 3D0B84221EC0B3F600B2BD8E /* RCTResizeMode.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA0851DE4F3A000E03CC6 /* RCTResizeMode.h */; }; - 3D0B84231EC0B40D00B2BD8E /* RCTImageLoader.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA0831DE4F3A000E03CC6 /* RCTImageLoader.h */; }; - 3D0B84241EC0B40D00B2BD8E /* RCTImageStoreManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA0841DE4F3A000E03CC6 /* RCTImageStoreManager.h */; }; - 3D0B84251EC0B42600B2BD8E /* RCTNetworking.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA07A1DE4F2EA00E03CC6 /* RCTNetworking.h */; }; - 3D0B84261EC0B42600B2BD8E /* RCTNetworkTask.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA07B1DE4F2EA00E03CC6 /* RCTNetworkTask.h */; }; - 3D0B84271EC0B45400B2BD8E /* RCTLinkingManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA08B1DE4F4DD00E03CC6 /* RCTLinkingManager.h */; }; - 3D0B842A1EC0B49400B2BD8E /* RCTTVRemoteHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D0B84281EC0B49400B2BD8E /* RCTTVRemoteHandler.h */; }; - 3D0B842B1EC0B49400B2BD8E /* RCTTVRemoteHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D0B84291EC0B49400B2BD8E /* RCTTVRemoteHandler.m */; }; - 3D0B842C1EC0B4EA00B2BD8E /* RCTTVView.m in Sources */ = {isa = PBXBuildFile; fileRef = 130443D71E401AD800D93A67 /* RCTTVView.m */; }; - 3D0B842F1EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D0B842D1EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.h */; }; - 3D0B84301EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D0B842E1EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.m */; }; - 3D0E378A1F1CC40000DCAC9F /* RCTWebSocketModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D0E37891F1CC40000DCAC9F /* RCTWebSocketModule.h */; }; - 3D0E378E1F1CC59100DCAC9F /* RCTWebSocketModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D0E37891F1CC40000DCAC9F /* RCTWebSocketModule.h */; }; - 3D0E378F1F1CC5CF00DCAC9F /* RCTWebSocketModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D0E37891F1CC40000DCAC9F /* RCTWebSocketModule.h */; }; - 3D0E37901F1CC5E100DCAC9F /* RCTWebSocketModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D0E37891F1CC40000DCAC9F /* RCTWebSocketModule.h */; }; - 3D1E68DB1CABD13900DD7465 /* RCTDisplayLink.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D1E68D91CABD13900DD7465 /* RCTDisplayLink.m */; }; - 3D302F241DF828F800D6DDAE /* RCTImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA0831DE4F3A000E03CC6 /* RCTImageLoader.h */; }; - 3D302F251DF828F800D6DDAE /* RCTImageStoreManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA0841DE4F3A000E03CC6 /* RCTImageStoreManager.h */; }; - 3D302F261DF828F800D6DDAE /* RCTResizeMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA0851DE4F3A000E03CC6 /* RCTResizeMode.h */; }; - 3D302F271DF828F800D6DDAE /* RCTLinkingManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA08B1DE4F4DD00E03CC6 /* RCTLinkingManager.h */; }; - 3D302F281DF828F800D6DDAE /* RCTNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA07A1DE4F2EA00E03CC6 /* RCTNetworking.h */; }; - 3D302F291DF828F800D6DDAE /* RCTNetworkTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA07B1DE4F2EA00E03CC6 /* RCTNetworkTask.h */; }; - 3D302F2A1DF828F800D6DDAE /* RCTPushNotificationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA08D1DE4F4EE00E03CC6 /* RCTPushNotificationManager.h */; }; - 3D302F2B1DF828F800D6DDAE /* RCTAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4A1A601E3B00E9B192 /* RCTAssert.h */; }; - 3D302F2C1DF828F800D6DDAE /* RCTBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA5E1A601EAA00E9B192 /* RCTBridge.h */; }; - 3D302F2D1DF828F800D6DDAE /* RCTBridge+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A43DB81C1F849600794BC8 /* RCTBridge+Private.h */; }; - 3D302F2E1DF828F800D6DDAE /* RCTBridgeDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482F9E61B55B927000ADFF3 /* RCTBridgeDelegate.h */; }; - 3D302F2F1DF828F800D6DDAE /* RCTBridgeMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = 13AFBCA11C07287B00BBAEAA /* RCTBridgeMethod.h */; }; - 3D302F301DF828F800D6DDAE /* RCTBridgeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 830213F31A654E0800B993E6 /* RCTBridgeModule.h */; }; - 3D302F311DF828F800D6DDAE /* RCTBundleURLProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 68EFE4EC1CF6EB3000A1DE13 /* RCTBundleURLProvider.h */; }; - 3D302F321DF828F800D6DDAE /* RCTConvert.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBACA1A6023D300E9B192 /* RCTConvert.h */; }; - 3D302F331DF828F800D6DDAE /* RCTDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 13AF1F851AE6E777005F5298 /* RCTDefines.h */; }; - 3D302F341DF828F800D6DDAE /* RCTDisplayLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1E68D81CABD13900DD7465 /* RCTDisplayLink.h */; }; - 3D302F351DF828F800D6DDAE /* RCTErrorCustomizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 3EDCA8A21D3591E700450C31 /* RCTErrorCustomizer.h */; }; - 3D302F361DF828F800D6DDAE /* RCTErrorInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 3EDCA8A31D3591E700450C31 /* RCTErrorInfo.h */; }; - 3D302F371DF828F800D6DDAE /* RCTEventDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA651A601EF300E9B192 /* RCTEventDispatcher.h */; }; - 3D302F381DF828F800D6DDAE /* RCTFrameUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1436DD071ADE7AA000A5ED7D /* RCTFrameUpdate.h */; }; - 3D302F391DF828F800D6DDAE /* RCTImageSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 13BB3D001BECD54500932C10 /* RCTImageSource.h */; }; - 3D302F3A1DF828F800D6DDAE /* RCTInvalidating.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4C1A601E3B00E9B192 /* RCTInvalidating.h */; }; - 3D302F3B1DF828F800D6DDAE /* RCTJavaScriptExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA631A601ECA00E9B192 /* RCTJavaScriptExecutor.h */; }; - 3D302F3C1DF828F800D6DDAE /* RCTJavaScriptLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 14200DA81AC179B3008EE6BA /* RCTJavaScriptLoader.h */; }; - 3D302F3D1DF828F800D6DDAE /* RCTJSStackFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 008341F51D1DB34400876D9A /* RCTJSStackFrame.h */; }; - 3D302F3E1DF828F800D6DDAE /* RCTKeyCommands.h in Headers */ = {isa = PBXBuildFile; fileRef = 13A1F71C1A75392D00D3D453 /* RCTKeyCommands.h */; }; - 3D302F3F1DF828F800D6DDAE /* RCTLog.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4D1A601E3B00E9B192 /* RCTLog.h */; }; - 3D302F401DF828F800D6DDAE /* RCTModuleData.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C2CA721B3AC64300E6CBB2 /* RCTModuleData.h */; }; - 3D302F411DF828F800D6DDAE /* RCTModuleMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C2CA6F1B3AC63800E6CBB2 /* RCTModuleMethod.h */; }; - 3D302F421DF828F800D6DDAE /* RCTMultipartDataTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 006FC4121D9B20820057AAAD /* RCTMultipartDataTask.h */; }; - 3D302F431DF828F800D6DDAE /* RCTMultipartStreamReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 001BFCCE1D8381DE008E587E /* RCTMultipartStreamReader.h */; }; - 3D302F441DF828F800D6DDAE /* RCTNullability.h in Headers */ = {isa = PBXBuildFile; fileRef = 13A6E20F1C19ABC700845B82 /* RCTNullability.h */; }; - 3D302F451DF828F800D6DDAE /* RCTParserUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 13A6E20C1C19AA0C00845B82 /* RCTParserUtils.h */; }; - 3D302F461DF828F800D6DDAE /* RCTPerformanceLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = 142014181B32094000CC17BA /* RCTPerformanceLogger.h */; }; - 3D302F471DF828F800D6DDAE /* RCTPlatform.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7749421DC1065C007EC8D8 /* RCTPlatform.h */; }; - 3D302F481DF828F800D6DDAE /* RCTRootView.h in Headers */ = {isa = PBXBuildFile; fileRef = 830A229C1A66C68A008503DA /* RCTRootView.h */; }; - 3D302F491DF828F800D6DDAE /* RCTRootViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 13AFBCA21C07287B00BBAEAA /* RCTRootViewDelegate.h */; }; - 3D302F4A1DF828F800D6DDAE /* RCTRootViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 6A15FB0C1BDF663500531DFB /* RCTRootViewInternal.h */; }; - 3D302F4B1DF828F800D6DDAE /* RCTTouchEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 391E86A31C623EC800009732 /* RCTTouchEvent.h */; }; - 3D302F4C1DF828F800D6DDAE /* RCTTouchHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA961A6020BB00E9B192 /* RCTTouchHandler.h */; }; - 3D302F4D1DF828F800D6DDAE /* RCTURLRequestDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1345A83A1B265A0E00583190 /* RCTURLRequestDelegate.h */; }; - 3D302F4E1DF828F800D6DDAE /* RCTURLRequestHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */; }; - 3D302F4F1DF828F800D6DDAE /* RCTUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4F1A601E3B00E9B192 /* RCTUtils.h */; }; - 3D302F551DF828F800D6DDAE /* RCTAccessibilityManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */; }; - 3D302F561DF828F800D6DDAE /* RCTAlertManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13B07FE71A69327A00A75B9A /* RCTAlertManager.h */; }; - 3D302F571DF828F800D6DDAE /* RCTAppState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1372B7081AB030C200659ED6 /* RCTAppState.h */; }; - 3D302F581DF828F800D6DDAE /* RCTAsyncLocalStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 58114A4F1AAE93D500E7D092 /* RCTAsyncLocalStorage.h */; }; - 3D302F591DF828F800D6DDAE /* RCTClipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 13D033611C1837FE0021DC29 /* RCTClipboard.h */; }; - 3D302F5A1DF828F800D6DDAE /* RCTDevLoadingView.h in Headers */ = {isa = PBXBuildFile; fileRef = 13A0C2851B74F71200B29F6F /* RCTDevLoadingView.h */; }; - 3D302F5B1DF828F800D6DDAE /* RCTDevMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 13A0C2871B74F71200B29F6F /* RCTDevMenu.h */; }; - 3D302F5C1DF828F800D6DDAE /* RCTEventEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 13D9FEE91CDCCECF00158BD7 /* RCTEventEmitter.h */; }; - 3D302F5D1DF828F800D6DDAE /* RCTExceptionsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13B07FE91A69327A00A75B9A /* RCTExceptionsManager.h */; }; - 3D302F5E1DF828F800D6DDAE /* RCTI18nManager.h in Headers */ = {isa = PBXBuildFile; fileRef = B233E6E81D2D843200BC68BA /* RCTI18nManager.h */; }; - 3D302F5F1DF828F800D6DDAE /* RCTI18nUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 352DCFEE1D19F4C20056D623 /* RCTI18nUtil.h */; }; - 3D302F601DF828F800D6DDAE /* RCTKeyboardObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 13D9FEEC1CDCD93000158BD7 /* RCTKeyboardObserver.h */; }; - 3D302F611DF828F800D6DDAE /* RCTRedBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 13F17A831B8493E5007D4C75 /* RCTRedBox.h */; }; - 3D302F621DF828F800D6DDAE /* RCTSourceCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 000E6CE91AB0E97F000CDF4D /* RCTSourceCode.h */; }; - 3D302F631DF828F800D6DDAE /* RCTStatusBarManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13723B4E1A82FD3C00F88898 /* RCTStatusBarManager.h */; }; - 3D302F641DF828F800D6DDAE /* RCTTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 13B07FED1A69327A00A75B9A /* RCTTiming.h */; }; - 3D302F651DF828F800D6DDAE /* RCTUIManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E067481A70F434002CDEE1 /* RCTUIManager.h */; }; - 3D302F661DF828F800D6DDAE /* RCTFPSGraph.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F7A0EE1BDA714B003C6C10 /* RCTFPSGraph.h */; }; - 3D302F681DF828F800D6DDAE /* RCTMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 14BF71811C04795500C97D0C /* RCTMacros.h */; }; - 3D302F691DF828F800D6DDAE /* RCTProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 1450FF801BCFF28A00208362 /* RCTProfile.h */; }; - 3D302F6A1DF828F800D6DDAE /* RCTActivityIndicatorView.h in Headers */ = {isa = PBXBuildFile; fileRef = B95154301D1B34B200FE7B80 /* RCTActivityIndicatorView.h */; }; - 3D302F6B1DF828F800D6DDAE /* RCTActivityIndicatorViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13B080181A69489C00A75B9A /* RCTActivityIndicatorViewManager.h */; }; - 3D302F6C1DF828F800D6DDAE /* RCTAnimationType.h in Headers */ = {isa = PBXBuildFile; fileRef = 13442BF21AA90E0B0037E5B0 /* RCTAnimationType.h */; }; - 3D302F6D1DF828F800D6DDAE /* RCTAutoInsetsProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 13C325261AA63B6A0048765F /* RCTAutoInsetsProtocol.h */; }; - 3D302F6E1DF828F800D6DDAE /* RCTBorderDrawing.h in Headers */ = {isa = PBXBuildFile; fileRef = 13CC8A801B17642100940AE7 /* RCTBorderDrawing.h */; }; - 3D302F6F1DF828F800D6DDAE /* RCTBorderStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = ACDD3FDA1BC7430D00E7DE33 /* RCTBorderStyle.h */; }; - 3D302F701DF828F800D6DDAE /* RCTComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = 13C325281AA63B6A0048765F /* RCTComponent.h */; }; - 3D302F711DF828F800D6DDAE /* RCTComponentData.h in Headers */ = {isa = PBXBuildFile; fileRef = 13AB90BF1B6FA36700713B4F /* RCTComponentData.h */; }; - 3D302F721DF828F800D6DDAE /* RCTConvert+CoreLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 13456E911ADAD2DE009F94A7 /* RCTConvert+CoreLocation.h */; }; - 3D302F761DF828F800D6DDAE /* RCTFont.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D37B5801D522B190042D5B5 /* RCTFont.h */; }; - 3D302F7B1DF828F800D6DDAE /* RCTModalHostView.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A1FE8A1B62640A00BE0E65 /* RCTModalHostView.h */; }; - 3D302F7C1DF828F800D6DDAE /* RCTModalHostViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 83392EB11B6634E10013B15F /* RCTModalHostViewController.h */; }; - 3D302F7D1DF828F800D6DDAE /* RCTModalHostViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A1FE8D1B62643A00BE0E65 /* RCTModalHostViewManager.h */; }; - 3D302F841DF828F800D6DDAE /* RCTPointerEvents.h in Headers */ = {isa = PBXBuildFile; fileRef = 13442BF31AA90E0B0037E5B0 /* RCTPointerEvents.h */; }; - 3D302F851DF828F800D6DDAE /* RCTProgressViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13513F3A1B1F43F400FCE529 /* RCTProgressViewManager.h */; }; - 3D302F861DF828F800D6DDAE /* RCTRefreshControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 191E3EBF1C29DC3800C180A6 /* RCTRefreshControl.h */; }; - 3D302F871DF828F800D6DDAE /* RCTRefreshControlManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 191E3EBC1C29D9AF00C180A6 /* RCTRefreshControlManager.h */; }; - 3D302F881DF828F800D6DDAE /* RCTRootShadowView.h in Headers */ = {isa = PBXBuildFile; fileRef = 13BCE8071C99CB9D00DD7AAD /* RCTRootShadowView.h */; }; - 3D302F8C1DF828F800D6DDAE /* RCTSegmentedControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 131B6AF01AF1093D00FFC3E0 /* RCTSegmentedControl.h */; }; - 3D302F8D1DF828F800D6DDAE /* RCTSegmentedControlManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 131B6AF21AF1093D00FFC3E0 /* RCTSegmentedControlManager.h */; }; - 3D302F8E1DF828F800D6DDAE /* RCTShadowView.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E0674B1A70F44B002CDEE1 /* RCTShadowView.h */; }; - 3D302F8F1DF828F800D6DDAE /* RCTSlider.h in Headers */ = {isa = PBXBuildFile; fileRef = 13AF20431AE707F8005F5298 /* RCTSlider.h */; }; - 3D302F901DF828F800D6DDAE /* RCTSliderManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F484541AABFCE100FDF6B9 /* RCTSliderManager.h */; }; - 3D302F911DF828F800D6DDAE /* RCTSwitch.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F362071AABD06A001CE568 /* RCTSwitch.h */; }; - 3D302F921DF828F800D6DDAE /* RCTSwitchManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F362091AABD06A001CE568 /* RCTSwitchManager.h */; }; - 3D302F971DF828F800D6DDAE /* RCTTextDecorationLineType.h in Headers */ = {isa = PBXBuildFile; fileRef = E3BBC8EB1ADE6F47001BBD81 /* RCTTextDecorationLineType.h */; }; - 3D302F981DF828F800D6DDAE /* RCTView.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E0674F1A70F44B002CDEE1 /* RCTView.h */; }; - 3D302F9A1DF828F800D6DDAE /* RCTViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E0674D1A70F44B002CDEE1 /* RCTViewManager.h */; }; - 3D302F9D1DF828F800D6DDAE /* RCTWrapperViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 13B080231A694A8400A75B9A /* RCTWrapperViewController.h */; }; - 3D302F9F1DF828F800D6DDAE /* UIView+React.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E067531A70F44B002CDEE1 /* UIView+React.h */; }; - 3D3030221DF8294C00D6DDAE /* JSBundleType.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D3CD8F51DE5FB2300167DC4 /* JSBundleType.h */; }; - 3D37B5821D522B190042D5B5 /* RCTFont.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D37B5811D522B190042D5B5 /* RCTFont.mm */; }; - 3D383D1F1EBD27A8005632C8 /* RCTBridge+Private.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14A43DB81C1F849600794BC8 /* RCTBridge+Private.h */; }; - 3D383D201EBD27AF005632C8 /* RCTBridge+Private.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14A43DB81C1F849600794BC8 /* RCTBridge+Private.h */; }; - 3D383D251EBD27B6005632C8 /* Conv.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 139D849F1E273B5600323FB7 /* Conv.cpp */; }; - 3D383D271EBD27B6005632C8 /* raw_logging.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7EDB1E25DBDC00323FB7 /* raw_logging.cc */; }; - 3D383D281EBD27B6005632C8 /* signalhandler.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7EDC1E25DBDC00323FB7 /* signalhandler.cc */; }; - 3D383D291EBD27B6005632C8 /* dynamic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 139D84A21E273B5600323FB7 /* dynamic.cpp */; }; - 3D383D2A1EBD27B6005632C8 /* utilities.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7EE01E25DBDC00323FB7 /* utilities.cc */; }; - 3D383D2D1EBD27B6005632C8 /* symbolize.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7EDE1E25DBDC00323FB7 /* symbolize.cc */; }; - 3D383D2E1EBD27B6005632C8 /* vlog_is_on.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7EE21E25DBDC00323FB7 /* vlog_is_on.cc */; }; - 3D383D2F1EBD27B6005632C8 /* Unicode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13F887541E2971C500C3C7A1 /* Unicode.cpp */; }; - 3D383D301EBD27B6005632C8 /* demangle.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7F081E25DE3700323FB7 /* demangle.cc */; }; - 3D383D311EBD27B6005632C8 /* Demangle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13F887521E2971C500C3C7A1 /* Demangle.cpp */; }; - 3D383D331EBD27B6005632C8 /* logging.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7EDA1E25DBDC00323FB7 /* logging.cc */; }; - 3D383D341EBD27B6005632C8 /* json.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 139D84A71E273B5600323FB7 /* json.cpp */; }; - 3D383D401EBD27B9005632C8 /* bignum-dtoa.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7E391E25C5A300323FB7 /* bignum-dtoa.cc */; }; - 3D383D411EBD27B9005632C8 /* bignum.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7E3B1E25C5A300323FB7 /* bignum.cc */; }; - 3D383D421EBD27B9005632C8 /* cached-powers.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7E3D1E25C5A300323FB7 /* cached-powers.cc */; }; - 3D383D431EBD27B9005632C8 /* diy-fp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7E3F1E25C5A300323FB7 /* diy-fp.cc */; }; - 3D383D441EBD27B9005632C8 /* double-conversion.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7E411E25C5A300323FB7 /* double-conversion.cc */; }; - 3D383D451EBD27B9005632C8 /* fast-dtoa.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7E431E25C5A300323FB7 /* fast-dtoa.cc */; }; - 3D383D461EBD27B9005632C8 /* fixed-dtoa.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7E451E25C5A300323FB7 /* fixed-dtoa.cc */; }; - 3D383D471EBD27B9005632C8 /* strtod.cc in Sources */ = {isa = PBXBuildFile; fileRef = 139D7E481E25C5A300323FB7 /* strtod.cc */; }; - 3D383D4A1EBD27B9005632C8 /* bignum-dtoa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E3A1E25C5A300323FB7 /* bignum-dtoa.h */; }; - 3D383D4B1EBD27B9005632C8 /* bignum.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E3C1E25C5A300323FB7 /* bignum.h */; }; - 3D383D4C1EBD27B9005632C8 /* cached-powers.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E3E1E25C5A300323FB7 /* cached-powers.h */; }; - 3D383D4D1EBD27B9005632C8 /* diy-fp.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E401E25C5A300323FB7 /* diy-fp.h */; }; - 3D383D4E1EBD27B9005632C8 /* double-conversion.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E421E25C5A300323FB7 /* double-conversion.h */; }; - 3D383D4F1EBD27B9005632C8 /* fast-dtoa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E441E25C5A300323FB7 /* fast-dtoa.h */; }; - 3D383D501EBD27B9005632C8 /* fixed-dtoa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E461E25C5A300323FB7 /* fixed-dtoa.h */; }; - 3D383D511EBD27B9005632C8 /* ieee.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E471E25C5A300323FB7 /* ieee.h */; }; - 3D383D521EBD27B9005632C8 /* strtod.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E491E25C5A300323FB7 /* strtod.h */; }; - 3D383D531EBD27B9005632C8 /* utils.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E4A1E25C5A300323FB7 /* utils.h */; }; - 3D383D551EBD27B9005632C8 /* bignum-dtoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E3A1E25C5A300323FB7 /* bignum-dtoa.h */; }; - 3D383D561EBD27B9005632C8 /* bignum.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E3C1E25C5A300323FB7 /* bignum.h */; }; - 3D383D571EBD27B9005632C8 /* cached-powers.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E3E1E25C5A300323FB7 /* cached-powers.h */; }; - 3D383D581EBD27B9005632C8 /* diy-fp.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E401E25C5A300323FB7 /* diy-fp.h */; }; - 3D383D591EBD27B9005632C8 /* double-conversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E421E25C5A300323FB7 /* double-conversion.h */; }; - 3D383D5A1EBD27B9005632C8 /* fast-dtoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E441E25C5A300323FB7 /* fast-dtoa.h */; }; - 3D383D5B1EBD27B9005632C8 /* fixed-dtoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E461E25C5A300323FB7 /* fixed-dtoa.h */; }; - 3D383D5C1EBD27B9005632C8 /* ieee.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E471E25C5A300323FB7 /* ieee.h */; }; - 3D383D5D1EBD27B9005632C8 /* strtod.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E491E25C5A300323FB7 /* strtod.h */; }; - 3D383D5E1EBD27B9005632C8 /* utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E4A1E25C5A300323FB7 /* utils.h */; }; - 3D383D6D1EBD2940005632C8 /* libdouble-conversion.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139D7E881E25C6D100323FB7 /* libdouble-conversion.a */; }; - 3D383D6F1EBD2940005632C8 /* libthird-party.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139D7ECE1E25DB7D00323FB7 /* libthird-party.a */; }; - 3D383D721EBD2949005632C8 /* libthird-party.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D383D3C1EBD27B6005632C8 /* libthird-party.a */; }; - 3D3CD9411DE5FC5300167DC4 /* libcxxreact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D3CD9251DE5FBEC00167DC4 /* libcxxreact.a */; }; - 3D3CD9451DE5FC7100167DC4 /* JSBundleType.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D3CD8F51DE5FB2300167DC4 /* JSBundleType.h */; }; - 3D74547C1E54758900E74ADD /* JSBigString.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7454781E54757500E74ADD /* JSBigString.h */; }; - 3D74547D1E54758900E74ADD /* JSBigString.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7454781E54757500E74ADD /* JSBigString.h */; }; - 3D74547E1E54759A00E74ADD /* JSModulesUnbundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C81E03699D0018521A /* JSModulesUnbundle.h */; }; - 3D74547F1E54759E00E74ADD /* JSModulesUnbundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C81E03699D0018521A /* JSModulesUnbundle.h */; }; - 3D7454801E5475AF00E74ADD /* RecoverableError.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7454791E54757500E74ADD /* RecoverableError.h */; }; - 3D7454811E5475AF00E74ADD /* RecoverableError.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7454791E54757500E74ADD /* RecoverableError.h */; }; - 3D7749441DC1065C007EC8D8 /* RCTPlatform.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D7749431DC1065C007EC8D8 /* RCTPlatform.m */; }; - 3D7AA9C41E548CD5001955CF /* NSDataBigString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D7AA9C31E548CD5001955CF /* NSDataBigString.mm */; }; - 3D7AA9C51E548CDB001955CF /* NSDataBigString.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7454B31E54786200E74ADD /* NSDataBigString.h */; }; - 3D7AA9C61E548CDD001955CF /* NSDataBigString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D7AA9C31E548CD5001955CF /* NSDataBigString.mm */; }; - 3D7BFD151EA8E351008DFB7A /* RCTPackagerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7BFD0B1EA8E351008DFB7A /* RCTPackagerClient.h */; }; - 3D7BFD161EA8E351008DFB7A /* RCTPackagerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7BFD0B1EA8E351008DFB7A /* RCTPackagerClient.h */; }; - 3D7BFD171EA8E351008DFB7A /* RCTPackagerClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D7BFD0C1EA8E351008DFB7A /* RCTPackagerClient.m */; }; - 3D7BFD181EA8E351008DFB7A /* RCTPackagerClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D7BFD0C1EA8E351008DFB7A /* RCTPackagerClient.m */; }; - 3D7BFD1D1EA8E351008DFB7A /* RCTPackagerConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7BFD0F1EA8E351008DFB7A /* RCTPackagerConnection.h */; }; - 3D7BFD1E1EA8E351008DFB7A /* RCTPackagerConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7BFD0F1EA8E351008DFB7A /* RCTPackagerConnection.h */; }; - 3D7BFD1F1EA8E351008DFB7A /* RCTPackagerConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D7BFD101EA8E351008DFB7A /* RCTPackagerConnection.mm */; }; - 3D7BFD201EA8E351008DFB7A /* RCTPackagerConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D7BFD101EA8E351008DFB7A /* RCTPackagerConnection.mm */; }; - 3D7BFD291EA8E37B008DFB7A /* RCTDevSettings.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 130E3D861E6A082100ACE484 /* RCTDevSettings.h */; }; - 3D7BFD2D1EA8E3FA008DFB7A /* RCTReconnectingWebSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7BFD2B1EA8E3FA008DFB7A /* RCTReconnectingWebSocket.h */; }; - 3D7BFD2E1EA8E3FA008DFB7A /* RCTReconnectingWebSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7BFD2B1EA8E3FA008DFB7A /* RCTReconnectingWebSocket.h */; }; - 3D7BFD2F1EA8E3FA008DFB7A /* RCTSRWebSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7BFD2C1EA8E3FA008DFB7A /* RCTSRWebSocket.h */; }; - 3D7BFD301EA8E3FA008DFB7A /* RCTSRWebSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7BFD2C1EA8E3FA008DFB7A /* RCTSRWebSocket.h */; }; - 3D7BFD311EA8E41F008DFB7A /* RCTPackagerClient.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7BFD0B1EA8E351008DFB7A /* RCTPackagerClient.h */; }; - 3D7BFD331EA8E433008DFB7A /* RCTPackagerClient.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7BFD0B1EA8E351008DFB7A /* RCTPackagerClient.h */; }; - 3D7BFD351EA8E43F008DFB7A /* RCTDevSettings.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 130E3D861E6A082100ACE484 /* RCTDevSettings.h */; }; - 3D80D9181DF6F7A80028D040 /* JSBundleType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC70D2EB1DE48A22002E6351 /* JSBundleType.cpp */; }; - 3D80D91B1DF6F8200028D040 /* RCTPlatform.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D7749431DC1065C007EC8D8 /* RCTPlatform.m */; }; - 3D80D91F1DF6FA890028D040 /* RCTImageLoader.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA0831DE4F3A000E03CC6 /* RCTImageLoader.h */; }; - 3D80D9201DF6FA890028D040 /* RCTImageStoreManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA0841DE4F3A000E03CC6 /* RCTImageStoreManager.h */; }; - 3D80D9211DF6FA890028D040 /* RCTResizeMode.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA0851DE4F3A000E03CC6 /* RCTResizeMode.h */; }; - 3D80D9221DF6FA890028D040 /* RCTLinkingManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA08B1DE4F4DD00E03CC6 /* RCTLinkingManager.h */; }; - 3D80D9231DF6FA890028D040 /* RCTNetworking.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA07A1DE4F2EA00E03CC6 /* RCTNetworking.h */; }; - 3D80D9241DF6FA890028D040 /* RCTNetworkTask.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA07B1DE4F2EA00E03CC6 /* RCTNetworkTask.h */; }; - 3D80D9251DF6FA890028D040 /* RCTPushNotificationManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA08D1DE4F4EE00E03CC6 /* RCTPushNotificationManager.h */; }; - 3D80D9261DF6FA890028D040 /* RCTAssert.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4A1A601E3B00E9B192 /* RCTAssert.h */; }; - 3D80D9271DF6FA890028D040 /* RCTBridge.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA5E1A601EAA00E9B192 /* RCTBridge.h */; }; - 3D80D9291DF6FA890028D040 /* RCTBridgeDelegate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1482F9E61B55B927000ADFF3 /* RCTBridgeDelegate.h */; }; - 3D80D92A1DF6FA890028D040 /* RCTBridgeMethod.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13AFBCA11C07287B00BBAEAA /* RCTBridgeMethod.h */; }; - 3D80D92B1DF6FA890028D040 /* RCTBridgeModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 830213F31A654E0800B993E6 /* RCTBridgeModule.h */; }; - 3D80D92C1DF6FA890028D040 /* RCTBundleURLProvider.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 68EFE4EC1CF6EB3000A1DE13 /* RCTBundleURLProvider.h */; }; - 3D80D92D1DF6FA890028D040 /* RCTConvert.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBACA1A6023D300E9B192 /* RCTConvert.h */; }; - 3D80D92E1DF6FA890028D040 /* RCTDefines.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13AF1F851AE6E777005F5298 /* RCTDefines.h */; }; - 3D80D92F1DF6FA890028D040 /* RCTDisplayLink.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D1E68D81CABD13900DD7465 /* RCTDisplayLink.h */; }; - 3D80D9301DF6FA890028D040 /* RCTErrorCustomizer.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3EDCA8A21D3591E700450C31 /* RCTErrorCustomizer.h */; }; - 3D80D9311DF6FA890028D040 /* RCTErrorInfo.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3EDCA8A31D3591E700450C31 /* RCTErrorInfo.h */; }; - 3D80D9321DF6FA890028D040 /* RCTEventDispatcher.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA651A601EF300E9B192 /* RCTEventDispatcher.h */; }; - 3D80D9331DF6FA890028D040 /* RCTFrameUpdate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1436DD071ADE7AA000A5ED7D /* RCTFrameUpdate.h */; }; - 3D80D9341DF6FA890028D040 /* RCTImageSource.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13BB3D001BECD54500932C10 /* RCTImageSource.h */; }; - 3D80D9351DF6FA890028D040 /* RCTInvalidating.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4C1A601E3B00E9B192 /* RCTInvalidating.h */; }; - 3D80D9361DF6FA890028D040 /* RCTJavaScriptExecutor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA631A601ECA00E9B192 /* RCTJavaScriptExecutor.h */; }; - 3D80D9371DF6FA890028D040 /* RCTJavaScriptLoader.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14200DA81AC179B3008EE6BA /* RCTJavaScriptLoader.h */; }; - 3D80D9381DF6FA890028D040 /* RCTJSStackFrame.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 008341F51D1DB34400876D9A /* RCTJSStackFrame.h */; }; - 3D80D9391DF6FA890028D040 /* RCTKeyCommands.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13A1F71C1A75392D00D3D453 /* RCTKeyCommands.h */; }; - 3D80D93A1DF6FA890028D040 /* RCTLog.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4D1A601E3B00E9B192 /* RCTLog.h */; }; - 3D80D93B1DF6FA890028D040 /* RCTModuleData.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14C2CA721B3AC64300E6CBB2 /* RCTModuleData.h */; }; - 3D80D93C1DF6FA890028D040 /* RCTModuleMethod.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14C2CA6F1B3AC63800E6CBB2 /* RCTModuleMethod.h */; }; - 3D80D93D1DF6FA890028D040 /* RCTMultipartDataTask.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 006FC4121D9B20820057AAAD /* RCTMultipartDataTask.h */; }; - 3D80D93E1DF6FA890028D040 /* RCTMultipartStreamReader.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 001BFCCE1D8381DE008E587E /* RCTMultipartStreamReader.h */; }; - 3D80D93F1DF6FA890028D040 /* RCTNullability.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13A6E20F1C19ABC700845B82 /* RCTNullability.h */; }; - 3D80D9401DF6FA890028D040 /* RCTParserUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13A6E20C1C19AA0C00845B82 /* RCTParserUtils.h */; }; - 3D80D9411DF6FA890028D040 /* RCTPerformanceLogger.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 142014181B32094000CC17BA /* RCTPerformanceLogger.h */; }; - 3D80D9421DF6FA890028D040 /* RCTPlatform.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7749421DC1065C007EC8D8 /* RCTPlatform.h */; }; - 3D80D9431DF6FA890028D040 /* RCTRootView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 830A229C1A66C68A008503DA /* RCTRootView.h */; }; - 3D80D9441DF6FA890028D040 /* RCTRootViewDelegate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13AFBCA21C07287B00BBAEAA /* RCTRootViewDelegate.h */; }; - 3D80D9461DF6FA890028D040 /* RCTTouchEvent.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 391E86A31C623EC800009732 /* RCTTouchEvent.h */; }; - 3D80D9471DF6FA890028D040 /* RCTTouchHandler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA961A6020BB00E9B192 /* RCTTouchHandler.h */; }; - 3D80D9481DF6FA890028D040 /* RCTURLRequestDelegate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1345A83A1B265A0E00583190 /* RCTURLRequestDelegate.h */; }; - 3D80D9491DF6FA890028D040 /* RCTURLRequestHandler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */; }; - 3D80D94A1DF6FA890028D040 /* RCTUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4F1A601E3B00E9B192 /* RCTUtils.h */; }; - 3D80D9501DF6FA890028D040 /* RCTAccessibilityManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */; }; - 3D80D9511DF6FA890028D040 /* RCTAlertManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13B07FE71A69327A00A75B9A /* RCTAlertManager.h */; }; - 3D80D9521DF6FA890028D040 /* RCTAppState.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1372B7081AB030C200659ED6 /* RCTAppState.h */; }; - 3D80D9531DF6FA890028D040 /* RCTAsyncLocalStorage.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 58114A4F1AAE93D500E7D092 /* RCTAsyncLocalStorage.h */; }; - 3D80D9541DF6FA890028D040 /* RCTClipboard.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13D033611C1837FE0021DC29 /* RCTClipboard.h */; }; - 3D80D9551DF6FA890028D040 /* RCTDevLoadingView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13A0C2851B74F71200B29F6F /* RCTDevLoadingView.h */; }; - 3D80D9561DF6FA890028D040 /* RCTDevMenu.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13A0C2871B74F71200B29F6F /* RCTDevMenu.h */; }; - 3D80D9571DF6FA890028D040 /* RCTEventEmitter.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13D9FEE91CDCCECF00158BD7 /* RCTEventEmitter.h */; }; - 3D80D9581DF6FA890028D040 /* RCTExceptionsManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13B07FE91A69327A00A75B9A /* RCTExceptionsManager.h */; }; - 3D80D9591DF6FA890028D040 /* RCTI18nManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = B233E6E81D2D843200BC68BA /* RCTI18nManager.h */; }; - 3D80D95A1DF6FA890028D040 /* RCTI18nUtil.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 352DCFEE1D19F4C20056D623 /* RCTI18nUtil.h */; }; - 3D80D95B1DF6FA890028D040 /* RCTKeyboardObserver.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13D9FEEC1CDCD93000158BD7 /* RCTKeyboardObserver.h */; }; - 3D80D95C1DF6FA890028D040 /* RCTRedBox.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13F17A831B8493E5007D4C75 /* RCTRedBox.h */; }; - 3D80D95D1DF6FA890028D040 /* RCTSourceCode.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 000E6CE91AB0E97F000CDF4D /* RCTSourceCode.h */; }; - 3D80D95E1DF6FA890028D040 /* RCTStatusBarManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13723B4E1A82FD3C00F88898 /* RCTStatusBarManager.h */; }; - 3D80D95F1DF6FA890028D040 /* RCTTiming.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13B07FED1A69327A00A75B9A /* RCTTiming.h */; }; - 3D80D9601DF6FA890028D040 /* RCTUIManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13E067481A70F434002CDEE1 /* RCTUIManager.h */; }; - 3D80D9611DF6FA890028D040 /* RCTFPSGraph.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14F7A0EE1BDA714B003C6C10 /* RCTFPSGraph.h */; }; - 3D80D9631DF6FA890028D040 /* RCTMacros.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14BF71811C04795500C97D0C /* RCTMacros.h */; }; - 3D80D9641DF6FA890028D040 /* RCTProfile.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1450FF801BCFF28A00208362 /* RCTProfile.h */; }; - 3D80D9651DF6FA890028D040 /* RCTActivityIndicatorView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = B95154301D1B34B200FE7B80 /* RCTActivityIndicatorView.h */; }; - 3D80D9661DF6FA890028D040 /* RCTActivityIndicatorViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13B080181A69489C00A75B9A /* RCTActivityIndicatorViewManager.h */; }; - 3D80D9671DF6FA890028D040 /* RCTAnimationType.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13442BF21AA90E0B0037E5B0 /* RCTAnimationType.h */; }; - 3D80D9681DF6FA890028D040 /* RCTAutoInsetsProtocol.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13C325261AA63B6A0048765F /* RCTAutoInsetsProtocol.h */; }; - 3D80D9691DF6FA890028D040 /* RCTBorderDrawing.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13CC8A801B17642100940AE7 /* RCTBorderDrawing.h */; }; - 3D80D96A1DF6FA890028D040 /* RCTBorderStyle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = ACDD3FDA1BC7430D00E7DE33 /* RCTBorderStyle.h */; }; - 3D80D96B1DF6FA890028D040 /* RCTComponent.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13C325281AA63B6A0048765F /* RCTComponent.h */; }; - 3D80D96C1DF6FA890028D040 /* RCTComponentData.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13AB90BF1B6FA36700713B4F /* RCTComponentData.h */; }; - 3D80D96D1DF6FA890028D040 /* RCTConvert+CoreLocation.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13456E911ADAD2DE009F94A7 /* RCTConvert+CoreLocation.h */; }; - 3D80D9711DF6FA890028D040 /* RCTFont.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D37B5801D522B190042D5B5 /* RCTFont.h */; }; - 3D80D9761DF6FA890028D040 /* RCTModalHostView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83A1FE8A1B62640A00BE0E65 /* RCTModalHostView.h */; }; - 3D80D9771DF6FA890028D040 /* RCTModalHostViewController.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83392EB11B6634E10013B15F /* RCTModalHostViewController.h */; }; - 3D80D9781DF6FA890028D040 /* RCTModalHostViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83A1FE8D1B62643A00BE0E65 /* RCTModalHostViewManager.h */; }; - 3D80D97D1DF6FA890028D040 /* RCTPicker.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 58114A121AAE854800E7D092 /* RCTPicker.h */; }; - 3D80D97E1DF6FA890028D040 /* RCTPickerManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 58114A141AAE854800E7D092 /* RCTPickerManager.h */; }; - 3D80D97F1DF6FA890028D040 /* RCTPointerEvents.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13442BF31AA90E0B0037E5B0 /* RCTPointerEvents.h */; }; - 3D80D9801DF6FA890028D040 /* RCTProgressViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13513F3A1B1F43F400FCE529 /* RCTProgressViewManager.h */; }; - 3D80D9811DF6FA890028D040 /* RCTRefreshControl.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 191E3EBF1C29DC3800C180A6 /* RCTRefreshControl.h */; }; - 3D80D9821DF6FA890028D040 /* RCTRefreshControlManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 191E3EBC1C29D9AF00C180A6 /* RCTRefreshControlManager.h */; }; - 3D80D9831DF6FA890028D040 /* RCTRootShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13BCE8071C99CB9D00DD7AAD /* RCTRootShadowView.h */; }; - 3D80D9871DF6FA890028D040 /* RCTSegmentedControl.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 131B6AF01AF1093D00FFC3E0 /* RCTSegmentedControl.h */; }; - 3D80D9881DF6FA890028D040 /* RCTSegmentedControlManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 131B6AF21AF1093D00FFC3E0 /* RCTSegmentedControlManager.h */; }; - 3D80D9891DF6FA890028D040 /* RCTShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13E0674B1A70F44B002CDEE1 /* RCTShadowView.h */; }; - 3D80D98A1DF6FA890028D040 /* RCTSlider.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13AF20431AE707F8005F5298 /* RCTSlider.h */; }; - 3D80D98B1DF6FA890028D040 /* RCTSliderManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14F484541AABFCE100FDF6B9 /* RCTSliderManager.h */; }; - 3D80D98C1DF6FA890028D040 /* RCTSwitch.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14F362071AABD06A001CE568 /* RCTSwitch.h */; }; - 3D80D98D1DF6FA890028D040 /* RCTSwitchManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14F362091AABD06A001CE568 /* RCTSwitchManager.h */; }; - 3D80D9921DF6FA890028D040 /* RCTTextDecorationLineType.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = E3BBC8EB1ADE6F47001BBD81 /* RCTTextDecorationLineType.h */; }; - 3D80D9931DF6FA890028D040 /* RCTView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13E0674F1A70F44B002CDEE1 /* RCTView.h */; }; - 3D80D9951DF6FA890028D040 /* RCTViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13E0674D1A70F44B002CDEE1 /* RCTViewManager.h */; }; - 3D80D9961DF6FA890028D040 /* RCTWebView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13C156011AB1A2840079392D /* RCTWebView.h */; }; - 3D80D9971DF6FA890028D040 /* RCTWebViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13C156031AB1A2840079392D /* RCTWebViewManager.h */; }; - 3D80D9981DF6FA890028D040 /* RCTWrapperViewController.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13B080231A694A8400A75B9A /* RCTWrapperViewController.h */; }; - 3D80D99A1DF6FA890028D040 /* UIView+React.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13E067531A70F44B002CDEE1 /* UIView+React.h */; }; - 3D80DA191DF820620028D040 /* RCTImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA0831DE4F3A000E03CC6 /* RCTImageLoader.h */; }; - 3D80DA1A1DF820620028D040 /* RCTImageStoreManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA0841DE4F3A000E03CC6 /* RCTImageStoreManager.h */; }; - 3D80DA1B1DF820620028D040 /* RCTResizeMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA0851DE4F3A000E03CC6 /* RCTResizeMode.h */; }; - 3D80DA1C1DF820620028D040 /* RCTLinkingManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA08B1DE4F4DD00E03CC6 /* RCTLinkingManager.h */; }; - 3D80DA1D1DF820620028D040 /* RCTNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA07A1DE4F2EA00E03CC6 /* RCTNetworking.h */; }; - 3D80DA1E1DF820620028D040 /* RCTNetworkTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA07B1DE4F2EA00E03CC6 /* RCTNetworkTask.h */; }; - 3D80DA1F1DF820620028D040 /* RCTPushNotificationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA08D1DE4F4EE00E03CC6 /* RCTPushNotificationManager.h */; }; - 3D80DA201DF820620028D040 /* RCTAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4A1A601E3B00E9B192 /* RCTAssert.h */; }; - 3D80DA211DF820620028D040 /* RCTBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA5E1A601EAA00E9B192 /* RCTBridge.h */; }; - 3D80DA221DF820620028D040 /* RCTBridge+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A43DB81C1F849600794BC8 /* RCTBridge+Private.h */; }; - 3D80DA231DF820620028D040 /* RCTBridgeDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482F9E61B55B927000ADFF3 /* RCTBridgeDelegate.h */; }; - 3D80DA241DF820620028D040 /* RCTBridgeMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = 13AFBCA11C07287B00BBAEAA /* RCTBridgeMethod.h */; }; - 3D80DA251DF820620028D040 /* RCTBridgeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 830213F31A654E0800B993E6 /* RCTBridgeModule.h */; }; - 3D80DA261DF820620028D040 /* RCTBundleURLProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 68EFE4EC1CF6EB3000A1DE13 /* RCTBundleURLProvider.h */; }; - 3D80DA271DF820620028D040 /* RCTConvert.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBACA1A6023D300E9B192 /* RCTConvert.h */; }; - 3D80DA281DF820620028D040 /* RCTDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 13AF1F851AE6E777005F5298 /* RCTDefines.h */; }; - 3D80DA291DF820620028D040 /* RCTDisplayLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1E68D81CABD13900DD7465 /* RCTDisplayLink.h */; }; - 3D80DA2A1DF820620028D040 /* RCTErrorCustomizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 3EDCA8A21D3591E700450C31 /* RCTErrorCustomizer.h */; }; - 3D80DA2B1DF820620028D040 /* RCTErrorInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 3EDCA8A31D3591E700450C31 /* RCTErrorInfo.h */; }; - 3D80DA2C1DF820620028D040 /* RCTEventDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA651A601EF300E9B192 /* RCTEventDispatcher.h */; }; - 3D80DA2D1DF820620028D040 /* RCTFrameUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1436DD071ADE7AA000A5ED7D /* RCTFrameUpdate.h */; }; - 3D80DA2E1DF820620028D040 /* RCTImageSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 13BB3D001BECD54500932C10 /* RCTImageSource.h */; }; - 3D80DA2F1DF820620028D040 /* RCTInvalidating.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4C1A601E3B00E9B192 /* RCTInvalidating.h */; }; - 3D80DA301DF820620028D040 /* RCTJavaScriptExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA631A601ECA00E9B192 /* RCTJavaScriptExecutor.h */; }; - 3D80DA311DF820620028D040 /* RCTJavaScriptLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 14200DA81AC179B3008EE6BA /* RCTJavaScriptLoader.h */; }; - 3D80DA321DF820620028D040 /* RCTJSStackFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 008341F51D1DB34400876D9A /* RCTJSStackFrame.h */; }; - 3D80DA331DF820620028D040 /* RCTKeyCommands.h in Headers */ = {isa = PBXBuildFile; fileRef = 13A1F71C1A75392D00D3D453 /* RCTKeyCommands.h */; }; - 3D80DA341DF820620028D040 /* RCTLog.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4D1A601E3B00E9B192 /* RCTLog.h */; }; - 3D80DA351DF820620028D040 /* RCTModuleData.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C2CA721B3AC64300E6CBB2 /* RCTModuleData.h */; }; - 3D80DA361DF820620028D040 /* RCTModuleMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C2CA6F1B3AC63800E6CBB2 /* RCTModuleMethod.h */; }; - 3D80DA371DF820620028D040 /* RCTMultipartDataTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 006FC4121D9B20820057AAAD /* RCTMultipartDataTask.h */; }; - 3D80DA381DF820620028D040 /* RCTMultipartStreamReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 001BFCCE1D8381DE008E587E /* RCTMultipartStreamReader.h */; }; - 3D80DA391DF820620028D040 /* RCTNullability.h in Headers */ = {isa = PBXBuildFile; fileRef = 13A6E20F1C19ABC700845B82 /* RCTNullability.h */; }; - 3D80DA3A1DF820620028D040 /* RCTParserUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 13A6E20C1C19AA0C00845B82 /* RCTParserUtils.h */; }; - 3D80DA3B1DF820620028D040 /* RCTPerformanceLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = 142014181B32094000CC17BA /* RCTPerformanceLogger.h */; }; - 3D80DA3C1DF820620028D040 /* RCTPlatform.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7749421DC1065C007EC8D8 /* RCTPlatform.h */; }; - 3D80DA3D1DF820620028D040 /* RCTRootView.h in Headers */ = {isa = PBXBuildFile; fileRef = 830A229C1A66C68A008503DA /* RCTRootView.h */; }; - 3D80DA3E1DF820620028D040 /* RCTRootViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 13AFBCA21C07287B00BBAEAA /* RCTRootViewDelegate.h */; }; - 3D80DA3F1DF820620028D040 /* RCTRootViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 6A15FB0C1BDF663500531DFB /* RCTRootViewInternal.h */; }; - 3D80DA401DF820620028D040 /* RCTTouchEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 391E86A31C623EC800009732 /* RCTTouchEvent.h */; }; - 3D80DA411DF820620028D040 /* RCTTouchHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA961A6020BB00E9B192 /* RCTTouchHandler.h */; }; - 3D80DA421DF820620028D040 /* RCTURLRequestDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1345A83A1B265A0E00583190 /* RCTURLRequestDelegate.h */; }; - 3D80DA431DF820620028D040 /* RCTURLRequestHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */; }; - 3D80DA441DF820620028D040 /* RCTUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4F1A601E3B00E9B192 /* RCTUtils.h */; }; - 3D80DA4A1DF820620028D040 /* RCTAccessibilityManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */; }; - 3D80DA4B1DF820620028D040 /* RCTAlertManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13B07FE71A69327A00A75B9A /* RCTAlertManager.h */; }; - 3D80DA4C1DF820620028D040 /* RCTAppState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1372B7081AB030C200659ED6 /* RCTAppState.h */; }; - 3D80DA4D1DF820620028D040 /* RCTAsyncLocalStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 58114A4F1AAE93D500E7D092 /* RCTAsyncLocalStorage.h */; }; - 3D80DA4E1DF820620028D040 /* RCTClipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 13D033611C1837FE0021DC29 /* RCTClipboard.h */; }; - 3D80DA4F1DF820620028D040 /* RCTDevLoadingView.h in Headers */ = {isa = PBXBuildFile; fileRef = 13A0C2851B74F71200B29F6F /* RCTDevLoadingView.h */; }; - 3D80DA501DF820620028D040 /* RCTDevMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 13A0C2871B74F71200B29F6F /* RCTDevMenu.h */; }; - 3D80DA511DF820620028D040 /* RCTEventEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 13D9FEE91CDCCECF00158BD7 /* RCTEventEmitter.h */; }; - 3D80DA521DF820620028D040 /* RCTExceptionsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13B07FE91A69327A00A75B9A /* RCTExceptionsManager.h */; }; - 3D80DA531DF820620028D040 /* RCTI18nManager.h in Headers */ = {isa = PBXBuildFile; fileRef = B233E6E81D2D843200BC68BA /* RCTI18nManager.h */; }; - 3D80DA541DF820620028D040 /* RCTI18nUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 352DCFEE1D19F4C20056D623 /* RCTI18nUtil.h */; }; - 3D80DA551DF820620028D040 /* RCTKeyboardObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 13D9FEEC1CDCD93000158BD7 /* RCTKeyboardObserver.h */; }; - 3D80DA561DF820620028D040 /* RCTRedBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 13F17A831B8493E5007D4C75 /* RCTRedBox.h */; }; - 3D80DA571DF820620028D040 /* RCTSourceCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 000E6CE91AB0E97F000CDF4D /* RCTSourceCode.h */; }; - 3D80DA581DF820620028D040 /* RCTStatusBarManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13723B4E1A82FD3C00F88898 /* RCTStatusBarManager.h */; }; - 3D80DA591DF820620028D040 /* RCTTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 13B07FED1A69327A00A75B9A /* RCTTiming.h */; }; - 3D80DA5A1DF820620028D040 /* RCTUIManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E067481A70F434002CDEE1 /* RCTUIManager.h */; }; - 3D80DA5B1DF820620028D040 /* RCTFPSGraph.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F7A0EE1BDA714B003C6C10 /* RCTFPSGraph.h */; }; - 3D80DA5D1DF820620028D040 /* RCTMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 14BF71811C04795500C97D0C /* RCTMacros.h */; }; - 3D80DA5E1DF820620028D040 /* RCTProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 1450FF801BCFF28A00208362 /* RCTProfile.h */; }; - 3D80DA5F1DF820620028D040 /* RCTActivityIndicatorView.h in Headers */ = {isa = PBXBuildFile; fileRef = B95154301D1B34B200FE7B80 /* RCTActivityIndicatorView.h */; }; - 3D80DA601DF820620028D040 /* RCTActivityIndicatorViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13B080181A69489C00A75B9A /* RCTActivityIndicatorViewManager.h */; }; - 3D80DA611DF820620028D040 /* RCTAnimationType.h in Headers */ = {isa = PBXBuildFile; fileRef = 13442BF21AA90E0B0037E5B0 /* RCTAnimationType.h */; }; - 3D80DA621DF820620028D040 /* RCTAutoInsetsProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 13C325261AA63B6A0048765F /* RCTAutoInsetsProtocol.h */; }; - 3D80DA631DF820620028D040 /* RCTBorderDrawing.h in Headers */ = {isa = PBXBuildFile; fileRef = 13CC8A801B17642100940AE7 /* RCTBorderDrawing.h */; }; - 3D80DA641DF820620028D040 /* RCTBorderStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = ACDD3FDA1BC7430D00E7DE33 /* RCTBorderStyle.h */; }; - 3D80DA651DF820620028D040 /* RCTComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = 13C325281AA63B6A0048765F /* RCTComponent.h */; }; - 3D80DA661DF820620028D040 /* RCTComponentData.h in Headers */ = {isa = PBXBuildFile; fileRef = 13AB90BF1B6FA36700713B4F /* RCTComponentData.h */; }; - 3D80DA671DF820620028D040 /* RCTConvert+CoreLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 13456E911ADAD2DE009F94A7 /* RCTConvert+CoreLocation.h */; }; - 3D80DA6B1DF820620028D040 /* RCTFont.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D37B5801D522B190042D5B5 /* RCTFont.h */; }; - 3D80DA701DF820620028D040 /* RCTModalHostView.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A1FE8A1B62640A00BE0E65 /* RCTModalHostView.h */; }; - 3D80DA711DF820620028D040 /* RCTModalHostViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 83392EB11B6634E10013B15F /* RCTModalHostViewController.h */; }; - 3D80DA721DF820620028D040 /* RCTModalHostViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A1FE8D1B62643A00BE0E65 /* RCTModalHostViewManager.h */; }; - 3D80DA771DF820620028D040 /* RCTPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = 58114A121AAE854800E7D092 /* RCTPicker.h */; }; - 3D80DA781DF820620028D040 /* RCTPickerManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 58114A141AAE854800E7D092 /* RCTPickerManager.h */; }; - 3D80DA791DF820620028D040 /* RCTPointerEvents.h in Headers */ = {isa = PBXBuildFile; fileRef = 13442BF31AA90E0B0037E5B0 /* RCTPointerEvents.h */; }; - 3D80DA7A1DF820620028D040 /* RCTProgressViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13513F3A1B1F43F400FCE529 /* RCTProgressViewManager.h */; }; - 3D80DA7B1DF820620028D040 /* RCTRefreshControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 191E3EBF1C29DC3800C180A6 /* RCTRefreshControl.h */; }; - 3D80DA7C1DF820620028D040 /* RCTRefreshControlManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 191E3EBC1C29D9AF00C180A6 /* RCTRefreshControlManager.h */; }; - 3D80DA7D1DF820620028D040 /* RCTRootShadowView.h in Headers */ = {isa = PBXBuildFile; fileRef = 13BCE8071C99CB9D00DD7AAD /* RCTRootShadowView.h */; }; - 3D80DA811DF820620028D040 /* RCTSegmentedControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 131B6AF01AF1093D00FFC3E0 /* RCTSegmentedControl.h */; }; - 3D80DA821DF820620028D040 /* RCTSegmentedControlManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 131B6AF21AF1093D00FFC3E0 /* RCTSegmentedControlManager.h */; }; - 3D80DA831DF820620028D040 /* RCTShadowView.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E0674B1A70F44B002CDEE1 /* RCTShadowView.h */; }; - 3D80DA841DF820620028D040 /* RCTSlider.h in Headers */ = {isa = PBXBuildFile; fileRef = 13AF20431AE707F8005F5298 /* RCTSlider.h */; }; - 3D80DA851DF820620028D040 /* RCTSliderManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F484541AABFCE100FDF6B9 /* RCTSliderManager.h */; }; - 3D80DA861DF820620028D040 /* RCTSwitch.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F362071AABD06A001CE568 /* RCTSwitch.h */; }; - 3D80DA871DF820620028D040 /* RCTSwitchManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F362091AABD06A001CE568 /* RCTSwitchManager.h */; }; - 3D80DA8C1DF820620028D040 /* RCTTextDecorationLineType.h in Headers */ = {isa = PBXBuildFile; fileRef = E3BBC8EB1ADE6F47001BBD81 /* RCTTextDecorationLineType.h */; }; - 3D80DA8D1DF820620028D040 /* RCTView.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E0674F1A70F44B002CDEE1 /* RCTView.h */; }; - 3D80DA8F1DF820620028D040 /* RCTViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E0674D1A70F44B002CDEE1 /* RCTViewManager.h */; }; - 3D80DA901DF820620028D040 /* RCTWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 13C156011AB1A2840079392D /* RCTWebView.h */; }; - 3D80DA911DF820620028D040 /* RCTWebViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13C156031AB1A2840079392D /* RCTWebViewManager.h */; }; - 3D80DA921DF820620028D040 /* RCTWrapperViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 13B080231A694A8400A75B9A /* RCTWrapperViewController.h */; }; - 3D80DA931DF820620028D040 /* UIView+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F15A171B7CC46900F10295 /* UIView+Private.h */; }; - 3D80DA941DF820620028D040 /* UIView+React.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E067531A70F44B002CDEE1 /* UIView+React.h */; }; - 3D8ED92C1E5B120100D83D20 /* libcxxreact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D3CD9321DE5FBEE00167DC4 /* libcxxreact.a */; }; - 3DA9819E1E5B0DBB004F2374 /* NSDataBigString.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7454B31E54786200E74ADD /* NSDataBigString.h */; }; - 3DA981A01E5B0E34004F2374 /* CxxModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A71E03699D0018521A /* CxxModule.h */; }; - 3DA981A11E5B0E34004F2374 /* CxxNativeModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A91E03699D0018521A /* CxxNativeModule.h */; }; - 3DA981A21E5B0E34004F2374 /* JSExecutor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AB1E03699D0018521A /* JSExecutor.h */; }; - 3DA981A51E5B0E34004F2374 /* Instance.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AF1E03699D0018521A /* Instance.h */; }; - 3DA981A61E5B0E34004F2374 /* JsArgumentHelpers-inl.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */; }; - 3DA981A71E5B0E34004F2374 /* JsArgumentHelpers.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */; }; - 3DA981A81E5B0E34004F2374 /* JSBigString.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7454781E54757500E74ADD /* JSBigString.h */; }; - 3DA981A91E5B0E34004F2374 /* JSBundleType.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D3CD8F51DE5FB2300167DC4 /* JSBundleType.h */; }; - 3DA981B31E5B0E34004F2374 /* JSIndexedRAMBundle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C71E03699D0018521A /* JSIndexedRAMBundle.h */; }; - 3DA981B41E5B0E34004F2374 /* JSModulesUnbundle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C81E03699D0018521A /* JSModulesUnbundle.h */; }; - 3DA981B51E5B0E34004F2374 /* MessageQueueThread.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C91E03699D0018521A /* MessageQueueThread.h */; }; - 3DA981B61E5B0E34004F2374 /* MethodCall.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CB1E03699D0018521A /* MethodCall.h */; }; - 3DA981B71E5B0E34004F2374 /* ModuleRegistry.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CD1E03699D0018521A /* ModuleRegistry.h */; }; - 3DA981B81E5B0E34004F2374 /* NativeModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CE1E03699D0018521A /* NativeModule.h */; }; - 3DA981B91E5B0E34004F2374 /* NativeToJsBridge.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D01E03699D0018521A /* NativeToJsBridge.h */; }; - 3DA981BC1E5B0E34004F2374 /* RecoverableError.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7454791E54757500E74ADD /* RecoverableError.h */; }; - 3DA981BD1E5B0E34004F2374 /* SampleCxxModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D41E03699D0018521A /* SampleCxxModule.h */; }; - 3DA981BE1E5B0E34004F2374 /* SystraceSection.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D51E03699D0018521A /* SystraceSection.h */; }; - 3DA981BF1E5B0F29004F2374 /* RCTAssert.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4A1A601E3B00E9B192 /* RCTAssert.h */; }; - 3DA981C01E5B0F29004F2374 /* RCTBridge.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA5E1A601EAA00E9B192 /* RCTBridge.h */; }; - 3DA981C21E5B0F29004F2374 /* RCTBridgeDelegate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1482F9E61B55B927000ADFF3 /* RCTBridgeDelegate.h */; }; - 3DA981C31E5B0F29004F2374 /* RCTBridgeMethod.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13AFBCA11C07287B00BBAEAA /* RCTBridgeMethod.h */; }; - 3DA981C41E5B0F29004F2374 /* RCTBridgeModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 830213F31A654E0800B993E6 /* RCTBridgeModule.h */; }; - 3DA981C51E5B0F29004F2374 /* RCTBundleURLProvider.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 68EFE4EC1CF6EB3000A1DE13 /* RCTBundleURLProvider.h */; }; - 3DA981C61E5B0F29004F2374 /* RCTConvert.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBACA1A6023D300E9B192 /* RCTConvert.h */; }; - 3DA981C71E5B0F29004F2374 /* RCTDefines.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13AF1F851AE6E777005F5298 /* RCTDefines.h */; }; - 3DA981C81E5B0F29004F2374 /* RCTDisplayLink.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D1E68D81CABD13900DD7465 /* RCTDisplayLink.h */; }; - 3DA981C91E5B0F29004F2374 /* RCTErrorCustomizer.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3EDCA8A21D3591E700450C31 /* RCTErrorCustomizer.h */; }; - 3DA981CA1E5B0F29004F2374 /* RCTErrorInfo.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3EDCA8A31D3591E700450C31 /* RCTErrorInfo.h */; }; - 3DA981CB1E5B0F29004F2374 /* RCTEventDispatcher.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA651A601EF300E9B192 /* RCTEventDispatcher.h */; }; - 3DA981CC1E5B0F29004F2374 /* RCTFrameUpdate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1436DD071ADE7AA000A5ED7D /* RCTFrameUpdate.h */; }; - 3DA981CD1E5B0F29004F2374 /* RCTImageSource.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13BB3D001BECD54500932C10 /* RCTImageSource.h */; }; - 3DA981CE1E5B0F29004F2374 /* RCTInvalidating.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4C1A601E3B00E9B192 /* RCTInvalidating.h */; }; - 3DA981CF1E5B0F29004F2374 /* RCTJavaScriptExecutor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA631A601ECA00E9B192 /* RCTJavaScriptExecutor.h */; }; - 3DA981D01E5B0F29004F2374 /* RCTJavaScriptLoader.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14200DA81AC179B3008EE6BA /* RCTJavaScriptLoader.h */; }; - 3DA981D11E5B0F29004F2374 /* RCTJSStackFrame.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 008341F51D1DB34400876D9A /* RCTJSStackFrame.h */; }; - 3DA981D21E5B0F29004F2374 /* RCTKeyCommands.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13A1F71C1A75392D00D3D453 /* RCTKeyCommands.h */; }; - 3DA981D31E5B0F29004F2374 /* RCTLog.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4D1A601E3B00E9B192 /* RCTLog.h */; }; - 3DA981D41E5B0F29004F2374 /* RCTModuleData.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14C2CA721B3AC64300E6CBB2 /* RCTModuleData.h */; }; - 3DA981D51E5B0F29004F2374 /* RCTModuleMethod.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14C2CA6F1B3AC63800E6CBB2 /* RCTModuleMethod.h */; }; - 3DA981D61E5B0F29004F2374 /* RCTMultipartDataTask.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 006FC4121D9B20820057AAAD /* RCTMultipartDataTask.h */; }; - 3DA981D71E5B0F29004F2374 /* RCTMultipartStreamReader.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 001BFCCE1D8381DE008E587E /* RCTMultipartStreamReader.h */; }; - 3DA981D81E5B0F29004F2374 /* RCTNullability.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13A6E20F1C19ABC700845B82 /* RCTNullability.h */; }; - 3DA981D91E5B0F29004F2374 /* RCTParserUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13A6E20C1C19AA0C00845B82 /* RCTParserUtils.h */; }; - 3DA981DA1E5B0F29004F2374 /* RCTPerformanceLogger.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 142014181B32094000CC17BA /* RCTPerformanceLogger.h */; }; - 3DA981DB1E5B0F29004F2374 /* RCTPlatform.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7749421DC1065C007EC8D8 /* RCTPlatform.h */; }; - 3DA981DC1E5B0F29004F2374 /* RCTReloadCommand.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */; }; - 3DA981DD1E5B0F29004F2374 /* RCTRootContentView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 59A7B9FB1E577DBF0068EDBF /* RCTRootContentView.h */; }; - 3DA981DE1E5B0F29004F2374 /* RCTRootView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 830A229C1A66C68A008503DA /* RCTRootView.h */; }; - 3DA981DF1E5B0F29004F2374 /* RCTRootViewDelegate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13AFBCA21C07287B00BBAEAA /* RCTRootViewDelegate.h */; }; - 3DA981E11E5B0F29004F2374 /* RCTTouchEvent.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 391E86A31C623EC800009732 /* RCTTouchEvent.h */; }; - 3DA981E21E5B0F29004F2374 /* RCTTouchHandler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA961A6020BB00E9B192 /* RCTTouchHandler.h */; }; - 3DA981E31E5B0F29004F2374 /* RCTURLRequestDelegate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1345A83A1B265A0E00583190 /* RCTURLRequestDelegate.h */; }; - 3DA981E41E5B0F29004F2374 /* RCTURLRequestHandler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */; }; - 3DA981E51E5B0F29004F2374 /* RCTUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4F1A601E3B00E9B192 /* RCTUtils.h */; }; - 3DA981EA1E5B0F7F004F2374 /* RCTAccessibilityManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */; }; - 3DA981EB1E5B0F7F004F2374 /* RCTAlertManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13B07FE71A69327A00A75B9A /* RCTAlertManager.h */; }; - 3DA981EC1E5B0F7F004F2374 /* RCTAppState.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1372B7081AB030C200659ED6 /* RCTAppState.h */; }; - 3DA981ED1E5B0F7F004F2374 /* RCTAsyncLocalStorage.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 58114A4F1AAE93D500E7D092 /* RCTAsyncLocalStorage.h */; }; - 3DA981EE1E5B0F7F004F2374 /* RCTClipboard.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13D033611C1837FE0021DC29 /* RCTClipboard.h */; }; - 3DA981EF1E5B0F7F004F2374 /* RCTDevLoadingView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13A0C2851B74F71200B29F6F /* RCTDevLoadingView.h */; }; - 3DA981F01E5B0F7F004F2374 /* RCTDevMenu.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13A0C2871B74F71200B29F6F /* RCTDevMenu.h */; }; - 3DA981F11E5B0F7F004F2374 /* RCTEventEmitter.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13D9FEE91CDCCECF00158BD7 /* RCTEventEmitter.h */; }; - 3DA981F21E5B0F7F004F2374 /* RCTExceptionsManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13B07FE91A69327A00A75B9A /* RCTExceptionsManager.h */; }; - 3DA981F31E5B0F7F004F2374 /* RCTI18nManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = B233E6E81D2D843200BC68BA /* RCTI18nManager.h */; }; - 3DA981F41E5B0F7F004F2374 /* RCTI18nUtil.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 352DCFEE1D19F4C20056D623 /* RCTI18nUtil.h */; }; - 3DA981F51E5B0F7F004F2374 /* RCTKeyboardObserver.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13D9FEEC1CDCD93000158BD7 /* RCTKeyboardObserver.h */; }; - 3DA981F61E5B0F7F004F2374 /* RCTRedBox.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13F17A831B8493E5007D4C75 /* RCTRedBox.h */; }; - 3DA981F71E5B0F7F004F2374 /* RCTSourceCode.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 000E6CE91AB0E97F000CDF4D /* RCTSourceCode.h */; }; - 3DA981F81E5B0F7F004F2374 /* RCTStatusBarManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13723B4E1A82FD3C00F88898 /* RCTStatusBarManager.h */; }; - 3DA981F91E5B0F7F004F2374 /* RCTTiming.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13B07FED1A69327A00A75B9A /* RCTTiming.h */; }; - 3DA981FA1E5B0F7F004F2374 /* RCTUIManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13E067481A70F434002CDEE1 /* RCTUIManager.h */; }; - 3DA981FB1E5B0F7F004F2374 /* RCTFPSGraph.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14F7A0EE1BDA714B003C6C10 /* RCTFPSGraph.h */; }; - 3DA981FD1E5B0F7F004F2374 /* RCTMacros.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14BF71811C04795500C97D0C /* RCTMacros.h */; }; - 3DA981FE1E5B0F7F004F2374 /* RCTProfile.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1450FF801BCFF28A00208362 /* RCTProfile.h */; }; - 3DA981FF1E5B0F7F004F2374 /* RCTActivityIndicatorView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = B95154301D1B34B200FE7B80 /* RCTActivityIndicatorView.h */; }; - 3DA982001E5B0F7F004F2374 /* RCTActivityIndicatorViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13B080181A69489C00A75B9A /* RCTActivityIndicatorViewManager.h */; }; - 3DA982011E5B0F7F004F2374 /* RCTAnimationType.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13442BF21AA90E0B0037E5B0 /* RCTAnimationType.h */; }; - 3DA982021E5B0F7F004F2374 /* RCTAutoInsetsProtocol.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13C325261AA63B6A0048765F /* RCTAutoInsetsProtocol.h */; }; - 3DA982031E5B0F7F004F2374 /* RCTBorderDrawing.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13CC8A801B17642100940AE7 /* RCTBorderDrawing.h */; }; - 3DA982041E5B0F7F004F2374 /* RCTBorderStyle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = ACDD3FDA1BC7430D00E7DE33 /* RCTBorderStyle.h */; }; - 3DA982051E5B0F7F004F2374 /* RCTComponent.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13C325281AA63B6A0048765F /* RCTComponent.h */; }; - 3DA982061E5B0F7F004F2374 /* RCTComponentData.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13AB90BF1B6FA36700713B4F /* RCTComponentData.h */; }; - 3DA982071E5B0F7F004F2374 /* RCTConvert+CoreLocation.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13456E911ADAD2DE009F94A7 /* RCTConvert+CoreLocation.h */; }; - 3DA9820C1E5B0F7F004F2374 /* RCTFont.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D37B5801D522B190042D5B5 /* RCTFont.h */; }; - 3DA982111E5B0F7F004F2374 /* RCTModalHostView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83A1FE8A1B62640A00BE0E65 /* RCTModalHostView.h */; }; - 3DA982121E5B0F7F004F2374 /* RCTModalHostViewController.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83392EB11B6634E10013B15F /* RCTModalHostViewController.h */; }; - 3DA982131E5B0F7F004F2374 /* RCTModalHostViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83A1FE8D1B62643A00BE0E65 /* RCTModalHostViewManager.h */; }; - 3DA982181E5B0F7F004F2374 /* RCTPicker.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 58114A121AAE854800E7D092 /* RCTPicker.h */; }; - 3DA982191E5B0F7F004F2374 /* RCTPickerManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 58114A141AAE854800E7D092 /* RCTPickerManager.h */; }; - 3DA9821A1E5B0F7F004F2374 /* RCTPointerEvents.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13442BF31AA90E0B0037E5B0 /* RCTPointerEvents.h */; }; - 3DA9821B1E5B0F7F004F2374 /* RCTProgressViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13513F3A1B1F43F400FCE529 /* RCTProgressViewManager.h */; }; - 3DA9821C1E5B0F7F004F2374 /* RCTRefreshControl.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 191E3EBF1C29DC3800C180A6 /* RCTRefreshControl.h */; }; - 3DA9821D1E5B0F7F004F2374 /* RCTRefreshControlManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 191E3EBC1C29D9AF00C180A6 /* RCTRefreshControlManager.h */; }; - 3DA9821E1E5B0F7F004F2374 /* RCTRootShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13BCE8071C99CB9D00DD7AAD /* RCTRootShadowView.h */; }; - 3DA982241E5B0F7F004F2374 /* RCTSegmentedControl.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 131B6AF01AF1093D00FFC3E0 /* RCTSegmentedControl.h */; }; - 3DA982251E5B0F7F004F2374 /* RCTSegmentedControlManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 131B6AF21AF1093D00FFC3E0 /* RCTSegmentedControlManager.h */; }; - 3DA982261E5B0F7F004F2374 /* RCTShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13E0674B1A70F44B002CDEE1 /* RCTShadowView.h */; }; - 3DA982271E5B0F7F004F2374 /* RCTSlider.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13AF20431AE707F8005F5298 /* RCTSlider.h */; }; - 3DA982281E5B0F7F004F2374 /* RCTSliderManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14F484541AABFCE100FDF6B9 /* RCTSliderManager.h */; }; - 3DA982291E5B0F7F004F2374 /* RCTSwitch.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14F362071AABD06A001CE568 /* RCTSwitch.h */; }; - 3DA9822A1E5B0F7F004F2374 /* RCTSwitchManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14F362091AABD06A001CE568 /* RCTSwitchManager.h */; }; - 3DA9822F1E5B0F7F004F2374 /* RCTTextDecorationLineType.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = E3BBC8EB1ADE6F47001BBD81 /* RCTTextDecorationLineType.h */; }; - 3DA982301E5B0F7F004F2374 /* RCTTVView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 130443D61E401AD800D93A67 /* RCTTVView.h */; }; - 3DA982311E5B0F7F004F2374 /* RCTView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13E0674F1A70F44B002CDEE1 /* RCTView.h */; }; - 3DA982331E5B0F7F004F2374 /* RCTViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13E0674D1A70F44B002CDEE1 /* RCTViewManager.h */; }; - 3DA982341E5B0F7F004F2374 /* RCTWebView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13C156011AB1A2840079392D /* RCTWebView.h */; }; - 3DA982351E5B0F7F004F2374 /* RCTWebViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13C156031AB1A2840079392D /* RCTWebViewManager.h */; }; - 3DA982361E5B0F7F004F2374 /* RCTWrapperViewController.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13B080231A694A8400A75B9A /* RCTWrapperViewController.h */; }; - 3DA982381E5B0F7F004F2374 /* UIView+React.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13E067531A70F44B002CDEE1 /* UIView+React.h */; }; - 3DA982391E5B0F8A004F2374 /* UIView+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F15A171B7CC46900F10295 /* UIView+Private.h */; }; - 3DA9823B1E5B1053004F2374 /* CxxModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A71E03699D0018521A /* CxxModule.h */; }; - 3DA9823C1E5B1053004F2374 /* CxxNativeModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A91E03699D0018521A /* CxxNativeModule.h */; }; - 3DA9823D1E5B1053004F2374 /* JSExecutor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AB1E03699D0018521A /* JSExecutor.h */; }; - 3DA982401E5B1053004F2374 /* Instance.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AF1E03699D0018521A /* Instance.h */; }; - 3DA982411E5B1053004F2374 /* JsArgumentHelpers-inl.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */; }; - 3DA982421E5B1053004F2374 /* JsArgumentHelpers.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */; }; - 3DA982431E5B1053004F2374 /* JSBigString.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7454781E54757500E74ADD /* JSBigString.h */; }; - 3DA982441E5B1053004F2374 /* JSBundleType.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D3CD8F51DE5FB2300167DC4 /* JSBundleType.h */; }; - 3DA9824E1E5B1053004F2374 /* JSIndexedRAMBundle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C71E03699D0018521A /* JSIndexedRAMBundle.h */; }; - 3DA9824F1E5B1053004F2374 /* JSModulesUnbundle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C81E03699D0018521A /* JSModulesUnbundle.h */; }; - 3DA982501E5B1053004F2374 /* MessageQueueThread.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C91E03699D0018521A /* MessageQueueThread.h */; }; - 3DA982511E5B1053004F2374 /* MethodCall.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CB1E03699D0018521A /* MethodCall.h */; }; - 3DA982521E5B1053004F2374 /* ModuleRegistry.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CD1E03699D0018521A /* ModuleRegistry.h */; }; - 3DA982531E5B1053004F2374 /* NativeModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CE1E03699D0018521A /* NativeModule.h */; }; - 3DA982541E5B1053004F2374 /* NativeToJsBridge.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D01E03699D0018521A /* NativeToJsBridge.h */; }; - 3DA982571E5B1053004F2374 /* RecoverableError.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7454791E54757500E74ADD /* RecoverableError.h */; }; - 3DA982581E5B1053004F2374 /* SampleCxxModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D41E03699D0018521A /* SampleCxxModule.h */; }; - 3DA982591E5B1053004F2374 /* SystraceSection.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D51E03699D0018521A /* SystraceSection.h */; }; - 3DC159E41E83E1AE007B1282 /* RCTRootContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59A7B9FC1E577DBF0068EDBF /* RCTRootContentView.m */; }; - 3DC159E51E83E1E9007B1282 /* JSBigString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27B958731E57587D0096647A /* JSBigString.cpp */; }; - 3DC159E61E83E1FA007B1282 /* JSBigString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27B958731E57587D0096647A /* JSBigString.cpp */; }; - 3DCD185D1DF978E7007FE5A1 /* RCTReloadCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = A2440AA11DF8D854006E7BFC /* RCTReloadCommand.m */; }; - 3DCE52F31FEAB10600613583 /* RCTRedBoxExtraDataViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = FEFAAC9D1FDB89B40057BBE0 /* RCTRedBoxExtraDataViewController.h */; }; - 3DCE52F41FEAB10D00613583 /* RCTRedBoxExtraDataViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FEFAAC9C1FDB89B40057BBE0 /* RCTRedBoxExtraDataViewController.m */; }; - 3DCE53251FEAB1E000613583 /* RCTShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5335D5401FE81A4700883D58 /* RCTShadowView.m */; }; - 3DCE53281FEAB23100613583 /* RCTDatePicker.h in Headers */ = {isa = PBXBuildFile; fileRef = 133CAE8C1B8E5CFD00F6AD92 /* RCTDatePicker.h */; }; - 3DCE53291FEAB23100613583 /* RCTDatePicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 133CAE8D1B8E5CFD00F6AD92 /* RCTDatePicker.m */; }; - 3DCE532A1FEAB23100613583 /* RCTDatePickerManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 58C571C01AA56C1900CDF9C8 /* RCTDatePickerManager.h */; }; - 3DCE532B1FEAB23100613583 /* RCTDatePickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 58C571BF1AA56C1900CDF9C8 /* RCTDatePickerManager.m */; }; - 3DE4F8681DF85D8E00B9E5A0 /* YGEnums.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 130A77031DF767AF001F9587 /* YGEnums.h */; }; - 3DE4F8691DF85D8E00B9E5A0 /* YGMacros.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 130A77041DF767AF001F9587 /* YGMacros.h */; }; - 3DE4F86A1DF85D8E00B9E5A0 /* Yoga.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 130A77081DF767AF001F9587 /* Yoga.h */; }; - 3DFE0D161DF8574D00459392 /* YGEnums.h in Headers */ = {isa = PBXBuildFile; fileRef = 130A77031DF767AF001F9587 /* YGEnums.h */; }; - 3DFE0D171DF8574D00459392 /* YGMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 130A77041DF767AF001F9587 /* YGMacros.h */; }; - 3DFE0D191DF8574D00459392 /* Yoga.h in Headers */ = {isa = PBXBuildFile; fileRef = 130A77081DF767AF001F9587 /* Yoga.h */; }; - 3DFE0D1A1DF8575800459392 /* YGEnums.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 130A77031DF767AF001F9587 /* YGEnums.h */; }; - 3DFE0D1B1DF8575800459392 /* YGMacros.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 130A77041DF767AF001F9587 /* YGMacros.h */; }; - 3DFE0D1C1DF8575800459392 /* Yoga.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 130A77081DF767AF001F9587 /* Yoga.h */; }; - 3EDCA8A51D3591E700450C31 /* RCTErrorInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 3EDCA8A41D3591E700450C31 /* RCTErrorInfo.m */; }; - 50E98FEA21460B0D00CD9289 /* RCTWKWebViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 50E98FE621460B0D00CD9289 /* RCTWKWebViewManager.m */; }; - 50E98FEB21460B0D00CD9289 /* RCTWKWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 50E98FE721460B0D00CD9289 /* RCTWKWebView.h */; }; - 50E98FEC21460B0D00CD9289 /* RCTWKWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 50E98FE821460B0D00CD9289 /* RCTWKWebView.m */; }; - 50E98FED21460B0D00CD9289 /* RCTWKWebViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 50E98FE921460B0D00CD9289 /* RCTWKWebViewManager.h */; }; - 5335D5411FE81A4700883D58 /* RCTShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5335D5401FE81A4700883D58 /* RCTShadowView.m */; }; - 53438962203905BB008E0CB3 /* YGLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5343895E203905B6008E0CB3 /* YGLayout.cpp */; }; - 53438963203905BC008E0CB3 /* YGLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5343895E203905B6008E0CB3 /* YGLayout.cpp */; }; - 53438964203905BF008E0CB3 /* YGLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 5343895F203905B6008E0CB3 /* YGLayout.h */; }; - 53438965203905C0008E0CB3 /* YGLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 5343895F203905B6008E0CB3 /* YGLayout.h */; }; - 5352C5752038FF9500A3B97E /* YGStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5352C5722038FF8D00A3B97E /* YGStyle.cpp */; }; - 5352C5762038FF9700A3B97E /* YGStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5352C5722038FF8D00A3B97E /* YGStyle.cpp */; }; - 5352C5772038FF9A00A3B97E /* YGStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 5352C5712038FF8D00A3B97E /* YGStyle.h */; }; - 5352C5782038FF9B00A3B97E /* YGStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 5352C5712038FF8D00A3B97E /* YGStyle.h */; }; - 53756E3B2004FFFA00FBBD99 /* Utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53756E372004FFF700FBBD99 /* Utils.cpp */; }; - 53756E3C2004FFFC00FBBD99 /* Utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 53756E382004FFF700FBBD99 /* Utils.h */; }; - 53756E3D2004FFFE00FBBD99 /* Utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 53756E382004FFF700FBBD99 /* Utils.h */; }; - 53756E3E2005000300FBBD99 /* Utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53756E372004FFF700FBBD99 /* Utils.cpp */; }; - 5376C5E41FC6DDBC0083513D /* YGNodePrint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5376C5E11FC6DDB20083513D /* YGNodePrint.cpp */; }; - 5376C5E51FC6DDBD0083513D /* YGNodePrint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5376C5E11FC6DDB20083513D /* YGNodePrint.cpp */; }; - 5376C5E61FC6DDC10083513D /* YGNodePrint.h in Headers */ = {isa = PBXBuildFile; fileRef = 5376C5E01FC6DDB20083513D /* YGNodePrint.h */; }; - 5376C5E71FC6DDC20083513D /* YGNodePrint.h in Headers */ = {isa = PBXBuildFile; fileRef = 5376C5E01FC6DDB20083513D /* YGNodePrint.h */; }; - 53D123971FBF1DF5001B8A10 /* libyoga.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D3C059A1DE3340900C268FA /* libyoga.a */; }; - 53D1239A1FBF1EF2001B8A10 /* YGEnums.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53CBF1861FB4FE80002CBB31 /* YGEnums.cpp */; }; - 53D1239B1FBF1EF4001B8A10 /* YGEnums.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53CBF1861FB4FE80002CBB31 /* YGEnums.cpp */; }; - 53D1239E1FBF1EFB001B8A10 /* Yoga-internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 53CBF1851FB4FE80002CBB31 /* Yoga-internal.h */; }; - 53D1239F1FBF1EFB001B8A10 /* Yoga-internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 53CBF1851FB4FE80002CBB31 /* Yoga-internal.h */; }; - 53D123A01FBF1EFF001B8A10 /* Yoga.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53CBF1871FB4FE80002CBB31 /* Yoga.cpp */; }; - 53D123A11FBF1EFF001B8A10 /* Yoga.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53CBF1871FB4FE80002CBB31 /* Yoga.cpp */; }; - 53DEF6EC205AE5A6006A3890 /* YGFloatOptional.h in Headers */ = {isa = PBXBuildFile; fileRef = 53DEF6E7205AE59C006A3890 /* YGFloatOptional.h */; }; - 53DEF6ED205AE5A7006A3890 /* YGFloatOptional.h in Headers */ = {isa = PBXBuildFile; fileRef = 53DEF6E7205AE59C006A3890 /* YGFloatOptional.h */; }; - 53EC85E21FDEC75F0051B2B5 /* YGNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53EC85DF1FDEC75A0051B2B5 /* YGNode.cpp */; }; - 53EC85E31FDEC75F0051B2B5 /* YGNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53EC85DF1FDEC75A0051B2B5 /* YGNode.cpp */; }; - 53EC85E41FDEC7630051B2B5 /* YGNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 53EC85DE1FDEC75A0051B2B5 /* YGNode.h */; }; - 53EC85E51FDEC7630051B2B5 /* YGNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 53EC85DE1FDEC75A0051B2B5 /* YGNode.h */; }; - 58114A161AAE854800E7D092 /* RCTPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 58114A131AAE854800E7D092 /* RCTPicker.m */; }; - 58114A171AAE854800E7D092 /* RCTPickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 58114A151AAE854800E7D092 /* RCTPickerManager.m */; }; - 58114A501AAE93D500E7D092 /* RCTAsyncLocalStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 58114A4E1AAE93D500E7D092 /* RCTAsyncLocalStorage.m */; }; - 590D7BFD1EBD458B00D8A370 /* RCTShadowView+Layout.h in Headers */ = {isa = PBXBuildFile; fileRef = 590D7BFB1EBD458B00D8A370 /* RCTShadowView+Layout.h */; }; - 590D7BFE1EBD458B00D8A370 /* RCTShadowView+Layout.h in Headers */ = {isa = PBXBuildFile; fileRef = 590D7BFB1EBD458B00D8A370 /* RCTShadowView+Layout.h */; }; - 590D7BFF1EBD458B00D8A370 /* RCTShadowView+Layout.m in Sources */ = {isa = PBXBuildFile; fileRef = 590D7BFC1EBD458B00D8A370 /* RCTShadowView+Layout.m */; }; - 590D7C001EBD458B00D8A370 /* RCTShadowView+Layout.m in Sources */ = {isa = PBXBuildFile; fileRef = 590D7BFC1EBD458B00D8A370 /* RCTShadowView+Layout.m */; }; - 591F78DA202ADB22004A668C /* RCTLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 591F78D8202ADB21004A668C /* RCTLayout.m */; }; - 591F78DB202ADB22004A668C /* RCTLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 591F78D8202ADB21004A668C /* RCTLayout.m */; }; - 591F78DC202ADB22004A668C /* RCTLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 591F78D9202ADB22004A668C /* RCTLayout.h */; }; - 591F78DD202ADB22004A668C /* RCTLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 591F78D9202ADB22004A668C /* RCTLayout.h */; }; - 591F78DE202ADB8F004A668C /* RCTLayout.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 591F78D9202ADB22004A668C /* RCTLayout.h */; }; - 591F78DF202ADB97004A668C /* RCTLayout.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 591F78D9202ADB22004A668C /* RCTLayout.h */; }; - 5925356A20084D0600DD584B /* RCTSurfaceSizeMeasureMode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5925356920084D0600DD584B /* RCTSurfaceSizeMeasureMode.mm */; }; - 5925356B20084D0600DD584B /* RCTSurfaceSizeMeasureMode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5925356920084D0600DD584B /* RCTSurfaceSizeMeasureMode.mm */; }; - 59283CA01FD67321000EAAB9 /* RCTSurfaceStage.m in Sources */ = {isa = PBXBuildFile; fileRef = 59283C9F1FD67320000EAAB9 /* RCTSurfaceStage.m */; }; - 59283CA11FD67321000EAAB9 /* RCTSurfaceStage.m in Sources */ = {isa = PBXBuildFile; fileRef = 59283C9F1FD67320000EAAB9 /* RCTSurfaceStage.m */; }; - 594F0A321FD23228007FBE96 /* RCTSurfaceHostingView.h in Headers */ = {isa = PBXBuildFile; fileRef = 594F0A2F1FD23228007FBE96 /* RCTSurfaceHostingView.h */; }; - 594F0A331FD23228007FBE96 /* RCTSurfaceHostingView.h in Headers */ = {isa = PBXBuildFile; fileRef = 594F0A2F1FD23228007FBE96 /* RCTSurfaceHostingView.h */; }; - 594F0A341FD23228007FBE96 /* RCTSurfaceHostingView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 594F0A301FD23228007FBE96 /* RCTSurfaceHostingView.mm */; }; - 594F0A351FD23228007FBE96 /* RCTSurfaceHostingView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 594F0A301FD23228007FBE96 /* RCTSurfaceHostingView.mm */; }; - 594F0A361FD23228007FBE96 /* RCTSurfaceSizeMeasureMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 594F0A311FD23228007FBE96 /* RCTSurfaceSizeMeasureMode.h */; }; - 594F0A371FD23228007FBE96 /* RCTSurfaceSizeMeasureMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 594F0A311FD23228007FBE96 /* RCTSurfaceSizeMeasureMode.h */; }; - 594F0A381FD233A2007FBE96 /* RCTSurface.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2A1FB274970058CCF6 /* RCTSurface.h */; }; - 594F0A391FD233A2007FBE96 /* RCTSurfaceDelegate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2C1FB274970058CCF6 /* RCTSurfaceDelegate.h */; }; - 594F0A3A1FD233A2007FBE96 /* RCTSurfaceRootShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2D1FB274970058CCF6 /* RCTSurfaceRootShadowView.h */; }; - 594F0A3B1FD233A2007FBE96 /* RCTSurfaceRootShadowViewDelegate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2F1FB274970058CCF6 /* RCTSurfaceRootShadowViewDelegate.h */; }; - 594F0A3C1FD233A2007FBE96 /* RCTSurfaceRootView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 599FAA301FB274970058CCF6 /* RCTSurfaceRootView.h */; }; - 594F0A3D1FD233A2007FBE96 /* RCTSurfaceStage.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 599FAA321FB274970058CCF6 /* RCTSurfaceStage.h */; }; - 594F0A3E1FD233A2007FBE96 /* RCTSurfaceView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 599FAA341FB274970058CCF6 /* RCTSurfaceView.h */; }; - 594F0A3F1FD233A2007FBE96 /* RCTSurfaceHostingView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 594F0A2F1FD23228007FBE96 /* RCTSurfaceHostingView.h */; }; - 594F0A401FD233A2007FBE96 /* RCTSurfaceSizeMeasureMode.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 594F0A311FD23228007FBE96 /* RCTSurfaceSizeMeasureMode.h */; }; - 594F0A411FD233BD007FBE96 /* RCTSurface.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2A1FB274970058CCF6 /* RCTSurface.h */; }; - 594F0A421FD233BD007FBE96 /* RCTSurfaceDelegate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2C1FB274970058CCF6 /* RCTSurfaceDelegate.h */; }; - 594F0A431FD233BD007FBE96 /* RCTSurfaceRootShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2D1FB274970058CCF6 /* RCTSurfaceRootShadowView.h */; }; - 594F0A441FD233BD007FBE96 /* RCTSurfaceRootShadowViewDelegate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2F1FB274970058CCF6 /* RCTSurfaceRootShadowViewDelegate.h */; }; - 594F0A451FD233BD007FBE96 /* RCTSurfaceRootView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 599FAA301FB274970058CCF6 /* RCTSurfaceRootView.h */; }; - 594F0A461FD233BD007FBE96 /* RCTSurfaceStage.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 599FAA321FB274970058CCF6 /* RCTSurfaceStage.h */; }; - 594F0A471FD233BD007FBE96 /* RCTSurfaceView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 599FAA341FB274970058CCF6 /* RCTSurfaceView.h */; }; - 594F0A481FD233BD007FBE96 /* RCTSurfaceHostingView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 594F0A2F1FD23228007FBE96 /* RCTSurfaceHostingView.h */; }; - 594F0A491FD233BD007FBE96 /* RCTSurfaceSizeMeasureMode.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 594F0A311FD23228007FBE96 /* RCTSurfaceSizeMeasureMode.h */; }; - 59500D431F71C63F00B122B7 /* RCTUIManagerUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 59500D411F71C63700B122B7 /* RCTUIManagerUtils.h */; }; - 59500D441F71C63F00B122B7 /* RCTUIManagerUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 59500D411F71C63700B122B7 /* RCTUIManagerUtils.h */; }; - 59500D451F71C63F00B122B7 /* RCTUIManagerUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 59500D421F71C63F00B122B7 /* RCTUIManagerUtils.m */; }; - 59500D461F71C63F00B122B7 /* RCTUIManagerUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 59500D421F71C63F00B122B7 /* RCTUIManagerUtils.m */; }; - 59500D471F71C66700B122B7 /* RCTUIManagerUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 59500D411F71C63700B122B7 /* RCTUIManagerUtils.h */; }; - 59500D481F71C67600B122B7 /* RCTUIManagerUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 59500D411F71C63700B122B7 /* RCTUIManagerUtils.h */; }; - 5960C1B51F0804A00066FD5B /* RCTLayoutAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 5960C1B11F0804A00066FD5B /* RCTLayoutAnimation.h */; }; - 5960C1B61F0804A00066FD5B /* RCTLayoutAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 5960C1B11F0804A00066FD5B /* RCTLayoutAnimation.h */; }; - 5960C1B71F0804A00066FD5B /* RCTLayoutAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 5960C1B21F0804A00066FD5B /* RCTLayoutAnimation.m */; }; - 5960C1B81F0804A00066FD5B /* RCTLayoutAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 5960C1B21F0804A00066FD5B /* RCTLayoutAnimation.m */; }; - 5960C1B91F0804A00066FD5B /* RCTLayoutAnimationGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 5960C1B31F0804A00066FD5B /* RCTLayoutAnimationGroup.h */; }; - 5960C1BA1F0804A00066FD5B /* RCTLayoutAnimationGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 5960C1B31F0804A00066FD5B /* RCTLayoutAnimationGroup.h */; }; - 5960C1BB1F0804A00066FD5B /* RCTLayoutAnimationGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 5960C1B41F0804A00066FD5B /* RCTLayoutAnimationGroup.m */; }; - 5960C1BC1F0804A00066FD5B /* RCTLayoutAnimationGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 5960C1B41F0804A00066FD5B /* RCTLayoutAnimationGroup.m */; }; - 5960C1BD1F0804DF0066FD5B /* RCTLayoutAnimation.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5960C1B11F0804A00066FD5B /* RCTLayoutAnimation.h */; }; - 5960C1BE1F0804DF0066FD5B /* RCTLayoutAnimationGroup.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5960C1B31F0804A00066FD5B /* RCTLayoutAnimationGroup.h */; }; - 5960C1BF1F0804F50066FD5B /* RCTLayoutAnimation.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5960C1B11F0804A00066FD5B /* RCTLayoutAnimation.h */; }; - 5960C1C01F0804F50066FD5B /* RCTLayoutAnimationGroup.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5960C1B31F0804A00066FD5B /* RCTLayoutAnimationGroup.h */; }; - 597633361F4E021D005BE8A4 /* RCTShadowView+Internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 597633341F4E021D005BE8A4 /* RCTShadowView+Internal.m */; }; - 597633371F4E021D005BE8A4 /* RCTShadowView+Internal.m in Sources */ = {isa = PBXBuildFile; fileRef = 597633341F4E021D005BE8A4 /* RCTShadowView+Internal.m */; }; - 597633381F4E021D005BE8A4 /* RCTShadowView+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 597633351F4E021D005BE8A4 /* RCTShadowView+Internal.h */; }; - 597633391F4E021D005BE8A4 /* RCTShadowView+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 597633351F4E021D005BE8A4 /* RCTShadowView+Internal.h */; }; - 598FD1921F816A2A006C54CB /* RAMBundleRegistry.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = C6D380181F71D75B00621378 /* RAMBundleRegistry.h */; }; - 598FD1951F817335006C54CB /* RCTModalManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 91076A881F743AB00081B4FA /* RCTModalManager.h */; }; - 598FD1961F817335006C54CB /* RCTModalManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 91076A871F743AB00081B4FA /* RCTModalManager.m */; }; - 598FD1971F817336006C54CB /* RCTModalManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 91076A881F743AB00081B4FA /* RCTModalManager.h */; }; - 599FAA361FB274980058CCF6 /* RCTSurface.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2A1FB274970058CCF6 /* RCTSurface.h */; }; - 599FAA371FB274980058CCF6 /* RCTSurface.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2A1FB274970058CCF6 /* RCTSurface.h */; }; - 599FAA381FB274980058CCF6 /* RCTSurface.mm in Sources */ = {isa = PBXBuildFile; fileRef = 599FAA2B1FB274970058CCF6 /* RCTSurface.mm */; }; - 599FAA391FB274980058CCF6 /* RCTSurface.mm in Sources */ = {isa = PBXBuildFile; fileRef = 599FAA2B1FB274970058CCF6 /* RCTSurface.mm */; }; - 599FAA3A1FB274980058CCF6 /* RCTSurfaceDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2C1FB274970058CCF6 /* RCTSurfaceDelegate.h */; }; - 599FAA3B1FB274980058CCF6 /* RCTSurfaceDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2C1FB274970058CCF6 /* RCTSurfaceDelegate.h */; }; - 599FAA3C1FB274980058CCF6 /* RCTSurfaceRootShadowView.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2D1FB274970058CCF6 /* RCTSurfaceRootShadowView.h */; }; - 599FAA3D1FB274980058CCF6 /* RCTSurfaceRootShadowView.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2D1FB274970058CCF6 /* RCTSurfaceRootShadowView.h */; }; - 599FAA3E1FB274980058CCF6 /* RCTSurfaceRootShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 599FAA2E1FB274970058CCF6 /* RCTSurfaceRootShadowView.m */; }; - 599FAA3F1FB274980058CCF6 /* RCTSurfaceRootShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 599FAA2E1FB274970058CCF6 /* RCTSurfaceRootShadowView.m */; }; - 599FAA401FB274980058CCF6 /* RCTSurfaceRootShadowViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2F1FB274970058CCF6 /* RCTSurfaceRootShadowViewDelegate.h */; }; - 599FAA411FB274980058CCF6 /* RCTSurfaceRootShadowViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2F1FB274970058CCF6 /* RCTSurfaceRootShadowViewDelegate.h */; }; - 599FAA421FB274980058CCF6 /* RCTSurfaceRootView.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA301FB274970058CCF6 /* RCTSurfaceRootView.h */; }; - 599FAA431FB274980058CCF6 /* RCTSurfaceRootView.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA301FB274970058CCF6 /* RCTSurfaceRootView.h */; }; - 599FAA441FB274980058CCF6 /* RCTSurfaceRootView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 599FAA311FB274970058CCF6 /* RCTSurfaceRootView.mm */; }; - 599FAA451FB274980058CCF6 /* RCTSurfaceRootView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 599FAA311FB274970058CCF6 /* RCTSurfaceRootView.mm */; }; - 599FAA461FB274980058CCF6 /* RCTSurfaceStage.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA321FB274970058CCF6 /* RCTSurfaceStage.h */; }; - 599FAA471FB274980058CCF6 /* RCTSurfaceStage.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA321FB274970058CCF6 /* RCTSurfaceStage.h */; }; - 599FAA481FB274980058CCF6 /* RCTSurfaceView+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA331FB274970058CCF6 /* RCTSurfaceView+Internal.h */; }; - 599FAA491FB274980058CCF6 /* RCTSurfaceView+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA331FB274970058CCF6 /* RCTSurfaceView+Internal.h */; }; - 599FAA4A1FB274980058CCF6 /* RCTSurfaceView.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA341FB274970058CCF6 /* RCTSurfaceView.h */; }; - 599FAA4B1FB274980058CCF6 /* RCTSurfaceView.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA341FB274970058CCF6 /* RCTSurfaceView.h */; }; - 599FAA4C1FB274980058CCF6 /* RCTSurfaceView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 599FAA351FB274970058CCF6 /* RCTSurfaceView.mm */; }; - 599FAA4D1FB274980058CCF6 /* RCTSurfaceView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 599FAA351FB274970058CCF6 /* RCTSurfaceView.mm */; }; - 59A7B9FD1E577DBF0068EDBF /* RCTRootContentView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A7B9FB1E577DBF0068EDBF /* RCTRootContentView.h */; }; - 59A7B9FE1E577DBF0068EDBF /* RCTRootContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59A7B9FC1E577DBF0068EDBF /* RCTRootContentView.m */; }; - 59B1EBC91EBD46250047B19B /* RCTShadowView+Layout.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 590D7BFB1EBD458B00D8A370 /* RCTShadowView+Layout.h */; }; - 59B1EBCA1EBD47520047B19B /* RCTShadowView+Layout.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 590D7BFB1EBD458B00D8A370 /* RCTShadowView+Layout.h */; }; - 59D031ED1F8353D3008361F0 /* RCTSafeAreaShadowView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59D031E51F8353D3008361F0 /* RCTSafeAreaShadowView.h */; }; - 59D031EE1F8353D3008361F0 /* RCTSafeAreaShadowView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59D031E51F8353D3008361F0 /* RCTSafeAreaShadowView.h */; }; - 59D031EF1F8353D3008361F0 /* RCTSafeAreaShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59D031E61F8353D3008361F0 /* RCTSafeAreaShadowView.m */; }; - 59D031F01F8353D3008361F0 /* RCTSafeAreaShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59D031E61F8353D3008361F0 /* RCTSafeAreaShadowView.m */; }; - 59D031F11F8353D3008361F0 /* RCTSafeAreaView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59D031E71F8353D3008361F0 /* RCTSafeAreaView.h */; }; - 59D031F21F8353D3008361F0 /* RCTSafeAreaView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59D031E71F8353D3008361F0 /* RCTSafeAreaView.h */; }; - 59D031F31F8353D3008361F0 /* RCTSafeAreaView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59D031E81F8353D3008361F0 /* RCTSafeAreaView.m */; }; - 59D031F41F8353D3008361F0 /* RCTSafeAreaView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59D031E81F8353D3008361F0 /* RCTSafeAreaView.m */; }; - 59D031F51F8353D3008361F0 /* RCTSafeAreaViewLocalData.h in Headers */ = {isa = PBXBuildFile; fileRef = 59D031E91F8353D3008361F0 /* RCTSafeAreaViewLocalData.h */; }; - 59D031F61F8353D3008361F0 /* RCTSafeAreaViewLocalData.h in Headers */ = {isa = PBXBuildFile; fileRef = 59D031E91F8353D3008361F0 /* RCTSafeAreaViewLocalData.h */; }; - 59D031F71F8353D3008361F0 /* RCTSafeAreaViewLocalData.m in Sources */ = {isa = PBXBuildFile; fileRef = 59D031EA1F8353D3008361F0 /* RCTSafeAreaViewLocalData.m */; }; - 59D031F81F8353D3008361F0 /* RCTSafeAreaViewLocalData.m in Sources */ = {isa = PBXBuildFile; fileRef = 59D031EA1F8353D3008361F0 /* RCTSafeAreaViewLocalData.m */; }; - 59D031F91F8353D3008361F0 /* RCTSafeAreaViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 59D031EB1F8353D3008361F0 /* RCTSafeAreaViewManager.h */; }; - 59D031FA1F8353D3008361F0 /* RCTSafeAreaViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 59D031EB1F8353D3008361F0 /* RCTSafeAreaViewManager.h */; }; - 59D031FB1F8353D3008361F0 /* RCTSafeAreaViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 59D031EC1F8353D3008361F0 /* RCTSafeAreaViewManager.m */; }; - 59D031FC1F8353D3008361F0 /* RCTSafeAreaViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 59D031EC1F8353D3008361F0 /* RCTSafeAreaViewManager.m */; }; - 59E604A01FE9CCE300BD90C5 /* RCTScrollContentShadowView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59E6049C1FE9CCE100BD90C5 /* RCTScrollContentShadowView.h */; }; - 59E604A11FE9CCE300BD90C5 /* RCTScrollContentShadowView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59E6049C1FE9CCE100BD90C5 /* RCTScrollContentShadowView.h */; }; - 59E604A21FE9CCE300BD90C5 /* RCTScrollContentViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E6049D1FE9CCE200BD90C5 /* RCTScrollContentViewManager.m */; }; - 59E604A31FE9CCE300BD90C5 /* RCTScrollContentViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E6049D1FE9CCE200BD90C5 /* RCTScrollContentViewManager.m */; }; - 59E604A41FE9CCE300BD90C5 /* RCTScrollContentShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E6049E1FE9CCE200BD90C5 /* RCTScrollContentShadowView.m */; }; - 59E604A51FE9CCE300BD90C5 /* RCTScrollContentShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E6049E1FE9CCE200BD90C5 /* RCTScrollContentShadowView.m */; }; - 59E604A61FE9CCE300BD90C5 /* RCTScrollContentViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 59E6049F1FE9CCE200BD90C5 /* RCTScrollContentViewManager.h */; }; - 59E604A71FE9CCE300BD90C5 /* RCTScrollContentViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 59E6049F1FE9CCE200BD90C5 /* RCTScrollContentViewManager.h */; }; - 59EB6DBB1EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB6DB91EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.h */; }; - 59EB6DBC1EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB6DB91EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.h */; }; - 59EB6DBD1EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 59EB6DBA1EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.mm */; }; - 59EB6DBE1EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 59EB6DBA1EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.mm */; }; - 59EB6DBF1EBD6FFC0072A5E7 /* RCTUIManagerObserverCoordinator.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 59EB6DB91EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.h */; }; - 59EB6DC01EBD70130072A5E7 /* RCTUIManagerObserverCoordinator.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 59EB6DB91EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.h */; }; - 59EDBCA71FDF4E0C003573DE /* RCTScrollableProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EDBC9C1FDF4E0C003573DE /* RCTScrollableProtocol.h */; }; - 59EDBCA81FDF4E0C003573DE /* RCTScrollableProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EDBC9C1FDF4E0C003573DE /* RCTScrollableProtocol.h */; }; - 59EDBCA91FDF4E0C003573DE /* (null) in Headers */ = {isa = PBXBuildFile; }; - 59EDBCAB1FDF4E0C003573DE /* (null) in Sources */ = {isa = PBXBuildFile; }; - 59EDBCAC1FDF4E0C003573DE /* (null) in Sources */ = {isa = PBXBuildFile; }; - 59EDBCAD1FDF4E0C003573DE /* RCTScrollContentView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EDBC9F1FDF4E0C003573DE /* RCTScrollContentView.h */; }; - 59EDBCAE1FDF4E0C003573DE /* RCTScrollContentView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EDBC9F1FDF4E0C003573DE /* RCTScrollContentView.h */; }; - 59EDBCAF1FDF4E0C003573DE /* RCTScrollContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EDBCA01FDF4E0C003573DE /* RCTScrollContentView.m */; }; - 59EDBCB01FDF4E0C003573DE /* RCTScrollContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EDBCA01FDF4E0C003573DE /* RCTScrollContentView.m */; }; - 59EDBCB11FDF4E0C003573DE /* (null) in Headers */ = {isa = PBXBuildFile; }; - 59EDBCB31FDF4E0C003573DE /* (null) in Sources */ = {isa = PBXBuildFile; }; - 59EDBCB41FDF4E0C003573DE /* (null) in Sources */ = {isa = PBXBuildFile; }; - 59EDBCB51FDF4E0C003573DE /* RCTScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EDBCA31FDF4E0C003573DE /* RCTScrollView.h */; }; - 59EDBCB61FDF4E0C003573DE /* RCTScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EDBCA31FDF4E0C003573DE /* RCTScrollView.h */; }; - 59EDBCB71FDF4E0C003573DE /* RCTScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EDBCA41FDF4E0C003573DE /* RCTScrollView.m */; }; - 59EDBCB81FDF4E0C003573DE /* RCTScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EDBCA41FDF4E0C003573DE /* RCTScrollView.m */; }; - 59EDBCB91FDF4E0C003573DE /* RCTScrollViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EDBCA51FDF4E0C003573DE /* RCTScrollViewManager.h */; }; - 59EDBCBA1FDF4E0C003573DE /* RCTScrollViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EDBCA51FDF4E0C003573DE /* RCTScrollViewManager.h */; }; - 59EDBCBB1FDF4E0C003573DE /* RCTScrollViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EDBCA61FDF4E0C003573DE /* RCTScrollViewManager.m */; }; - 59EDBCBC1FDF4E0C003573DE /* RCTScrollViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EDBCA61FDF4E0C003573DE /* RCTScrollViewManager.m */; }; - 59EDBCBD1FDF4E43003573DE /* RCTScrollableProtocol.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 59EDBC9C1FDF4E0C003573DE /* RCTScrollableProtocol.h */; }; - 59EDBCBE1FDF4E43003573DE /* (null) in Copy Headers */ = {isa = PBXBuildFile; }; - 59EDBCBF1FDF4E43003573DE /* RCTScrollContentView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 59EDBC9F1FDF4E0C003573DE /* RCTScrollContentView.h */; }; - 59EDBCC01FDF4E43003573DE /* (null) in Copy Headers */ = {isa = PBXBuildFile; }; - 59EDBCC11FDF4E43003573DE /* RCTScrollView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 59EDBCA31FDF4E0C003573DE /* RCTScrollView.h */; }; - 59EDBCC21FDF4E43003573DE /* RCTScrollViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 59EDBCA51FDF4E0C003573DE /* RCTScrollViewManager.h */; }; - 59EDBCC31FDF4E55003573DE /* RCTScrollableProtocol.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 59EDBC9C1FDF4E0C003573DE /* RCTScrollableProtocol.h */; }; - 59EDBCC41FDF4E55003573DE /* (null) in Copy Headers */ = {isa = PBXBuildFile; }; - 59EDBCC51FDF4E55003573DE /* RCTScrollContentView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 59EDBC9F1FDF4E0C003573DE /* RCTScrollContentView.h */; }; - 59EDBCC61FDF4E55003573DE /* (null) in Copy Headers */ = {isa = PBXBuildFile; }; - 59EDBCC71FDF4E55003573DE /* RCTScrollView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 59EDBCA31FDF4E0C003573DE /* RCTScrollView.h */; }; - 59EDBCC81FDF4E55003573DE /* RCTScrollViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 59EDBCA51FDF4E0C003573DE /* RCTScrollViewManager.h */; }; - 5CE2080320772F7D009A43B3 /* YGConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CE2080120772F7C009A43B3 /* YGConfig.h */; }; - 657734841EE834C900A0E9EA /* RCTInspectorDevServerHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 657734821EE834C900A0E9EA /* RCTInspectorDevServerHelper.h */; }; - 657734851EE834C900A0E9EA /* RCTInspectorDevServerHelper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 657734831EE834C900A0E9EA /* RCTInspectorDevServerHelper.mm */; }; - 657734861EE834D900A0E9EA /* RCTInspectorDevServerHelper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 657734831EE834C900A0E9EA /* RCTInspectorDevServerHelper.mm */; }; - 657734871EE834E000A0E9EA /* RCTInspectorDevServerHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 657734821EE834C900A0E9EA /* RCTInspectorDevServerHelper.h */; }; - 6577348E1EE8354A00A0E9EA /* RCTInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 6577348A1EE8354A00A0E9EA /* RCTInspector.h */; }; - 6577348F1EE8354A00A0E9EA /* RCTInspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6577348B1EE8354A00A0E9EA /* RCTInspector.mm */; }; - 657734901EE8354A00A0E9EA /* RCTInspectorPackagerConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 6577348C1EE8354A00A0E9EA /* RCTInspectorPackagerConnection.h */; }; - 657734911EE8354A00A0E9EA /* RCTInspectorPackagerConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 6577348D1EE8354A00A0E9EA /* RCTInspectorPackagerConnection.m */; }; - 657734921EE8356100A0E9EA /* RCTInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 6577348A1EE8354A00A0E9EA /* RCTInspector.h */; }; - 657734931EE8356100A0E9EA /* RCTInspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6577348B1EE8354A00A0E9EA /* RCTInspector.mm */; }; - 657734941EE8356100A0E9EA /* RCTInspectorPackagerConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 6577348C1EE8354A00A0E9EA /* RCTInspectorPackagerConnection.h */; }; - 657734951EE8356100A0E9EA /* RCTInspectorPackagerConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 6577348D1EE8354A00A0E9EA /* RCTInspectorPackagerConnection.m */; }; - 66CD94B11F1045E700CB3C7C /* RCTMaskedView.h in Headers */ = {isa = PBXBuildFile; fileRef = 66CD94AD1F1045E700CB3C7C /* RCTMaskedView.h */; }; - 66CD94B21F1045E700CB3C7C /* RCTMaskedView.h in Headers */ = {isa = PBXBuildFile; fileRef = 66CD94AD1F1045E700CB3C7C /* RCTMaskedView.h */; }; - 66CD94B31F1045E700CB3C7C /* RCTMaskedView.m in Sources */ = {isa = PBXBuildFile; fileRef = 66CD94AE1F1045E700CB3C7C /* RCTMaskedView.m */; }; - 66CD94B41F1045E700CB3C7C /* RCTMaskedView.m in Sources */ = {isa = PBXBuildFile; fileRef = 66CD94AE1F1045E700CB3C7C /* RCTMaskedView.m */; }; - 66CD94B51F1045E700CB3C7C /* RCTMaskedViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 66CD94AF1F1045E700CB3C7C /* RCTMaskedViewManager.h */; }; - 66CD94B61F1045E700CB3C7C /* RCTMaskedViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 66CD94AF1F1045E700CB3C7C /* RCTMaskedViewManager.h */; }; - 66CD94B71F1045E700CB3C7C /* RCTMaskedViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 66CD94B01F1045E700CB3C7C /* RCTMaskedViewManager.m */; }; - 66CD94B81F1045E700CB3C7C /* RCTMaskedViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 66CD94B01F1045E700CB3C7C /* RCTMaskedViewManager.m */; }; - 68EFE4EE1CF6EB3900A1DE13 /* RCTBundleURLProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 68EFE4ED1CF6EB3900A1DE13 /* RCTBundleURLProvider.m */; }; - 830A229E1A66C68A008503DA /* RCTRootView.m in Sources */ = {isa = PBXBuildFile; fileRef = 830A229D1A66C68A008503DA /* RCTRootView.m */; }; - 83281384217EB70900574D55 /* MallocImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83281383217EB70800574D55 /* MallocImpl.cpp */; }; - 83281385217EB71200574D55 /* MallocImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83281383217EB70800574D55 /* MallocImpl.cpp */; }; - 83281387217EB73400574D55 /* String.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83281386217EB73400574D55 /* String.cpp */; }; - 83281388217EB73400574D55 /* String.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83281386217EB73400574D55 /* String.cpp */; }; - 8328138A217EB74C00574D55 /* json_pointer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83281389217EB74C00574D55 /* json_pointer.cpp */; }; - 8328138B217EB74C00574D55 /* json_pointer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83281389217EB74C00574D55 /* json_pointer.cpp */; }; - 8328138D217EB75C00574D55 /* ColdClass.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8328138C217EB75C00574D55 /* ColdClass.cpp */; }; - 8328138E217EB75C00574D55 /* ColdClass.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8328138C217EB75C00574D55 /* ColdClass.cpp */; }; - 83281390217EB76C00574D55 /* Demangle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8328138F217EB76B00574D55 /* Demangle.cpp */; }; - 83281391217EB76C00574D55 /* Demangle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8328138F217EB76B00574D55 /* Demangle.cpp */; }; - 83281393217EB77D00574D55 /* SpookyHashV2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83281392217EB77C00574D55 /* SpookyHashV2.cpp */; }; - 83281394217EB77D00574D55 /* SpookyHashV2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83281392217EB77C00574D55 /* SpookyHashV2.cpp */; }; - 83281396217EB79000574D55 /* F14Table.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83281395217EB78F00574D55 /* F14Table.cpp */; }; - 83281397217EB79000574D55 /* F14Table.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83281395217EB78F00574D55 /* F14Table.cpp */; }; - 83281399217EB79D00574D55 /* ScopeGuard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83281398217EB79D00574D55 /* ScopeGuard.cpp */; }; - 8328139A217EB79D00574D55 /* ScopeGuard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83281398217EB79D00574D55 /* ScopeGuard.cpp */; }; - 83392EB31B6634E10013B15F /* RCTModalHostViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 83392EB21B6634E10013B15F /* RCTModalHostViewController.m */; }; - 833D02BA217EBCFA00A23750 /* Assume.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 833D02B9217EBCFA00A23750 /* Assume.cpp */; }; - 833D02BB217EBCFA00A23750 /* Assume.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 833D02B9217EBCFA00A23750 /* Assume.cpp */; }; - 833D02BD217EBD2600A23750 /* Format.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 833D02BC217EBD2600A23750 /* Format.cpp */; }; - 833D02BE217EBD2600A23750 /* Format.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 833D02BC217EBD2600A23750 /* Format.cpp */; }; - 83A1FE8C1B62640A00BE0E65 /* RCTModalHostView.m in Sources */ = {isa = PBXBuildFile; fileRef = 83A1FE8B1B62640A00BE0E65 /* RCTModalHostView.m */; }; - 83A1FE8F1B62643A00BE0E65 /* RCTModalHostViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 83A1FE8E1B62643A00BE0E65 /* RCTModalHostViewManager.m */; }; - 83CBBA511A601E3B00E9B192 /* RCTAssert.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA4B1A601E3B00E9B192 /* RCTAssert.m */; }; - 83CBBA521A601E3B00E9B192 /* RCTLog.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA4E1A601E3B00E9B192 /* RCTLog.mm */; }; - 83CBBA531A601E3B00E9B192 /* RCTUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA501A601E3B00E9B192 /* RCTUtils.m */; }; - 83CBBA601A601EAA00E9B192 /* RCTBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA5F1A601EAA00E9B192 /* RCTBridge.m */; }; - 83CBBA691A601EF300E9B192 /* RCTEventDispatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA661A601EF300E9B192 /* RCTEventDispatcher.m */; }; - 83CBBA981A6020BB00E9B192 /* RCTTouchHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA971A6020BB00E9B192 /* RCTTouchHandler.m */; }; - 83CBBACC1A6023D300E9B192 /* RCTConvert.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBACB1A6023D300E9B192 /* RCTConvert.m */; }; - 8507BBBE21EDACC200AEAFCA /* JSCExecutorFactory.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8507BBBC21EDACC200AEAFCA /* JSCExecutorFactory.mm */; }; - 8507BBBF21EDACC200AEAFCA /* JSCExecutorFactory.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8507BBBC21EDACC200AEAFCA /* JSCExecutorFactory.mm */; }; - 8507BBC021EDACC200AEAFCA /* JSCExecutorFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 8507BBBD21EDACC200AEAFCA /* JSCExecutorFactory.h */; }; - 8507BBC121EDACC200AEAFCA /* JSCExecutorFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 8507BBBD21EDACC200AEAFCA /* JSCExecutorFactory.h */; }; - 916F9C2D1F743F57002E5920 /* RCTModalManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 91076A871F743AB00081B4FA /* RCTModalManager.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 */; }; - AC4A6AFA21FB4EBF00FBEC39 /* YGMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC4A6AF821FB4EA900FBEC39 /* YGMarker.cpp */; }; - AC4A6AFB21FB4ECA00FBEC39 /* YGMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC4A6AF821FB4EA900FBEC39 /* YGMarker.cpp */; }; - AC52CEDE21FB3FF9003C6BEC /* instrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = AC52CEDD21FB3FF9003C6BEC /* instrumentation.h */; }; - AC52CEDF21FB401D003C6BEC /* instrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = AC52CEDD21FB3FF9003C6BEC /* instrumentation.h */; }; - AC52CEE021FB403B003C6BEC /* instrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = AC52CEDD21FB3FF9003C6BEC /* instrumentation.h */; }; - AC6B69E421B1467C00B2B68A /* YGValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AC6B69E221B1467C00B2B68A /* YGValue.h */; }; - AC6B69E521B1469A00B2B68A /* YGValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AC6B69E221B1467C00B2B68A /* YGValue.h */; }; - AC6B69E621B146A500B2B68A /* YGValue.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = AC6B69E221B1467C00B2B68A /* YGValue.h */; }; - AC6B69E721B146B400B2B68A /* YGValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC6B69E121B1467C00B2B68A /* YGValue.cpp */; }; - AC6B69E821B146C500B2B68A /* YGValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AC6B69E221B1467C00B2B68A /* YGValue.h */; }; - AC6B69E921B146DB00B2B68A /* YGValue.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = AC6B69E221B1467C00B2B68A /* YGValue.h */; }; - AC6B69EA21B146E700B2B68A /* YGValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC6B69E121B1467C00B2B68A /* YGValue.cpp */; }; - AC70D2E91DE489E4002E6351 /* RCTJavaScriptLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = AC70D2E81DE489E4002E6351 /* RCTJavaScriptLoader.mm */; }; - AC71763521B0274000C06877 /* YGConfig.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5CE2080120772F7C009A43B3 /* YGConfig.h */; }; - AC71763621B0274A00C06877 /* YGMarker.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = AC8360CC21B0256A00FC46B9 /* YGMarker.h */; }; - AC8360CD21B0256A00FC46B9 /* YGMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = AC8360CC21B0256A00FC46B9 /* YGMarker.h */; }; - AC8360CE21B0256A00FC46B9 /* YGMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = AC8360CC21B0256A00FC46B9 /* YGMarker.h */; }; - AC8360CF21B0258B00FC46B9 /* YGConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CE2080120772F7C009A43B3 /* YGConfig.h */; }; - AC8360D121B025BC00FC46B9 /* YGConfig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CE2080020772F7C009A43B3 /* YGConfig.cpp */; }; - AC8360D221B025EF00FC46B9 /* YGConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CE2080120772F7C009A43B3 /* YGConfig.h */; }; - AC8360D321B0263000FC46B9 /* YGMarker.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = AC8360CC21B0256A00FC46B9 /* YGMarker.h */; }; - AC90463E21C91CC2005B24B3 /* CompactValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AC90463D21C91CC2005B24B3 /* CompactValue.h */; }; - AC90463F21C91D02005B24B3 /* CompactValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AC90463D21C91CC2005B24B3 /* CompactValue.h */; }; - AC90464021C91D14005B24B3 /* CompactValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AC90463D21C91CC2005B24B3 /* CompactValue.h */; }; - AC90464121C91DB8005B24B3 /* YGConfig.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5CE2080120772F7C009A43B3 /* YGConfig.h */; }; - B233E6EA1D2D845D00BC68BA /* RCTI18nManager.m in Sources */ = {isa = PBXBuildFile; fileRef = B233E6E91D2D845D00BC68BA /* RCTI18nManager.m */; }; - B95154321D1B34B200FE7B80 /* RCTActivityIndicatorView.m in Sources */ = {isa = PBXBuildFile; fileRef = B95154311D1B34B200FE7B80 /* RCTActivityIndicatorView.m */; }; - BA0501AD2109DCF200A6BBC4 /* ReactMarker.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13DA8A2F2097A90A00276ED4 /* ReactMarker.h */; }; - BA0501AE2109DD0600A6BBC4 /* JSExecutor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E223624320875A8000108244 /* JSExecutor.cpp */; }; - BA0501B02109DD1800A6BBC4 /* YGConfig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CE2080020772F7C009A43B3 /* YGConfig.cpp */; }; - C60128AB1F3D1258009DF9FF /* RCTCxxConvert.h in Headers */ = {isa = PBXBuildFile; fileRef = C60128A91F3D1258009DF9FF /* RCTCxxConvert.h */; }; - C60128AC1F3D1258009DF9FF /* RCTCxxConvert.h in Headers */ = {isa = PBXBuildFile; fileRef = C60128A91F3D1258009DF9FF /* RCTCxxConvert.h */; }; - C60128AD1F3D1258009DF9FF /* RCTCxxConvert.m in Sources */ = {isa = PBXBuildFile; fileRef = C60128AA1F3D1258009DF9FF /* RCTCxxConvert.m */; }; - C60128AE1F3D1258009DF9FF /* RCTCxxConvert.m in Sources */ = {isa = PBXBuildFile; fileRef = C60128AA1F3D1258009DF9FF /* RCTCxxConvert.m */; }; - C606692E1F3CC60500E67165 /* RCTModuleMethod.mm in Sources */ = {isa = PBXBuildFile; fileRef = C606692D1F3CC60500E67165 /* RCTModuleMethod.mm */; }; - C606692F1F3CC60500E67165 /* RCTModuleMethod.mm in Sources */ = {isa = PBXBuildFile; fileRef = C606692D1F3CC60500E67165 /* RCTModuleMethod.mm */; }; - C60669361F3CCF1B00E67165 /* RCTManagedPointer.mm in Sources */ = {isa = PBXBuildFile; fileRef = C60669351F3CCF1B00E67165 /* RCTManagedPointer.mm */; }; - C60669371F3CCF1B00E67165 /* RCTManagedPointer.mm in Sources */ = {isa = PBXBuildFile; fileRef = C60669351F3CCF1B00E67165 /* RCTManagedPointer.mm */; }; - C654505E1F3BD9280090799B /* RCTManagedPointer.h in Headers */ = {isa = PBXBuildFile; fileRef = C654505D1F3BD9280090799B /* RCTManagedPointer.h */; }; - C654505F1F3BD9280090799B /* RCTManagedPointer.h in Headers */ = {isa = PBXBuildFile; fileRef = C654505D1F3BD9280090799B /* RCTManagedPointer.h */; }; - C669D8981F72E3DE006748EB /* RAMBundleRegistry.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = C6D380181F71D75B00621378 /* RAMBundleRegistry.h */; }; - C6D3801A1F71D76100621378 /* RAMBundleRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = C6D380181F71D75B00621378 /* RAMBundleRegistry.h */; }; - C6D3801B1F71D76200621378 /* RAMBundleRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = C6D380181F71D75B00621378 /* RAMBundleRegistry.h */; }; - C6D3801C1F71D76700621378 /* RAMBundleRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6D380191F71D75B00621378 /* RAMBundleRegistry.cpp */; }; - C6D3801D1F71D76800621378 /* RAMBundleRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6D380191F71D75B00621378 /* RAMBundleRegistry.cpp */; }; - CF2731C01E7B8DE40044CA4F /* RCTDeviceInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = CF2731BE1E7B8DE40044CA4F /* RCTDeviceInfo.h */; }; - CF2731C11E7B8DE40044CA4F /* RCTDeviceInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = CF2731BF1E7B8DE40044CA4F /* RCTDeviceInfo.m */; }; - CF2731C21E7B8DEF0044CA4F /* RCTDeviceInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = CF2731BE1E7B8DE40044CA4F /* RCTDeviceInfo.h */; }; - CF2731C31E7B8DF30044CA4F /* RCTDeviceInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = CF2731BF1E7B8DE40044CA4F /* RCTDeviceInfo.m */; }; - E223624420875A8000108244 /* JSExecutor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E223624320875A8000108244 /* JSExecutor.cpp */; }; - E9B20B7B1B500126007A2DA7 /* RCTAccessibilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E9B20B7A1B500126007A2DA7 /* RCTAccessibilityManager.m */; }; - EBF21BBC1FC498270052F4D5 /* InspectorInterfaces.h in Headers */ = {isa = PBXBuildFile; fileRef = EBF21BBA1FC498270052F4D5 /* InspectorInterfaces.h */; }; - EBF21BBE1FC498630052F4D5 /* InspectorInterfaces.h in Headers */ = {isa = PBXBuildFile; fileRef = EBF21BBA1FC498270052F4D5 /* InspectorInterfaces.h */; }; - EBF21BFB1FC498FC0052F4D5 /* InspectorInterfaces.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EBF21BBA1FC498270052F4D5 /* InspectorInterfaces.h */; }; - EBF21BFC1FC4990B0052F4D5 /* InspectorInterfaces.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBF21BBB1FC498270052F4D5 /* InspectorInterfaces.cpp */; }; - EBF21BFE1FC499840052F4D5 /* InspectorInterfaces.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EBF21BBA1FC498270052F4D5 /* InspectorInterfaces.h */; }; - EBF21BFF1FC4998E0052F4D5 /* InspectorInterfaces.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBF21BBB1FC498270052F4D5 /* InspectorInterfaces.cpp */; }; - ED296F82214C973700B7C4FE /* libjsinspector-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EBF21BFA1FC4989A0052F4D5 /* libjsinspector-tvOS.a */; }; - ED296F83214C974A00B7C4FE /* libyoga.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D3C06751DE3340C00C268FA /* libyoga.a */; }; - ED296FB7214C9A9A00B7C4FE /* JSIDynamic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDEBC6DA214B3F6800DD5AC8 /* JSIDynamic.cpp */; }; - ED296FB8214C9A9A00B7C4FE /* jsi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDEBC6DB214B3F6800DD5AC8 /* jsi.cpp */; }; - ED296FB9214C9AC200B7C4FE /* JSCRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDEBC6DD214B3F6800DD5AC8 /* JSCRuntime.cpp */; }; - ED296FBC214C9B0400B7C4FE /* jsi-inl.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6D9214B3F6800DD5AC8 /* jsi-inl.h */; }; - ED296FBF214C9B0400B7C4FE /* JSIDynamic.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6DC214B3F6800DD5AC8 /* JSIDynamic.h */; }; - ED296FC1214C9B0400B7C4FE /* JSCRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6DE214B3F6800DD5AC8 /* JSCRuntime.h */; }; - ED296FC3214C9B0400B7C4FE /* instrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6E0214B3F6800DD5AC8 /* instrumentation.h */; }; - ED296FC4214C9B0400B7C4FE /* jsi.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6E1214B3F6800DD5AC8 /* jsi.h */; }; - ED296FC5214C9B3E00B7C4FE /* jsi-inl.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6D9214B3F6800DD5AC8 /* jsi-inl.h */; }; - ED296FC6214C9B4400B7C4FE /* JSIDynamic.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6DC214B3F6800DD5AC8 /* JSIDynamic.h */; }; - ED296FC7214C9B4B00B7C4FE /* instrumentation.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6E0214B3F6800DD5AC8 /* instrumentation.h */; }; - ED296FC8214C9B5200B7C4FE /* jsi.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6E1214B3F6800DD5AC8 /* jsi.h */; }; - ED296FCB214C9B6C00B7C4FE /* libjsi-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ED296FB6214C9A0900B7C4FE /* libjsi-tvOS.a */; }; - ED29703E2150126E00B7C4FE /* AtomicIntrusiveLinkedList.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D849C1E273B5600323FB7 /* AtomicIntrusiveLinkedList.h */; }; - ED2970422150126E00B7C4FE /* Conv.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D84A01E273B5600323FB7 /* Conv.h */; }; - ED2970432150126E00B7C4FE /* dynamic-inl.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D84A11E273B5600323FB7 /* dynamic-inl.h */; }; - ED2970452150126E00B7C4FE /* dynamic.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D84A31E273B5600323FB7 /* dynamic.h */; }; - ED2970462150126E00B7C4FE /* Exception.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D84A41E273B5600323FB7 /* Exception.h */; }; - ED2970482150126E00B7C4FE /* json.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D84A81E273B5600323FB7 /* json.h */; }; - ED2970492150126E00B7C4FE /* Memory.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D84A91E273B5600323FB7 /* Memory.h */; }; - ED29704A2150126E00B7C4FE /* MoveWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D84AA1E273B5600323FB7 /* MoveWrapper.h */; }; - ED29704B2150126E00B7C4FE /* Optional.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D84AB1E273B5600323FB7 /* Optional.h */; }; - ED29704C2150126E00B7C4FE /* ScopeGuard.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D84AC1E273B5600323FB7 /* ScopeGuard.h */; }; - ED29704F2150199F00B7C4FE /* JSCRuntime.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6DE214B3F6800DD5AC8 /* JSCRuntime.h */; }; - ED297050215019B400B7C4FE /* instrumentation.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6E0214B3F6800DD5AC8 /* instrumentation.h */; }; - ED297067215023D800B7C4FE /* libjsiexecutor-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ED296FEE214C9CF800B7C4FE /* libjsiexecutor-tvOS.a */; }; - ED6189692155BBF70000C9A7 /* JSIExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = ED6189672155BBF70000C9A7 /* JSIExecutor.h */; }; - ED61896A2155BBF70000C9A7 /* JSIExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = ED6189672155BBF70000C9A7 /* JSIExecutor.h */; }; - ED61896B2155BBF70000C9A7 /* JSINativeModules.h in Headers */ = {isa = PBXBuildFile; fileRef = ED6189682155BBF70000C9A7 /* JSINativeModules.h */; }; - ED61896C2155BBF70000C9A7 /* JSINativeModules.h in Headers */ = {isa = PBXBuildFile; fileRef = ED6189682155BBF70000C9A7 /* JSINativeModules.h */; }; - ED7286BC2155C62000C26ABF /* JSIExecutor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = ED6189672155BBF70000C9A7 /* JSIExecutor.h */; }; - ED7286BD2155C62000C26ABF /* JSINativeModules.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = ED6189682155BBF70000C9A7 /* JSINativeModules.h */; }; - ED7286BE2155C62B00C26ABF /* JSIExecutor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = ED6189672155BBF70000C9A7 /* JSIExecutor.h */; }; - ED7286BF2155C62B00C26ABF /* JSINativeModules.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = ED6189682155BBF70000C9A7 /* JSINativeModules.h */; }; - EDDA711D2164285A00B2D070 /* JSINativeModules.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDDA711B2164285A00B2D070 /* JSINativeModules.cpp */; }; - EDDA711E2164285A00B2D070 /* JSINativeModules.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDDA711B2164285A00B2D070 /* JSINativeModules.cpp */; }; - EDDA711F2164285A00B2D070 /* JSIExecutor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDDA711C2164285A00B2D070 /* JSIExecutor.cpp */; }; - EDDA71202164285A00B2D070 /* JSIExecutor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDDA711C2164285A00B2D070 /* JSIExecutor.cpp */; }; - EDEBC6E2214B3F6800DD5AC8 /* jsi-inl.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6D9214B3F6800DD5AC8 /* jsi-inl.h */; }; - EDEBC6E3214B3F6800DD5AC8 /* JSIDynamic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDEBC6DA214B3F6800DD5AC8 /* JSIDynamic.cpp */; }; - EDEBC6E4214B3F6800DD5AC8 /* jsi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDEBC6DB214B3F6800DD5AC8 /* jsi.cpp */; }; - EDEBC6E5214B3F6800DD5AC8 /* JSIDynamic.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6DC214B3F6800DD5AC8 /* JSIDynamic.h */; }; - EDEBC6E6214B3F6800DD5AC8 /* JSCRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDEBC6DD214B3F6800DD5AC8 /* JSCRuntime.cpp */; }; - EDEBC6E7214B3F6800DD5AC8 /* JSCRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6DE214B3F6800DD5AC8 /* JSCRuntime.h */; }; - EDEBC6E8214B3F6800DD5AC8 /* instrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6E0214B3F6800DD5AC8 /* instrumentation.h */; }; - EDEBC6E9214B3F6800DD5AC8 /* jsi.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6E1214B3F6800DD5AC8 /* jsi.h */; }; - EDEBC71A214B40A300DD5AC8 /* libjsi.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EDEBC6D6214B3E7000DD5AC8 /* libjsi.a */; }; - EDEBC71C214B40F900DD5AC8 /* jsi-inl.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6D9214B3F6800DD5AC8 /* jsi-inl.h */; }; - EDEBC71D214B40F900DD5AC8 /* JSIDynamic.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6DC214B3F6800DD5AC8 /* JSIDynamic.h */; }; - EDEBC71E214B40F900DD5AC8 /* JSCRuntime.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6DE214B3F6800DD5AC8 /* JSCRuntime.h */; }; - EDEBC71F214B40F900DD5AC8 /* jsi.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6E1214B3F6800DD5AC8 /* jsi.h */; }; - EDEBC7DF214C705700DD5AC8 /* libjsiexecutor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EDEBC73B214B45A300DD5AC8 /* libjsiexecutor.a */; }; - EDEBC7E0214C709200DD5AC8 /* libjsinspector.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EBF21BDC1FC498900052F4D5 /* libjsinspector.a */; }; - F1EFDA50201F661000EE6E4C /* RCTUIUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = F1EFDA4E201F660F00EE6E4C /* RCTUIUtils.m */; }; - FEFAAC9E1FDB89B50057BBE0 /* RCTRedBoxExtraDataViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FEFAAC9C1FDB89B40057BBE0 /* RCTRedBoxExtraDataViewController.m */; }; - FEFAAC9F1FDB89B50057BBE0 /* RCTRedBoxExtraDataViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = FEFAAC9D1FDB89B40057BBE0 /* RCTRedBoxExtraDataViewController.h */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 1320081C1E283DCB00F0C457 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 139D7E871E25C6D100323FB7; - remoteInfo = "double-conversion"; - }; - 3D0574541DE5FF9600184BB4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3D3C059B1DE3340C00C268FA; - remoteInfo = "yoga-tvOS"; - }; - 3D0574561DE5FF9600184BB4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3D3CD9261DE5FBEE00167DC4; - remoteInfo = "cxxreact-tvOS"; - }; - 3D383D651EBD27DB005632C8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3D383D3D1EBD27B9005632C8; - remoteInfo = "double-conversion-tvOS"; - }; - 3D3CD94B1DE5FCE700167DC4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3D3CD9191DE5FBEC00167DC4; - remoteInfo = cxxreact; - }; - 53D123981FBF1E0C001B8A10 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3D3C04B91DE3340900C268FA; - remoteInfo = yoga; - }; - ED296F7D214C957300B7C4FE /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = EDEBC6BA214B3E7000DD5AC8; - remoteInfo = jsi; - }; - ED296F80214C971800B7C4FE /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = EBF21BDD1FC4989A0052F4D5; - remoteInfo = "jsinspector-tvOS"; - }; - ED296F96214C996500B7C4FE /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3D383D3D1EBD27B9005632C8; - remoteInfo = "double-conversion-tvOS"; - }; - ED296FC9214C9B6200B7C4FE /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = ED296F98214C9A0900B7C4FE; - remoteInfo = "jsi-tvOS"; - }; - ED296FF7214C9EAA00B7C4FE /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3D383D211EBD27B6005632C8; - remoteInfo = "third-party-tvOS"; - }; - ED296FFB214C9EC000B7C4FE /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3D3CD9261DE5FBEE00167DC4; - remoteInfo = "cxxreact-tvOS"; - }; - ED296FFD214C9EC600B7C4FE /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = ED296F98214C9A0900B7C4FE; - remoteInfo = "jsi-tvOS"; - }; - ED29704D215012C700B7C4FE /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3D383D3D1EBD27B9005632C8; - remoteInfo = "double-conversion-tvOS"; - }; - ED2970652150237300B7C4FE /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = ED296FD0214C9CF800B7C4FE; - remoteInfo = "jsiexecutor-tvOS"; - }; - EDEBC74A214B46A700DD5AC8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = EDEBC724214B45A300DD5AC8; - remoteInfo = jsiexecutor; - }; - EDEBC74E214B477400DD5AC8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = EDEBC6BA214B3E7000DD5AC8; - remoteInfo = jsi; - }; - EDEBC7CB214C516800DD5AC8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 139D7E871E25C6D100323FB7; - remoteInfo = "double-conversion"; - }; - EDEBC7CD214C523F00DD5AC8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3D3CD9191DE5FBEC00167DC4; - remoteInfo = cxxreact; - }; - EDEBC7D2214C528C00DD5AC8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 139D7ECD1E25DB7D00323FB7; - remoteInfo = "third-party"; - }; - EDEBC7D6214C52FD00DD5AC8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 139D7E871E25C6D100323FB7; - remoteInfo = "double-conversion"; - }; - EDEBC7D8214C628300DD5AC8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = EBF21BBF1FC498900052F4D5; - remoteInfo = jsinspector; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 139D7E861E25C6D100323FB7 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - 19F61BFA1E8495CD00571D81 /* bignum-dtoa.h in CopyFiles */, - 19F61BFB1E8495CD00571D81 /* bignum.h in CopyFiles */, - 19F61BFC1E8495CD00571D81 /* cached-powers.h in CopyFiles */, - 19F61BFD1E8495CD00571D81 /* diy-fp.h in CopyFiles */, - 19F61BFE1E8495CD00571D81 /* double-conversion.h in CopyFiles */, - 19F61BFF1E8495CD00571D81 /* fast-dtoa.h in CopyFiles */, - 19F61C001E8495CD00571D81 /* fixed-dtoa.h in CopyFiles */, - 19F61C011E8495CD00571D81 /* ieee.h in CopyFiles */, - 19F61C021E8495CD00571D81 /* strtod.h in CopyFiles */, - 19F61C031E8495CD00571D81 /* utils.h in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D302E191DF8249100D6DDAE /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/React; - dstSubfolderSpec = 16; - files = ( - 591F78DF202ADB97004A668C /* RCTLayout.h in Copy Headers */, - 59EDBCC31FDF4E55003573DE /* RCTScrollableProtocol.h in Copy Headers */, - 59EDBCC41FDF4E55003573DE /* (null) in Copy Headers */, - 59EDBCC51FDF4E55003573DE /* RCTScrollContentView.h in Copy Headers */, - 59EDBCC61FDF4E55003573DE /* (null) in Copy Headers */, - 59EDBCC71FDF4E55003573DE /* RCTScrollView.h in Copy Headers */, - 59EDBCC81FDF4E55003573DE /* RCTScrollViewManager.h in Copy Headers */, - 594F0A411FD233BD007FBE96 /* RCTSurface.h in Copy Headers */, - 594F0A421FD233BD007FBE96 /* RCTSurfaceDelegate.h in Copy Headers */, - 594F0A431FD233BD007FBE96 /* RCTSurfaceRootShadowView.h in Copy Headers */, - 594F0A441FD233BD007FBE96 /* RCTSurfaceRootShadowViewDelegate.h in Copy Headers */, - 594F0A451FD233BD007FBE96 /* RCTSurfaceRootView.h in Copy Headers */, - 594F0A461FD233BD007FBE96 /* RCTSurfaceStage.h in Copy Headers */, - 594F0A471FD233BD007FBE96 /* RCTSurfaceView.h in Copy Headers */, - 594F0A481FD233BD007FBE96 /* RCTSurfaceHostingView.h in Copy Headers */, - 594F0A491FD233BD007FBE96 /* RCTSurfaceSizeMeasureMode.h in Copy Headers */, - 2D16E68E1FA4FD3900B85C8A /* RCTTVNavigationEventEmitter.h in Copy Headers */, - 59500D481F71C67600B122B7 /* RCTUIManagerUtils.h in Copy Headers */, - 3D0E37901F1CC5E100DCAC9F /* RCTWebSocketModule.h in Copy Headers */, - 5960C1BF1F0804F50066FD5B /* RCTLayoutAnimation.h in Copy Headers */, - 5960C1C01F0804F50066FD5B /* RCTLayoutAnimationGroup.h in Copy Headers */, - 59EB6DC01EBD70130072A5E7 /* RCTUIManagerObserverCoordinator.h in Copy Headers */, - 59B1EBCA1EBD47520047B19B /* RCTShadowView+Layout.h in Copy Headers */, - 3D0B84271EC0B45400B2BD8E /* RCTLinkingManager.h in Copy Headers */, - 3D0B84251EC0B42600B2BD8E /* RCTNetworking.h in Copy Headers */, - 3D0B84261EC0B42600B2BD8E /* RCTNetworkTask.h in Copy Headers */, - 3D0B84231EC0B40D00B2BD8E /* RCTImageLoader.h in Copy Headers */, - 3D0B84241EC0B40D00B2BD8E /* RCTImageStoreManager.h in Copy Headers */, - 3D0B84221EC0B3F600B2BD8E /* RCTResizeMode.h in Copy Headers */, - 3D383D201EBD27AF005632C8 /* RCTBridge+Private.h in Copy Headers */, - 3D7BFD351EA8E43F008DFB7A /* RCTDevSettings.h in Copy Headers */, - 3D7BFD331EA8E433008DFB7A /* RCTPackagerClient.h in Copy Headers */, - 3DA981EA1E5B0F7F004F2374 /* RCTAccessibilityManager.h in Copy Headers */, - 3DA981EB1E5B0F7F004F2374 /* RCTAlertManager.h in Copy Headers */, - 3DA981EC1E5B0F7F004F2374 /* RCTAppState.h in Copy Headers */, - 3DA981ED1E5B0F7F004F2374 /* RCTAsyncLocalStorage.h in Copy Headers */, - 3DA981EE1E5B0F7F004F2374 /* RCTClipboard.h in Copy Headers */, - 3DA981EF1E5B0F7F004F2374 /* RCTDevLoadingView.h in Copy Headers */, - 3DA981F01E5B0F7F004F2374 /* RCTDevMenu.h in Copy Headers */, - 3DA981F11E5B0F7F004F2374 /* RCTEventEmitter.h in Copy Headers */, - 3DA981F21E5B0F7F004F2374 /* RCTExceptionsManager.h in Copy Headers */, - 3DA981F31E5B0F7F004F2374 /* RCTI18nManager.h in Copy Headers */, - 3DA981F41E5B0F7F004F2374 /* RCTI18nUtil.h in Copy Headers */, - 3DA981F51E5B0F7F004F2374 /* RCTKeyboardObserver.h in Copy Headers */, - 3DA981F61E5B0F7F004F2374 /* RCTRedBox.h in Copy Headers */, - 3DA981F71E5B0F7F004F2374 /* RCTSourceCode.h in Copy Headers */, - 3DA981F81E5B0F7F004F2374 /* RCTStatusBarManager.h in Copy Headers */, - 3DA981F91E5B0F7F004F2374 /* RCTTiming.h in Copy Headers */, - 3DA981FA1E5B0F7F004F2374 /* RCTUIManager.h in Copy Headers */, - 3DA981FB1E5B0F7F004F2374 /* RCTFPSGraph.h in Copy Headers */, - 3DA981FD1E5B0F7F004F2374 /* RCTMacros.h in Copy Headers */, - 3DA981FE1E5B0F7F004F2374 /* RCTProfile.h in Copy Headers */, - 3DA981FF1E5B0F7F004F2374 /* RCTActivityIndicatorView.h in Copy Headers */, - 3DA982001E5B0F7F004F2374 /* RCTActivityIndicatorViewManager.h in Copy Headers */, - 3DA982011E5B0F7F004F2374 /* RCTAnimationType.h in Copy Headers */, - 3DA982021E5B0F7F004F2374 /* RCTAutoInsetsProtocol.h in Copy Headers */, - 3DA982031E5B0F7F004F2374 /* RCTBorderDrawing.h in Copy Headers */, - 3DA982041E5B0F7F004F2374 /* RCTBorderStyle.h in Copy Headers */, - 3DA982051E5B0F7F004F2374 /* RCTComponent.h in Copy Headers */, - 3DA982061E5B0F7F004F2374 /* RCTComponentData.h in Copy Headers */, - 3DA982071E5B0F7F004F2374 /* RCTConvert+CoreLocation.h in Copy Headers */, - 3DA9820C1E5B0F7F004F2374 /* RCTFont.h in Copy Headers */, - 3DA982111E5B0F7F004F2374 /* RCTModalHostView.h in Copy Headers */, - 3DA982121E5B0F7F004F2374 /* RCTModalHostViewController.h in Copy Headers */, - 3DA982131E5B0F7F004F2374 /* RCTModalHostViewManager.h in Copy Headers */, - 3DA982181E5B0F7F004F2374 /* RCTPicker.h in Copy Headers */, - 3DA982191E5B0F7F004F2374 /* RCTPickerManager.h in Copy Headers */, - 3DA9821A1E5B0F7F004F2374 /* RCTPointerEvents.h in Copy Headers */, - 3DA9821B1E5B0F7F004F2374 /* RCTProgressViewManager.h in Copy Headers */, - 3DA9821C1E5B0F7F004F2374 /* RCTRefreshControl.h in Copy Headers */, - 3DA9821D1E5B0F7F004F2374 /* RCTRefreshControlManager.h in Copy Headers */, - 3DA9821E1E5B0F7F004F2374 /* RCTRootShadowView.h in Copy Headers */, - 3DA982241E5B0F7F004F2374 /* RCTSegmentedControl.h in Copy Headers */, - 3DA982251E5B0F7F004F2374 /* RCTSegmentedControlManager.h in Copy Headers */, - 3DA982261E5B0F7F004F2374 /* RCTShadowView.h in Copy Headers */, - 3DA982271E5B0F7F004F2374 /* RCTSlider.h in Copy Headers */, - 3DA982281E5B0F7F004F2374 /* RCTSliderManager.h in Copy Headers */, - 3DA982291E5B0F7F004F2374 /* RCTSwitch.h in Copy Headers */, - 3DA9822A1E5B0F7F004F2374 /* RCTSwitchManager.h in Copy Headers */, - 3DA9822F1E5B0F7F004F2374 /* RCTTextDecorationLineType.h in Copy Headers */, - 3DA982301E5B0F7F004F2374 /* RCTTVView.h in Copy Headers */, - 3DA982311E5B0F7F004F2374 /* RCTView.h in Copy Headers */, - 3DA982331E5B0F7F004F2374 /* RCTViewManager.h in Copy Headers */, - 3DA982341E5B0F7F004F2374 /* RCTWebView.h in Copy Headers */, - 3DA982351E5B0F7F004F2374 /* RCTWebViewManager.h in Copy Headers */, - 3DA982361E5B0F7F004F2374 /* RCTWrapperViewController.h in Copy Headers */, - 3DA982381E5B0F7F004F2374 /* UIView+React.h in Copy Headers */, - 3DA981BF1E5B0F29004F2374 /* RCTAssert.h in Copy Headers */, - 3DA981C01E5B0F29004F2374 /* RCTBridge.h in Copy Headers */, - 3DA981C21E5B0F29004F2374 /* RCTBridgeDelegate.h in Copy Headers */, - 3DA981C31E5B0F29004F2374 /* RCTBridgeMethod.h in Copy Headers */, - 3DA981C41E5B0F29004F2374 /* RCTBridgeModule.h in Copy Headers */, - 3DA981C51E5B0F29004F2374 /* RCTBundleURLProvider.h in Copy Headers */, - 3DA981C61E5B0F29004F2374 /* RCTConvert.h in Copy Headers */, - 3DA981C71E5B0F29004F2374 /* RCTDefines.h in Copy Headers */, - 3DA981C81E5B0F29004F2374 /* RCTDisplayLink.h in Copy Headers */, - 3DA981C91E5B0F29004F2374 /* RCTErrorCustomizer.h in Copy Headers */, - 3DA981CA1E5B0F29004F2374 /* RCTErrorInfo.h in Copy Headers */, - 3DA981CB1E5B0F29004F2374 /* RCTEventDispatcher.h in Copy Headers */, - 3DA981CC1E5B0F29004F2374 /* RCTFrameUpdate.h in Copy Headers */, - 3DA981CD1E5B0F29004F2374 /* RCTImageSource.h in Copy Headers */, - 3DA981CE1E5B0F29004F2374 /* RCTInvalidating.h in Copy Headers */, - 3DA981CF1E5B0F29004F2374 /* RCTJavaScriptExecutor.h in Copy Headers */, - 3DA981D01E5B0F29004F2374 /* RCTJavaScriptLoader.h in Copy Headers */, - 3DA981D11E5B0F29004F2374 /* RCTJSStackFrame.h in Copy Headers */, - 3DA981D21E5B0F29004F2374 /* RCTKeyCommands.h in Copy Headers */, - 3DA981D31E5B0F29004F2374 /* RCTLog.h in Copy Headers */, - 3DA981D41E5B0F29004F2374 /* RCTModuleData.h in Copy Headers */, - 3DA981D51E5B0F29004F2374 /* RCTModuleMethod.h in Copy Headers */, - 3DA981D61E5B0F29004F2374 /* RCTMultipartDataTask.h in Copy Headers */, - 3DA981D71E5B0F29004F2374 /* RCTMultipartStreamReader.h in Copy Headers */, - 3DA981D81E5B0F29004F2374 /* RCTNullability.h in Copy Headers */, - 3DA981D91E5B0F29004F2374 /* RCTParserUtils.h in Copy Headers */, - 3DA981DA1E5B0F29004F2374 /* RCTPerformanceLogger.h in Copy Headers */, - 3DA981DB1E5B0F29004F2374 /* RCTPlatform.h in Copy Headers */, - 3DA981DC1E5B0F29004F2374 /* RCTReloadCommand.h in Copy Headers */, - 3DA981DD1E5B0F29004F2374 /* RCTRootContentView.h in Copy Headers */, - 3DA981DE1E5B0F29004F2374 /* RCTRootView.h in Copy Headers */, - 3DA981DF1E5B0F29004F2374 /* RCTRootViewDelegate.h in Copy Headers */, - 3DA981E11E5B0F29004F2374 /* RCTTouchEvent.h in Copy Headers */, - 3DA981E21E5B0F29004F2374 /* RCTTouchHandler.h in Copy Headers */, - 3DA981E31E5B0F29004F2374 /* RCTURLRequestDelegate.h in Copy Headers */, - 3DA981E41E5B0F29004F2374 /* RCTURLRequestHandler.h in Copy Headers */, - 3DA981E51E5B0F29004F2374 /* RCTUtils.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - 3D302F171DF825FE00D6DDAE /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/yoga; - dstSubfolderSpec = 16; - files = ( - AC6B69E921B146DB00B2B68A /* YGValue.h in Copy Headers */, - AC71763621B0274A00C06877 /* YGMarker.h in Copy Headers */, - AC71763521B0274000C06877 /* YGConfig.h in Copy Headers */, - 3DFE0D1A1DF8575800459392 /* YGEnums.h in Copy Headers */, - 3DFE0D1B1DF8575800459392 /* YGMacros.h in Copy Headers */, - 3DFE0D1C1DF8575800459392 /* Yoga.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - 3D302F1B1DF8263300D6DDAE /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/cxxreact; - dstSubfolderSpec = 16; - files = ( - BA0501AD2109DCF200A6BBC4 /* ReactMarker.h in Copy Headers */, - 598FD1921F816A2A006C54CB /* RAMBundleRegistry.h in Copy Headers */, - 3DA9823B1E5B1053004F2374 /* CxxModule.h in Copy Headers */, - 3DA9823C1E5B1053004F2374 /* CxxNativeModule.h in Copy Headers */, - 3DA9823D1E5B1053004F2374 /* JSExecutor.h in Copy Headers */, - 3DA982401E5B1053004F2374 /* Instance.h in Copy Headers */, - 3DA982411E5B1053004F2374 /* JsArgumentHelpers-inl.h in Copy Headers */, - 3DA982421E5B1053004F2374 /* JsArgumentHelpers.h in Copy Headers */, - 3DA982431E5B1053004F2374 /* JSBigString.h in Copy Headers */, - 3DA982441E5B1053004F2374 /* JSBundleType.h in Copy Headers */, - 3DA9824E1E5B1053004F2374 /* JSIndexedRAMBundle.h in Copy Headers */, - 3DA9824F1E5B1053004F2374 /* JSModulesUnbundle.h in Copy Headers */, - 3DA982501E5B1053004F2374 /* MessageQueueThread.h in Copy Headers */, - 3DA982511E5B1053004F2374 /* MethodCall.h in Copy Headers */, - 3DA982521E5B1053004F2374 /* ModuleRegistry.h in Copy Headers */, - 3DA982531E5B1053004F2374 /* NativeModule.h in Copy Headers */, - 3DA982541E5B1053004F2374 /* NativeToJsBridge.h in Copy Headers */, - 3DA982571E5B1053004F2374 /* RecoverableError.h in Copy Headers */, - 3DA982581E5B1053004F2374 /* SampleCxxModule.h in Copy Headers */, - 3DA982591E5B1053004F2374 /* SystraceSection.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - 3D383D491EBD27B9005632C8 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - 3D383D4A1EBD27B9005632C8 /* bignum-dtoa.h in CopyFiles */, - 3D383D4B1EBD27B9005632C8 /* bignum.h in CopyFiles */, - 3D383D4C1EBD27B9005632C8 /* cached-powers.h in CopyFiles */, - 3D383D4D1EBD27B9005632C8 /* diy-fp.h in CopyFiles */, - 3D383D4E1EBD27B9005632C8 /* double-conversion.h in CopyFiles */, - 3D383D4F1EBD27B9005632C8 /* fast-dtoa.h in CopyFiles */, - 3D383D501EBD27B9005632C8 /* fixed-dtoa.h in CopyFiles */, - 3D383D511EBD27B9005632C8 /* ieee.h in CopyFiles */, - 3D383D521EBD27B9005632C8 /* strtod.h in CopyFiles */, - 3D383D531EBD27B9005632C8 /* utils.h in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D80D91E1DF6FA530028D040 /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/React; - dstSubfolderSpec = 16; - files = ( - 39C50FF92046EACF00CEE534 /* RCTVersion.h in Copy Headers */, - 591F78DE202ADB8F004A668C /* RCTLayout.h in Copy Headers */, - 59EDBCBD1FDF4E43003573DE /* RCTScrollableProtocol.h in Copy Headers */, - 59EDBCBE1FDF4E43003573DE /* (null) in Copy Headers */, - 59EDBCBF1FDF4E43003573DE /* RCTScrollContentView.h in Copy Headers */, - 59EDBCC01FDF4E43003573DE /* (null) in Copy Headers */, - 59EDBCC11FDF4E43003573DE /* RCTScrollView.h in Copy Headers */, - 59EDBCC21FDF4E43003573DE /* RCTScrollViewManager.h in Copy Headers */, - 594F0A381FD233A2007FBE96 /* RCTSurface.h in Copy Headers */, - 594F0A391FD233A2007FBE96 /* RCTSurfaceDelegate.h in Copy Headers */, - 594F0A3A1FD233A2007FBE96 /* RCTSurfaceRootShadowView.h in Copy Headers */, - 594F0A3B1FD233A2007FBE96 /* RCTSurfaceRootShadowViewDelegate.h in Copy Headers */, - 594F0A3C1FD233A2007FBE96 /* RCTSurfaceRootView.h in Copy Headers */, - 594F0A3D1FD233A2007FBE96 /* RCTSurfaceStage.h in Copy Headers */, - 594F0A3E1FD233A2007FBE96 /* RCTSurfaceView.h in Copy Headers */, - 594F0A3F1FD233A2007FBE96 /* RCTSurfaceHostingView.h in Copy Headers */, - 594F0A401FD233A2007FBE96 /* RCTSurfaceSizeMeasureMode.h in Copy Headers */, - 59500D471F71C66700B122B7 /* RCTUIManagerUtils.h in Copy Headers */, - 3D0E378F1F1CC5CF00DCAC9F /* RCTWebSocketModule.h in Copy Headers */, - 5960C1BD1F0804DF0066FD5B /* RCTLayoutAnimation.h in Copy Headers */, - 5960C1BE1F0804DF0066FD5B /* RCTLayoutAnimationGroup.h in Copy Headers */, - 59EB6DBF1EBD6FFC0072A5E7 /* RCTUIManagerObserverCoordinator.h in Copy Headers */, - 59B1EBC91EBD46250047B19B /* RCTShadowView+Layout.h in Copy Headers */, - 3D383D1F1EBD27A8005632C8 /* RCTBridge+Private.h in Copy Headers */, - 3D7BFD311EA8E41F008DFB7A /* RCTPackagerClient.h in Copy Headers */, - 3D7BFD291EA8E37B008DFB7A /* RCTDevSettings.h in Copy Headers */, - 3D80D91F1DF6FA890028D040 /* RCTImageLoader.h in Copy Headers */, - 3D80D9201DF6FA890028D040 /* RCTImageStoreManager.h in Copy Headers */, - 3D80D9211DF6FA890028D040 /* RCTResizeMode.h in Copy Headers */, - 3D80D9221DF6FA890028D040 /* RCTLinkingManager.h in Copy Headers */, - 3D80D9231DF6FA890028D040 /* RCTNetworking.h in Copy Headers */, - 3D80D9241DF6FA890028D040 /* RCTNetworkTask.h in Copy Headers */, - 3D80D9251DF6FA890028D040 /* RCTPushNotificationManager.h in Copy Headers */, - 3D80D9261DF6FA890028D040 /* RCTAssert.h in Copy Headers */, - 3D80D9271DF6FA890028D040 /* RCTBridge.h in Copy Headers */, - 3D80D9291DF6FA890028D040 /* RCTBridgeDelegate.h in Copy Headers */, - 3D80D92A1DF6FA890028D040 /* RCTBridgeMethod.h in Copy Headers */, - 3D80D92B1DF6FA890028D040 /* RCTBridgeModule.h in Copy Headers */, - 3D80D92C1DF6FA890028D040 /* RCTBundleURLProvider.h in Copy Headers */, - 3D80D92D1DF6FA890028D040 /* RCTConvert.h in Copy Headers */, - 3D80D92E1DF6FA890028D040 /* RCTDefines.h in Copy Headers */, - 3D80D92F1DF6FA890028D040 /* RCTDisplayLink.h in Copy Headers */, - 3D80D9301DF6FA890028D040 /* RCTErrorCustomizer.h in Copy Headers */, - 3D80D9311DF6FA890028D040 /* RCTErrorInfo.h in Copy Headers */, - 3D80D9321DF6FA890028D040 /* RCTEventDispatcher.h in Copy Headers */, - 3D80D9331DF6FA890028D040 /* RCTFrameUpdate.h in Copy Headers */, - 3D80D9341DF6FA890028D040 /* RCTImageSource.h in Copy Headers */, - 3D80D9351DF6FA890028D040 /* RCTInvalidating.h in Copy Headers */, - 3D80D9361DF6FA890028D040 /* RCTJavaScriptExecutor.h in Copy Headers */, - 3D80D9371DF6FA890028D040 /* RCTJavaScriptLoader.h in Copy Headers */, - 3D80D9381DF6FA890028D040 /* RCTJSStackFrame.h in Copy Headers */, - 3D80D9391DF6FA890028D040 /* RCTKeyCommands.h in Copy Headers */, - 3D80D93A1DF6FA890028D040 /* RCTLog.h in Copy Headers */, - 3D80D93B1DF6FA890028D040 /* RCTModuleData.h in Copy Headers */, - 3D80D93C1DF6FA890028D040 /* RCTModuleMethod.h in Copy Headers */, - 3D80D93D1DF6FA890028D040 /* RCTMultipartDataTask.h in Copy Headers */, - 3D80D93E1DF6FA890028D040 /* RCTMultipartStreamReader.h in Copy Headers */, - 3D80D93F1DF6FA890028D040 /* RCTNullability.h in Copy Headers */, - 3D80D9401DF6FA890028D040 /* RCTParserUtils.h in Copy Headers */, - 3D80D9411DF6FA890028D040 /* RCTPerformanceLogger.h in Copy Headers */, - 3D80D9421DF6FA890028D040 /* RCTPlatform.h in Copy Headers */, - 3D80D9431DF6FA890028D040 /* RCTRootView.h in Copy Headers */, - 3D80D9441DF6FA890028D040 /* RCTRootViewDelegate.h in Copy Headers */, - 3D80D9461DF6FA890028D040 /* RCTTouchEvent.h in Copy Headers */, - 3D80D9471DF6FA890028D040 /* RCTTouchHandler.h in Copy Headers */, - 3D80D9481DF6FA890028D040 /* RCTURLRequestDelegate.h in Copy Headers */, - 3D80D9491DF6FA890028D040 /* RCTURLRequestHandler.h in Copy Headers */, - 3D80D94A1DF6FA890028D040 /* RCTUtils.h in Copy Headers */, - 3D80D9501DF6FA890028D040 /* RCTAccessibilityManager.h in Copy Headers */, - 3D80D9511DF6FA890028D040 /* RCTAlertManager.h in Copy Headers */, - 3D80D9521DF6FA890028D040 /* RCTAppState.h in Copy Headers */, - 3D80D9531DF6FA890028D040 /* RCTAsyncLocalStorage.h in Copy Headers */, - 3D80D9541DF6FA890028D040 /* RCTClipboard.h in Copy Headers */, - 3D80D9551DF6FA890028D040 /* RCTDevLoadingView.h in Copy Headers */, - 3D80D9561DF6FA890028D040 /* RCTDevMenu.h in Copy Headers */, - 3D80D9571DF6FA890028D040 /* RCTEventEmitter.h in Copy Headers */, - 3D80D9581DF6FA890028D040 /* RCTExceptionsManager.h in Copy Headers */, - 3D80D9591DF6FA890028D040 /* RCTI18nManager.h in Copy Headers */, - 3D80D95A1DF6FA890028D040 /* RCTI18nUtil.h in Copy Headers */, - 3D80D95B1DF6FA890028D040 /* RCTKeyboardObserver.h in Copy Headers */, - 3D80D95C1DF6FA890028D040 /* RCTRedBox.h in Copy Headers */, - 3D80D95D1DF6FA890028D040 /* RCTSourceCode.h in Copy Headers */, - 3D80D95E1DF6FA890028D040 /* RCTStatusBarManager.h in Copy Headers */, - 3D80D95F1DF6FA890028D040 /* RCTTiming.h in Copy Headers */, - 3D80D9601DF6FA890028D040 /* RCTUIManager.h in Copy Headers */, - 3D80D9611DF6FA890028D040 /* RCTFPSGraph.h in Copy Headers */, - 3D80D9631DF6FA890028D040 /* RCTMacros.h in Copy Headers */, - 3D80D9641DF6FA890028D040 /* RCTProfile.h in Copy Headers */, - 3D80D9651DF6FA890028D040 /* RCTActivityIndicatorView.h in Copy Headers */, - 3D80D9661DF6FA890028D040 /* RCTActivityIndicatorViewManager.h in Copy Headers */, - 3D80D9671DF6FA890028D040 /* RCTAnimationType.h in Copy Headers */, - 3D80D9681DF6FA890028D040 /* RCTAutoInsetsProtocol.h in Copy Headers */, - 3D80D9691DF6FA890028D040 /* RCTBorderDrawing.h in Copy Headers */, - 3D80D96A1DF6FA890028D040 /* RCTBorderStyle.h in Copy Headers */, - 3D80D96B1DF6FA890028D040 /* RCTComponent.h in Copy Headers */, - 3D80D96C1DF6FA890028D040 /* RCTComponentData.h in Copy Headers */, - 3D80D96D1DF6FA890028D040 /* RCTConvert+CoreLocation.h in Copy Headers */, - 3D80D9711DF6FA890028D040 /* RCTFont.h in Copy Headers */, - 3D80D9761DF6FA890028D040 /* RCTModalHostView.h in Copy Headers */, - 3D80D9771DF6FA890028D040 /* RCTModalHostViewController.h in Copy Headers */, - 3D80D9781DF6FA890028D040 /* RCTModalHostViewManager.h in Copy Headers */, - 3D80D97D1DF6FA890028D040 /* RCTPicker.h in Copy Headers */, - 3D80D97E1DF6FA890028D040 /* RCTPickerManager.h in Copy Headers */, - 3D80D97F1DF6FA890028D040 /* RCTPointerEvents.h in Copy Headers */, - 3D80D9801DF6FA890028D040 /* RCTProgressViewManager.h in Copy Headers */, - 3D80D9811DF6FA890028D040 /* RCTRefreshControl.h in Copy Headers */, - 3D80D9821DF6FA890028D040 /* RCTRefreshControlManager.h in Copy Headers */, - 3D80D9831DF6FA890028D040 /* RCTRootShadowView.h in Copy Headers */, - 3D80D9871DF6FA890028D040 /* RCTSegmentedControl.h in Copy Headers */, - 3D80D9881DF6FA890028D040 /* RCTSegmentedControlManager.h in Copy Headers */, - 3D80D9891DF6FA890028D040 /* RCTShadowView.h in Copy Headers */, - 3D80D98A1DF6FA890028D040 /* RCTSlider.h in Copy Headers */, - 3D80D98B1DF6FA890028D040 /* RCTSliderManager.h in Copy Headers */, - 3D80D98C1DF6FA890028D040 /* RCTSwitch.h in Copy Headers */, - 3D80D98D1DF6FA890028D040 /* RCTSwitchManager.h in Copy Headers */, - 3D80D9921DF6FA890028D040 /* RCTTextDecorationLineType.h in Copy Headers */, - 3D80D9931DF6FA890028D040 /* RCTView.h in Copy Headers */, - 3D80D9951DF6FA890028D040 /* RCTViewManager.h in Copy Headers */, - 3D80D9961DF6FA890028D040 /* RCTWebView.h in Copy Headers */, - 3D80D9971DF6FA890028D040 /* RCTWebViewManager.h in Copy Headers */, - 3D80D9981DF6FA890028D040 /* RCTWrapperViewController.h in Copy Headers */, - 3D80D99A1DF6FA890028D040 /* UIView+React.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - 3D80DAB41DF8212E0028D040 /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 12; - dstPath = include/yoga; - dstSubfolderSpec = 16; - files = ( - AC90464121C91DB8005B24B3 /* YGConfig.h in Copy Headers */, - AC6B69E621B146A500B2B68A /* YGValue.h in Copy Headers */, - AC8360D321B0263000FC46B9 /* YGMarker.h in Copy Headers */, - 3DE4F8681DF85D8E00B9E5A0 /* YGEnums.h in Copy Headers */, - 3DE4F8691DF85D8E00B9E5A0 /* YGMacros.h in Copy Headers */, - 3DE4F86A1DF85D8E00B9E5A0 /* Yoga.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - 3D80DAB91DF821710028D040 /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/cxxreact; - dstSubfolderSpec = 16; - files = ( - 133EA4E52098F6E30035B1D8 /* ReactMarker.h in Copy Headers */, - C669D8981F72E3DE006748EB /* RAMBundleRegistry.h in Copy Headers */, - 3DA981A01E5B0E34004F2374 /* CxxModule.h in Copy Headers */, - 3DA981A11E5B0E34004F2374 /* CxxNativeModule.h in Copy Headers */, - 3DA981A21E5B0E34004F2374 /* JSExecutor.h in Copy Headers */, - 3DA981A51E5B0E34004F2374 /* Instance.h in Copy Headers */, - 3DA981A61E5B0E34004F2374 /* JsArgumentHelpers-inl.h in Copy Headers */, - 3DA981A71E5B0E34004F2374 /* JsArgumentHelpers.h in Copy Headers */, - 3DA981A81E5B0E34004F2374 /* JSBigString.h in Copy Headers */, - 3DA981A91E5B0E34004F2374 /* JSBundleType.h in Copy Headers */, - 3DA981B31E5B0E34004F2374 /* JSIndexedRAMBundle.h in Copy Headers */, - 3DA981B41E5B0E34004F2374 /* JSModulesUnbundle.h in Copy Headers */, - 3DA981B51E5B0E34004F2374 /* MessageQueueThread.h in Copy Headers */, - 3DA981B61E5B0E34004F2374 /* MethodCall.h in Copy Headers */, - 3DA981B71E5B0E34004F2374 /* ModuleRegistry.h in Copy Headers */, - 3DA981B81E5B0E34004F2374 /* NativeModule.h in Copy Headers */, - 3DA981B91E5B0E34004F2374 /* NativeToJsBridge.h in Copy Headers */, - 3DA981BC1E5B0E34004F2374 /* RecoverableError.h in Copy Headers */, - 3DA981BD1E5B0E34004F2374 /* SampleCxxModule.h in Copy Headers */, - 3DA981BE1E5B0E34004F2374 /* SystraceSection.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - EBF21BCB1FC498900052F4D5 /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/jsinspector; - dstSubfolderSpec = 16; - files = ( - EBF21BFB1FC498FC0052F4D5 /* InspectorInterfaces.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - EBF21BE91FC4989A0052F4D5 /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/jsinspector; - dstSubfolderSpec = 16; - files = ( - EBF21BFE1FC499840052F4D5 /* InspectorInterfaces.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - ED296FA4214C9A0900B7C4FE /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/jsi; - dstSubfolderSpec = 16; - files = ( - ED29704F2150199F00B7C4FE /* JSCRuntime.h in Copy Headers */, - ED296FC8214C9B5200B7C4FE /* jsi.h in Copy Headers */, - ED296FC7214C9B4B00B7C4FE /* instrumentation.h in Copy Headers */, - ED296FC6214C9B4400B7C4FE /* JSIDynamic.h in Copy Headers */, - ED296FC5214C9B3E00B7C4FE /* jsi-inl.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - ED296FDC214C9CF800B7C4FE /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/jsireact; - dstSubfolderSpec = 16; - files = ( - ED7286BE2155C62B00C26ABF /* JSIExecutor.h in Copy Headers */, - ED7286BF2155C62B00C26ABF /* JSINativeModules.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - EDEBC6C6214B3E7000DD5AC8 /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 12; - dstPath = include/jsi; - dstSubfolderSpec = 16; - files = ( - ED297050215019B400B7C4FE /* instrumentation.h in Copy Headers */, - EDEBC71C214B40F900DD5AC8 /* jsi-inl.h in Copy Headers */, - EDEBC71D214B40F900DD5AC8 /* JSIDynamic.h in Copy Headers */, - EDEBC71E214B40F900DD5AC8 /* JSCRuntime.h in Copy Headers */, - EDEBC71F214B40F900DD5AC8 /* jsi.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - EDEBC72F214B45A300DD5AC8 /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 12; - dstPath = include/jsireact; - dstSubfolderSpec = 16; - files = ( - ED7286BC2155C62000C26ABF /* JSIExecutor.h in Copy Headers */, - ED7286BD2155C62000C26ABF /* JSINativeModules.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 000E6CE91AB0E97F000CDF4D /* RCTSourceCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSourceCode.h; sourceTree = ""; }; - 000E6CEA1AB0E980000CDF4D /* RCTSourceCode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSourceCode.m; sourceTree = ""; }; - 001BFCCE1D8381DE008E587E /* RCTMultipartStreamReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTMultipartStreamReader.h; sourceTree = ""; }; - 001BFCCF1D8381DE008E587E /* RCTMultipartStreamReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMultipartStreamReader.m; sourceTree = ""; }; - 006FC4121D9B20820057AAAD /* RCTMultipartDataTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTMultipartDataTask.h; sourceTree = ""; }; - 006FC4131D9B20820057AAAD /* RCTMultipartDataTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMultipartDataTask.m; sourceTree = ""; }; - 008341F41D1DB34400876D9A /* RCTJSStackFrame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJSStackFrame.m; sourceTree = ""; }; - 008341F51D1DB34400876D9A /* RCTJSStackFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJSStackFrame.h; sourceTree = ""; }; - 1304439F1E3FEAA900D93A67 /* RCTFollyConvert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCTFollyConvert.h; path = CxxUtils/RCTFollyConvert.h; sourceTree = ""; }; - 130443A01E3FEAA900D93A67 /* RCTFollyConvert.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RCTFollyConvert.mm; path = CxxUtils/RCTFollyConvert.mm; sourceTree = ""; }; - 130443C31E401A8C00D93A67 /* RCTConvert+Transform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RCTConvert+Transform.h"; sourceTree = ""; }; - 130443C41E401A8C00D93A67 /* RCTConvert+Transform.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RCTConvert+Transform.m"; sourceTree = ""; }; - 130443D61E401AD800D93A67 /* RCTTVView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTVView.h; sourceTree = ""; }; - 130443D71E401AD800D93A67 /* RCTTVView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTVView.m; sourceTree = ""; }; - 130A77031DF767AF001F9587 /* YGEnums.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGEnums.h; sourceTree = ""; }; - 130A77041DF767AF001F9587 /* YGMacros.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGMacros.h; sourceTree = ""; }; - 130A77081DF767AF001F9587 /* Yoga.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Yoga.h; sourceTree = ""; }; - 130E3D861E6A082100ACE484 /* RCTDevSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDevSettings.h; sourceTree = ""; }; - 130E3D871E6A082100ACE484 /* RCTDevSettings.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTDevSettings.mm; sourceTree = ""; }; - 13134C741E296B2A00B9F3CB /* RCTCxxBridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTCxxBridge.mm; sourceTree = ""; }; - 13134C771E296B2A00B9F3CB /* RCTMessageThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTMessageThread.h; sourceTree = ""; }; - 13134C781E296B2A00B9F3CB /* RCTMessageThread.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTMessageThread.mm; sourceTree = ""; }; - 13134C7B1E296B2A00B9F3CB /* RCTObjcExecutor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTObjcExecutor.h; sourceTree = ""; }; - 13134C7C1E296B2A00B9F3CB /* RCTObjcExecutor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTObjcExecutor.mm; sourceTree = ""; }; - 13134C7E1E296B2A00B9F3CB /* RCTCxxMethod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTCxxMethod.h; sourceTree = ""; }; - 13134C7F1E296B2A00B9F3CB /* RCTCxxMethod.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTCxxMethod.mm; sourceTree = ""; }; - 13134C801E296B2A00B9F3CB /* RCTCxxModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTCxxModule.h; sourceTree = ""; }; - 13134C811E296B2A00B9F3CB /* RCTCxxModule.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTCxxModule.mm; sourceTree = ""; }; - 13134C821E296B2A00B9F3CB /* RCTCxxUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTCxxUtils.h; sourceTree = ""; }; - 13134C831E296B2A00B9F3CB /* RCTCxxUtils.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTCxxUtils.mm; sourceTree = ""; }; - 131B6AF01AF1093D00FFC3E0 /* RCTSegmentedControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSegmentedControl.h; sourceTree = ""; }; - 131B6AF11AF1093D00FFC3E0 /* RCTSegmentedControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSegmentedControl.m; sourceTree = ""; }; - 131B6AF21AF1093D00FFC3E0 /* RCTSegmentedControlManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSegmentedControlManager.h; sourceTree = ""; }; - 131B6AF31AF1093D00FFC3E0 /* RCTSegmentedControlManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSegmentedControlManager.m; sourceTree = ""; }; - 133CAE8C1B8E5CFD00F6AD92 /* RCTDatePicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDatePicker.h; sourceTree = ""; }; - 133CAE8D1B8E5CFD00F6AD92 /* RCTDatePicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDatePicker.m; sourceTree = ""; }; - 13442BF21AA90E0B0037E5B0 /* RCTAnimationType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAnimationType.h; sourceTree = ""; }; - 13442BF31AA90E0B0037E5B0 /* RCTPointerEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPointerEvents.h; sourceTree = ""; }; - 13456E911ADAD2DE009F94A7 /* RCTConvert+CoreLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RCTConvert+CoreLocation.h"; sourceTree = ""; }; - 13456E921ADAD2DE009F94A7 /* RCTConvert+CoreLocation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RCTConvert+CoreLocation.m"; sourceTree = ""; }; - 1345A83A1B265A0E00583190 /* RCTURLRequestDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTURLRequestDelegate.h; sourceTree = ""; }; - 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTURLRequestHandler.h; sourceTree = ""; }; - 134D63C21F1FEC4B008872B5 /* RCTCxxBridgeDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTCxxBridgeDelegate.h; sourceTree = ""; }; - 13513F3A1B1F43F400FCE529 /* RCTProgressViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTProgressViewManager.h; sourceTree = ""; }; - 13513F3B1B1F43F400FCE529 /* RCTProgressViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTProgressViewManager.m; sourceTree = ""; }; - 13723B4E1A82FD3C00F88898 /* RCTStatusBarManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTStatusBarManager.h; sourceTree = ""; }; - 13723B4F1A82FD3C00F88898 /* RCTStatusBarManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTStatusBarManager.m; sourceTree = ""; }; - 1372B7081AB030C200659ED6 /* RCTAppState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAppState.h; sourceTree = ""; }; - 1372B7091AB030C200659ED6 /* RCTAppState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAppState.m; sourceTree = ""; }; - 1384E2061E806D4E00545659 /* RCTNativeModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTNativeModule.h; sourceTree = ""; }; - 1384E2071E806D4E00545659 /* RCTNativeModule.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTNativeModule.mm; sourceTree = ""; }; - 139D7E391E25C5A300323FB7 /* bignum-dtoa.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "bignum-dtoa.cc"; path = "../third-party/double-conversion-1.1.6/src/bignum-dtoa.cc"; sourceTree = SOURCE_ROOT; }; - 139D7E3A1E25C5A300323FB7 /* bignum-dtoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "bignum-dtoa.h"; path = "../third-party/double-conversion-1.1.6/src/bignum-dtoa.h"; sourceTree = SOURCE_ROOT; }; - 139D7E3B1E25C5A300323FB7 /* bignum.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = bignum.cc; path = "../third-party/double-conversion-1.1.6/src/bignum.cc"; sourceTree = SOURCE_ROOT; }; - 139D7E3C1E25C5A300323FB7 /* bignum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bignum.h; path = "../third-party/double-conversion-1.1.6/src/bignum.h"; sourceTree = SOURCE_ROOT; }; - 139D7E3D1E25C5A300323FB7 /* cached-powers.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "cached-powers.cc"; path = "../third-party/double-conversion-1.1.6/src/cached-powers.cc"; sourceTree = SOURCE_ROOT; }; - 139D7E3E1E25C5A300323FB7 /* cached-powers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "cached-powers.h"; path = "../third-party/double-conversion-1.1.6/src/cached-powers.h"; sourceTree = SOURCE_ROOT; }; - 139D7E3F1E25C5A300323FB7 /* diy-fp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "diy-fp.cc"; path = "../third-party/double-conversion-1.1.6/src/diy-fp.cc"; sourceTree = SOURCE_ROOT; }; - 139D7E401E25C5A300323FB7 /* diy-fp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "diy-fp.h"; path = "../third-party/double-conversion-1.1.6/src/diy-fp.h"; sourceTree = SOURCE_ROOT; }; - 139D7E411E25C5A300323FB7 /* double-conversion.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "double-conversion.cc"; path = "../third-party/double-conversion-1.1.6/src/double-conversion.cc"; sourceTree = SOURCE_ROOT; }; - 139D7E421E25C5A300323FB7 /* double-conversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "double-conversion.h"; path = "../third-party/double-conversion-1.1.6/src/double-conversion.h"; sourceTree = SOURCE_ROOT; }; - 139D7E431E25C5A300323FB7 /* fast-dtoa.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "fast-dtoa.cc"; path = "../third-party/double-conversion-1.1.6/src/fast-dtoa.cc"; sourceTree = SOURCE_ROOT; }; - 139D7E441E25C5A300323FB7 /* fast-dtoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "fast-dtoa.h"; path = "../third-party/double-conversion-1.1.6/src/fast-dtoa.h"; sourceTree = SOURCE_ROOT; }; - 139D7E451E25C5A300323FB7 /* fixed-dtoa.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "fixed-dtoa.cc"; path = "../third-party/double-conversion-1.1.6/src/fixed-dtoa.cc"; sourceTree = SOURCE_ROOT; }; - 139D7E461E25C5A300323FB7 /* fixed-dtoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "fixed-dtoa.h"; path = "../third-party/double-conversion-1.1.6/src/fixed-dtoa.h"; sourceTree = SOURCE_ROOT; }; - 139D7E471E25C5A300323FB7 /* ieee.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ieee.h; path = "../third-party/double-conversion-1.1.6/src/ieee.h"; sourceTree = SOURCE_ROOT; }; - 139D7E481E25C5A300323FB7 /* strtod.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = strtod.cc; path = "../third-party/double-conversion-1.1.6/src/strtod.cc"; sourceTree = SOURCE_ROOT; }; - 139D7E491E25C5A300323FB7 /* strtod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = strtod.h; path = "../third-party/double-conversion-1.1.6/src/strtod.h"; sourceTree = SOURCE_ROOT; }; - 139D7E4A1E25C5A300323FB7 /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = utils.h; path = "../third-party/double-conversion-1.1.6/src/utils.h"; sourceTree = SOURCE_ROOT; }; - 139D7E881E25C6D100323FB7 /* libdouble-conversion.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libdouble-conversion.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 139D7ECE1E25DB7D00323FB7 /* libthird-party.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libthird-party.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 139D7ED81E25DBDC00323FB7 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = config.h; path = "../third-party/glog-0.3.5/src/config.h"; sourceTree = SOURCE_ROOT; }; - 139D7ED91E25DBDC00323FB7 /* demangle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = demangle.h; path = "../third-party/glog-0.3.5/src/demangle.h"; sourceTree = SOURCE_ROOT; }; - 139D7EDA1E25DBDC00323FB7 /* logging.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = logging.cc; path = "../third-party/glog-0.3.5/src/logging.cc"; sourceTree = SOURCE_ROOT; }; - 139D7EDB1E25DBDC00323FB7 /* raw_logging.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = raw_logging.cc; path = "../third-party/glog-0.3.5/src/raw_logging.cc"; sourceTree = SOURCE_ROOT; }; - 139D7EDC1E25DBDC00323FB7 /* signalhandler.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = signalhandler.cc; path = "../third-party/glog-0.3.5/src/signalhandler.cc"; sourceTree = SOURCE_ROOT; }; - 139D7EDD1E25DBDC00323FB7 /* stacktrace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stacktrace.h; path = "../third-party/glog-0.3.5/src/stacktrace.h"; sourceTree = SOURCE_ROOT; }; - 139D7EDE1E25DBDC00323FB7 /* symbolize.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = symbolize.cc; path = "../third-party/glog-0.3.5/src/symbolize.cc"; sourceTree = SOURCE_ROOT; }; - 139D7EDF1E25DBDC00323FB7 /* symbolize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = symbolize.h; path = "../third-party/glog-0.3.5/src/symbolize.h"; sourceTree = SOURCE_ROOT; }; - 139D7EE01E25DBDC00323FB7 /* utilities.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = utilities.cc; path = "../third-party/glog-0.3.5/src/utilities.cc"; sourceTree = SOURCE_ROOT; }; - 139D7EE11E25DBDC00323FB7 /* utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = utilities.h; path = "../third-party/glog-0.3.5/src/utilities.h"; sourceTree = SOURCE_ROOT; }; - 139D7EE21E25DBDC00323FB7 /* vlog_is_on.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = vlog_is_on.cc; path = "../third-party/glog-0.3.5/src/vlog_is_on.cc"; sourceTree = SOURCE_ROOT; }; - 139D7F081E25DE3700323FB7 /* demangle.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = demangle.cc; path = "../third-party/glog-0.3.5/src/demangle.cc"; sourceTree = SOURCE_ROOT; }; - 139D7F111E25DEC900323FB7 /* log_severity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = log_severity.h; path = "../third-party/glog-0.3.5/src/glog/log_severity.h"; sourceTree = SOURCE_ROOT; }; - 139D7F121E25DEC900323FB7 /* logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = logging.h; path = "../third-party/glog-0.3.5/src/glog/logging.h"; sourceTree = SOURCE_ROOT; }; - 139D7F141E25DEC900323FB7 /* raw_logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = raw_logging.h; path = "../third-party/glog-0.3.5/src/glog/raw_logging.h"; sourceTree = SOURCE_ROOT; }; - 139D7F161E25DEC900323FB7 /* stl_logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stl_logging.h; path = "../third-party/glog-0.3.5/src/glog/stl_logging.h"; sourceTree = SOURCE_ROOT; }; - 139D7F181E25DEC900323FB7 /* vlog_is_on.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = vlog_is_on.h; path = "../third-party/glog-0.3.5/src/glog/vlog_is_on.h"; sourceTree = SOURCE_ROOT; }; - 139D849C1E273B5600323FB7 /* AtomicIntrusiveLinkedList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AtomicIntrusiveLinkedList.h; path = "../third-party/folly-2018.10.22.00/folly/AtomicIntrusiveLinkedList.h"; sourceTree = SOURCE_ROOT; }; - 139D849F1E273B5600323FB7 /* Conv.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Conv.cpp; path = "../third-party/folly-2018.10.22.00/folly/Conv.cpp"; sourceTree = SOURCE_ROOT; }; - 139D84A01E273B5600323FB7 /* Conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Conv.h; path = "../third-party/folly-2018.10.22.00/folly/Conv.h"; sourceTree = SOURCE_ROOT; }; - 139D84A11E273B5600323FB7 /* dynamic-inl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "dynamic-inl.h"; path = "../third-party/folly-2018.10.22.00/folly/dynamic-inl.h"; sourceTree = SOURCE_ROOT; }; - 139D84A21E273B5600323FB7 /* dynamic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dynamic.cpp; path = "../third-party/folly-2018.10.22.00/folly/dynamic.cpp"; sourceTree = SOURCE_ROOT; }; - 139D84A31E273B5600323FB7 /* dynamic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dynamic.h; path = "../third-party/folly-2018.10.22.00/folly/dynamic.h"; sourceTree = SOURCE_ROOT; }; - 139D84A41E273B5600323FB7 /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Exception.h; path = "../third-party/folly-2018.10.22.00/folly/Exception.h"; sourceTree = SOURCE_ROOT; }; - 139D84A71E273B5600323FB7 /* json.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = json.cpp; path = "../third-party/folly-2018.10.22.00/folly/json.cpp"; sourceTree = SOURCE_ROOT; }; - 139D84A81E273B5600323FB7 /* json.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = json.h; path = "../third-party/folly-2018.10.22.00/folly/json.h"; sourceTree = SOURCE_ROOT; }; - 139D84A91E273B5600323FB7 /* Memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Memory.h; path = "../third-party/folly-2018.10.22.00/folly/Memory.h"; sourceTree = SOURCE_ROOT; }; - 139D84AA1E273B5600323FB7 /* MoveWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MoveWrapper.h; path = "../third-party/folly-2018.10.22.00/folly/MoveWrapper.h"; sourceTree = SOURCE_ROOT; }; - 139D84AB1E273B5600323FB7 /* Optional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Optional.h; path = "../third-party/folly-2018.10.22.00/folly/Optional.h"; sourceTree = SOURCE_ROOT; }; - 139D84AC1E273B5600323FB7 /* ScopeGuard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ScopeGuard.h; path = "../third-party/folly-2018.10.22.00/folly/ScopeGuard.h"; sourceTree = SOURCE_ROOT; }; - 13A0C2851B74F71200B29F6F /* RCTDevLoadingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTDevLoadingView.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13A0C2861B74F71200B29F6F /* RCTDevLoadingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDevLoadingView.m; sourceTree = ""; }; - 13A0C2871B74F71200B29F6F /* RCTDevMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTDevMenu.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13A0C2881B74F71200B29F6F /* RCTDevMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDevMenu.m; sourceTree = ""; }; - 13A1F71C1A75392D00D3D453 /* RCTKeyCommands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTKeyCommands.h; sourceTree = ""; }; - 13A1F71D1A75392D00D3D453 /* RCTKeyCommands.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTKeyCommands.m; sourceTree = ""; }; - 13A6E20C1C19AA0C00845B82 /* RCTParserUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTParserUtils.h; sourceTree = ""; }; - 13A6E20D1C19AA0C00845B82 /* RCTParserUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTParserUtils.m; sourceTree = ""; }; - 13A6E20F1C19ABC700845B82 /* RCTNullability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTNullability.h; sourceTree = ""; }; - 13AB90BF1B6FA36700713B4F /* RCTComponentData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTComponentData.h; sourceTree = ""; }; - 13AB90C01B6FA36700713B4F /* RCTComponentData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTComponentData.m; sourceTree = ""; }; - 13AF1F851AE6E777005F5298 /* RCTDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDefines.h; sourceTree = ""; }; - 13AF20431AE707F8005F5298 /* RCTSlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSlider.h; sourceTree = ""; }; - 13AF20441AE707F9005F5298 /* RCTSlider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSlider.m; sourceTree = ""; }; - 13AFBCA11C07287B00BBAEAA /* RCTBridgeMethod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBridgeMethod.h; sourceTree = ""; }; - 13AFBCA21C07287B00BBAEAA /* RCTRootViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRootViewDelegate.h; sourceTree = ""; }; - 13B07FE71A69327A00A75B9A /* RCTAlertManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAlertManager.h; sourceTree = ""; }; - 13B07FE81A69327A00A75B9A /* RCTAlertManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAlertManager.m; sourceTree = ""; }; - 13B07FE91A69327A00A75B9A /* RCTExceptionsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTExceptionsManager.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13B07FEA1A69327A00A75B9A /* RCTExceptionsManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTExceptionsManager.m; sourceTree = ""; }; - 13B07FED1A69327A00A75B9A /* RCTTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTiming.h; sourceTree = ""; }; - 13B07FEE1A69327A00A75B9A /* RCTTiming.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTiming.m; sourceTree = ""; }; - 13B080181A69489C00A75B9A /* RCTActivityIndicatorViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTActivityIndicatorViewManager.h; sourceTree = ""; }; - 13B080191A69489C00A75B9A /* RCTActivityIndicatorViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTActivityIndicatorViewManager.m; sourceTree = ""; }; - 13B080231A694A8400A75B9A /* RCTWrapperViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWrapperViewController.h; sourceTree = ""; }; - 13B080241A694A8400A75B9A /* RCTWrapperViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWrapperViewController.m; sourceTree = ""; }; - 13BB3D001BECD54500932C10 /* RCTImageSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTImageSource.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13BB3D011BECD54500932C10 /* RCTImageSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageSource.m; sourceTree = ""; }; - 13BCE8071C99CB9D00DD7AAD /* RCTRootShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRootShadowView.h; sourceTree = ""; }; - 13BCE8081C99CB9D00DD7AAD /* RCTRootShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRootShadowView.m; sourceTree = ""; }; - 13C156011AB1A2840079392D /* RCTWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebView.h; sourceTree = ""; }; - 13C156021AB1A2840079392D /* RCTWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWebView.m; sourceTree = ""; }; - 13C156031AB1A2840079392D /* RCTWebViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebViewManager.h; sourceTree = ""; }; - 13C156041AB1A2840079392D /* RCTWebViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWebViewManager.m; sourceTree = ""; }; - 13C325261AA63B6A0048765F /* RCTAutoInsetsProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAutoInsetsProtocol.h; sourceTree = ""; }; - 13C325281AA63B6A0048765F /* RCTComponent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTComponent.h; sourceTree = ""; }; - 13CC8A801B17642100940AE7 /* RCTBorderDrawing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBorderDrawing.h; sourceTree = ""; }; - 13CC8A811B17642100940AE7 /* RCTBorderDrawing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBorderDrawing.m; sourceTree = ""; }; - 13D033611C1837FE0021DC29 /* RCTClipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTClipboard.h; sourceTree = ""; }; - 13D033621C1837FE0021DC29 /* RCTClipboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTClipboard.m; sourceTree = ""; }; - 13D9FEE91CDCCECF00158BD7 /* RCTEventEmitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTEventEmitter.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 13D9FEEA1CDCCECF00158BD7 /* RCTEventEmitter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTEventEmitter.m; sourceTree = ""; }; - 13D9FEEC1CDCD93000158BD7 /* RCTKeyboardObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTKeyboardObserver.h; sourceTree = ""; }; - 13D9FEED1CDCD93000158BD7 /* RCTKeyboardObserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTKeyboardObserver.m; sourceTree = ""; }; - 13DA8A2F2097A90A00276ED4 /* ReactMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReactMarker.h; sourceTree = ""; }; - 13DA8A302097A90B00276ED4 /* ReactMarker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReactMarker.cpp; sourceTree = ""; }; - 13E067481A70F434002CDEE1 /* RCTUIManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTUIManager.h; sourceTree = ""; }; - 13E067491A70F434002CDEE1 /* RCTUIManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIManager.m; sourceTree = ""; }; - 13E0674B1A70F44B002CDEE1 /* RCTShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTShadowView.h; sourceTree = ""; }; - 13E0674D1A70F44B002CDEE1 /* RCTViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTViewManager.h; sourceTree = ""; }; - 13E0674E1A70F44B002CDEE1 /* RCTViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTViewManager.m; sourceTree = ""; }; - 13E0674F1A70F44B002CDEE1 /* RCTView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTView.h; sourceTree = ""; }; - 13E067501A70F44B002CDEE1 /* RCTView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTView.m; sourceTree = ""; }; - 13E067531A70F44B002CDEE1 /* UIView+React.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+React.h"; sourceTree = ""; }; - 13E067541A70F44B002CDEE1 /* UIView+React.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+React.m"; sourceTree = ""; }; - 13F17A831B8493E5007D4C75 /* RCTRedBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRedBox.h; sourceTree = ""; }; - 13F17A841B8493E5007D4C75 /* RCTRedBox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRedBox.m; sourceTree = ""; }; - 13F887521E2971C500C3C7A1 /* Demangle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Demangle.cpp; path = "../third-party/folly-2018.10.22.00/folly/Demangle.cpp"; sourceTree = SOURCE_ROOT; }; - 13F887541E2971C500C3C7A1 /* Unicode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Unicode.cpp; path = "../third-party/folly-2018.10.22.00/folly/Unicode.cpp"; sourceTree = SOURCE_ROOT; }; - 14200DA81AC179B3008EE6BA /* RCTJavaScriptLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJavaScriptLoader.h; sourceTree = ""; }; - 142014171B32094000CC17BA /* RCTPerformanceLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPerformanceLogger.m; sourceTree = ""; }; - 142014181B32094000CC17BA /* RCTPerformanceLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPerformanceLogger.h; sourceTree = ""; }; - 1436DD071ADE7AA000A5ED7D /* RCTFrameUpdate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTFrameUpdate.h; sourceTree = ""; }; - 1450FF801BCFF28A00208362 /* RCTProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTProfile.h; sourceTree = ""; }; - 1450FF811BCFF28A00208362 /* RCTProfile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTProfile.m; sourceTree = ""; }; - 1450FF821BCFF28A00208362 /* RCTProfileTrampoline-arm.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = "RCTProfileTrampoline-arm.S"; sourceTree = ""; }; - 1450FF831BCFF28A00208362 /* RCTProfileTrampoline-arm64.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = "RCTProfileTrampoline-arm64.S"; sourceTree = ""; }; - 1450FF851BCFF28A00208362 /* RCTProfileTrampoline-x86_64.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = "RCTProfileTrampoline-x86_64.S"; sourceTree = ""; }; - 1482F9E61B55B927000ADFF3 /* RCTBridgeDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTBridgeDelegate.h; sourceTree = ""; }; - 14A43DB81C1F849600794BC8 /* RCTBridge+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RCTBridge+Private.h"; sourceTree = ""; }; - 14BF717F1C04793D00C97D0C /* RCTProfileTrampoline-i386.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = "RCTProfileTrampoline-i386.S"; sourceTree = ""; }; - 14BF71811C04795500C97D0C /* RCTMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTMacros.h; sourceTree = ""; }; - 14C2CA6F1B3AC63800E6CBB2 /* RCTModuleMethod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTModuleMethod.h; sourceTree = ""; }; - 14C2CA721B3AC64300E6CBB2 /* RCTModuleData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTModuleData.h; sourceTree = ""; }; - 14C2CA731B3AC64300E6CBB2 /* RCTModuleData.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTModuleData.mm; sourceTree = ""; }; - 14C2CA751B3AC64F00E6CBB2 /* RCTFrameUpdate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTFrameUpdate.m; sourceTree = ""; }; - 14F362071AABD06A001CE568 /* RCTSwitch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSwitch.h; sourceTree = ""; }; - 14F362081AABD06A001CE568 /* RCTSwitch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSwitch.m; sourceTree = ""; }; - 14F362091AABD06A001CE568 /* RCTSwitchManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSwitchManager.h; sourceTree = ""; }; - 14F3620A1AABD06A001CE568 /* RCTSwitchManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSwitchManager.m; sourceTree = ""; }; - 14F484541AABFCE100FDF6B9 /* RCTSliderManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSliderManager.h; sourceTree = ""; }; - 14F484551AABFCE100FDF6B9 /* RCTSliderManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSliderManager.m; sourceTree = ""; }; - 14F7A0EB1BDA3B3C003C6C10 /* RCTPerfMonitor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPerfMonitor.m; sourceTree = ""; }; - 14F7A0EE1BDA714B003C6C10 /* RCTFPSGraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTFPSGraph.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 14F7A0EF1BDA714B003C6C10 /* RCTFPSGraph.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTFPSGraph.m; sourceTree = ""; }; - 191E3EBC1C29D9AF00C180A6 /* RCTRefreshControlManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRefreshControlManager.h; sourceTree = ""; }; - 191E3EBD1C29D9AF00C180A6 /* RCTRefreshControlManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRefreshControlManager.m; sourceTree = ""; }; - 191E3EBF1C29DC3800C180A6 /* RCTRefreshControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRefreshControl.h; sourceTree = ""; }; - 191E3EC01C29DC3800C180A6 /* RCTRefreshControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRefreshControl.m; sourceTree = ""; }; - 199B8A6E1F44DB16005DEF67 /* RCTVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTVersion.h; sourceTree = ""; }; - 27B958731E57587D0096647A /* JSBigString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBigString.cpp; sourceTree = ""; }; - 2D2A28131D9B038B00D4039D /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 352DCFEE1D19F4C20056D623 /* RCTI18nUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTI18nUtil.h; sourceTree = ""; }; - 352DCFEF1D19F4C20056D623 /* RCTI18nUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTI18nUtil.m; sourceTree = ""; }; - 391E86A21C623EC800009732 /* RCTTouchEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTouchEvent.m; sourceTree = ""; }; - 391E86A31C623EC800009732 /* RCTTouchEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTouchEvent.h; sourceTree = ""; }; - 39C50FFA2046EE3500CEE534 /* RCTVersion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTVersion.m; sourceTree = ""; }; - 3D0B84281EC0B49400B2BD8E /* RCTTVRemoteHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTVRemoteHandler.h; sourceTree = ""; }; - 3D0B84291EC0B49400B2BD8E /* RCTTVRemoteHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTVRemoteHandler.m; sourceTree = ""; }; - 3D0B842D1EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTVNavigationEventEmitter.h; sourceTree = ""; }; - 3D0B842E1EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTVNavigationEventEmitter.m; sourceTree = ""; }; - 3D0E37891F1CC40000DCAC9F /* RCTWebSocketModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCTWebSocketModule.h; path = WebSocket/RCTWebSocketModule.h; sourceTree = ""; }; - 3D1E68D81CABD13900DD7465 /* RCTDisplayLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDisplayLink.h; sourceTree = ""; }; - 3D1E68D91CABD13900DD7465 /* RCTDisplayLink.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDisplayLink.m; sourceTree = ""; }; - 3D1FA07A1DE4F2EA00E03CC6 /* RCTNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTNetworking.h; sourceTree = ""; }; - 3D1FA07B1DE4F2EA00E03CC6 /* RCTNetworkTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTNetworkTask.h; sourceTree = ""; }; - 3D1FA0831DE4F3A000E03CC6 /* RCTImageLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageLoader.h; sourceTree = ""; }; - 3D1FA0841DE4F3A000E03CC6 /* RCTImageStoreManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageStoreManager.h; sourceTree = ""; }; - 3D1FA0851DE4F3A000E03CC6 /* RCTResizeMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTResizeMode.h; sourceTree = ""; }; - 3D1FA08B1DE4F4DD00E03CC6 /* RCTLinkingManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTLinkingManager.h; sourceTree = ""; }; - 3D1FA08D1DE4F4EE00E03CC6 /* RCTPushNotificationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCTPushNotificationManager.h; path = PushNotificationIOS/RCTPushNotificationManager.h; sourceTree = ""; }; - 3D37B5801D522B190042D5B5 /* RCTFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTFont.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 3D37B5811D522B190042D5B5 /* RCTFont.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTFont.mm; sourceTree = ""; }; - 3D383D3C1EBD27B6005632C8 /* libthird-party.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libthird-party.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 3D383D621EBD27B9005632C8 /* libdouble-conversion.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libdouble-conversion.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 3D3C059A1DE3340900C268FA /* libyoga.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libyoga.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 3D3C06751DE3340C00C268FA /* libyoga.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libyoga.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 3D3CD8F51DE5FB2300167DC4 /* JSBundleType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBundleType.h; sourceTree = ""; }; - 3D3CD9251DE5FBEC00167DC4 /* libcxxreact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libcxxreact.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 3D3CD9321DE5FBEE00167DC4 /* libcxxreact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libcxxreact.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 3D7454781E54757500E74ADD /* JSBigString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBigString.h; sourceTree = ""; }; - 3D7454791E54757500E74ADD /* RecoverableError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecoverableError.h; sourceTree = ""; }; - 3D7454B31E54786200E74ADD /* NSDataBigString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSDataBigString.h; sourceTree = ""; }; - 3D7749421DC1065C007EC8D8 /* RCTPlatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPlatform.h; sourceTree = ""; }; - 3D7749431DC1065C007EC8D8 /* RCTPlatform.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPlatform.m; sourceTree = ""; }; - 3D788F841EBD2D240063D616 /* third-party.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "third-party.xcconfig"; sourceTree = ""; }; - 3D7AA9C31E548CD5001955CF /* NSDataBigString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NSDataBigString.mm; sourceTree = ""; }; - 3D7BFD0B1EA8E351008DFB7A /* RCTPackagerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPackagerClient.h; sourceTree = ""; }; - 3D7BFD0C1EA8E351008DFB7A /* RCTPackagerClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPackagerClient.m; sourceTree = ""; }; - 3D7BFD0F1EA8E351008DFB7A /* RCTPackagerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPackagerConnection.h; sourceTree = ""; }; - 3D7BFD101EA8E351008DFB7A /* RCTPackagerConnection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTPackagerConnection.mm; sourceTree = ""; }; - 3D7BFD2B1EA8E3FA008DFB7A /* RCTReconnectingWebSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCTReconnectingWebSocket.h; path = WebSocket/RCTReconnectingWebSocket.h; sourceTree = ""; }; - 3D7BFD2C1EA8E3FA008DFB7A /* RCTSRWebSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCTSRWebSocket.h; path = WebSocket/RCTSRWebSocket.h; sourceTree = ""; }; - 3D92B0A71E03699D0018521A /* CxxModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CxxModule.h; sourceTree = ""; }; - 3D92B0A81E03699D0018521A /* CxxNativeModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CxxNativeModule.cpp; sourceTree = ""; }; - 3D92B0A91E03699D0018521A /* CxxNativeModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CxxNativeModule.h; sourceTree = ""; }; - 3D92B0AB1E03699D0018521A /* JSExecutor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSExecutor.h; sourceTree = ""; }; - 3D92B0AE1E03699D0018521A /* Instance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Instance.cpp; sourceTree = ""; }; - 3D92B0AF1E03699D0018521A /* Instance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Instance.h; sourceTree = ""; }; - 3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JsArgumentHelpers-inl.h"; sourceTree = ""; }; - 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JsArgumentHelpers.h; sourceTree = ""; }; - 3D92B0C61E03699D0018521A /* JSIndexedRAMBundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIndexedRAMBundle.cpp; sourceTree = ""; }; - 3D92B0C71E03699D0018521A /* JSIndexedRAMBundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIndexedRAMBundle.h; sourceTree = ""; }; - 3D92B0C81E03699D0018521A /* JSModulesUnbundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSModulesUnbundle.h; sourceTree = ""; }; - 3D92B0C91E03699D0018521A /* MessageQueueThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageQueueThread.h; sourceTree = ""; }; - 3D92B0CA1E03699D0018521A /* MethodCall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MethodCall.cpp; sourceTree = ""; }; - 3D92B0CB1E03699D0018521A /* MethodCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MethodCall.h; sourceTree = ""; }; - 3D92B0CC1E03699D0018521A /* ModuleRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModuleRegistry.cpp; sourceTree = ""; }; - 3D92B0CD1E03699D0018521A /* ModuleRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModuleRegistry.h; sourceTree = ""; }; - 3D92B0CE1E03699D0018521A /* NativeModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeModule.h; sourceTree = ""; }; - 3D92B0CF1E03699D0018521A /* NativeToJsBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NativeToJsBridge.cpp; sourceTree = ""; }; - 3D92B0D01E03699D0018521A /* NativeToJsBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeToJsBridge.h; sourceTree = ""; }; - 3D92B0D31E03699D0018521A /* SampleCxxModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SampleCxxModule.cpp; sourceTree = ""; }; - 3D92B0D41E03699D0018521A /* SampleCxxModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SampleCxxModule.h; sourceTree = ""; }; - 3D92B0D51E03699D0018521A /* SystraceSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystraceSection.h; sourceTree = ""; }; - 3EDCA8A21D3591E700450C31 /* RCTErrorCustomizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTErrorCustomizer.h; sourceTree = ""; }; - 3EDCA8A31D3591E700450C31 /* RCTErrorInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTErrorInfo.h; sourceTree = ""; }; - 3EDCA8A41D3591E700450C31 /* RCTErrorInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTErrorInfo.m; sourceTree = ""; }; - 50E98FE621460B0D00CD9289 /* RCTWKWebViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWKWebViewManager.m; sourceTree = ""; }; - 50E98FE721460B0D00CD9289 /* RCTWKWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWKWebView.h; sourceTree = ""; }; - 50E98FE821460B0D00CD9289 /* RCTWKWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWKWebView.m; sourceTree = ""; }; - 50E98FE921460B0D00CD9289 /* RCTWKWebViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWKWebViewManager.h; sourceTree = ""; }; - 5335D5401FE81A4700883D58 /* RCTShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTShadowView.m; sourceTree = ""; }; - 5343895E203905B6008E0CB3 /* YGLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGLayout.cpp; sourceTree = ""; }; - 5343895F203905B6008E0CB3 /* YGLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGLayout.h; sourceTree = ""; }; - 5352C5712038FF8D00A3B97E /* YGStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGStyle.h; sourceTree = ""; }; - 5352C5722038FF8D00A3B97E /* YGStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGStyle.cpp; sourceTree = ""; }; - 53756E372004FFF700FBBD99 /* Utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Utils.cpp; sourceTree = ""; }; - 53756E382004FFF700FBBD99 /* Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utils.h; sourceTree = ""; }; - 5376C5E01FC6DDB20083513D /* YGNodePrint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGNodePrint.h; sourceTree = ""; }; - 5376C5E11FC6DDB20083513D /* YGNodePrint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGNodePrint.cpp; sourceTree = ""; }; - 53CBF1851FB4FE80002CBB31 /* Yoga-internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Yoga-internal.h"; sourceTree = ""; }; - 53CBF1861FB4FE80002CBB31 /* YGEnums.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGEnums.cpp; sourceTree = ""; }; - 53CBF1871FB4FE80002CBB31 /* Yoga.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Yoga.cpp; sourceTree = ""; }; - 53D123831FBF1D49001B8A10 /* libyoga.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libyoga.a; path = "../../../../../../../../../Library/Developer/Xcode/DerivedData/yoga-hdfifpwsinitsibujacpiefkjfdy/Build/Products/Debug/libyoga.a"; sourceTree = ""; }; - 53DEF6E7205AE59C006A3890 /* YGFloatOptional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGFloatOptional.h; sourceTree = ""; }; - 53EC85DE1FDEC75A0051B2B5 /* YGNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGNode.h; sourceTree = ""; }; - 53EC85DF1FDEC75A0051B2B5 /* YGNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGNode.cpp; sourceTree = ""; }; - 58114A121AAE854800E7D092 /* RCTPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPicker.h; sourceTree = ""; }; - 58114A131AAE854800E7D092 /* RCTPicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPicker.m; sourceTree = ""; }; - 58114A141AAE854800E7D092 /* RCTPickerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPickerManager.h; sourceTree = ""; }; - 58114A151AAE854800E7D092 /* RCTPickerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPickerManager.m; sourceTree = ""; }; - 58114A4E1AAE93D500E7D092 /* RCTAsyncLocalStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAsyncLocalStorage.m; sourceTree = ""; }; - 58114A4F1AAE93D500E7D092 /* RCTAsyncLocalStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAsyncLocalStorage.h; sourceTree = ""; }; - 58C571BF1AA56C1900CDF9C8 /* RCTDatePickerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDatePickerManager.m; sourceTree = ""; }; - 58C571C01AA56C1900CDF9C8 /* RCTDatePickerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTDatePickerManager.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 590D7BFB1EBD458B00D8A370 /* RCTShadowView+Layout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RCTShadowView+Layout.h"; sourceTree = ""; }; - 590D7BFC1EBD458B00D8A370 /* RCTShadowView+Layout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RCTShadowView+Layout.m"; sourceTree = ""; }; - 591F78D8202ADB21004A668C /* RCTLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTLayout.m; sourceTree = ""; }; - 591F78D9202ADB22004A668C /* RCTLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTLayout.h; sourceTree = ""; }; - 5925356920084D0600DD584B /* RCTSurfaceSizeMeasureMode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTSurfaceSizeMeasureMode.mm; sourceTree = ""; }; - 59283C9F1FD67320000EAAB9 /* RCTSurfaceStage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSurfaceStage.m; sourceTree = ""; }; - 594F0A2F1FD23228007FBE96 /* RCTSurfaceHostingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSurfaceHostingView.h; sourceTree = ""; }; - 594F0A301FD23228007FBE96 /* RCTSurfaceHostingView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTSurfaceHostingView.mm; sourceTree = ""; }; - 594F0A311FD23228007FBE96 /* RCTSurfaceSizeMeasureMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSurfaceSizeMeasureMode.h; sourceTree = ""; }; - 59500D411F71C63700B122B7 /* RCTUIManagerUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTUIManagerUtils.h; sourceTree = ""; }; - 59500D421F71C63F00B122B7 /* RCTUIManagerUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIManagerUtils.m; sourceTree = ""; }; - 5960C1B11F0804A00066FD5B /* RCTLayoutAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTLayoutAnimation.h; sourceTree = ""; }; - 5960C1B21F0804A00066FD5B /* RCTLayoutAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTLayoutAnimation.m; sourceTree = ""; }; - 5960C1B31F0804A00066FD5B /* RCTLayoutAnimationGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTLayoutAnimationGroup.h; sourceTree = ""; }; - 5960C1B41F0804A00066FD5B /* RCTLayoutAnimationGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTLayoutAnimationGroup.m; sourceTree = ""; }; - 597633341F4E021D005BE8A4 /* RCTShadowView+Internal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RCTShadowView+Internal.m"; sourceTree = ""; }; - 597633351F4E021D005BE8A4 /* RCTShadowView+Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RCTShadowView+Internal.h"; sourceTree = ""; }; - 599FAA2A1FB274970058CCF6 /* RCTSurface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSurface.h; sourceTree = ""; }; - 599FAA2B1FB274970058CCF6 /* RCTSurface.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTSurface.mm; sourceTree = ""; }; - 599FAA2C1FB274970058CCF6 /* RCTSurfaceDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSurfaceDelegate.h; sourceTree = ""; }; - 599FAA2D1FB274970058CCF6 /* RCTSurfaceRootShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSurfaceRootShadowView.h; sourceTree = ""; }; - 599FAA2E1FB274970058CCF6 /* RCTSurfaceRootShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSurfaceRootShadowView.m; sourceTree = ""; }; - 599FAA2F1FB274970058CCF6 /* RCTSurfaceRootShadowViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSurfaceRootShadowViewDelegate.h; sourceTree = ""; }; - 599FAA301FB274970058CCF6 /* RCTSurfaceRootView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSurfaceRootView.h; sourceTree = ""; }; - 599FAA311FB274970058CCF6 /* RCTSurfaceRootView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTSurfaceRootView.mm; sourceTree = ""; }; - 599FAA321FB274970058CCF6 /* RCTSurfaceStage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSurfaceStage.h; sourceTree = ""; }; - 599FAA331FB274970058CCF6 /* RCTSurfaceView+Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RCTSurfaceView+Internal.h"; sourceTree = ""; }; - 599FAA341FB274970058CCF6 /* RCTSurfaceView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSurfaceView.h; sourceTree = ""; }; - 599FAA351FB274970058CCF6 /* RCTSurfaceView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTSurfaceView.mm; sourceTree = ""; }; - 59A7B9FB1E577DBF0068EDBF /* RCTRootContentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRootContentView.h; sourceTree = ""; }; - 59A7B9FC1E577DBF0068EDBF /* RCTRootContentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRootContentView.m; sourceTree = ""; }; - 59D031E51F8353D3008361F0 /* RCTSafeAreaShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSafeAreaShadowView.h; sourceTree = ""; }; - 59D031E61F8353D3008361F0 /* RCTSafeAreaShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSafeAreaShadowView.m; sourceTree = ""; }; - 59D031E71F8353D3008361F0 /* RCTSafeAreaView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSafeAreaView.h; sourceTree = ""; }; - 59D031E81F8353D3008361F0 /* RCTSafeAreaView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSafeAreaView.m; sourceTree = ""; }; - 59D031E91F8353D3008361F0 /* RCTSafeAreaViewLocalData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSafeAreaViewLocalData.h; sourceTree = ""; }; - 59D031EA1F8353D3008361F0 /* RCTSafeAreaViewLocalData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSafeAreaViewLocalData.m; sourceTree = ""; }; - 59D031EB1F8353D3008361F0 /* RCTSafeAreaViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSafeAreaViewManager.h; sourceTree = ""; }; - 59D031EC1F8353D3008361F0 /* RCTSafeAreaViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSafeAreaViewManager.m; sourceTree = ""; }; - 59E6049C1FE9CCE100BD90C5 /* RCTScrollContentShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTScrollContentShadowView.h; sourceTree = ""; }; - 59E6049D1FE9CCE200BD90C5 /* RCTScrollContentViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTScrollContentViewManager.m; sourceTree = ""; }; - 59E6049E1FE9CCE200BD90C5 /* RCTScrollContentShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTScrollContentShadowView.m; sourceTree = ""; }; - 59E6049F1FE9CCE200BD90C5 /* RCTScrollContentViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTScrollContentViewManager.h; sourceTree = ""; }; - 59EB6DB91EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTUIManagerObserverCoordinator.h; sourceTree = ""; }; - 59EB6DBA1EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTUIManagerObserverCoordinator.mm; sourceTree = ""; }; - 59EDBC9C1FDF4E0C003573DE /* RCTScrollableProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTScrollableProtocol.h; sourceTree = ""; }; - 59EDBC9F1FDF4E0C003573DE /* RCTScrollContentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTScrollContentView.h; sourceTree = ""; }; - 59EDBCA01FDF4E0C003573DE /* RCTScrollContentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTScrollContentView.m; sourceTree = ""; }; - 59EDBCA31FDF4E0C003573DE /* RCTScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTScrollView.h; sourceTree = ""; }; - 59EDBCA41FDF4E0C003573DE /* RCTScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTScrollView.m; sourceTree = ""; }; - 59EDBCA51FDF4E0C003573DE /* RCTScrollViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTScrollViewManager.h; sourceTree = ""; }; - 59EDBCA61FDF4E0C003573DE /* RCTScrollViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTScrollViewManager.m; sourceTree = ""; }; - 5CE2080020772F7C009A43B3 /* YGConfig.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGConfig.cpp; sourceTree = ""; }; - 5CE2080120772F7C009A43B3 /* YGConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGConfig.h; sourceTree = ""; }; - 657734821EE834C900A0E9EA /* RCTInspectorDevServerHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTInspectorDevServerHelper.h; sourceTree = ""; }; - 657734831EE834C900A0E9EA /* RCTInspectorDevServerHelper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTInspectorDevServerHelper.mm; sourceTree = ""; }; - 6577348A1EE8354A00A0E9EA /* RCTInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCTInspector.h; path = Inspector/RCTInspector.h; sourceTree = ""; }; - 6577348B1EE8354A00A0E9EA /* RCTInspector.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RCTInspector.mm; path = Inspector/RCTInspector.mm; sourceTree = ""; }; - 6577348C1EE8354A00A0E9EA /* RCTInspectorPackagerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCTInspectorPackagerConnection.h; path = Inspector/RCTInspectorPackagerConnection.h; sourceTree = ""; }; - 6577348D1EE8354A00A0E9EA /* RCTInspectorPackagerConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RCTInspectorPackagerConnection.m; path = Inspector/RCTInspectorPackagerConnection.m; sourceTree = ""; }; - 66CD94AD1F1045E700CB3C7C /* RCTMaskedView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTMaskedView.h; sourceTree = ""; }; - 66CD94AE1F1045E700CB3C7C /* RCTMaskedView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMaskedView.m; sourceTree = ""; }; - 66CD94AF1F1045E700CB3C7C /* RCTMaskedViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTMaskedViewManager.h; sourceTree = ""; }; - 66CD94B01F1045E700CB3C7C /* RCTMaskedViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMaskedViewManager.m; sourceTree = ""; }; - 68EFE4EC1CF6EB3000A1DE13 /* RCTBundleURLProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBundleURLProvider.h; sourceTree = ""; }; - 68EFE4ED1CF6EB3900A1DE13 /* RCTBundleURLProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBundleURLProvider.m; sourceTree = ""; }; - 6A15FB0C1BDF663500531DFB /* RCTRootViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRootViewInternal.h; sourceTree = ""; }; - 830213F31A654E0800B993E6 /* RCTBridgeModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTBridgeModule.h; sourceTree = ""; }; - 830A229C1A66C68A008503DA /* RCTRootView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRootView.h; sourceTree = ""; }; - 830A229D1A66C68A008503DA /* RCTRootView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRootView.m; sourceTree = ""; }; - 83281383217EB70800574D55 /* MallocImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MallocImpl.cpp; path = folly/memory/detail/MallocImpl.cpp; sourceTree = ""; }; - 83281386217EB73400574D55 /* String.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = String.cpp; path = folly/String.cpp; sourceTree = ""; }; - 83281389217EB74C00574D55 /* json_pointer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = json_pointer.cpp; path = folly/json_pointer.cpp; sourceTree = ""; }; - 8328138C217EB75C00574D55 /* ColdClass.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ColdClass.cpp; path = folly/lang/ColdClass.cpp; sourceTree = ""; }; - 8328138F217EB76B00574D55 /* Demangle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Demangle.cpp; path = folly/detail/Demangle.cpp; sourceTree = ""; }; - 83281392217EB77C00574D55 /* SpookyHashV2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SpookyHashV2.cpp; path = folly/hash/SpookyHashV2.cpp; sourceTree = ""; }; - 83281395217EB78F00574D55 /* F14Table.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = F14Table.cpp; path = folly/container/detail/F14Table.cpp; sourceTree = ""; }; - 83281398217EB79D00574D55 /* ScopeGuard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScopeGuard.cpp; path = folly/ScopeGuard.cpp; sourceTree = ""; }; - 83392EB11B6634E10013B15F /* RCTModalHostViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTModalHostViewController.h; sourceTree = ""; }; - 83392EB21B6634E10013B15F /* RCTModalHostViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTModalHostViewController.m; sourceTree = ""; }; - 833D02B9217EBCFA00A23750 /* Assume.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Assume.cpp; path = folly/lang/Assume.cpp; sourceTree = ""; }; - 833D02BC217EBD2600A23750 /* Format.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Format.cpp; path = folly/Format.cpp; sourceTree = ""; }; - 83A1FE8A1B62640A00BE0E65 /* RCTModalHostView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTModalHostView.h; sourceTree = ""; }; - 83A1FE8B1B62640A00BE0E65 /* RCTModalHostView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTModalHostView.m; sourceTree = ""; }; - 83A1FE8D1B62643A00BE0E65 /* RCTModalHostViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTModalHostViewManager.h; sourceTree = ""; }; - 83A1FE8E1B62643A00BE0E65 /* RCTModalHostViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTModalHostViewManager.m; sourceTree = ""; }; - 83CBBA2E1A601D0E00E9B192 /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 83CBBA4A1A601E3B00E9B192 /* RCTAssert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAssert.h; sourceTree = ""; }; - 83CBBA4B1A601E3B00E9B192 /* RCTAssert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAssert.m; sourceTree = ""; }; - 83CBBA4C1A601E3B00E9B192 /* RCTInvalidating.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTInvalidating.h; sourceTree = ""; }; - 83CBBA4D1A601E3B00E9B192 /* RCTLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTLog.h; sourceTree = ""; }; - 83CBBA4E1A601E3B00E9B192 /* RCTLog.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTLog.mm; sourceTree = ""; }; - 83CBBA4F1A601E3B00E9B192 /* RCTUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTUtils.h; sourceTree = ""; }; - 83CBBA501A601E3B00E9B192 /* RCTUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUtils.m; sourceTree = ""; }; - 83CBBA5E1A601EAA00E9B192 /* RCTBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBridge.h; sourceTree = ""; }; - 83CBBA5F1A601EAA00E9B192 /* RCTBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBridge.m; sourceTree = ""; }; - 83CBBA631A601ECA00E9B192 /* RCTJavaScriptExecutor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTJavaScriptExecutor.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 83CBBA651A601EF300E9B192 /* RCTEventDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTEventDispatcher.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 83CBBA661A601EF300E9B192 /* RCTEventDispatcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTEventDispatcher.m; sourceTree = ""; }; - 83CBBA961A6020BB00E9B192 /* RCTTouchHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTouchHandler.h; sourceTree = ""; }; - 83CBBA971A6020BB00E9B192 /* RCTTouchHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTouchHandler.m; sourceTree = ""; }; - 83CBBACA1A6023D300E9B192 /* RCTConvert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTConvert.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 83CBBACB1A6023D300E9B192 /* RCTConvert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTConvert.m; sourceTree = ""; }; - 83F15A171B7CC46900F10295 /* UIView+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIView+Private.h"; sourceTree = ""; }; - 8507BBBC21EDACC200AEAFCA /* JSCExecutorFactory.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JSCExecutorFactory.mm; sourceTree = ""; }; - 8507BBBD21EDACC200AEAFCA /* JSCExecutorFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCExecutorFactory.h; sourceTree = ""; }; - 91076A871F743AB00081B4FA /* RCTModalManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTModalManager.m; sourceTree = ""; }; - 91076A881F743AB00081B4FA /* RCTModalManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTModalManager.h; 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 = ""; }; - AC4A6AF821FB4EA900FBEC39 /* YGMarker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGMarker.cpp; sourceTree = ""; }; - AC52CEDD21FB3FF9003C6BEC /* instrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = instrumentation.h; sourceTree = ""; }; - AC6B69E121B1467C00B2B68A /* YGValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGValue.cpp; sourceTree = ""; }; - AC6B69E221B1467C00B2B68A /* YGValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGValue.h; sourceTree = ""; }; - AC70D2E81DE489E4002E6351 /* RCTJavaScriptLoader.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTJavaScriptLoader.mm; sourceTree = ""; }; - AC70D2EB1DE48A22002E6351 /* JSBundleType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBundleType.cpp; sourceTree = ""; }; - AC8360CC21B0256A00FC46B9 /* YGMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGMarker.h; sourceTree = ""; }; - AC90463D21C91CC2005B24B3 /* CompactValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompactValue.h; sourceTree = ""; }; - ACDD3FDA1BC7430D00E7DE33 /* RCTBorderStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBorderStyle.h; sourceTree = ""; }; - B233E6E81D2D843200BC68BA /* RCTI18nManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTI18nManager.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - B233E6E91D2D845D00BC68BA /* RCTI18nManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTI18nManager.m; sourceTree = ""; }; - B95154301D1B34B200FE7B80 /* RCTActivityIndicatorView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTActivityIndicatorView.h; sourceTree = ""; }; - B95154311D1B34B200FE7B80 /* RCTActivityIndicatorView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTActivityIndicatorView.m; sourceTree = ""; }; - C60128A91F3D1258009DF9FF /* RCTCxxConvert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTCxxConvert.h; sourceTree = ""; }; - C60128AA1F3D1258009DF9FF /* RCTCxxConvert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTCxxConvert.m; sourceTree = ""; }; - C606692D1F3CC60500E67165 /* RCTModuleMethod.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTModuleMethod.mm; sourceTree = ""; }; - C60669351F3CCF1B00E67165 /* RCTManagedPointer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTManagedPointer.mm; sourceTree = ""; }; - C654505D1F3BD9280090799B /* RCTManagedPointer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTManagedPointer.h; sourceTree = ""; }; - C6D380181F71D75B00621378 /* RAMBundleRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RAMBundleRegistry.h; sourceTree = ""; }; - C6D380191F71D75B00621378 /* RAMBundleRegistry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RAMBundleRegistry.cpp; sourceTree = ""; }; - CF2731BE1E7B8DE40044CA4F /* RCTDeviceInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDeviceInfo.h; sourceTree = ""; }; - CF2731BF1E7B8DE40044CA4F /* RCTDeviceInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDeviceInfo.m; sourceTree = ""; }; - E223624320875A8000108244 /* JSExecutor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSExecutor.cpp; sourceTree = ""; }; - E3BBC8EB1ADE6F47001BBD81 /* RCTTextDecorationLineType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTTextDecorationLineType.h; sourceTree = ""; }; - E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAccessibilityManager.h; sourceTree = ""; }; - E9B20B7A1B500126007A2DA7 /* RCTAccessibilityManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAccessibilityManager.m; sourceTree = ""; }; - EBF21BBA1FC498270052F4D5 /* InspectorInterfaces.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorInterfaces.h; sourceTree = ""; }; - EBF21BBB1FC498270052F4D5 /* InspectorInterfaces.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorInterfaces.cpp; sourceTree = ""; }; - EBF21BDC1FC498900052F4D5 /* libjsinspector.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libjsinspector.a; sourceTree = BUILT_PRODUCTS_DIR; }; - EBF21BFA1FC4989A0052F4D5 /* libjsinspector-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libjsinspector-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - ED296FB6214C9A0900B7C4FE /* libjsi-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libjsi-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - ED296FEE214C9CF800B7C4FE /* libjsiexecutor-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libjsiexecutor-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - ED6189672155BBF70000C9A7 /* JSIExecutor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSIExecutor.h; path = jsireact/JSIExecutor.h; sourceTree = ""; }; - ED6189682155BBF70000C9A7 /* JSINativeModules.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSINativeModules.h; path = jsireact/JSINativeModules.h; sourceTree = ""; }; - EDDA711B2164285A00B2D070 /* JSINativeModules.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSINativeModules.cpp; path = jsireact/JSINativeModules.cpp; sourceTree = ""; }; - EDDA711C2164285A00B2D070 /* JSIExecutor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSIExecutor.cpp; path = jsireact/JSIExecutor.cpp; sourceTree = ""; }; - EDEBC6D6214B3E7000DD5AC8 /* libjsi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libjsi.a; sourceTree = BUILT_PRODUCTS_DIR; }; - EDEBC6D9214B3F6800DD5AC8 /* jsi-inl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "jsi-inl.h"; sourceTree = ""; }; - EDEBC6DA214B3F6800DD5AC8 /* JSIDynamic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDynamic.cpp; sourceTree = ""; }; - EDEBC6DB214B3F6800DD5AC8 /* jsi.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsi.cpp; sourceTree = ""; }; - EDEBC6DC214B3F6800DD5AC8 /* JSIDynamic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDynamic.h; sourceTree = ""; }; - EDEBC6DD214B3F6800DD5AC8 /* JSCRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCRuntime.cpp; sourceTree = ""; }; - EDEBC6DE214B3F6800DD5AC8 /* JSCRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCRuntime.h; sourceTree = ""; }; - EDEBC6DF214B3F6800DD5AC8 /* BUCK */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BUCK; sourceTree = ""; }; - EDEBC6E0214B3F6800DD5AC8 /* instrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = instrumentation.h; sourceTree = ""; }; - EDEBC6E1214B3F6800DD5AC8 /* jsi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsi.h; sourceTree = ""; }; - EDEBC73B214B45A300DD5AC8 /* libjsiexecutor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libjsiexecutor.a; sourceTree = BUILT_PRODUCTS_DIR; }; - EDEBC740214B463000DD5AC8 /* BUCK */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BUCK; sourceTree = ""; }; - EDEBC750214B47E100DD5AC8 /* JSDeltaBundleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeltaBundleClient.cpp; sourceTree = ""; }; - EDEBC751214B47E100DD5AC8 /* JSDeltaBundleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDeltaBundleClient.h; sourceTree = ""; }; - EDEBC752214B47E100DD5AC8 /* SharedProxyCxxModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedProxyCxxModule.h; sourceTree = ""; }; - EDEBC757214C284000DD5AC8 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; - F1EFDA4E201F660F00EE6E4C /* RCTUIUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIUtils.m; sourceTree = ""; }; - F1EFDA4F201F660F00EE6E4C /* RCTUIUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTUIUtils.h; sourceTree = ""; }; - FEFAAC9C1FDB89B40057BBE0 /* RCTRedBoxExtraDataViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRedBoxExtraDataViewController.m; sourceTree = ""; }; - FEFAAC9D1FDB89B40057BBE0 /* RCTRedBoxExtraDataViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRedBoxExtraDataViewController.h; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 3D3C08881DE342EE00C268FA /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - EDEBC7E0214C709200DD5AC8 /* libjsinspector.a in Frameworks */, - 3D3CD9411DE5FC5300167DC4 /* libcxxreact.a in Frameworks */, - EDEBC71A214B40A300DD5AC8 /* libjsi.a in Frameworks */, - EDEBC7DF214C705700DD5AC8 /* libjsiexecutor.a in Frameworks */, - 53D123971FBF1DF5001B8A10 /* libyoga.a in Frameworks */, - 3D383D6D1EBD2940005632C8 /* libdouble-conversion.a in Frameworks */, - 3D383D6F1EBD2940005632C8 /* libthird-party.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D3C088B1DE342FE00C268FA /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ED297067215023D800B7C4FE /* libjsiexecutor-tvOS.a in Frameworks */, - ED296FCB214C9B6C00B7C4FE /* libjsi-tvOS.a in Frameworks */, - ED296F83214C974A00B7C4FE /* libyoga.a in Frameworks */, - ED296F82214C973700B7C4FE /* libjsinspector-tvOS.a in Frameworks */, - 2D1D83CE1F74E2DA00615550 /* libdouble-conversion.a in Frameworks */, - 3D383D721EBD2949005632C8 /* libthird-party.a in Frameworks */, - 3D8ED92C1E5B120100D83D20 /* libcxxreact.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - ED296FCE214C9CB400B7C4FE /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - ED296FF5214C9E7C00B7C4FE /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EDEBC756214C283300DD5AC8 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EDEBC79A214C2A7000DD5AC8 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 1304439E1E3FEA8B00D93A67 /* CxxUtils */ = { - isa = PBXGroup; - children = ( - 1304439F1E3FEAA900D93A67 /* RCTFollyConvert.h */, - 130443A01E3FEAA900D93A67 /* RCTFollyConvert.mm */, - ); - name = CxxUtils; - sourceTree = ""; - }; - 130A77021DF767AF001F9587 /* yoga */ = { - isa = PBXGroup; - children = ( - AC4A6AF821FB4EA900FBEC39 /* YGMarker.cpp */, - AC52CEDD21FB3FF9003C6BEC /* instrumentation.h */, - AC90463D21C91CC2005B24B3 /* CompactValue.h */, - AC6B69E121B1467C00B2B68A /* YGValue.cpp */, - AC6B69E221B1467C00B2B68A /* YGValue.h */, - AC8360CC21B0256A00FC46B9 /* YGMarker.h */, - 5CE2080020772F7C009A43B3 /* YGConfig.cpp */, - 5CE2080120772F7C009A43B3 /* YGConfig.h */, - 53DEF6E7205AE59C006A3890 /* YGFloatOptional.h */, - 5343895E203905B6008E0CB3 /* YGLayout.cpp */, - 5343895F203905B6008E0CB3 /* YGLayout.h */, - 5352C5722038FF8D00A3B97E /* YGStyle.cpp */, - 5352C5712038FF8D00A3B97E /* YGStyle.h */, - 53756E372004FFF700FBBD99 /* Utils.cpp */, - 53756E382004FFF700FBBD99 /* Utils.h */, - 53EC85DF1FDEC75A0051B2B5 /* YGNode.cpp */, - 53EC85DE1FDEC75A0051B2B5 /* YGNode.h */, - 5376C5E11FC6DDB20083513D /* YGNodePrint.cpp */, - 5376C5E01FC6DDB20083513D /* YGNodePrint.h */, - 53CBF1861FB4FE80002CBB31 /* YGEnums.cpp */, - 53CBF1851FB4FE80002CBB31 /* Yoga-internal.h */, - 53CBF1871FB4FE80002CBB31 /* Yoga.cpp */, - 130A77031DF767AF001F9587 /* YGEnums.h */, - 130A77041DF767AF001F9587 /* YGMacros.h */, - 130A77081DF767AF001F9587 /* Yoga.h */, - ); - name = yoga; - path = yoga/yoga; - sourceTree = ""; - }; - 13134C721E296B2A00B9F3CB /* CxxBridge */ = { - isa = PBXGroup; - children = ( - 134D63C21F1FEC4B008872B5 /* RCTCxxBridgeDelegate.h */, - 3D7454B31E54786200E74ADD /* NSDataBigString.h */, - 3D7AA9C31E548CD5001955CF /* NSDataBigString.mm */, - 13134C741E296B2A00B9F3CB /* RCTCxxBridge.mm */, - 13134C771E296B2A00B9F3CB /* RCTMessageThread.h */, - 13134C781E296B2A00B9F3CB /* RCTMessageThread.mm */, - 13134C7B1E296B2A00B9F3CB /* RCTObjcExecutor.h */, - 13134C7C1E296B2A00B9F3CB /* RCTObjcExecutor.mm */, - 8507BBBD21EDACC200AEAFCA /* JSCExecutorFactory.h */, - 8507BBBC21EDACC200AEAFCA /* JSCExecutorFactory.mm */, - ); - path = CxxBridge; - sourceTree = ""; - }; - 13134C7D1E296B2A00B9F3CB /* CxxModule */ = { - isa = PBXGroup; - children = ( - 1384E2061E806D4E00545659 /* RCTNativeModule.h */, - 1384E2071E806D4E00545659 /* RCTNativeModule.mm */, - 13134C7E1E296B2A00B9F3CB /* RCTCxxMethod.h */, - 13134C7F1E296B2A00B9F3CB /* RCTCxxMethod.mm */, - 13134C801E296B2A00B9F3CB /* RCTCxxModule.h */, - 13134C811E296B2A00B9F3CB /* RCTCxxModule.mm */, - 13134C821E296B2A00B9F3CB /* RCTCxxUtils.h */, - 13134C831E296B2A00B9F3CB /* RCTCxxUtils.mm */, - ); - path = CxxModule; - sourceTree = ""; - }; - 139D7E381E25C55B00323FB7 /* double-conversion */ = { - isa = PBXGroup; - children = ( - 139D7E391E25C5A300323FB7 /* bignum-dtoa.cc */, - 139D7E3A1E25C5A300323FB7 /* bignum-dtoa.h */, - 139D7E3B1E25C5A300323FB7 /* bignum.cc */, - 139D7E3C1E25C5A300323FB7 /* bignum.h */, - 139D7E3D1E25C5A300323FB7 /* cached-powers.cc */, - 139D7E3E1E25C5A300323FB7 /* cached-powers.h */, - 139D7E3F1E25C5A300323FB7 /* diy-fp.cc */, - 139D7E401E25C5A300323FB7 /* diy-fp.h */, - 139D7E411E25C5A300323FB7 /* double-conversion.cc */, - 139D7E421E25C5A300323FB7 /* double-conversion.h */, - 139D7E431E25C5A300323FB7 /* fast-dtoa.cc */, - 139D7E441E25C5A300323FB7 /* fast-dtoa.h */, - 139D7E451E25C5A300323FB7 /* fixed-dtoa.cc */, - 139D7E461E25C5A300323FB7 /* fixed-dtoa.h */, - 139D7E471E25C5A300323FB7 /* ieee.h */, - 139D7E481E25C5A300323FB7 /* strtod.cc */, - 139D7E491E25C5A300323FB7 /* strtod.h */, - 139D7E4A1E25C5A300323FB7 /* utils.h */, - ); - name = "double-conversion"; - path = "../third-party/double-conversion-1.1.6"; - sourceTree = ""; - }; - 139D7ED71E25DB9200323FB7 /* glog */ = { - isa = PBXGroup; - children = ( - 139D7F101E25DEC900323FB7 /* glog */, - 139D7ED81E25DBDC00323FB7 /* config.h */, - 139D7F081E25DE3700323FB7 /* demangle.cc */, - 139D7ED91E25DBDC00323FB7 /* demangle.h */, - 139D7EDA1E25DBDC00323FB7 /* logging.cc */, - 139D7EDB1E25DBDC00323FB7 /* raw_logging.cc */, - 139D7EDC1E25DBDC00323FB7 /* signalhandler.cc */, - 139D7EDD1E25DBDC00323FB7 /* stacktrace.h */, - 139D7EDE1E25DBDC00323FB7 /* symbolize.cc */, - 139D7EDF1E25DBDC00323FB7 /* symbolize.h */, - 139D7EE01E25DBDC00323FB7 /* utilities.cc */, - 139D7EE11E25DBDC00323FB7 /* utilities.h */, - 139D7EE21E25DBDC00323FB7 /* vlog_is_on.cc */, - ); - name = glog; - sourceTree = ""; - }; - 139D7F101E25DEC900323FB7 /* glog */ = { - isa = PBXGroup; - children = ( - 139D7F111E25DEC900323FB7 /* log_severity.h */, - 139D7F121E25DEC900323FB7 /* logging.h */, - 139D7F141E25DEC900323FB7 /* raw_logging.h */, - 139D7F161E25DEC900323FB7 /* stl_logging.h */, - 139D7F181E25DEC900323FB7 /* vlog_is_on.h */, - ); - name = glog; - path = "../third-party/glog-0.3.5/src/glog"; - sourceTree = ""; - }; - 139D849B1E2739EC00323FB7 /* folly */ = { - isa = PBXGroup; - children = ( - 833D02B9217EBCFA00A23750 /* Assume.cpp */, - 139D849C1E273B5600323FB7 /* AtomicIntrusiveLinkedList.h */, - 8328138C217EB75C00574D55 /* ColdClass.cpp */, - 139D849F1E273B5600323FB7 /* Conv.cpp */, - 139D84A01E273B5600323FB7 /* Conv.h */, - 8328138F217EB76B00574D55 /* Demangle.cpp */, - 13F887521E2971C500C3C7A1 /* Demangle.cpp */, - 139D84A11E273B5600323FB7 /* dynamic-inl.h */, - 139D84A21E273B5600323FB7 /* dynamic.cpp */, - 139D84A31E273B5600323FB7 /* dynamic.h */, - 139D84A41E273B5600323FB7 /* Exception.h */, - 83281395217EB78F00574D55 /* F14Table.cpp */, - 833D02BC217EBD2600A23750 /* Format.cpp */, - 83281389217EB74C00574D55 /* json_pointer.cpp */, - 139D84A71E273B5600323FB7 /* json.cpp */, - 139D84A81E273B5600323FB7 /* json.h */, - 83281383217EB70800574D55 /* MallocImpl.cpp */, - 139D84A91E273B5600323FB7 /* Memory.h */, - 139D84AA1E273B5600323FB7 /* MoveWrapper.h */, - 139D84AB1E273B5600323FB7 /* Optional.h */, - 83281398217EB79D00574D55 /* ScopeGuard.cpp */, - 139D84AC1E273B5600323FB7 /* ScopeGuard.h */, - 83281392217EB77C00574D55 /* SpookyHashV2.cpp */, - 83281386217EB73400574D55 /* String.cpp */, - 13F887541E2971C500C3C7A1 /* Unicode.cpp */, - ); - name = folly; - path = "../third-party/folly-2018.10.22.00"; - sourceTree = ""; - }; - 13B07FE01A69315300A75B9A /* Modules */ = { - isa = PBXGroup; - children = ( - E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */, - E9B20B7A1B500126007A2DA7 /* RCTAccessibilityManager.m */, - 13B07FE71A69327A00A75B9A /* RCTAlertManager.h */, - 13B07FE81A69327A00A75B9A /* RCTAlertManager.m */, - 1372B7081AB030C200659ED6 /* RCTAppState.h */, - 1372B7091AB030C200659ED6 /* RCTAppState.m */, - 58114A4F1AAE93D500E7D092 /* RCTAsyncLocalStorage.h */, - 58114A4E1AAE93D500E7D092 /* RCTAsyncLocalStorage.m */, - 13D033611C1837FE0021DC29 /* RCTClipboard.h */, - 13D033621C1837FE0021DC29 /* RCTClipboard.m */, - CF2731BE1E7B8DE40044CA4F /* RCTDeviceInfo.h */, - CF2731BF1E7B8DE40044CA4F /* RCTDeviceInfo.m */, - 130E3D861E6A082100ACE484 /* RCTDevSettings.h */, - 130E3D871E6A082100ACE484 /* RCTDevSettings.mm */, - 13D9FEE91CDCCECF00158BD7 /* RCTEventEmitter.h */, - 13D9FEEA1CDCCECF00158BD7 /* RCTEventEmitter.m */, - 13B07FE91A69327A00A75B9A /* RCTExceptionsManager.h */, - 13B07FEA1A69327A00A75B9A /* RCTExceptionsManager.m */, - B233E6E81D2D843200BC68BA /* RCTI18nManager.h */, - B233E6E91D2D845D00BC68BA /* RCTI18nManager.m */, - 352DCFEE1D19F4C20056D623 /* RCTI18nUtil.h */, - 352DCFEF1D19F4C20056D623 /* RCTI18nUtil.m */, - 13D9FEEC1CDCD93000158BD7 /* RCTKeyboardObserver.h */, - 13D9FEED1CDCD93000158BD7 /* RCTKeyboardObserver.m */, - 5960C1B11F0804A00066FD5B /* RCTLayoutAnimation.h */, - 5960C1B21F0804A00066FD5B /* RCTLayoutAnimation.m */, - 5960C1B31F0804A00066FD5B /* RCTLayoutAnimationGroup.h */, - 5960C1B41F0804A00066FD5B /* RCTLayoutAnimationGroup.m */, - 13F17A831B8493E5007D4C75 /* RCTRedBox.h */, - 13F17A841B8493E5007D4C75 /* RCTRedBox.m */, - FEFAAC9D1FDB89B40057BBE0 /* RCTRedBoxExtraDataViewController.h */, - FEFAAC9C1FDB89B40057BBE0 /* RCTRedBoxExtraDataViewController.m */, - 000E6CE91AB0E97F000CDF4D /* RCTSourceCode.h */, - 000E6CEA1AB0E980000CDF4D /* RCTSourceCode.m */, - 13723B4E1A82FD3C00F88898 /* RCTStatusBarManager.h */, - 13723B4F1A82FD3C00F88898 /* RCTStatusBarManager.m */, - 13B07FED1A69327A00A75B9A /* RCTTiming.h */, - 13B07FEE1A69327A00A75B9A /* RCTTiming.m */, - 3D0B842D1EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.h */, - 3D0B842E1EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.m */, - 13E067481A70F434002CDEE1 /* RCTUIManager.h */, - 13E067491A70F434002CDEE1 /* RCTUIManager.m */, - 59EB6DB91EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.h */, - 59EB6DBA1EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.mm */, - 59500D411F71C63700B122B7 /* RCTUIManagerUtils.h */, - 59500D421F71C63F00B122B7 /* RCTUIManagerUtils.m */, - ); - path = Modules; - sourceTree = ""; - }; - 13B07FF31A6947C200A75B9A /* Views */ = { - isa = PBXGroup; - children = ( - 50E98FE721460B0D00CD9289 /* RCTWKWebView.h */, - 50E98FE821460B0D00CD9289 /* RCTWKWebView.m */, - 50E98FE921460B0D00CD9289 /* RCTWKWebViewManager.h */, - 50E98FE621460B0D00CD9289 /* RCTWKWebViewManager.m */, - B95154301D1B34B200FE7B80 /* RCTActivityIndicatorView.h */, - B95154311D1B34B200FE7B80 /* RCTActivityIndicatorView.m */, - 13B080181A69489C00A75B9A /* RCTActivityIndicatorViewManager.h */, - 13B080191A69489C00A75B9A /* RCTActivityIndicatorViewManager.m */, - 13442BF21AA90E0B0037E5B0 /* RCTAnimationType.h */, - 13C325261AA63B6A0048765F /* RCTAutoInsetsProtocol.h */, - 13CC8A801B17642100940AE7 /* RCTBorderDrawing.h */, - 13CC8A811B17642100940AE7 /* RCTBorderDrawing.m */, - ACDD3FDA1BC7430D00E7DE33 /* RCTBorderStyle.h */, - 13C325281AA63B6A0048765F /* RCTComponent.h */, - 13AB90BF1B6FA36700713B4F /* RCTComponentData.h */, - 13AB90C01B6FA36700713B4F /* RCTComponentData.m */, - 13456E911ADAD2DE009F94A7 /* RCTConvert+CoreLocation.h */, - 13456E921ADAD2DE009F94A7 /* RCTConvert+CoreLocation.m */, - 130443C31E401A8C00D93A67 /* RCTConvert+Transform.h */, - 130443C41E401A8C00D93A67 /* RCTConvert+Transform.m */, - 133CAE8C1B8E5CFD00F6AD92 /* RCTDatePicker.h */, - 133CAE8D1B8E5CFD00F6AD92 /* RCTDatePicker.m */, - 58C571C01AA56C1900CDF9C8 /* RCTDatePickerManager.h */, - 58C571BF1AA56C1900CDF9C8 /* RCTDatePickerManager.m */, - 3D37B5801D522B190042D5B5 /* RCTFont.h */, - 3D37B5811D522B190042D5B5 /* RCTFont.mm */, - 591F78D9202ADB22004A668C /* RCTLayout.h */, - 591F78D8202ADB21004A668C /* RCTLayout.m */, - 66CD94AD1F1045E700CB3C7C /* RCTMaskedView.h */, - 66CD94AE1F1045E700CB3C7C /* RCTMaskedView.m */, - 66CD94AF1F1045E700CB3C7C /* RCTMaskedViewManager.h */, - 66CD94B01F1045E700CB3C7C /* RCTMaskedViewManager.m */, - 83A1FE8A1B62640A00BE0E65 /* RCTModalHostView.h */, - 83A1FE8B1B62640A00BE0E65 /* RCTModalHostView.m */, - 83392EB11B6634E10013B15F /* RCTModalHostViewController.h */, - 83392EB21B6634E10013B15F /* RCTModalHostViewController.m */, - 83A1FE8D1B62643A00BE0E65 /* RCTModalHostViewManager.h */, - 83A1FE8E1B62643A00BE0E65 /* RCTModalHostViewManager.m */, - 91076A881F743AB00081B4FA /* RCTModalManager.h */, - 91076A871F743AB00081B4FA /* RCTModalManager.m */, - 58114A121AAE854800E7D092 /* RCTPicker.h */, - 58114A131AAE854800E7D092 /* RCTPicker.m */, - 58114A141AAE854800E7D092 /* RCTPickerManager.h */, - 58114A151AAE854800E7D092 /* RCTPickerManager.m */, - 13442BF31AA90E0B0037E5B0 /* RCTPointerEvents.h */, - 13513F3A1B1F43F400FCE529 /* RCTProgressViewManager.h */, - 13513F3B1B1F43F400FCE529 /* RCTProgressViewManager.m */, - 191E3EBF1C29DC3800C180A6 /* RCTRefreshControl.h */, - 191E3EC01C29DC3800C180A6 /* RCTRefreshControl.m */, - 191E3EBC1C29D9AF00C180A6 /* RCTRefreshControlManager.h */, - 191E3EBD1C29D9AF00C180A6 /* RCTRefreshControlManager.m */, - 13BCE8071C99CB9D00DD7AAD /* RCTRootShadowView.h */, - 13BCE8081C99CB9D00DD7AAD /* RCTRootShadowView.m */, - 131B6AF01AF1093D00FFC3E0 /* RCTSegmentedControl.h */, - 131B6AF11AF1093D00FFC3E0 /* RCTSegmentedControl.m */, - 131B6AF21AF1093D00FFC3E0 /* RCTSegmentedControlManager.h */, - 131B6AF31AF1093D00FFC3E0 /* RCTSegmentedControlManager.m */, - 13E0674B1A70F44B002CDEE1 /* RCTShadowView.h */, - 5335D5401FE81A4700883D58 /* RCTShadowView.m */, - 597633351F4E021D005BE8A4 /* RCTShadowView+Internal.h */, - 597633341F4E021D005BE8A4 /* RCTShadowView+Internal.m */, - 590D7BFB1EBD458B00D8A370 /* RCTShadowView+Layout.h */, - 590D7BFC1EBD458B00D8A370 /* RCTShadowView+Layout.m */, - 13AF20431AE707F8005F5298 /* RCTSlider.h */, - 13AF20441AE707F9005F5298 /* RCTSlider.m */, - 14F484541AABFCE100FDF6B9 /* RCTSliderManager.h */, - 14F484551AABFCE100FDF6B9 /* RCTSliderManager.m */, - 14F362071AABD06A001CE568 /* RCTSwitch.h */, - 14F362081AABD06A001CE568 /* RCTSwitch.m */, - 14F362091AABD06A001CE568 /* RCTSwitchManager.h */, - 14F3620A1AABD06A001CE568 /* RCTSwitchManager.m */, - E3BBC8EB1ADE6F47001BBD81 /* RCTTextDecorationLineType.h */, - 130443D61E401AD800D93A67 /* RCTTVView.h */, - 130443D71E401AD800D93A67 /* RCTTVView.m */, - 13E0674F1A70F44B002CDEE1 /* RCTView.h */, - 13E067501A70F44B002CDEE1 /* RCTView.m */, - 13E0674D1A70F44B002CDEE1 /* RCTViewManager.h */, - 13E0674E1A70F44B002CDEE1 /* RCTViewManager.m */, - 13C156011AB1A2840079392D /* RCTWebView.h */, - 13C156021AB1A2840079392D /* RCTWebView.m */, - 13C156031AB1A2840079392D /* RCTWebViewManager.h */, - 13C156041AB1A2840079392D /* RCTWebViewManager.m */, - 13B080231A694A8400A75B9A /* RCTWrapperViewController.h */, - 13B080241A694A8400A75B9A /* RCTWrapperViewController.m */, - 59D031E41F8353D3008361F0 /* SafeAreaView */, - 59EDBC9B1FDF4E0C003573DE /* ScrollView */, - 83F15A171B7CC46900F10295 /* UIView+Private.h */, - 13E067531A70F44B002CDEE1 /* UIView+React.h */, - 13E067541A70F44B002CDEE1 /* UIView+React.m */, - ); - path = Views; - sourceTree = ""; - }; - 1450FF7F1BCFF28A00208362 /* Profiler */ = { - isa = PBXGroup; - children = ( - 14F7A0EE1BDA714B003C6C10 /* RCTFPSGraph.h */, - 14F7A0EF1BDA714B003C6C10 /* RCTFPSGraph.m */, - 14BF71811C04795500C97D0C /* RCTMacros.h */, - 14F7A0EB1BDA3B3C003C6C10 /* RCTPerfMonitor.m */, - 1450FF801BCFF28A00208362 /* RCTProfile.h */, - 1450FF811BCFF28A00208362 /* RCTProfile.m */, - 1450FF821BCFF28A00208362 /* RCTProfileTrampoline-arm.S */, - 1450FF831BCFF28A00208362 /* RCTProfileTrampoline-arm64.S */, - 14BF717F1C04793D00C97D0C /* RCTProfileTrampoline-i386.S */, - 1450FF851BCFF28A00208362 /* RCTProfileTrampoline-x86_64.S */, - ); - path = Profiler; - sourceTree = ""; - }; - 3D10A3C71DDF3CED004A0F9D /* ReactCommon */ = { - isa = PBXGroup; - children = ( - EDEBC73C214B463000DD5AC8 /* jsiexecutor */, - EDEBC6D8214B3F6800DD5AC8 /* jsi */, - 130A77021DF767AF001F9587 /* yoga */, - AC70D2EA1DE489FC002E6351 /* cxxreact */, - EBF21BB91FC497DA0052F4D5 /* jsinspector */, - ); - name = ReactCommon; - path = ../ReactCommon; - sourceTree = ""; - }; - 3D1FA0781DE4F2CD00E03CC6 /* Libraries */ = { - isa = PBXGroup; - children = ( - 3D1FA0821DE4F36600E03CC6 /* Image */, - 3D1FA0891DE4F4B900E03CC6 /* LinkingIOS */, - 3D1FA0791DE4F2D200E03CC6 /* Network */, - 3D1FA08A1DE4F4D600E03CC6 /* PushNotificationIOS */, - 3D7BFD2A1EA8E3D3008DFB7A /* WebSocket */, - ); - name = Libraries; - path = ../; - sourceTree = ""; - }; - 3D1FA0791DE4F2D200E03CC6 /* Network */ = { - isa = PBXGroup; - children = ( - 3D1FA07A1DE4F2EA00E03CC6 /* RCTNetworking.h */, - 3D1FA07B1DE4F2EA00E03CC6 /* RCTNetworkTask.h */, - ); - path = Network; - sourceTree = ""; - }; - 3D1FA0821DE4F36600E03CC6 /* Image */ = { - isa = PBXGroup; - children = ( - 3D1FA0831DE4F3A000E03CC6 /* RCTImageLoader.h */, - 3D1FA0841DE4F3A000E03CC6 /* RCTImageStoreManager.h */, - 3D1FA0851DE4F3A000E03CC6 /* RCTResizeMode.h */, - ); - path = Image; - sourceTree = ""; - }; - 3D1FA0891DE4F4B900E03CC6 /* LinkingIOS */ = { - isa = PBXGroup; - children = ( - 3D1FA08B1DE4F4DD00E03CC6 /* RCTLinkingManager.h */, - ); - path = LinkingIOS; - sourceTree = ""; - }; - 3D1FA08A1DE4F4D600E03CC6 /* PushNotificationIOS */ = { - isa = PBXGroup; - children = ( - 3D1FA08D1DE4F4EE00E03CC6 /* RCTPushNotificationManager.h */, - ); - name = PushNotificationIOS; - sourceTree = ""; - }; - 3D7BFD0A1EA8E2D1008DFB7A /* DevSupport */ = { - isa = PBXGroup; - children = ( - 657734821EE834C900A0E9EA /* RCTInspectorDevServerHelper.h */, - 657734831EE834C900A0E9EA /* RCTInspectorDevServerHelper.mm */, - 13A0C2851B74F71200B29F6F /* RCTDevLoadingView.h */, - 13A0C2861B74F71200B29F6F /* RCTDevLoadingView.m */, - 13A0C2871B74F71200B29F6F /* RCTDevMenu.h */, - 13A0C2881B74F71200B29F6F /* RCTDevMenu.m */, - 3D7BFD0B1EA8E351008DFB7A /* RCTPackagerClient.h */, - 3D7BFD0C1EA8E351008DFB7A /* RCTPackagerClient.m */, - 3D7BFD0F1EA8E351008DFB7A /* RCTPackagerConnection.h */, - 3D7BFD101EA8E351008DFB7A /* RCTPackagerConnection.mm */, - ); - path = DevSupport; - sourceTree = ""; - }; - 3D7BFD2A1EA8E3D3008DFB7A /* WebSocket */ = { - isa = PBXGroup; - children = ( - 3D0E37891F1CC40000DCAC9F /* RCTWebSocketModule.h */, - 3D7BFD2B1EA8E3FA008DFB7A /* RCTReconnectingWebSocket.h */, - 3D7BFD2C1EA8E3FA008DFB7A /* RCTSRWebSocket.h */, - ); - name = WebSocket; - sourceTree = ""; - }; - 3D92B1151E036A690018521A /* ThirdParty */ = { - isa = PBXGroup; - children = ( - 139D849B1E2739EC00323FB7 /* folly */, - 139D7ED71E25DB9200323FB7 /* glog */, - 139D7E381E25C55B00323FB7 /* double-conversion */, - ); - name = ThirdParty; - sourceTree = ""; - }; - 53D123821FBF1D49001B8A10 /* Frameworks */ = { - isa = PBXGroup; - children = ( - EDEBC757214C284000DD5AC8 /* JavaScriptCore.framework */, - 53D123831FBF1D49001B8A10 /* libyoga.a */, - ); - name = Frameworks; - sourceTree = ""; - }; - 594F0A2E1FD23228007FBE96 /* SurfaceHostingView */ = { - isa = PBXGroup; - children = ( - 594F0A2F1FD23228007FBE96 /* RCTSurfaceHostingView.h */, - 594F0A301FD23228007FBE96 /* RCTSurfaceHostingView.mm */, - 594F0A311FD23228007FBE96 /* RCTSurfaceSizeMeasureMode.h */, - 5925356920084D0600DD584B /* RCTSurfaceSizeMeasureMode.mm */, - ); - path = SurfaceHostingView; - sourceTree = ""; - }; - 599FAA291FB274970058CCF6 /* Surface */ = { - isa = PBXGroup; - children = ( - 599FAA2A1FB274970058CCF6 /* RCTSurface.h */, - 599FAA2B1FB274970058CCF6 /* RCTSurface.mm */, - 599FAA2C1FB274970058CCF6 /* RCTSurfaceDelegate.h */, - 599FAA2D1FB274970058CCF6 /* RCTSurfaceRootShadowView.h */, - 599FAA2E1FB274970058CCF6 /* RCTSurfaceRootShadowView.m */, - 599FAA2F1FB274970058CCF6 /* RCTSurfaceRootShadowViewDelegate.h */, - 599FAA301FB274970058CCF6 /* RCTSurfaceRootView.h */, - 599FAA311FB274970058CCF6 /* RCTSurfaceRootView.mm */, - 599FAA321FB274970058CCF6 /* RCTSurfaceStage.h */, - 59283C9F1FD67320000EAAB9 /* RCTSurfaceStage.m */, - 599FAA341FB274970058CCF6 /* RCTSurfaceView.h */, - 599FAA351FB274970058CCF6 /* RCTSurfaceView.mm */, - 599FAA331FB274970058CCF6 /* RCTSurfaceView+Internal.h */, - 594F0A2E1FD23228007FBE96 /* SurfaceHostingView */, - ); - path = Surface; - sourceTree = ""; - }; - 59D031E41F8353D3008361F0 /* SafeAreaView */ = { - isa = PBXGroup; - children = ( - 59D031E51F8353D3008361F0 /* RCTSafeAreaShadowView.h */, - 59D031E61F8353D3008361F0 /* RCTSafeAreaShadowView.m */, - 59D031E71F8353D3008361F0 /* RCTSafeAreaView.h */, - 59D031E81F8353D3008361F0 /* RCTSafeAreaView.m */, - 59D031E91F8353D3008361F0 /* RCTSafeAreaViewLocalData.h */, - 59D031EA1F8353D3008361F0 /* RCTSafeAreaViewLocalData.m */, - 59D031EB1F8353D3008361F0 /* RCTSafeAreaViewManager.h */, - 59D031EC1F8353D3008361F0 /* RCTSafeAreaViewManager.m */, - ); - path = SafeAreaView; - sourceTree = ""; - }; - 59EDBC9B1FDF4E0C003573DE /* ScrollView */ = { - isa = PBXGroup; - children = ( - 59EDBC9C1FDF4E0C003573DE /* RCTScrollableProtocol.h */, - 59E6049C1FE9CCE100BD90C5 /* RCTScrollContentShadowView.h */, - 59E6049E1FE9CCE200BD90C5 /* RCTScrollContentShadowView.m */, - 59EDBC9F1FDF4E0C003573DE /* RCTScrollContentView.h */, - 59EDBCA01FDF4E0C003573DE /* RCTScrollContentView.m */, - 59E6049F1FE9CCE200BD90C5 /* RCTScrollContentViewManager.h */, - 59E6049D1FE9CCE200BD90C5 /* RCTScrollContentViewManager.m */, - 59EDBCA31FDF4E0C003573DE /* RCTScrollView.h */, - 59EDBCA41FDF4E0C003573DE /* RCTScrollView.m */, - 59EDBCA51FDF4E0C003573DE /* RCTScrollViewManager.h */, - 59EDBCA61FDF4E0C003573DE /* RCTScrollViewManager.m */, - ); - path = ScrollView; - sourceTree = ""; - }; - 657734881EE8352500A0E9EA /* Inspector */ = { - isa = PBXGroup; - children = ( - 6577348A1EE8354A00A0E9EA /* RCTInspector.h */, - 6577348B1EE8354A00A0E9EA /* RCTInspector.mm */, - 6577348C1EE8354A00A0E9EA /* RCTInspectorPackagerConnection.h */, - 6577348D1EE8354A00A0E9EA /* RCTInspectorPackagerConnection.m */, - ); - name = Inspector; - sourceTree = ""; - }; - 83CBB9F61A601CBA00E9B192 = { - isa = PBXGroup; - children = ( - 83CBBA2F1A601D0F00E9B192 /* React */, - 3D788F841EBD2D240063D616 /* third-party.xcconfig */, - 3D10A3C71DDF3CED004A0F9D /* ReactCommon */, - 3D1FA0781DE4F2CD00E03CC6 /* Libraries */, - 3D92B1151E036A690018521A /* ThirdParty */, - 83CBBA001A601CBA00E9B192 /* Products */, - 53D123821FBF1D49001B8A10 /* Frameworks */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 83CBBA001A601CBA00E9B192 /* Products */ = { - isa = PBXGroup; - children = ( - 83CBBA2E1A601D0E00E9B192 /* libReact.a */, - 2D2A28131D9B038B00D4039D /* libReact.a */, - 3D3C059A1DE3340900C268FA /* libyoga.a */, - 3D3C06751DE3340C00C268FA /* libyoga.a */, - 3D3CD9251DE5FBEC00167DC4 /* libcxxreact.a */, - 3D3CD9321DE5FBEE00167DC4 /* libcxxreact.a */, - 139D7E881E25C6D100323FB7 /* libdouble-conversion.a */, - 139D7ECE1E25DB7D00323FB7 /* libthird-party.a */, - 3D383D3C1EBD27B6005632C8 /* libthird-party.a */, - 3D383D621EBD27B9005632C8 /* libdouble-conversion.a */, - EBF21BDC1FC498900052F4D5 /* libjsinspector.a */, - EBF21BFA1FC4989A0052F4D5 /* libjsinspector-tvOS.a */, - EDEBC6D6214B3E7000DD5AC8 /* libjsi.a */, - EDEBC73B214B45A300DD5AC8 /* libjsiexecutor.a */, - ED296FB6214C9A0900B7C4FE /* libjsi-tvOS.a */, - ED296FEE214C9CF800B7C4FE /* libjsiexecutor-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 83CBBA2F1A601D0F00E9B192 /* React */ = { - isa = PBXGroup; - children = ( - 83CBBA491A601E3B00E9B192 /* Base */, - 13134C721E296B2A00B9F3CB /* CxxBridge */, - 13134C7D1E296B2A00B9F3CB /* CxxModule */, - 1304439E1E3FEA8B00D93A67 /* CxxUtils */, - 3D7BFD0A1EA8E2D1008DFB7A /* DevSupport */, - 657734881EE8352500A0E9EA /* Inspector */, - 13B07FE01A69315300A75B9A /* Modules */, - 1450FF7F1BCFF28A00208362 /* Profiler */, - F1EFDA4D201F660F00EE6E4C /* UIUtils */, - 13B07FF31A6947C200A75B9A /* Views */, - ); - name = React; - sourceTree = ""; - }; - 83CBBA491A601E3B00E9B192 /* Base */ = { - isa = PBXGroup; - children = ( - 83CBBA4A1A601E3B00E9B192 /* RCTAssert.h */, - 83CBBA4B1A601E3B00E9B192 /* RCTAssert.m */, - 83CBBA5E1A601EAA00E9B192 /* RCTBridge.h */, - 83CBBA5F1A601EAA00E9B192 /* RCTBridge.m */, - 14A43DB81C1F849600794BC8 /* RCTBridge+Private.h */, - 1482F9E61B55B927000ADFF3 /* RCTBridgeDelegate.h */, - 13AFBCA11C07287B00BBAEAA /* RCTBridgeMethod.h */, - 830213F31A654E0800B993E6 /* RCTBridgeModule.h */, - 68EFE4EC1CF6EB3000A1DE13 /* RCTBundleURLProvider.h */, - 68EFE4ED1CF6EB3900A1DE13 /* RCTBundleURLProvider.m */, - 83CBBACA1A6023D300E9B192 /* RCTConvert.h */, - 83CBBACB1A6023D300E9B192 /* RCTConvert.m */, - C60128A91F3D1258009DF9FF /* RCTCxxConvert.h */, - C60128AA1F3D1258009DF9FF /* RCTCxxConvert.m */, - 13AF1F851AE6E777005F5298 /* RCTDefines.h */, - 3D1E68D81CABD13900DD7465 /* RCTDisplayLink.h */, - 3D1E68D91CABD13900DD7465 /* RCTDisplayLink.m */, - 3EDCA8A21D3591E700450C31 /* RCTErrorCustomizer.h */, - 3EDCA8A31D3591E700450C31 /* RCTErrorInfo.h */, - 3EDCA8A41D3591E700450C31 /* RCTErrorInfo.m */, - 83CBBA651A601EF300E9B192 /* RCTEventDispatcher.h */, - 83CBBA661A601EF300E9B192 /* RCTEventDispatcher.m */, - 1436DD071ADE7AA000A5ED7D /* RCTFrameUpdate.h */, - 14C2CA751B3AC64F00E6CBB2 /* RCTFrameUpdate.m */, - 13BB3D001BECD54500932C10 /* RCTImageSource.h */, - 13BB3D011BECD54500932C10 /* RCTImageSource.m */, - 83CBBA4C1A601E3B00E9B192 /* RCTInvalidating.h */, - 83CBBA631A601ECA00E9B192 /* RCTJavaScriptExecutor.h */, - 14200DA81AC179B3008EE6BA /* RCTJavaScriptLoader.h */, - AC70D2E81DE489E4002E6351 /* RCTJavaScriptLoader.mm */, - 008341F51D1DB34400876D9A /* RCTJSStackFrame.h */, - 008341F41D1DB34400876D9A /* RCTJSStackFrame.m */, - 13A1F71C1A75392D00D3D453 /* RCTKeyCommands.h */, - 13A1F71D1A75392D00D3D453 /* RCTKeyCommands.m */, - 83CBBA4D1A601E3B00E9B192 /* RCTLog.h */, - 83CBBA4E1A601E3B00E9B192 /* RCTLog.mm */, - C654505D1F3BD9280090799B /* RCTManagedPointer.h */, - C60669351F3CCF1B00E67165 /* RCTManagedPointer.mm */, - 14C2CA721B3AC64300E6CBB2 /* RCTModuleData.h */, - 14C2CA731B3AC64300E6CBB2 /* RCTModuleData.mm */, - 14C2CA6F1B3AC63800E6CBB2 /* RCTModuleMethod.h */, - C606692D1F3CC60500E67165 /* RCTModuleMethod.mm */, - 006FC4121D9B20820057AAAD /* RCTMultipartDataTask.h */, - 006FC4131D9B20820057AAAD /* RCTMultipartDataTask.m */, - 001BFCCE1D8381DE008E587E /* RCTMultipartStreamReader.h */, - 001BFCCF1D8381DE008E587E /* RCTMultipartStreamReader.m */, - 13A6E20F1C19ABC700845B82 /* RCTNullability.h */, - 13A6E20C1C19AA0C00845B82 /* RCTParserUtils.h */, - 13A6E20D1C19AA0C00845B82 /* RCTParserUtils.m */, - 142014181B32094000CC17BA /* RCTPerformanceLogger.h */, - 142014171B32094000CC17BA /* RCTPerformanceLogger.m */, - 3D7749421DC1065C007EC8D8 /* RCTPlatform.h */, - 3D7749431DC1065C007EC8D8 /* RCTPlatform.m */, - A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */, - A2440AA11DF8D854006E7BFC /* RCTReloadCommand.m */, - 59A7B9FB1E577DBF0068EDBF /* RCTRootContentView.h */, - 59A7B9FC1E577DBF0068EDBF /* RCTRootContentView.m */, - 830A229C1A66C68A008503DA /* RCTRootView.h */, - 830A229D1A66C68A008503DA /* RCTRootView.m */, - 13AFBCA21C07287B00BBAEAA /* RCTRootViewDelegate.h */, - 6A15FB0C1BDF663500531DFB /* RCTRootViewInternal.h */, - 391E86A31C623EC800009732 /* RCTTouchEvent.h */, - 391E86A21C623EC800009732 /* RCTTouchEvent.m */, - 83CBBA961A6020BB00E9B192 /* RCTTouchHandler.h */, - 83CBBA971A6020BB00E9B192 /* RCTTouchHandler.m */, - 3D0B84281EC0B49400B2BD8E /* RCTTVRemoteHandler.h */, - 3D0B84291EC0B49400B2BD8E /* RCTTVRemoteHandler.m */, - 1345A83A1B265A0E00583190 /* RCTURLRequestDelegate.h */, - 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */, - 83CBBA4F1A601E3B00E9B192 /* RCTUtils.h */, - 83CBBA501A601E3B00E9B192 /* RCTUtils.m */, - 199B8A6E1F44DB16005DEF67 /* RCTVersion.h */, - 39C50FFA2046EE3500CEE534 /* RCTVersion.m */, - 599FAA291FB274970058CCF6 /* Surface */, - ); - path = Base; - sourceTree = ""; - }; - AC70D2EA1DE489FC002E6351 /* cxxreact */ = { - isa = PBXGroup; - children = ( - EDEBC750214B47E100DD5AC8 /* JSDeltaBundleClient.cpp */, - EDEBC751214B47E100DD5AC8 /* JSDeltaBundleClient.h */, - EDEBC752214B47E100DD5AC8 /* SharedProxyCxxModule.h */, - 13DA8A302097A90B00276ED4 /* ReactMarker.cpp */, - 13DA8A2F2097A90A00276ED4 /* ReactMarker.h */, - E223624320875A8000108244 /* JSExecutor.cpp */, - 3D92B0A71E03699D0018521A /* CxxModule.h */, - 3D92B0A81E03699D0018521A /* CxxNativeModule.cpp */, - 3D92B0A91E03699D0018521A /* CxxNativeModule.h */, - 3D92B0AE1E03699D0018521A /* Instance.cpp */, - 3D92B0AF1E03699D0018521A /* Instance.h */, - 3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */, - 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */, - 27B958731E57587D0096647A /* JSBigString.cpp */, - 3D7454781E54757500E74ADD /* JSBigString.h */, - AC70D2EB1DE48A22002E6351 /* JSBundleType.cpp */, - 3D3CD8F51DE5FB2300167DC4 /* JSBundleType.h */, - 3D92B0AB1E03699D0018521A /* JSExecutor.h */, - 3D92B0C61E03699D0018521A /* JSIndexedRAMBundle.cpp */, - 3D92B0C71E03699D0018521A /* JSIndexedRAMBundle.h */, - 3D92B0C81E03699D0018521A /* JSModulesUnbundle.h */, - 3D92B0C91E03699D0018521A /* MessageQueueThread.h */, - 3D92B0CA1E03699D0018521A /* MethodCall.cpp */, - 3D92B0CB1E03699D0018521A /* MethodCall.h */, - 3D92B0CC1E03699D0018521A /* ModuleRegistry.cpp */, - 3D92B0CD1E03699D0018521A /* ModuleRegistry.h */, - 3D92B0CE1E03699D0018521A /* NativeModule.h */, - 3D92B0CF1E03699D0018521A /* NativeToJsBridge.cpp */, - 3D92B0D01E03699D0018521A /* NativeToJsBridge.h */, - C6D380191F71D75B00621378 /* RAMBundleRegistry.cpp */, - C6D380181F71D75B00621378 /* RAMBundleRegistry.h */, - 3D7454791E54757500E74ADD /* RecoverableError.h */, - 3D92B0D31E03699D0018521A /* SampleCxxModule.cpp */, - 3D92B0D41E03699D0018521A /* SampleCxxModule.h */, - 3D92B0D51E03699D0018521A /* SystraceSection.h */, - ); - path = cxxreact; - sourceTree = ""; - }; - EBF21BB91FC497DA0052F4D5 /* jsinspector */ = { - isa = PBXGroup; - children = ( - EBF21BBB1FC498270052F4D5 /* InspectorInterfaces.cpp */, - EBF21BBA1FC498270052F4D5 /* InspectorInterfaces.h */, - ); - path = jsinspector; - sourceTree = ""; - }; - ED6189662155BBDD0000C9A7 /* jsireact */ = { - isa = PBXGroup; - children = ( - EDDA711C2164285A00B2D070 /* JSIExecutor.cpp */, - EDDA711B2164285A00B2D070 /* JSINativeModules.cpp */, - ED6189672155BBF70000C9A7 /* JSIExecutor.h */, - ED6189682155BBF70000C9A7 /* JSINativeModules.h */, - ); - name = jsireact; - sourceTree = ""; - }; - EDEBC6D8214B3F6800DD5AC8 /* jsi */ = { - isa = PBXGroup; - children = ( - EDEBC6D9214B3F6800DD5AC8 /* jsi-inl.h */, - EDEBC6DA214B3F6800DD5AC8 /* JSIDynamic.cpp */, - EDEBC6DB214B3F6800DD5AC8 /* jsi.cpp */, - EDEBC6DC214B3F6800DD5AC8 /* JSIDynamic.h */, - EDEBC6DD214B3F6800DD5AC8 /* JSCRuntime.cpp */, - EDEBC6DE214B3F6800DD5AC8 /* JSCRuntime.h */, - EDEBC6DF214B3F6800DD5AC8 /* BUCK */, - EDEBC6E0214B3F6800DD5AC8 /* instrumentation.h */, - EDEBC6E1214B3F6800DD5AC8 /* jsi.h */, - ); - path = jsi; - sourceTree = ""; - }; - EDEBC73C214B463000DD5AC8 /* jsiexecutor */ = { - isa = PBXGroup; - children = ( - ED6189662155BBDD0000C9A7 /* jsireact */, - EDEBC740214B463000DD5AC8 /* BUCK */, - ); - path = jsiexecutor; - sourceTree = ""; - }; - F1EFDA4D201F660F00EE6E4C /* UIUtils */ = { - isa = PBXGroup; - children = ( - F1EFDA4F201F660F00EE6E4C /* RCTUIUtils.h */, - F1EFDA4E201F660F00EE6E4C /* RCTUIUtils.m */, - ); - path = UIUtils; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 139D7EA41E25C7BD00323FB7 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 139D7EA51E25C85300323FB7 /* bignum-dtoa.h in Headers */, - 139D7EA61E25C85300323FB7 /* bignum.h in Headers */, - 139D7EA71E25C85300323FB7 /* cached-powers.h in Headers */, - 139D7EA81E25C85300323FB7 /* diy-fp.h in Headers */, - 139D7EA91E25C85300323FB7 /* double-conversion.h in Headers */, - 139D7EAA1E25C85300323FB7 /* fast-dtoa.h in Headers */, - 139D7EAB1E25C85300323FB7 /* fixed-dtoa.h in Headers */, - 139D7EAC1E25C85300323FB7 /* ieee.h in Headers */, - 139D7EAD1E25C85300323FB7 /* strtod.h in Headers */, - 139D7EAE1E25C85300323FB7 /* utils.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D302F231DF828D100D6DDAE /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 3DA982391E5B0F8A004F2374 /* UIView+Private.h in Headers */, - 13134C8D1E296B2A00B9F3CB /* RCTMessageThread.h in Headers */, - 130443DE1E401B0D00D93A67 /* RCTTVView.h in Headers */, - 3D7AA9C51E548CDB001955CF /* NSDataBigString.h in Headers */, - 5960C1BA1F0804A00066FD5B /* RCTLayoutAnimationGroup.h in Headers */, - 13134C991E296B2A00B9F3CB /* RCTCxxMethod.h in Headers */, - 3D302F471DF828F800D6DDAE /* RCTPlatform.h in Headers */, - 13134C951E296B2A00B9F3CB /* RCTObjcExecutor.h in Headers */, - 590D7BFE1EBD458B00D8A370 /* RCTShadowView+Layout.h in Headers */, - 13134C9D1E296B2A00B9F3CB /* RCTCxxModule.h in Headers */, - 66CD94B61F1045E700CB3C7C /* RCTMaskedViewManager.h in Headers */, - 130443A31E3FEAAE00D93A67 /* RCTFollyConvert.h in Headers */, - 3D7BFD1E1EA8E351008DFB7A /* RCTPackagerConnection.h in Headers */, - 3D302F241DF828F800D6DDAE /* RCTImageLoader.h in Headers */, - 3D302F251DF828F800D6DDAE /* RCTImageStoreManager.h in Headers */, - C60128AC1F3D1258009DF9FF /* RCTCxxConvert.h in Headers */, - 3D302F261DF828F800D6DDAE /* RCTResizeMode.h in Headers */, - 3D302F271DF828F800D6DDAE /* RCTLinkingManager.h in Headers */, - 3D7BFD161EA8E351008DFB7A /* RCTPackagerClient.h in Headers */, - 3D302F281DF828F800D6DDAE /* RCTNetworking.h in Headers */, - 3D302F291DF828F800D6DDAE /* RCTNetworkTask.h in Headers */, - 3D7BFD2E1EA8E3FA008DFB7A /* RCTReconnectingWebSocket.h in Headers */, - 3D302F2A1DF828F800D6DDAE /* RCTPushNotificationManager.h in Headers */, - 3D302F2B1DF828F800D6DDAE /* RCTAssert.h in Headers */, - 3D302F2C1DF828F800D6DDAE /* RCTBridge.h in Headers */, - 3D302F2D1DF828F800D6DDAE /* RCTBridge+Private.h in Headers */, - 3D302F2E1DF828F800D6DDAE /* RCTBridgeDelegate.h in Headers */, - 3D302F2F1DF828F800D6DDAE /* RCTBridgeMethod.h in Headers */, - 130E3D8A1E6A083600ACE484 /* RCTDevSettings.h in Headers */, - 8507BBC121EDACC200AEAFCA /* JSCExecutorFactory.h in Headers */, - 3D0E378E1F1CC59100DCAC9F /* RCTWebSocketModule.h in Headers */, - 3D302F301DF828F800D6DDAE /* RCTBridgeModule.h in Headers */, - 3D302F311DF828F800D6DDAE /* RCTBundleURLProvider.h in Headers */, - 3D302F321DF828F800D6DDAE /* RCTConvert.h in Headers */, - 3D302F331DF828F800D6DDAE /* RCTDefines.h in Headers */, - 3D0B842F1EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.h in Headers */, - 3D302F341DF828F800D6DDAE /* RCTDisplayLink.h in Headers */, - 3D302F351DF828F800D6DDAE /* RCTErrorCustomizer.h in Headers */, - 3D302F361DF828F800D6DDAE /* RCTErrorInfo.h in Headers */, - 3D302F371DF828F800D6DDAE /* RCTEventDispatcher.h in Headers */, - 594F0A371FD23228007FBE96 /* RCTSurfaceSizeMeasureMode.h in Headers */, - 3D302F381DF828F800D6DDAE /* RCTFrameUpdate.h in Headers */, - 3D302F391DF828F800D6DDAE /* RCTImageSource.h in Headers */, - 597633391F4E021D005BE8A4 /* RCTShadowView+Internal.h in Headers */, - 3D302F3A1DF828F800D6DDAE /* RCTInvalidating.h in Headers */, - 3D302F3B1DF828F800D6DDAE /* RCTJavaScriptExecutor.h in Headers */, - 59D031F61F8353D3008361F0 /* RCTSafeAreaViewLocalData.h in Headers */, - 3D302F3C1DF828F800D6DDAE /* RCTJavaScriptLoader.h in Headers */, - 3D302F3D1DF828F800D6DDAE /* RCTJSStackFrame.h in Headers */, - 599FAA491FB274980058CCF6 /* RCTSurfaceView+Internal.h in Headers */, - 59EDBCB61FDF4E0C003573DE /* RCTScrollView.h in Headers */, - 3D302F3E1DF828F800D6DDAE /* RCTKeyCommands.h in Headers */, - 599FAA411FB274980058CCF6 /* RCTSurfaceRootShadowViewDelegate.h in Headers */, - 3D302F3F1DF828F800D6DDAE /* RCTLog.h in Headers */, - 599FAA431FB274980058CCF6 /* RCTSurfaceRootView.h in Headers */, - 3D302F401DF828F800D6DDAE /* RCTModuleData.h in Headers */, - 5960C1B61F0804A00066FD5B /* RCTLayoutAnimation.h in Headers */, - 3D302F411DF828F800D6DDAE /* RCTModuleMethod.h in Headers */, - 3D302F421DF828F800D6DDAE /* RCTMultipartDataTask.h in Headers */, - 3D302F431DF828F800D6DDAE /* RCTMultipartStreamReader.h in Headers */, - 199B8A761F44DEDA005DEF67 /* RCTVersion.h in Headers */, - 3D302F441DF828F800D6DDAE /* RCTNullability.h in Headers */, - 3D302F451DF828F800D6DDAE /* RCTParserUtils.h in Headers */, - 3D302F461DF828F800D6DDAE /* RCTPerformanceLogger.h in Headers */, - 3D302F481DF828F800D6DDAE /* RCTRootView.h in Headers */, - 3D302F491DF828F800D6DDAE /* RCTRootViewDelegate.h in Headers */, - 3D302F4A1DF828F800D6DDAE /* RCTRootViewInternal.h in Headers */, - 3D302F4B1DF828F800D6DDAE /* RCTTouchEvent.h in Headers */, - 591F78DD202ADB22004A668C /* RCTLayout.h in Headers */, - 59D031F21F8353D3008361F0 /* RCTSafeAreaView.h in Headers */, - 3D302F4C1DF828F800D6DDAE /* RCTTouchHandler.h in Headers */, - 3D302F4D1DF828F800D6DDAE /* RCTURLRequestDelegate.h in Headers */, - 3D302F4E1DF828F800D6DDAE /* RCTURLRequestHandler.h in Headers */, - 59500D441F71C63F00B122B7 /* RCTUIManagerUtils.h in Headers */, - 3D302F4F1DF828F800D6DDAE /* RCTUtils.h in Headers */, - 59D031FA1F8353D3008361F0 /* RCTSafeAreaViewManager.h in Headers */, - 3D302F551DF828F800D6DDAE /* RCTAccessibilityManager.h in Headers */, - 3D302F561DF828F800D6DDAE /* RCTAlertManager.h in Headers */, - 3D302F571DF828F800D6DDAE /* RCTAppState.h in Headers */, - 3D302F581DF828F800D6DDAE /* RCTAsyncLocalStorage.h in Headers */, - 59D031EE1F8353D3008361F0 /* RCTSafeAreaShadowView.h in Headers */, - 3D302F591DF828F800D6DDAE /* RCTClipboard.h in Headers */, - 3D302F5A1DF828F800D6DDAE /* RCTDevLoadingView.h in Headers */, - 59EDBCBA1FDF4E0C003573DE /* RCTScrollViewManager.h in Headers */, - 3D0B842A1EC0B49400B2BD8E /* RCTTVRemoteHandler.h in Headers */, - 3D302F5B1DF828F800D6DDAE /* RCTDevMenu.h in Headers */, - 657734921EE8356100A0E9EA /* RCTInspector.h in Headers */, - 3D302F5C1DF828F800D6DDAE /* RCTEventEmitter.h in Headers */, - 3D302F5D1DF828F800D6DDAE /* RCTExceptionsManager.h in Headers */, - 599FAA4B1FB274980058CCF6 /* RCTSurfaceView.h in Headers */, - 599FAA3D1FB274980058CCF6 /* RCTSurfaceRootShadowView.h in Headers */, - 3D302F5E1DF828F800D6DDAE /* RCTI18nManager.h in Headers */, - 3D302F5F1DF828F800D6DDAE /* RCTI18nUtil.h in Headers */, - 3D302F601DF828F800D6DDAE /* RCTKeyboardObserver.h in Headers */, - 3D302F611DF828F800D6DDAE /* RCTRedBox.h in Headers */, - 3D302F621DF828F800D6DDAE /* RCTSourceCode.h in Headers */, - 3D302F631DF828F800D6DDAE /* RCTStatusBarManager.h in Headers */, - 3DCE52F31FEAB10600613583 /* RCTRedBoxExtraDataViewController.h in Headers */, - 3D302F641DF828F800D6DDAE /* RCTTiming.h in Headers */, - 3D302F651DF828F800D6DDAE /* RCTUIManager.h in Headers */, - 599FAA3B1FB274980058CCF6 /* RCTSurfaceDelegate.h in Headers */, - 3D302F661DF828F800D6DDAE /* RCTFPSGraph.h in Headers */, - 3D302F681DF828F800D6DDAE /* RCTMacros.h in Headers */, - 3D302F691DF828F800D6DDAE /* RCTProfile.h in Headers */, - 3D302F6A1DF828F800D6DDAE /* RCTActivityIndicatorView.h in Headers */, - 3D302F6B1DF828F800D6DDAE /* RCTActivityIndicatorViewManager.h in Headers */, - 3D7BFD301EA8E3FA008DFB7A /* RCTSRWebSocket.h in Headers */, - 59EDBCA81FDF4E0C003573DE /* RCTScrollableProtocol.h in Headers */, - 3D302F6C1DF828F800D6DDAE /* RCTAnimationType.h in Headers */, - 598FD1951F817335006C54CB /* RCTModalManager.h in Headers */, - 657734871EE834E000A0E9EA /* RCTInspectorDevServerHelper.h in Headers */, - 3D302F6D1DF828F800D6DDAE /* RCTAutoInsetsProtocol.h in Headers */, - 3D302F6E1DF828F800D6DDAE /* RCTBorderDrawing.h in Headers */, - 3D302F6F1DF828F800D6DDAE /* RCTBorderStyle.h in Headers */, - 3D302F701DF828F800D6DDAE /* RCTComponent.h in Headers */, - 3D302F711DF828F800D6DDAE /* RCTComponentData.h in Headers */, - 3D302F721DF828F800D6DDAE /* RCTConvert+CoreLocation.h in Headers */, - 3D302F761DF828F800D6DDAE /* RCTFont.h in Headers */, - 3D302F7B1DF828F800D6DDAE /* RCTModalHostView.h in Headers */, - 1384E20A1E806D5700545659 /* RCTNativeModule.h in Headers */, - 3D302F7C1DF828F800D6DDAE /* RCTModalHostViewController.h in Headers */, - 3D302F7D1DF828F800D6DDAE /* RCTModalHostViewManager.h in Headers */, - 594F0A331FD23228007FBE96 /* RCTSurfaceHostingView.h in Headers */, - 130443DD1E401AF500D93A67 /* RCTConvert+Transform.h in Headers */, - 134D63C41F1FEC65008872B5 /* RCTCxxBridgeDelegate.h in Headers */, - 3D302F841DF828F800D6DDAE /* RCTPointerEvents.h in Headers */, - 59EB6DBC1EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.h in Headers */, - 657734941EE8356100A0E9EA /* RCTInspectorPackagerConnection.h in Headers */, - 3D302F851DF828F800D6DDAE /* RCTProgressViewManager.h in Headers */, - 3D302F861DF828F800D6DDAE /* RCTRefreshControl.h in Headers */, - EBF21BBE1FC498630052F4D5 /* InspectorInterfaces.h in Headers */, - C654505F1F3BD9280090799B /* RCTManagedPointer.h in Headers */, - 3D302F871DF828F800D6DDAE /* RCTRefreshControlManager.h in Headers */, - A2440AA41DF8D865006E7BFC /* RCTReloadCommand.h in Headers */, - 3D302F881DF828F800D6DDAE /* RCTRootShadowView.h in Headers */, - CF2731C21E7B8DEF0044CA4F /* RCTDeviceInfo.h in Headers */, - 599FAA371FB274980058CCF6 /* RCTSurface.h in Headers */, - 3D302F8C1DF828F800D6DDAE /* RCTSegmentedControl.h in Headers */, - 66CD94B21F1045E700CB3C7C /* RCTMaskedView.h in Headers */, - 3D302F8D1DF828F800D6DDAE /* RCTSegmentedControlManager.h in Headers */, - 3D302F8E1DF828F800D6DDAE /* RCTShadowView.h in Headers */, - 59E604A11FE9CCE300BD90C5 /* RCTScrollContentShadowView.h in Headers */, - 3D302F8F1DF828F800D6DDAE /* RCTSlider.h in Headers */, - 3D302F901DF828F800D6DDAE /* RCTSliderManager.h in Headers */, - 3D302F911DF828F800D6DDAE /* RCTSwitch.h in Headers */, - 3D302F921DF828F800D6DDAE /* RCTSwitchManager.h in Headers */, - 59EDBCAE1FDF4E0C003573DE /* RCTScrollContentView.h in Headers */, - 59E604A71FE9CCE300BD90C5 /* RCTScrollContentViewManager.h in Headers */, - 3D302F971DF828F800D6DDAE /* RCTTextDecorationLineType.h in Headers */, - 3D302F981DF828F800D6DDAE /* RCTView.h in Headers */, - 3D302F9A1DF828F800D6DDAE /* RCTViewManager.h in Headers */, - 3D302F9D1DF828F800D6DDAE /* RCTWrapperViewController.h in Headers */, - 3D302F9F1DF828F800D6DDAE /* UIView+React.h in Headers */, - 599FAA471FB274980058CCF6 /* RCTSurfaceStage.h in Headers */, - 13134CA11E296B2A00B9F3CB /* RCTCxxUtils.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D30301C1DF8292200D6DDAE /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - AC52CEE021FB403B003C6BEC /* instrumentation.h in Headers */, - AC90463F21C91D02005B24B3 /* CompactValue.h in Headers */, - AC6B69E821B146C500B2B68A /* YGValue.h in Headers */, - AC8360D221B025EF00FC46B9 /* YGConfig.h in Headers */, - AC8360CE21B0256A00FC46B9 /* YGMarker.h in Headers */, - 5352C5782038FF9B00A3B97E /* YGStyle.h in Headers */, - 53EC85E41FDEC7630051B2B5 /* YGNode.h in Headers */, - 53D1239F1FBF1EFB001B8A10 /* Yoga-internal.h in Headers */, - 3DFE0D161DF8574D00459392 /* YGEnums.h in Headers */, - 3DFE0D171DF8574D00459392 /* YGMacros.h in Headers */, - 53756E3D2004FFFE00FBBD99 /* Utils.h in Headers */, - 5376C5E71FC6DDC20083513D /* YGNodePrint.h in Headers */, - 3DFE0D191DF8574D00459392 /* Yoga.h in Headers */, - 53438965203905C0008E0CB3 /* YGLayout.h in Headers */, - 53DEF6ED205AE5A7006A3890 /* YGFloatOptional.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D3030211DF8294400D6DDAE /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 13DA8A322097A90B00276ED4 /* ReactMarker.h in Headers */, - 3D74547E1E54759A00E74ADD /* JSModulesUnbundle.h in Headers */, - C6D3801B1F71D76200621378 /* RAMBundleRegistry.h in Headers */, - 27595AD51E575C7800CCE2B1 /* NativeToJsBridge.h in Headers */, - 27595AC41E575C7800CCE2B1 /* Instance.h in Headers */, - 27595AD11E575C7800CCE2B1 /* MessageQueueThread.h in Headers */, - 3D7454811E5475AF00E74ADD /* RecoverableError.h in Headers */, - 27595AC51E575C7800CCE2B1 /* JsArgumentHelpers-inl.h in Headers */, - 27595AD81E575C7800CCE2B1 /* SystraceSection.h in Headers */, - 27595AC61E575C7800CCE2B1 /* JsArgumentHelpers.h in Headers */, - 27595AD71E575C7800CCE2B1 /* SampleCxxModule.h in Headers */, - 27595AD21E575C7800CCE2B1 /* MethodCall.h in Headers */, - 3D3030221DF8294C00D6DDAE /* JSBundleType.h in Headers */, - 3D74547D1E54758900E74ADD /* JSBigString.h in Headers */, - 27595ABF1E575C7800CCE2B1 /* CxxModule.h in Headers */, - 27595AD41E575C7800CCE2B1 /* NativeModule.h in Headers */, - 27595AC01E575C7800CCE2B1 /* CxxNativeModule.h in Headers */, - 27595AD01E575C7800CCE2B1 /* JSIndexedRAMBundle.h in Headers */, - 27595AD31E575C7800CCE2B1 /* ModuleRegistry.h in Headers */, - 27595AC11E575C7800CCE2B1 /* JSExecutor.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D383D541EBD27B9005632C8 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 3D383D551EBD27B9005632C8 /* bignum-dtoa.h in Headers */, - 3D383D561EBD27B9005632C8 /* bignum.h in Headers */, - 3D383D571EBD27B9005632C8 /* cached-powers.h in Headers */, - 3D383D581EBD27B9005632C8 /* diy-fp.h in Headers */, - 3D383D591EBD27B9005632C8 /* double-conversion.h in Headers */, - 3D383D5A1EBD27B9005632C8 /* fast-dtoa.h in Headers */, - 3D383D5B1EBD27B9005632C8 /* fixed-dtoa.h in Headers */, - 3D383D5C1EBD27B9005632C8 /* ieee.h in Headers */, - 3D383D5D1EBD27B9005632C8 /* strtod.h in Headers */, - 3D383D5E1EBD27B9005632C8 /* utils.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D3C04BB1DE3340900C268FA /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - AC52CEDF21FB401D003C6BEC /* instrumentation.h in Headers */, - AC90464021C91D14005B24B3 /* CompactValue.h in Headers */, - AC6B69E521B1469A00B2B68A /* YGValue.h in Headers */, - AC8360CF21B0258B00FC46B9 /* YGConfig.h in Headers */, - AC8360CD21B0256A00FC46B9 /* YGMarker.h in Headers */, - 5352C5772038FF9A00A3B97E /* YGStyle.h in Headers */, - 53EC85E51FDEC7630051B2B5 /* YGNode.h in Headers */, - 53D1239E1FBF1EFB001B8A10 /* Yoga-internal.h in Headers */, - 133957881DF76D3500EC27BE /* YGEnums.h in Headers */, - 1339578B1DF76D3500EC27BE /* Yoga.h in Headers */, - 53756E3C2004FFFC00FBBD99 /* Utils.h in Headers */, - 5376C5E61FC6DDC10083513D /* YGNodePrint.h in Headers */, - 133957891DF76D3500EC27BE /* YGMacros.h in Headers */, - 53438964203905BF008E0CB3 /* YGLayout.h in Headers */, - 53DEF6EC205AE5A6006A3890 /* YGFloatOptional.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D3CD91A1DE5FBEC00167DC4 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 13DA8A312097A90B00276ED4 /* ReactMarker.h in Headers */, - 3D74547F1E54759E00E74ADD /* JSModulesUnbundle.h in Headers */, - C6D3801A1F71D76100621378 /* RAMBundleRegistry.h in Headers */, - 27595ABA1E575C7800CCE2B1 /* NativeToJsBridge.h in Headers */, - 27595AA91E575C7800CCE2B1 /* Instance.h in Headers */, - 27595AB61E575C7800CCE2B1 /* MessageQueueThread.h in Headers */, - 3D7454801E5475AF00E74ADD /* RecoverableError.h in Headers */, - 27595AAA1E575C7800CCE2B1 /* JsArgumentHelpers-inl.h in Headers */, - 27595ABD1E575C7800CCE2B1 /* SystraceSection.h in Headers */, - 27595AAB1E575C7800CCE2B1 /* JsArgumentHelpers.h in Headers */, - 27595ABC1E575C7800CCE2B1 /* SampleCxxModule.h in Headers */, - 27595AB71E575C7800CCE2B1 /* MethodCall.h in Headers */, - 3D74547C1E54758900E74ADD /* JSBigString.h in Headers */, - 27595AA41E575C7800CCE2B1 /* CxxModule.h in Headers */, - 27595AB91E575C7800CCE2B1 /* NativeModule.h in Headers */, - 3D3CD9451DE5FC7100167DC4 /* JSBundleType.h in Headers */, - 27595AA51E575C7800CCE2B1 /* CxxNativeModule.h in Headers */, - 27595AB51E575C7800CCE2B1 /* JSIndexedRAMBundle.h in Headers */, - 27595AB81E575C7800CCE2B1 /* ModuleRegistry.h in Headers */, - 27595AA61E575C7800CCE2B1 /* JSExecutor.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D80DA181DF820500028D040 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 3D80DA191DF820620028D040 /* RCTImageLoader.h in Headers */, - C654505E1F3BD9280090799B /* RCTManagedPointer.h in Headers */, - 13134C941E296B2A00B9F3CB /* RCTObjcExecutor.h in Headers */, - 199B8A6F1F44DB16005DEF67 /* RCTVersion.h in Headers */, - 3D80DA1A1DF820620028D040 /* RCTImageStoreManager.h in Headers */, - 130443A11E3FEAA900D93A67 /* RCTFollyConvert.h in Headers */, - 3D80DA1B1DF820620028D040 /* RCTResizeMode.h in Headers */, - 3D80DA1C1DF820620028D040 /* RCTLinkingManager.h in Headers */, - 3D80DA1D1DF820620028D040 /* RCTNetworking.h in Headers */, - 3D80DA1E1DF820620028D040 /* RCTNetworkTask.h in Headers */, - 657734841EE834C900A0E9EA /* RCTInspectorDevServerHelper.h in Headers */, - 3D80DA1F1DF820620028D040 /* RCTPushNotificationManager.h in Headers */, - 3D80DA201DF820620028D040 /* RCTAssert.h in Headers */, - 3D80DA211DF820620028D040 /* RCTBridge.h in Headers */, - 3D80DA221DF820620028D040 /* RCTBridge+Private.h in Headers */, - 599FAA461FB274980058CCF6 /* RCTSurfaceStage.h in Headers */, - 599FAA361FB274980058CCF6 /* RCTSurface.h in Headers */, - 3D80DA231DF820620028D040 /* RCTBridgeDelegate.h in Headers */, - 3D80DA241DF820620028D040 /* RCTBridgeMethod.h in Headers */, - 3D7BFD151EA8E351008DFB7A /* RCTPackagerClient.h in Headers */, - 3D80DA251DF820620028D040 /* RCTBridgeModule.h in Headers */, - 3D80DA261DF820620028D040 /* RCTBundleURLProvider.h in Headers */, - 599FAA401FB274980058CCF6 /* RCTSurfaceRootShadowViewDelegate.h in Headers */, - 5960C1B51F0804A00066FD5B /* RCTLayoutAnimation.h in Headers */, - 3D80DA271DF820620028D040 /* RCTConvert.h in Headers */, - 3D80DA281DF820620028D040 /* RCTDefines.h in Headers */, - 3D80DA291DF820620028D040 /* RCTDisplayLink.h in Headers */, - 597633381F4E021D005BE8A4 /* RCTShadowView+Internal.h in Headers */, - 3D80DA2A1DF820620028D040 /* RCTErrorCustomizer.h in Headers */, - 3D80DA2B1DF820620028D040 /* RCTErrorInfo.h in Headers */, - 1384E2081E806D4E00545659 /* RCTNativeModule.h in Headers */, - 50E98FED21460B0D00CD9289 /* RCTWKWebViewManager.h in Headers */, - 3D7BFD2D1EA8E3FA008DFB7A /* RCTReconnectingWebSocket.h in Headers */, - 3D80DA2C1DF820620028D040 /* RCTEventDispatcher.h in Headers */, - 3D80DA2D1DF820620028D040 /* RCTFrameUpdate.h in Headers */, - 59EDBCA91FDF4E0C003573DE /* (null) in Headers */, - 3D80DA2E1DF820620028D040 /* RCTImageSource.h in Headers */, - 3D80DA2F1DF820620028D040 /* RCTInvalidating.h in Headers */, - 598FD1971F817336006C54CB /* RCTModalManager.h in Headers */, - 599FAA3A1FB274980058CCF6 /* RCTSurfaceDelegate.h in Headers */, - 3D80DA301DF820620028D040 /* RCTJavaScriptExecutor.h in Headers */, - 3DCE53281FEAB23100613583 /* RCTDatePicker.h in Headers */, - 50E98FEB21460B0D00CD9289 /* RCTWKWebView.h in Headers */, - 3D80DA311DF820620028D040 /* RCTJavaScriptLoader.h in Headers */, - 130E3D881E6A082100ACE484 /* RCTDevSettings.h in Headers */, - 3D80DA321DF820620028D040 /* RCTJSStackFrame.h in Headers */, - 130443DC1E401AF400D93A67 /* RCTConvert+Transform.h in Headers */, - 3D80DA331DF820620028D040 /* RCTKeyCommands.h in Headers */, - 3D80DA341DF820620028D040 /* RCTLog.h in Headers */, - 3D80DA351DF820620028D040 /* RCTModuleData.h in Headers */, - 3D80DA361DF820620028D040 /* RCTModuleMethod.h in Headers */, - 3D80DA371DF820620028D040 /* RCTMultipartDataTask.h in Headers */, - 3D80DA381DF820620028D040 /* RCTMultipartStreamReader.h in Headers */, - 594F0A361FD23228007FBE96 /* RCTSurfaceSizeMeasureMode.h in Headers */, - 3D80DA391DF820620028D040 /* RCTNullability.h in Headers */, - 3D80DA3A1DF820620028D040 /* RCTParserUtils.h in Headers */, - 59EDBCB11FDF4E0C003573DE /* (null) in Headers */, - 599FAA421FB274980058CCF6 /* RCTSurfaceRootView.h in Headers */, - 59D031F91F8353D3008361F0 /* RCTSafeAreaViewManager.h in Headers */, - 3D80DA3B1DF820620028D040 /* RCTPerformanceLogger.h in Headers */, - 59D031F51F8353D3008361F0 /* RCTSafeAreaViewLocalData.h in Headers */, - 3D80DA3C1DF820620028D040 /* RCTPlatform.h in Headers */, - 3D80DA3D1DF820620028D040 /* RCTRootView.h in Headers */, - 59EDBCB91FDF4E0C003573DE /* RCTScrollViewManager.h in Headers */, - 59EDBCB51FDF4E0C003573DE /* RCTScrollView.h in Headers */, - 3D80DA3E1DF820620028D040 /* RCTRootViewDelegate.h in Headers */, - 3D80DA3F1DF820620028D040 /* RCTRootViewInternal.h in Headers */, - 3D80DA401DF820620028D040 /* RCTTouchEvent.h in Headers */, - AC90463E21C91CC2005B24B3 /* CompactValue.h in Headers */, - 3D80DA411DF820620028D040 /* RCTTouchHandler.h in Headers */, - 59E604A61FE9CCE300BD90C5 /* RCTScrollContentViewManager.h in Headers */, - 13134C8C1E296B2A00B9F3CB /* RCTMessageThread.h in Headers */, - 59EB6DBB1EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.h in Headers */, - 3D80DA421DF820620028D040 /* RCTURLRequestDelegate.h in Headers */, - 3D80DA431DF820620028D040 /* RCTURLRequestHandler.h in Headers */, - 3D80DA441DF820620028D040 /* RCTUtils.h in Headers */, - 13134C981E296B2A00B9F3CB /* RCTCxxMethod.h in Headers */, - 3D80DA4A1DF820620028D040 /* RCTAccessibilityManager.h in Headers */, - 3D80DA4B1DF820620028D040 /* RCTAlertManager.h in Headers */, - 3D80DA4C1DF820620028D040 /* RCTAppState.h in Headers */, - 3D80DA4D1DF820620028D040 /* RCTAsyncLocalStorage.h in Headers */, - 3D80DA4E1DF820620028D040 /* RCTClipboard.h in Headers */, - 3D80DA4F1DF820620028D040 /* RCTDevLoadingView.h in Headers */, - 3D80DA501DF820620028D040 /* RCTDevMenu.h in Headers */, - 3D80DA511DF820620028D040 /* RCTEventEmitter.h in Headers */, - 59A7B9FD1E577DBF0068EDBF /* RCTRootContentView.h in Headers */, - 3D80DA521DF820620028D040 /* RCTExceptionsManager.h in Headers */, - 3DCE532A1FEAB23100613583 /* RCTDatePickerManager.h in Headers */, - 3D80DA531DF820620028D040 /* RCTI18nManager.h in Headers */, - 3D7BFD2F1EA8E3FA008DFB7A /* RCTSRWebSocket.h in Headers */, - 3D80DA541DF820620028D040 /* RCTI18nUtil.h in Headers */, - 3D80DA551DF820620028D040 /* RCTKeyboardObserver.h in Headers */, - 3D80DA561DF820620028D040 /* RCTRedBox.h in Headers */, - AC6B69E421B1467C00B2B68A /* YGValue.h in Headers */, - 3D80DA571DF820620028D040 /* RCTSourceCode.h in Headers */, - EBF21BBC1FC498270052F4D5 /* InspectorInterfaces.h in Headers */, - AC52CEDE21FB3FF9003C6BEC /* instrumentation.h in Headers */, - 3D80DA581DF820620028D040 /* RCTStatusBarManager.h in Headers */, - 3D80DA591DF820620028D040 /* RCTTiming.h in Headers */, - 3D80DA5A1DF820620028D040 /* RCTUIManager.h in Headers */, - 3D80DA5B1DF820620028D040 /* RCTFPSGraph.h in Headers */, - FEFAAC9F1FDB89B50057BBE0 /* RCTRedBoxExtraDataViewController.h in Headers */, - 59E604A01FE9CCE300BD90C5 /* RCTScrollContentShadowView.h in Headers */, - 3D80DA5D1DF820620028D040 /* RCTMacros.h in Headers */, - 3D80DA5E1DF820620028D040 /* RCTProfile.h in Headers */, - 3D80DA5F1DF820620028D040 /* RCTActivityIndicatorView.h in Headers */, - 3D80DA601DF820620028D040 /* RCTActivityIndicatorViewManager.h in Headers */, - 59500D431F71C63F00B122B7 /* RCTUIManagerUtils.h in Headers */, - 5960C1B91F0804A00066FD5B /* RCTLayoutAnimationGroup.h in Headers */, - CF2731C01E7B8DE40044CA4F /* RCTDeviceInfo.h in Headers */, - 3D80DA611DF820620028D040 /* RCTAnimationType.h in Headers */, - 3D0E378A1F1CC40000DCAC9F /* RCTWebSocketModule.h in Headers */, - 3D80DA621DF820620028D040 /* RCTAutoInsetsProtocol.h in Headers */, - C60128AB1F3D1258009DF9FF /* RCTCxxConvert.h in Headers */, - 59EDBCAD1FDF4E0C003573DE /* RCTScrollContentView.h in Headers */, - 59EDBCA71FDF4E0C003573DE /* RCTScrollableProtocol.h in Headers */, - 591F78DC202ADB22004A668C /* RCTLayout.h in Headers */, - 5CE2080320772F7D009A43B3 /* YGConfig.h in Headers */, - 3D80DA631DF820620028D040 /* RCTBorderDrawing.h in Headers */, - 3D80DA641DF820620028D040 /* RCTBorderStyle.h in Headers */, - 3D80DA651DF820620028D040 /* RCTComponent.h in Headers */, - 3D80DA661DF820620028D040 /* RCTComponentData.h in Headers */, - 3DA9819E1E5B0DBB004F2374 /* NSDataBigString.h in Headers */, - 59D031F11F8353D3008361F0 /* RCTSafeAreaView.h in Headers */, - 3D80DA671DF820620028D040 /* RCTConvert+CoreLocation.h in Headers */, - 66CD94B11F1045E700CB3C7C /* RCTMaskedView.h in Headers */, - 3D80DA6B1DF820620028D040 /* RCTFont.h in Headers */, - 3D80DA701DF820620028D040 /* RCTModalHostView.h in Headers */, - 3D80DA711DF820620028D040 /* RCTModalHostViewController.h in Headers */, - 3D80DA721DF820620028D040 /* RCTModalHostViewManager.h in Headers */, - 13134C9C1E296B2A00B9F3CB /* RCTCxxModule.h in Headers */, - 594F0A321FD23228007FBE96 /* RCTSurfaceHostingView.h in Headers */, - 3D80DA771DF820620028D040 /* RCTPicker.h in Headers */, - 3D80DA781DF820620028D040 /* RCTPickerManager.h in Headers */, - 3D80DA791DF820620028D040 /* RCTPointerEvents.h in Headers */, - 3D80DA7A1DF820620028D040 /* RCTProgressViewManager.h in Headers */, - 3D80DA7B1DF820620028D040 /* RCTRefreshControl.h in Headers */, - A2440AA21DF8D854006E7BFC /* RCTReloadCommand.h in Headers */, - 3D80DA7C1DF820620028D040 /* RCTRefreshControlManager.h in Headers */, - 59D031ED1F8353D3008361F0 /* RCTSafeAreaShadowView.h in Headers */, - 3D80DA7D1DF820620028D040 /* RCTRootShadowView.h in Headers */, - 134D63C31F1FEC4B008872B5 /* RCTCxxBridgeDelegate.h in Headers */, - 657734901EE8354A00A0E9EA /* RCTInspectorPackagerConnection.h in Headers */, - 3D7BFD1D1EA8E351008DFB7A /* RCTPackagerConnection.h in Headers */, - 3D80DA811DF820620028D040 /* RCTSegmentedControl.h in Headers */, - 599FAA3C1FB274980058CCF6 /* RCTSurfaceRootShadowView.h in Headers */, - 3D80DA821DF820620028D040 /* RCTSegmentedControlManager.h in Headers */, - 3D80DA831DF820620028D040 /* RCTShadowView.h in Headers */, - 3D80DA841DF820620028D040 /* RCTSlider.h in Headers */, - 3D80DA851DF820620028D040 /* RCTSliderManager.h in Headers */, - 3D80DA861DF820620028D040 /* RCTSwitch.h in Headers */, - 3D80DA871DF820620028D040 /* RCTSwitchManager.h in Headers */, - 66CD94B51F1045E700CB3C7C /* RCTMaskedViewManager.h in Headers */, - 3D80DA8C1DF820620028D040 /* RCTTextDecorationLineType.h in Headers */, - 6577348E1EE8354A00A0E9EA /* RCTInspector.h in Headers */, - 3D80DA8D1DF820620028D040 /* RCTView.h in Headers */, - 8507BBC021EDACC200AEAFCA /* JSCExecutorFactory.h in Headers */, - 590D7BFD1EBD458B00D8A370 /* RCTShadowView+Layout.h in Headers */, - 3D80DA8F1DF820620028D040 /* RCTViewManager.h in Headers */, - 13134CA01E296B2A00B9F3CB /* RCTCxxUtils.h in Headers */, - 599FAA4A1FB274980058CCF6 /* RCTSurfaceView.h in Headers */, - 3D80DA901DF820620028D040 /* RCTWebView.h in Headers */, - 3D80DA911DF820620028D040 /* RCTWebViewManager.h in Headers */, - 3D80DA921DF820620028D040 /* RCTWrapperViewController.h in Headers */, - 3D80DA931DF820620028D040 /* UIView+Private.h in Headers */, - 3D80DA941DF820620028D040 /* UIView+React.h in Headers */, - 599FAA481FB274980058CCF6 /* RCTSurfaceView+Internal.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EBF21BC41FC498900052F4D5 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EBF21BE21FC4989A0052F4D5 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - ED296F99214C9A0900B7C4FE /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ED296FBC214C9B0400B7C4FE /* jsi-inl.h in Headers */, - ED296FBF214C9B0400B7C4FE /* JSIDynamic.h in Headers */, - ED296FC1214C9B0400B7C4FE /* JSCRuntime.h in Headers */, - ED296FC3214C9B0400B7C4FE /* instrumentation.h in Headers */, - ED296FC4214C9B0400B7C4FE /* jsi.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - ED296FD1214C9CF800B7C4FE /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ED61896C2155BBF70000C9A7 /* JSINativeModules.h in Headers */, - ED61896A2155BBF70000C9A7 /* JSIExecutor.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - ED2970382150123E00B7C4FE /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ED29703E2150126E00B7C4FE /* AtomicIntrusiveLinkedList.h in Headers */, - ED2970422150126E00B7C4FE /* Conv.h in Headers */, - ED2970432150126E00B7C4FE /* dynamic-inl.h in Headers */, - ED2970452150126E00B7C4FE /* dynamic.h in Headers */, - ED2970462150126E00B7C4FE /* Exception.h in Headers */, - ED2970482150126E00B7C4FE /* json.h in Headers */, - ED2970492150126E00B7C4FE /* Memory.h in Headers */, - ED29704A2150126E00B7C4FE /* MoveWrapper.h in Headers */, - ED29704B2150126E00B7C4FE /* Optional.h in Headers */, - ED29704C2150126E00B7C4FE /* ScopeGuard.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EDEBC6BB214B3E7000DD5AC8 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - EDEBC6E9214B3F6800DD5AC8 /* jsi.h in Headers */, - EDEBC6E7214B3F6800DD5AC8 /* JSCRuntime.h in Headers */, - EDEBC6E5214B3F6800DD5AC8 /* JSIDynamic.h in Headers */, - EDEBC6E2214B3F6800DD5AC8 /* jsi-inl.h in Headers */, - EDEBC6E8214B3F6800DD5AC8 /* instrumentation.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EDEBC729214B45A300DD5AC8 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ED61896B2155BBF70000C9A7 /* JSINativeModules.h in Headers */, - ED6189692155BBF70000C9A7 /* JSIExecutor.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 139D7E871E25C6D100323FB7 /* double-conversion */ = { - isa = PBXNativeTarget; - buildConfigurationList = 139D7E8E1E25C6D100323FB7 /* Build configuration list for PBXNativeTarget "double-conversion" */; - buildPhases = ( - 190EE32F1E6A43DE00A8543A /* Install Third Party */, - 139D7EA41E25C7BD00323FB7 /* Headers */, - 139D7E841E25C6D100323FB7 /* Sources */, - 139D7E861E25C6D100323FB7 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "double-conversion"; - productName = ThirdParty; - productReference = 139D7E881E25C6D100323FB7 /* libdouble-conversion.a */; - productType = "com.apple.product-type.library.static"; - }; - 139D7ECD1E25DB7D00323FB7 /* third-party */ = { - isa = PBXNativeTarget; - buildConfigurationList = 139D7ED41E25DB7D00323FB7 /* Build configuration list for PBXNativeTarget "third-party" */; - buildPhases = ( - 139D7ECA1E25DB7D00323FB7 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - 1320081D1E283DCB00F0C457 /* PBXTargetDependency */, - ); - name = "third-party"; - productName = "third-party"; - productReference = 139D7ECE1E25DB7D00323FB7 /* libthird-party.a */; - productType = "com.apple.product-type.library.static"; - }; - 2D2A28121D9B038B00D4039D /* React-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D2A281B1D9B038B00D4039D /* Build configuration list for PBXNativeTarget "React-tvOS" */; - buildPhases = ( - 2D6948301DA3088700B3FA97 /* Start Packager */, - 3D302F231DF828D100D6DDAE /* Headers */, - 3D302E191DF8249100D6DDAE /* Copy Headers */, - 2D2A280F1D9B038B00D4039D /* Sources */, - 2D6948201DA3042200B3FA97 /* Include RCTJSCProfiler */, - 3D3C088B1DE342FE00C268FA /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ED2970662150237300B7C4FE /* PBXTargetDependency */, - ED296FCA214C9B6200B7C4FE /* PBXTargetDependency */, - ED296F81214C971800B7C4FE /* PBXTargetDependency */, - 3D0574551DE5FF9600184BB4 /* PBXTargetDependency */, - 3D0574571DE5FF9600184BB4 /* PBXTargetDependency */, - ); - name = "React-tvOS"; - productName = "React-tvOS"; - productReference = 2D2A28131D9B038B00D4039D /* libReact.a */; - productType = "com.apple.product-type.library.static"; - }; - 3D383D211EBD27B6005632C8 /* third-party-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3D383D391EBD27B6005632C8 /* Build configuration list for PBXNativeTarget "third-party-tvOS" */; - buildPhases = ( - 3D383D241EBD27B6005632C8 /* Sources */, - ED2970382150123E00B7C4FE /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - 3D383D661EBD27DB005632C8 /* PBXTargetDependency */, - ); - name = "third-party-tvOS"; - productName = "third-party"; - productReference = 3D383D3C1EBD27B6005632C8 /* libthird-party.a */; - productType = "com.apple.product-type.library.static"; - }; - 3D383D3D1EBD27B9005632C8 /* double-conversion-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3D383D5F1EBD27B9005632C8 /* Build configuration list for PBXNativeTarget "double-conversion-tvOS" */; - buildPhases = ( - 3D383D3E1EBD27B9005632C8 /* Install Third Party */, - 3D383D541EBD27B9005632C8 /* Headers */, - 3D383D3F1EBD27B9005632C8 /* Sources */, - 3D383D491EBD27B9005632C8 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "double-conversion-tvOS"; - productName = ThirdParty; - productReference = 3D383D621EBD27B9005632C8 /* libdouble-conversion.a */; - productType = "com.apple.product-type.library.static"; - }; - 3D3C04B91DE3340900C268FA /* yoga */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3D3C05971DE3340900C268FA /* Build configuration list for PBXNativeTarget "yoga" */; - buildPhases = ( - 3D3C04BB1DE3340900C268FA /* Headers */, - 3D80DAB41DF8212E0028D040 /* Copy Headers */, - 3D3C05301DE3340900C268FA /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = yoga; - productName = React; - productReference = 3D3C059A1DE3340900C268FA /* libyoga.a */; - productType = "com.apple.product-type.library.static"; - }; - 3D3C059B1DE3340C00C268FA /* yoga-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3D3C06721DE3340C00C268FA /* Build configuration list for PBXNativeTarget "yoga-tvOS" */; - buildPhases = ( - 3D30301C1DF8292200D6DDAE /* Headers */, - 3D302F171DF825FE00D6DDAE /* Copy Headers */, - 3D3C06181DE3340C00C268FA /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "yoga-tvOS"; - productName = "React-tvOS"; - productReference = 3D3C06751DE3340C00C268FA /* libyoga.a */; - productType = "com.apple.product-type.library.static"; - }; - 3D3CD9191DE5FBEC00167DC4 /* cxxreact */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3D3CD9221DE5FBEC00167DC4 /* Build configuration list for PBXNativeTarget "cxxreact" */; - buildPhases = ( - 3D3CD91A1DE5FBEC00167DC4 /* Headers */, - 3D80DAB91DF821710028D040 /* Copy Headers */, - 3D3CD91F1DE5FBEC00167DC4 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - EDEBC7D7214C52FD00DD5AC8 /* PBXTargetDependency */, - ); - name = cxxreact; - productName = React; - productReference = 3D3CD9251DE5FBEC00167DC4 /* libcxxreact.a */; - productType = "com.apple.product-type.library.static"; - }; - 3D3CD9261DE5FBEE00167DC4 /* cxxreact-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3D3CD92F1DE5FBEE00167DC4 /* Build configuration list for PBXNativeTarget "cxxreact-tvOS" */; - buildPhases = ( - 3D3030211DF8294400D6DDAE /* Headers */, - 3D302F1B1DF8263300D6DDAE /* Copy Headers */, - 3D3CD92C1DE5FBEE00167DC4 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ED296F97214C996500B7C4FE /* PBXTargetDependency */, - ); - name = "cxxreact-tvOS"; - productName = "React-tvOS"; - productReference = 3D3CD9321DE5FBEE00167DC4 /* libcxxreact.a */; - productType = "com.apple.product-type.library.static"; - }; - 83CBBA2D1A601D0E00E9B192 /* React */ = { - isa = PBXNativeTarget; - buildConfigurationList = 83CBBA3F1A601D0F00E9B192 /* Build configuration list for PBXNativeTarget "React" */; - buildPhases = ( - - 3D80DA181DF820500028D040 /* Headers */, - 3D80D91E1DF6FA530028D040 /* Copy Headers */, - 83CBBA2A1A601D0E00E9B192 /* Sources */, - 142C4F7F1B582EA6001F0B58 /* Include RCTJSCProfiler */, - 3D3C08881DE342EE00C268FA /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - EDEBC74F214B477400DD5AC8 /* PBXTargetDependency */, - EDEBC7D9214C628300DD5AC8 /* PBXTargetDependency */, - EDEBC74B214B46A700DD5AC8 /* PBXTargetDependency */, - 53D123991FBF1E0C001B8A10 /* PBXTargetDependency */, - 3D3CD94C1DE5FCE700167DC4 /* PBXTargetDependency */, - ); - name = React; - productName = React; - productReference = 83CBBA2E1A601D0E00E9B192 /* libReact.a */; - productType = "com.apple.product-type.library.static"; - }; - EBF21BBF1FC498900052F4D5 /* jsinspector */ = { - isa = PBXNativeTarget; - buildConfigurationList = EBF21BD91FC498900052F4D5 /* Build configuration list for PBXNativeTarget "jsinspector" */; - buildPhases = ( - EBF21BC41FC498900052F4D5 /* Headers */, - EBF21BCB1FC498900052F4D5 /* Copy Headers */, - EBF21BD31FC498900052F4D5 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = jsinspector; - productName = React; - productReference = EBF21BDC1FC498900052F4D5 /* libjsinspector.a */; - productType = "com.apple.product-type.library.static"; - }; - EBF21BDD1FC4989A0052F4D5 /* jsinspector-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = EBF21BF71FC4989A0052F4D5 /* Build configuration list for PBXNativeTarget "jsinspector-tvOS" */; - buildPhases = ( - EBF21BE21FC4989A0052F4D5 /* Headers */, - EBF21BE91FC4989A0052F4D5 /* Copy Headers */, - EBF21BF11FC4989A0052F4D5 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "jsinspector-tvOS"; - productName = "React-tvOS"; - productReference = EBF21BFA1FC4989A0052F4D5 /* libjsinspector-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - ED296F98214C9A0900B7C4FE /* jsi-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = ED296FB3214C9A0900B7C4FE /* Build configuration list for PBXNativeTarget "jsi-tvOS" */; - buildPhases = ( - ED296F99214C9A0900B7C4FE /* Headers */, - ED296FA4214C9A0900B7C4FE /* Copy Headers */, - ED296FA9214C9A0900B7C4FE /* Sources */, - ED296FCE214C9CB400B7C4FE /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ED29704E215012C700B7C4FE /* PBXTargetDependency */, - ); - name = "jsi-tvOS"; - productName = "React-tvOS"; - productReference = ED296FB6214C9A0900B7C4FE /* libjsi-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - ED296FD0214C9CF800B7C4FE /* jsiexecutor-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = ED296FEB214C9CF800B7C4FE /* Build configuration list for PBXNativeTarget "jsiexecutor-tvOS" */; - buildPhases = ( - ED296FD1214C9CF800B7C4FE /* Headers */, - ED296FDC214C9CF800B7C4FE /* Copy Headers */, - ED296FE1214C9CF800B7C4FE /* Sources */, - ED296FF5214C9E7C00B7C4FE /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ED296FFE214C9EC600B7C4FE /* PBXTargetDependency */, - ED296FFC214C9EC000B7C4FE /* PBXTargetDependency */, - ED296FF8214C9EAA00B7C4FE /* PBXTargetDependency */, - ); - name = "jsiexecutor-tvOS"; - productName = "React-tvOS"; - productReference = ED296FEE214C9CF800B7C4FE /* libjsiexecutor-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - EDEBC6BA214B3E7000DD5AC8 /* jsi */ = { - isa = PBXNativeTarget; - buildConfigurationList = EDEBC6D3214B3E7000DD5AC8 /* Build configuration list for PBXNativeTarget "jsi" */; - buildPhases = ( - EDEBC6BB214B3E7000DD5AC8 /* Headers */, - EDEBC6C6214B3E7000DD5AC8 /* Copy Headers */, - EDEBC6CA214B3E7000DD5AC8 /* Sources */, - EDEBC756214C283300DD5AC8 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - EDEBC7CC214C516800DD5AC8 /* PBXTargetDependency */, - ); - name = jsi; - productName = React; - productReference = EDEBC6D6214B3E7000DD5AC8 /* libjsi.a */; - productType = "com.apple.product-type.library.static"; - }; - EDEBC724214B45A300DD5AC8 /* jsiexecutor */ = { - isa = PBXNativeTarget; - buildConfigurationList = EDEBC738214B45A300DD5AC8 /* Build configuration list for PBXNativeTarget "jsiexecutor" */; - buildPhases = ( - EDEBC729214B45A300DD5AC8 /* Headers */, - EDEBC72F214B45A300DD5AC8 /* Copy Headers */, - EDEBC734214B45A300DD5AC8 /* Sources */, - EDEBC79A214C2A7000DD5AC8 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ED296F7E214C957300B7C4FE /* PBXTargetDependency */, - EDEBC7D3214C528C00DD5AC8 /* PBXTargetDependency */, - EDEBC7CE214C523F00DD5AC8 /* PBXTargetDependency */, - ); - name = jsiexecutor; - productName = React; - productReference = EDEBC73B214B45A300DD5AC8 /* libjsiexecutor.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 83CBB9F71A601CBA00E9B192 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 139D7E871E25C6D100323FB7 = { - CreatedOnToolsVersion = 8.1; - }; - 139D7ECD1E25DB7D00323FB7 = { - CreatedOnToolsVersion = 8.1; - }; - 2D2A28121D9B038B00D4039D = { - CreatedOnToolsVersion = 8.0; - }; - 83CBBA2D1A601D0E00E9B192 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "React" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 83CBB9F61A601CBA00E9B192; - productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 83CBBA2D1A601D0E00E9B192 /* React */, - 2D2A28121D9B038B00D4039D /* React-tvOS */, - 3D3C04B91DE3340900C268FA /* yoga */, - 3D3C059B1DE3340C00C268FA /* yoga-tvOS */, - 3D3CD9191DE5FBEC00167DC4 /* cxxreact */, - 3D3CD9261DE5FBEE00167DC4 /* cxxreact-tvOS */, - EBF21BBF1FC498900052F4D5 /* jsinspector */, - EBF21BDD1FC4989A0052F4D5 /* jsinspector-tvOS */, - 139D7ECD1E25DB7D00323FB7 /* third-party */, - 3D383D211EBD27B6005632C8 /* third-party-tvOS */, - 139D7E871E25C6D100323FB7 /* double-conversion */, - 3D383D3D1EBD27B9005632C8 /* double-conversion-tvOS */, - EDEBC6BA214B3E7000DD5AC8 /* jsi */, - EDEBC724214B45A300DD5AC8 /* jsiexecutor */, - ED296F98214C9A0900B7C4FE /* jsi-tvOS */, - ED296FD0214C9CF800B7C4FE /* jsiexecutor-tvOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXShellScriptBuildPhase section */ - 006B79A01A781F38006873D1 /* Start Packager */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Start Packager"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; - showEnvVarsInLog = 0; - }; - 142C4F7F1B582EA6001F0B58 /* Include RCTJSCProfiler */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Include RCTJSCProfiler"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if [[ \"$CONFIGURATION\" == \"Debug\" ]] && [[ -d \"/tmp/RCTJSCProfiler\" ]]; then\n find \"${CONFIGURATION_BUILD_DIR}\" -name '*.app' | xargs -I{} sh -c 'cp -r /tmp/RCTJSCProfiler \"$1\"' -- {}\nfi\n"; - showEnvVarsInLog = 0; - }; - 190EE32F1E6A43DE00A8543A /* Install Third Party */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "../scripts/ios-install-third-party.sh", - ); - name = "Install Third Party"; - outputPaths = ( - "../third-party/glog-0.3.5/src/config.h", - "../third-party/glog-0.3.5/src/demangle.cc", - "../third-party/glog-0.3.5/src/demangle.h", - "../third-party/glog-0.3.5/src/logging.cc", - "../third-party/glog-0.3.5/src/raw_logging.cc", - "../third-party/glog-0.3.5/src/signalhandler.cc", - "../third-party/glog-0.3.5/src/stacktrace.h", - "../third-party/glog-0.3.5/src/symbolize.cc", - "../third-party/glog-0.3.5/src/symbolize.h", - "../third-party/glog-0.3.5/src/utilities.cc", - "../third-party/glog-0.3.5/src/utilities.h", - "../third-party/glog-0.3.5/src/vlog_is_on.cc", - "../third-party/glog-0.3.5/src/glog/log_severity.h", - "../third-party/glog-0.3.5/src/glog/logging.h", - "../third-party/glog-0.3.5/src/glog/raw_logging.h", - "../third-party/glog-0.3.5/src/glog/stl_logging.h", - "../third-party/glog-0.3.5/src/glog/vlog_is_on.h", - "../third-party/folly-2018.10.22.00/folly/memory/detail/MallocImpl.cpp", - "../third-party/folly-2018.10.22.00/folly/Demangle.cpp", - "../third-party/folly-2018.10.22.00/folly/Unicode.cpp", - "../third-party/folly-2018.10.22.00/folly/AtomicIntrusiveLinkedList.h", - "../third-party/folly-2018.10.22.00/folly/Conv.cpp", - "../third-party/folly-2018.10.22.00/folly/Conv.h", - "../third-party/folly-2018.10.22.00/folly/dynamic-inl.h", - "../third-party/folly-2018.10.22.00/folly/dynamic.cpp", - "../third-party/folly-2018.10.22.00/folly/dynamic.h", - "../third-party/folly-2018.10.22.00/folly/Exception.h", - "../third-party/folly-2018.10.22.00/folly/json.cpp", - "../third-party/folly-2018.10.22.00/folly/json.h", - "../third-party/folly-2018.10.22.00/folly/Memory.h", - "../third-party/folly-2018.10.22.00/folly/MoveWrapper.h", - "../third-party/folly-2018.10.22.00/folly/Optional.h", - "../third-party/folly-2018.10.22.00/folly/ScopeGuard.h", - "../third-party/folly-2018.10.22.00/folly/json_pointer.cpp", - "../third-party/folly-2018.10.22.00/folly/String.cpp", - "../third-party/folly-2018.10.22.00/folly/detail/Demangle.cpp", - "../third-party/folly-2018.10.22.00/folly/hash/SpookyHashV2.cpp", - "../third-party/folly-2018.10.22.00/folly/lang/ColdClass.cpp", - "../third-party/folly-2018.10.22.00/folly/container/detail/F14Table.cpp", - "../third-party/folly-2018.10.22.00/folly/ScopeGuard.cpp", - "../third-party/folly-2018.10.22.00/folly/lang/Assume.cpp", - "../third-party/folly-2018.10.22.00/folly/Format.cpp", - "../third-party/double-conversion-1.1.6/src/bignum-dtoa.cc", - "../third-party/double-conversion-1.1.6/src/bignum-dtoa.h", - "../third-party/double-conversion-1.1.6/src/bignum.cc", - "../third-party/double-conversion-1.1.6/src/bignum.h", - "../third-party/double-conversion-1.1.6/src/cached-powers.cc", - "../third-party/double-conversion-1.1.6/src/cached-powers.h", - "../third-party/double-conversion-1.1.6/src/diy-fp.cc", - "../third-party/double-conversion-1.1.6/src/diy-fp.h", - "../third-party/double-conversion-1.1.6/src/double-conversion.cc", - "../third-party/double-conversion-1.1.6/src/double-conversion.h", - "../third-party/double-conversion-1.1.6/src/fast-dtoa.cc", - "../third-party/double-conversion-1.1.6/src/fast-dtoa.h", - "../third-party/double-conversion-1.1.6/src/fixed-dtoa.cc", - "../third-party/double-conversion-1.1.6/src/fixed-dtoa.h", - "../third-party/double-conversion-1.1.6/src/ieee.h", - "../third-party/double-conversion-1.1.6/src/strtod.cc", - "../third-party/double-conversion-1.1.6/src/strtod.h", - "../third-party/double-conversion-1.1.6/src/utils.h", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "cd \"$SRCROOT/..\"\nexec ./scripts/ios-install-third-party.sh\n"; - }; - 2D6948201DA3042200B3FA97 /* Include RCTJSCProfiler */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Include RCTJSCProfiler"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if [[ \"$CONFIGURATION\" == \"Debug\" ]] && [[ -d \"/tmp/RCTJSCProfiler\" ]]; then\nfind \"${CONFIGURATION_BUILD_DIR}\" -name '*.app' | xargs -I{} sh -c 'cp -r /tmp/RCTJSCProfiler \"$1\"' -- {}\nfi"; - showEnvVarsInLog = 0; - }; - 2D6948301DA3088700B3FA97 /* Start Packager */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Start Packager"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\nif nc -w 5 -z localhost 8081 ; then\nif ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\necho \"Port 8081 already in use, packager is either not running or not running correctly\"\nexit 2\nfi\nelse\nopen \"$SRCROOT/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\nfi\nfi\n"; - showEnvVarsInLog = 0; - }; - 3D383D3E1EBD27B9005632C8 /* Install Third Party */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Install Third Party"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "cd \"$SRCROOT/..\"\nexec ./scripts/ios-install-third-party.sh"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 139D7E841E25C6D100323FB7 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 139D7E911E25C70B00323FB7 /* bignum-dtoa.cc in Sources */, - 139D7E931E25C70B00323FB7 /* bignum.cc in Sources */, - 139D7E951E25C70B00323FB7 /* cached-powers.cc in Sources */, - 139D7E971E25C70B00323FB7 /* diy-fp.cc in Sources */, - 139D7E991E25C70B00323FB7 /* double-conversion.cc in Sources */, - 139D7E9B1E25C70B00323FB7 /* fast-dtoa.cc in Sources */, - 139D7E9D1E25C70B00323FB7 /* fixed-dtoa.cc in Sources */, - 139D7EA01E25C70B00323FB7 /* strtod.cc in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 139D7ECA1E25DB7D00323FB7 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 139D84B01E273B5600323FB7 /* Conv.cpp in Sources */, - 139D7F031E25DE1100323FB7 /* raw_logging.cc in Sources */, - 83281387217EB73400574D55 /* String.cpp in Sources */, - 139D7F041E25DE1100323FB7 /* signalhandler.cc in Sources */, - 833D02BD217EBD2600A23750 /* Format.cpp in Sources */, - 83281390217EB76C00574D55 /* Demangle.cpp in Sources */, - 833D02BA217EBCFA00A23750 /* Assume.cpp in Sources */, - 139D84B11E273B5600323FB7 /* dynamic.cpp in Sources */, - 139D7F061E25DE1100323FB7 /* utilities.cc in Sources */, - 8328138D217EB75C00574D55 /* ColdClass.cpp in Sources */, - 139D7F051E25DE1100323FB7 /* symbolize.cc in Sources */, - 139D7F071E25DE1100323FB7 /* vlog_is_on.cc in Sources */, - 13F8875A1E2971D400C3C7A1 /* Unicode.cpp in Sources */, - 139D7F091E25DE3700323FB7 /* demangle.cc in Sources */, - 83281399217EB79D00574D55 /* ScopeGuard.cpp in Sources */, - 83281393217EB77D00574D55 /* SpookyHashV2.cpp in Sources */, - 13F887581E2971D400C3C7A1 /* Demangle.cpp in Sources */, - 139D7F021E25DE1100323FB7 /* logging.cc in Sources */, - 83281396217EB79000574D55 /* F14Table.cpp in Sources */, - 83281384217EB70900574D55 /* MallocImpl.cpp in Sources */, - 8328138A217EB74C00574D55 /* json_pointer.cpp in Sources */, - 139D84B31E273B5600323FB7 /* json.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D2A280F1D9B038B00D4039D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3DC159E41E83E1AE007B1282 /* RCTRootContentView.m in Sources */, - 3D80D91B1DF6F8200028D040 /* RCTPlatform.m in Sources */, - 2D0EB9F32021067800CAF88A /* RCTUIUtils.m in Sources */, - 2DD0EFE11DA84F2800B0C975 /* RCTStatusBarManager.m in Sources */, - 2D3B5EC91D9B095C00451313 /* RCTBorderDrawing.m in Sources */, - 66CD94B81F1045E700CB3C7C /* RCTMaskedViewManager.m in Sources */, - 2D3B5E991D9B089A00451313 /* RCTDisplayLink.m in Sources */, - 2D3B5EA11D9B08B600451313 /* RCTModuleData.mm in Sources */, - 3DCE52F41FEAB10D00613583 /* RCTRedBoxExtraDataViewController.m in Sources */, - 590D7C001EBD458B00D8A370 /* RCTShadowView+Layout.m in Sources */, - 2D3B5EAE1D9B08F800451313 /* RCTEventEmitter.m in Sources */, - 2D3B5ECA1D9B095F00451313 /* RCTComponentData.m in Sources */, - 2D3B5EA31D9B08BE00451313 /* RCTParserUtils.m in Sources */, - 59500D461F71C63F00B122B7 /* RCTUIManagerUtils.m in Sources */, - 599FAA4D1FB274980058CCF6 /* RCTSurfaceView.mm in Sources */, - 59EDBCB41FDF4E0C003573DE /* (null) in Sources */, - 2D3B5EA01D9B08B200451313 /* RCTLog.mm in Sources */, - 5960C1BC1F0804A00066FD5B /* RCTLayoutAnimationGroup.m in Sources */, - 2D3B5ECF1D9B096F00451313 /* RCTFont.mm in Sources */, - 2D3B5ED51D9B098000451313 /* RCTModalHostViewController.m in Sources */, - 39C50FFC2046EE3500CEE534 /* RCTVersion.m in Sources */, - 2D3B5EBC1D9B092600451313 /* RCTKeyboardObserver.m in Sources */, - 657734931EE8356100A0E9EA /* RCTInspector.mm in Sources */, - 59EB6DBE1EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.mm in Sources */, - 2D3B5E971D9B089000451313 /* RCTBridge.m in Sources */, - 2D3B5E9B1D9B08A000451313 /* RCTFrameUpdate.m in Sources */, - 2D3B5EE41D9B09BB00451313 /* RCTSegmentedControlManager.m in Sources */, - 59EDBCB81FDF4E0C003573DE /* RCTScrollView.m in Sources */, - 13134C9F1E296B2A00B9F3CB /* RCTCxxModule.mm in Sources */, - 2D3B5EE31D9B09B700451313 /* RCTSegmentedControl.m in Sources */, - 130443A41E3FEAC600D93A67 /* RCTFollyConvert.mm in Sources */, - 3D7BFD201EA8E351008DFB7A /* RCTPackagerConnection.mm in Sources */, - 59E604A51FE9CCE300BD90C5 /* RCTScrollContentShadowView.m in Sources */, - 5960C1B81F0804A00066FD5B /* RCTLayoutAnimation.m in Sources */, - 2D3B5EB71D9B091800451313 /* RCTRedBox.m in Sources */, - 3D7AA9C61E548CDD001955CF /* NSDataBigString.mm in Sources */, - 13134C8F1E296B2A00B9F3CB /* RCTMessageThread.mm in Sources */, - 2D3B5EAF1D9B08FB00451313 /* RCTAccessibilityManager.m in Sources */, - 2D3B5EF11D9B09E700451313 /* UIView+React.m in Sources */, - 2D3B5E931D9B087300451313 /* RCTErrorInfo.m in Sources */, - C60669371F3CCF1B00E67165 /* RCTManagedPointer.mm in Sources */, - 2D3B5EE01D9B09AD00451313 /* RCTRootShadowView.m in Sources */, - 2D3B5EBA1D9B092100451313 /* RCTI18nUtil.m in Sources */, - 2D3B5EB41D9B090A00451313 /* RCTDevLoadingView.m in Sources */, - 3D0B842C1EC0B4EA00B2BD8E /* RCTTVView.m in Sources */, - 2D3B5EEF1D9B09DC00451313 /* RCTViewManager.m in Sources */, - 13134C971E296B2A00B9F3CB /* RCTObjcExecutor.mm in Sources */, - 594F0A351FD23228007FBE96 /* RCTSurfaceHostingView.mm in Sources */, - 130E3D8B1E6A083900ACE484 /* RCTDevSettings.mm in Sources */, - 2D3B5E951D9B087C00451313 /* RCTAssert.m in Sources */, - 59D031F81F8353D3008361F0 /* RCTSafeAreaViewLocalData.m in Sources */, - 2D3B5EB61D9B091400451313 /* RCTExceptionsManager.m in Sources */, - 2D3B5ED41D9B097D00451313 /* RCTModalHostView.m in Sources */, - 599FAA391FB274980058CCF6 /* RCTSurface.mm in Sources */, - C606692F1F3CC60500E67165 /* RCTModuleMethod.mm in Sources */, - 2D3B5E9F1D9B08AF00451313 /* RCTKeyCommands.m in Sources */, - 2D3B5EA51D9B08C700451313 /* RCTRootView.m in Sources */, - 13134C871E296B2A00B9F3CB /* RCTCxxBridge.mm in Sources */, - CF2731C31E7B8DF30044CA4F /* RCTDeviceInfo.m in Sources */, - 599FAA3F1FB274980058CCF6 /* RCTSurfaceRootShadowView.m in Sources */, - 597633371F4E021D005BE8A4 /* RCTShadowView+Internal.m in Sources */, - 2D3B5EB11D9B090100451313 /* RCTAppState.m in Sources */, - 59E604A31FE9CCE300BD90C5 /* RCTScrollContentViewManager.m in Sources */, - 1384E20B1E806D5B00545659 /* RCTNativeModule.mm in Sources */, - 2D3B5EC21D9B093B00451313 /* RCTProfile.m in Sources */, - 2D3B5ECB1D9B096200451313 /* RCTConvert+CoreLocation.m in Sources */, - 2D3B5EEE1D9B09DA00451313 /* RCTView.m in Sources */, - 2D3B5E981D9B089500451313 /* RCTConvert.m in Sources */, - 3D7BFD181EA8E351008DFB7A /* RCTPackagerClient.m in Sources */, - 2D3B5EA71D9B08CE00451313 /* RCTTouchHandler.m in Sources */, - 8507BBBF21EDACC200AEAFCA /* JSCExecutorFactory.mm in Sources */, - 59D031F01F8353D3008361F0 /* RCTSafeAreaShadowView.m in Sources */, - 5925356B20084D0600DD584B /* RCTSurfaceSizeMeasureMode.mm in Sources */, - 3D05745A1DE5FFF500184BB4 /* RCTJavaScriptLoader.mm in Sources */, - 2D3B5EA41D9B08C200451313 /* RCTPerformanceLogger.m in Sources */, - 3DCE53251FEAB1E000613583 /* RCTShadowView.m in Sources */, - 2D3B5E9E1D9B08AD00451313 /* RCTJSStackFrame.m in Sources */, - 13134CA31E296B2A00B9F3CB /* RCTCxxUtils.mm in Sources */, - 59D031F41F8353D3008361F0 /* RCTSafeAreaView.m in Sources */, - 2D3B5E941D9B087900451313 /* RCTBundleURLProvider.m in Sources */, - 2D3B5EB81D9B091B00451313 /* RCTSourceCode.m in Sources */, - 591F78DB202ADB22004A668C /* RCTLayout.m in Sources */, - 2D3B5EB51D9B091100451313 /* RCTDevMenu.m in Sources */, - 59EDBCAC1FDF4E0C003573DE /* (null) in Sources */, - 2D3B5EBD1D9B092A00451313 /* RCTTiming.m in Sources */, - 2D3B5EA81D9B08D300451313 /* RCTUtils.m in Sources */, - 599FAA451FB274980058CCF6 /* RCTSurfaceRootView.mm in Sources */, - 2D3B5EC81D9B095800451313 /* RCTActivityIndicatorViewManager.m in Sources */, - 598FD1961F817335006C54CB /* RCTModalManager.m in Sources */, - 3DCD185D1DF978E7007FE5A1 /* RCTReloadCommand.m in Sources */, - 130443DB1E401ADD00D93A67 /* RCTConvert+Transform.m in Sources */, - 3D0B84301EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.m in Sources */, - 2D3B5EC61D9B095000451313 /* RCTProfileTrampoline-x86_64.S in Sources */, - 2D3B5EA61D9B08CA00451313 /* RCTTouchEvent.m in Sources */, - 2D8C2E331DA40441000EE098 /* RCTMultipartStreamReader.m in Sources */, - 59EDBCBC1FDF4E0C003573DE /* RCTScrollViewManager.m in Sources */, - 59EDBCB01FDF4E0C003573DE /* RCTScrollContentView.m in Sources */, - 2D3B5EF01D9B09E300451313 /* RCTWrapperViewController.m in Sources */, - 2D3B5EB01D9B08FE00451313 /* RCTAlertManager.m in Sources */, - 13134C9B1E296B2A00B9F3CB /* RCTCxxMethod.mm in Sources */, - 2D3B5E9C1D9B08A300451313 /* RCTImageSource.m in Sources */, - 2D3B5EC31D9B094800451313 /* RCTProfileTrampoline-arm.S in Sources */, - 3D0B842B1EC0B49400B2BD8E /* RCTTVRemoteHandler.m in Sources */, - 657734861EE834D900A0E9EA /* RCTInspectorDevServerHelper.mm in Sources */, - 66CD94B41F1045E700CB3C7C /* RCTMaskedView.m in Sources */, - 2D74EAFA1DAE9590003B751B /* RCTMultipartDataTask.m in Sources */, - 2D3B5EC51D9B094D00451313 /* RCTProfileTrampoline-i386.S in Sources */, - 657734951EE8356100A0E9EA /* RCTInspectorPackagerConnection.m in Sources */, - 59283CA11FD67321000EAAB9 /* RCTSurfaceStage.m in Sources */, - 2D3B5EC41D9B094B00451313 /* RCTProfileTrampoline-arm64.S in Sources */, - 2D3B5EBB1D9B092300451313 /* RCTI18nManager.m in Sources */, - 2D3B5EBE1D9B092D00451313 /* RCTUIManager.m in Sources */, - C60128AE1F3D1258009DF9FF /* RCTCxxConvert.m in Sources */, - 2D3B5EDD1D9B09A300451313 /* RCTProgressViewManager.m in Sources */, - 2D3B5EC11D9B093900451313 /* RCTFPSGraph.m in Sources */, - 2D3B5E9A1D9B089D00451313 /* RCTEventDispatcher.m in Sources */, - 2D3B5ED61D9B098400451313 /* RCTModalHostViewManager.m in Sources */, - 2D3B5EC71D9B095600451313 /* RCTActivityIndicatorView.m in Sources */, - 2D3B5EB21D9B090300451313 /* RCTAsyncLocalStorage.m in Sources */, - 59D031FC1F8353D3008361F0 /* RCTSafeAreaViewManager.m in Sources */, - 2D3B5EC01D9B093600451313 /* RCTPerfMonitor.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D383D241EBD27B6005632C8 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3D383D251EBD27B6005632C8 /* Conv.cpp in Sources */, - 3D383D271EBD27B6005632C8 /* raw_logging.cc in Sources */, - 83281388217EB73400574D55 /* String.cpp in Sources */, - 3D383D281EBD27B6005632C8 /* signalhandler.cc in Sources */, - 833D02BE217EBD2600A23750 /* Format.cpp in Sources */, - 83281391217EB76C00574D55 /* Demangle.cpp in Sources */, - 833D02BB217EBCFA00A23750 /* Assume.cpp in Sources */, - 3D383D291EBD27B6005632C8 /* dynamic.cpp in Sources */, - 3D383D2A1EBD27B6005632C8 /* utilities.cc in Sources */, - 8328138E217EB75C00574D55 /* ColdClass.cpp in Sources */, - 3D383D2D1EBD27B6005632C8 /* symbolize.cc in Sources */, - 3D383D2E1EBD27B6005632C8 /* vlog_is_on.cc in Sources */, - 3D383D2F1EBD27B6005632C8 /* Unicode.cpp in Sources */, - 3D383D301EBD27B6005632C8 /* demangle.cc in Sources */, - 8328139A217EB79D00574D55 /* ScopeGuard.cpp in Sources */, - 83281394217EB77D00574D55 /* SpookyHashV2.cpp in Sources */, - 3D383D311EBD27B6005632C8 /* Demangle.cpp in Sources */, - 3D383D331EBD27B6005632C8 /* logging.cc in Sources */, - 83281397217EB79000574D55 /* F14Table.cpp in Sources */, - 83281385217EB71200574D55 /* MallocImpl.cpp in Sources */, - 8328138B217EB74C00574D55 /* json_pointer.cpp in Sources */, - 3D383D341EBD27B6005632C8 /* json.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D383D3F1EBD27B9005632C8 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3D383D401EBD27B9005632C8 /* bignum-dtoa.cc in Sources */, - 3D383D411EBD27B9005632C8 /* bignum.cc in Sources */, - 3D383D421EBD27B9005632C8 /* cached-powers.cc in Sources */, - 3D383D431EBD27B9005632C8 /* diy-fp.cc in Sources */, - 3D383D441EBD27B9005632C8 /* double-conversion.cc in Sources */, - 3D383D451EBD27B9005632C8 /* fast-dtoa.cc in Sources */, - 3D383D461EBD27B9005632C8 /* fixed-dtoa.cc in Sources */, - 3D383D471EBD27B9005632C8 /* strtod.cc in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D3C05301DE3340900C268FA /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - AC4A6AFA21FB4EBF00FBEC39 /* YGMarker.cpp in Sources */, - AC6B69E721B146B400B2B68A /* YGValue.cpp in Sources */, - AC8360D121B025BC00FC46B9 /* YGConfig.cpp in Sources */, - 53D123A01FBF1EFF001B8A10 /* Yoga.cpp in Sources */, - 5352C5752038FF9500A3B97E /* YGStyle.cpp in Sources */, - 53EC85E21FDEC75F0051B2B5 /* YGNode.cpp in Sources */, - 53D1239A1FBF1EF2001B8A10 /* YGEnums.cpp in Sources */, - 53756E3B2004FFFA00FBBD99 /* Utils.cpp in Sources */, - 53438962203905BB008E0CB3 /* YGLayout.cpp in Sources */, - 5376C5E41FC6DDBC0083513D /* YGNodePrint.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D3C06181DE3340C00C268FA /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - AC4A6AFB21FB4ECA00FBEC39 /* YGMarker.cpp in Sources */, - AC6B69EA21B146E700B2B68A /* YGValue.cpp in Sources */, - BA0501B02109DD1800A6BBC4 /* YGConfig.cpp in Sources */, - 53D123A11FBF1EFF001B8A10 /* Yoga.cpp in Sources */, - 5352C5762038FF9700A3B97E /* YGStyle.cpp in Sources */, - 53EC85E31FDEC75F0051B2B5 /* YGNode.cpp in Sources */, - 53D1239B1FBF1EF4001B8A10 /* YGEnums.cpp in Sources */, - 53756E3E2005000300FBBD99 /* Utils.cpp in Sources */, - 53438963203905BC008E0CB3 /* YGLayout.cpp in Sources */, - 5376C5E51FC6DDBD0083513D /* YGNodePrint.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D3CD91F1DE5FBEC00167DC4 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3DC159E51E83E1E9007B1282 /* JSBigString.cpp in Sources */, - 13F8877B1E29726200C3C7A1 /* JSIndexedRAMBundle.cpp in Sources */, - 13F8877D1E29726200C3C7A1 /* ModuleRegistry.cpp in Sources */, - C6D3801C1F71D76700621378 /* RAMBundleRegistry.cpp in Sources */, - 13F8876E1E29726200C3C7A1 /* CxxNativeModule.cpp in Sources */, - 13DA8A332097A90B00276ED4 /* ReactMarker.cpp in Sources */, - 13F887711E29726200C3C7A1 /* JSBundleType.cpp in Sources */, - 13F8877C1E29726200C3C7A1 /* MethodCall.cpp in Sources */, - 13F887701E29726200C3C7A1 /* Instance.cpp in Sources */, - 13F8877E1E29726200C3C7A1 /* NativeToJsBridge.cpp in Sources */, - 13F887801E29726200C3C7A1 /* SampleCxxModule.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D3CD92C1DE5FBEE00167DC4 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BA0501AE2109DD0600A6BBC4 /* JSExecutor.cpp in Sources */, - 3DC159E61E83E1FA007B1282 /* JSBigString.cpp in Sources */, - 13F8878E1E29726300C3C7A1 /* JSIndexedRAMBundle.cpp in Sources */, - 13F887901E29726300C3C7A1 /* ModuleRegistry.cpp in Sources */, - C6D3801D1F71D76800621378 /* RAMBundleRegistry.cpp in Sources */, - 13DA8A342097A90B00276ED4 /* ReactMarker.cpp in Sources */, - 13F887841E29726300C3C7A1 /* Instance.cpp in Sources */, - 3D80D9181DF6F7A80028D040 /* JSBundleType.cpp in Sources */, - 13F8878F1E29726300C3C7A1 /* MethodCall.cpp in Sources */, - 13F887911E29726300C3C7A1 /* NativeToJsBridge.cpp in Sources */, - 13F887821E29726300C3C7A1 /* CxxNativeModule.cpp in Sources */, - 13F887931E29726300C3C7A1 /* SampleCxxModule.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 83CBBA2A1A601D0E00E9B192 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13134C9A1E296B2A00B9F3CB /* RCTCxxMethod.mm in Sources */, - E223624420875A8000108244 /* JSExecutor.cpp in Sources */, - 59500D451F71C63F00B122B7 /* RCTUIManagerUtils.m in Sources */, - 597633361F4E021D005BE8A4 /* RCTShadowView+Internal.m in Sources */, - 13723B501A82FD3C00F88898 /* RCTStatusBarManager.m in Sources */, - 000E6CEB1AB0E980000CDF4D /* RCTSourceCode.m in Sources */, - 001BFCD01D8381DE008E587E /* RCTMultipartStreamReader.m in Sources */, - 14C2CA761B3AC64F00E6CBB2 /* RCTFrameUpdate.m in Sources */, - 594F0A341FD23228007FBE96 /* RCTSurfaceHostingView.mm in Sources */, - 13134C861E296B2A00B9F3CB /* RCTCxxBridge.mm in Sources */, - 13B07FEF1A69327A00A75B9A /* RCTAlertManager.m in Sources */, - 599FAA4C1FB274980058CCF6 /* RCTSurfaceView.mm in Sources */, - 352DCFF01D19F4C20056D623 /* RCTI18nUtil.m in Sources */, - 66CD94B71F1045E700CB3C7C /* RCTMaskedViewManager.m in Sources */, - 008341F61D1DB34400876D9A /* RCTJSStackFrame.m in Sources */, - 13134C961E296B2A00B9F3CB /* RCTObjcExecutor.mm in Sources */, - 59D031FB1F8353D3008361F0 /* RCTSafeAreaViewManager.m in Sources */, - 83CBBACC1A6023D300E9B192 /* RCTConvert.m in Sources */, - 131B6AF41AF1093D00FFC3E0 /* RCTSegmentedControl.m in Sources */, - 830A229E1A66C68A008503DA /* RCTRootView.m in Sources */, - 8507BBBE21EDACC200AEAFCA /* JSCExecutorFactory.mm in Sources */, - 13B07FF01A69327A00A75B9A /* RCTExceptionsManager.m in Sources */, - 13A0C28A1B74F71200B29F6F /* RCTDevMenu.m in Sources */, - 13BCE8091C99CB9D00DD7AAD /* RCTRootShadowView.m in Sources */, - 006FC4141D9B20820057AAAD /* RCTMultipartDataTask.m in Sources */, - 59EDBCB31FDF4E0C003573DE /* (null) in Sources */, - 13CC8A821B17642100940AE7 /* RCTBorderDrawing.m in Sources */, - C60128AD1F3D1258009DF9FF /* RCTCxxConvert.m in Sources */, - 3DCE53291FEAB23100613583 /* RCTDatePicker.m in Sources */, - 50E98FEA21460B0D00CD9289 /* RCTWKWebViewManager.m in Sources */, - 83CBBA511A601E3B00E9B192 /* RCTAssert.m in Sources */, - 59EB6DBD1EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.mm in Sources */, - 59E604A21FE9CCE300BD90C5 /* RCTScrollContentViewManager.m in Sources */, - 13AF20451AE707F9005F5298 /* RCTSlider.m in Sources */, - 130443A21E3FEAA900D93A67 /* RCTFollyConvert.mm in Sources */, - 58114A501AAE93D500E7D092 /* RCTAsyncLocalStorage.m in Sources */, - 657734851EE834C900A0E9EA /* RCTInspectorDevServerHelper.mm in Sources */, - 130E3D891E6A082100ACE484 /* RCTDevSettings.mm in Sources */, - 59283CA01FD67321000EAAB9 /* RCTSurfaceStage.m in Sources */, - 13513F3C1B1F43F400FCE529 /* RCTProgressViewManager.m in Sources */, - 14F7A0F01BDA714B003C6C10 /* RCTFPSGraph.m in Sources */, - 3D7BFD171EA8E351008DFB7A /* RCTPackagerClient.m in Sources */, - 14F3620D1AABD06A001CE568 /* RCTSwitch.m in Sources */, - 13134C8E1E296B2A00B9F3CB /* RCTMessageThread.mm in Sources */, - 599FAA381FB274980058CCF6 /* RCTSurface.mm in Sources */, - 59D031EF1F8353D3008361F0 /* RCTSafeAreaShadowView.m in Sources */, - 3D1E68DB1CABD13900DD7465 /* RCTDisplayLink.m in Sources */, - 14F3620E1AABD06A001CE568 /* RCTSwitchManager.m in Sources */, - 13B080201A69489C00A75B9A /* RCTActivityIndicatorViewManager.m in Sources */, - 13E067561A70F44B002CDEE1 /* RCTViewManager.m in Sources */, - 13BB3D021BECD54500932C10 /* RCTImageSource.m in Sources */, - 13134CA21E296B2A00B9F3CB /* RCTCxxUtils.mm in Sources */, - C606692E1F3CC60500E67165 /* RCTModuleMethod.mm in Sources */, - 1450FF8A1BCFF28A00208362 /* RCTProfileTrampoline-x86_64.S in Sources */, - 13D9FEEB1CDCCECF00158BD7 /* RCTEventEmitter.m in Sources */, - 599FAA3E1FB274980058CCF6 /* RCTSurfaceRootShadowView.m in Sources */, - AC70D2E91DE489E4002E6351 /* RCTJavaScriptLoader.mm in Sources */, - 39C50FFB2046EE3500CEE534 /* RCTVersion.m in Sources */, - 14F7A0EC1BDA3B3C003C6C10 /* RCTPerfMonitor.m in Sources */, - 5960C1B71F0804A00066FD5B /* RCTLayoutAnimation.m in Sources */, - 13134C9E1E296B2A00B9F3CB /* RCTCxxModule.mm in Sources */, - 59E604A41FE9CCE300BD90C5 /* RCTScrollContentShadowView.m in Sources */, - 1450FF881BCFF28A00208362 /* RCTProfileTrampoline-arm64.S in Sources */, - 13E41EEB1C05CA0B00CD8DAC /* RCTProfileTrampoline-i386.S in Sources */, - 3D37B5821D522B190042D5B5 /* RCTFont.mm in Sources */, - 59EDBCB71FDF4E0C003573DE /* RCTScrollView.m in Sources */, - 59EDBCAB1FDF4E0C003573DE /* (null) in Sources */, - 59EDBCBB1FDF4E0C003573DE /* RCTScrollViewManager.m in Sources */, - 599FAA441FB274980058CCF6 /* RCTSurfaceRootView.mm in Sources */, - C60669361F3CCF1B00E67165 /* RCTManagedPointer.mm in Sources */, - 13B080261A694A8400A75B9A /* RCTWrapperViewController.m in Sources */, - A2440AA31DF8D854006E7BFC /* RCTReloadCommand.m in Sources */, - 6577348F1EE8354A00A0E9EA /* RCTInspector.mm in Sources */, - E9B20B7B1B500126007A2DA7 /* RCTAccessibilityManager.m in Sources */, - 13A0C2891B74F71200B29F6F /* RCTDevLoadingView.m in Sources */, - 13B07FF21A69327A00A75B9A /* RCTTiming.m in Sources */, - 1372B70A1AB030C200659ED6 /* RCTAppState.m in Sources */, - 59A7B9FE1E577DBF0068EDBF /* RCTRootContentView.m in Sources */, - 13E067591A70F44B002CDEE1 /* UIView+React.m in Sources */, - 591F78DA202ADB22004A668C /* RCTLayout.m in Sources */, - FEFAAC9E1FDB89B50057BBE0 /* RCTRedBoxExtraDataViewController.m in Sources */, - 14F484561AABFCE100FDF6B9 /* RCTSliderManager.m in Sources */, - CF2731C11E7B8DE40044CA4F /* RCTDeviceInfo.m in Sources */, - 3D7AA9C41E548CD5001955CF /* NSDataBigString.mm in Sources */, - 13D033631C1837FE0021DC29 /* RCTClipboard.m in Sources */, - 14C2CA741B3AC64300E6CBB2 /* RCTModuleData.mm in Sources */, - 142014191B32094000CC17BA /* RCTPerformanceLogger.m in Sources */, - 83CBBA981A6020BB00E9B192 /* RCTTouchHandler.m in Sources */, - 3EDCA8A51D3591E700450C31 /* RCTErrorInfo.m in Sources */, - 83CBBA521A601E3B00E9B192 /* RCTLog.mm in Sources */, - 13A6E20E1C19AA0C00845B82 /* RCTParserUtils.m in Sources */, - 59D031F71F8353D3008361F0 /* RCTSafeAreaViewLocalData.m in Sources */, - 13E067571A70F44B002CDEE1 /* RCTView.m in Sources */, - 3D7749441DC1065C007EC8D8 /* RCTPlatform.m in Sources */, - 59EDBCAF1FDF4E0C003573DE /* RCTScrollContentView.m in Sources */, - 13D9FEEE1CDCD93000158BD7 /* RCTKeyboardObserver.m in Sources */, - B233E6EA1D2D845D00BC68BA /* RCTI18nManager.m in Sources */, - 3D7BFD1F1EA8E351008DFB7A /* RCTPackagerConnection.mm in Sources */, - 13456E931ADAD2DE009F94A7 /* RCTConvert+CoreLocation.m in Sources */, - 13A1F71E1A75392D00D3D453 /* RCTKeyCommands.m in Sources */, - 83CBBA531A601E3B00E9B192 /* RCTUtils.m in Sources */, - 130443C61E401A8C00D93A67 /* RCTConvert+Transform.m in Sources */, - 191E3EC11C29DC3800C180A6 /* RCTRefreshControl.m in Sources */, - 3DCE532B1FEAB23100613583 /* RCTDatePickerManager.m in Sources */, - 13C156051AB1A2840079392D /* RCTWebView.m in Sources */, - 83CBBA601A601EAA00E9B192 /* RCTBridge.m in Sources */, - 50E98FEC21460B0D00CD9289 /* RCTWKWebView.m in Sources */, - 590D7BFF1EBD458B00D8A370 /* RCTShadowView+Layout.m in Sources */, - 5335D5411FE81A4700883D58 /* RCTShadowView.m in Sources */, - 66CD94B31F1045E700CB3C7C /* RCTMaskedView.m in Sources */, - 13C156061AB1A2840079392D /* RCTWebViewManager.m in Sources */, - 58114A161AAE854800E7D092 /* RCTPicker.m in Sources */, - 83A1FE8C1B62640A00BE0E65 /* RCTModalHostView.m in Sources */, - 5925356A20084D0600DD584B /* RCTSurfaceSizeMeasureMode.mm in Sources */, - 1450FF871BCFF28A00208362 /* RCTProfileTrampoline-arm.S in Sources */, - 131B6AF51AF1093D00FFC3E0 /* RCTSegmentedControlManager.m in Sources */, - 58114A171AAE854800E7D092 /* RCTPickerManager.m in Sources */, - 191E3EBE1C29D9AF00C180A6 /* RCTRefreshControlManager.m in Sources */, - 657734911EE8354A00A0E9EA /* RCTInspectorPackagerConnection.m in Sources */, - 68EFE4EE1CF6EB3900A1DE13 /* RCTBundleURLProvider.m in Sources */, - B95154321D1B34B200FE7B80 /* RCTActivityIndicatorView.m in Sources */, - 5960C1BB1F0804A00066FD5B /* RCTLayoutAnimationGroup.m in Sources */, - 13F17A851B8493E5007D4C75 /* RCTRedBox.m in Sources */, - 59D031F31F8353D3008361F0 /* RCTSafeAreaView.m in Sources */, - 83392EB31B6634E10013B15F /* RCTModalHostViewController.m in Sources */, - 83CBBA691A601EF300E9B192 /* RCTEventDispatcher.m in Sources */, - 83A1FE8F1B62643A00BE0E65 /* RCTModalHostViewManager.m in Sources */, - 13E0674A1A70F434002CDEE1 /* RCTUIManager.m in Sources */, - 1384E2091E806D4E00545659 /* RCTNativeModule.mm in Sources */, - 391E86A41C623EC800009732 /* RCTTouchEvent.m in Sources */, - 1450FF861BCFF28A00208362 /* RCTProfile.m in Sources */, - 13AB90C11B6FA36700713B4F /* RCTComponentData.m in Sources */, - 916F9C2D1F743F57002E5920 /* RCTModalManager.m in Sources */, - F1EFDA50201F661000EE6E4C /* RCTUIUtils.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EBF21BD31FC498900052F4D5 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - EBF21BFC1FC4990B0052F4D5 /* InspectorInterfaces.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EBF21BF11FC4989A0052F4D5 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - EBF21BFF1FC4998E0052F4D5 /* InspectorInterfaces.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - ED296FA9214C9A0900B7C4FE /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ED296FB9214C9AC200B7C4FE /* JSCRuntime.cpp in Sources */, - ED296FB7214C9A9A00B7C4FE /* JSIDynamic.cpp in Sources */, - ED296FB8214C9A9A00B7C4FE /* jsi.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - ED296FE1214C9CF800B7C4FE /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - EDDA711E2164285A00B2D070 /* JSINativeModules.cpp in Sources */, - EDDA71202164285A00B2D070 /* JSIExecutor.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EDEBC6CA214B3E7000DD5AC8 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - EDEBC6E6214B3F6800DD5AC8 /* JSCRuntime.cpp in Sources */, - EDEBC6E4214B3F6800DD5AC8 /* jsi.cpp in Sources */, - EDEBC6E3214B3F6800DD5AC8 /* JSIDynamic.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EDEBC734214B45A300DD5AC8 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - EDDA711D2164285A00B2D070 /* JSINativeModules.cpp in Sources */, - EDDA711F2164285A00B2D070 /* JSIExecutor.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 1320081D1E283DCB00F0C457 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 139D7E871E25C6D100323FB7 /* double-conversion */; - targetProxy = 1320081C1E283DCB00F0C457 /* PBXContainerItemProxy */; - }; - 3D0574551DE5FF9600184BB4 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3D3C059B1DE3340C00C268FA /* yoga-tvOS */; - targetProxy = 3D0574541DE5FF9600184BB4 /* PBXContainerItemProxy */; - }; - 3D0574571DE5FF9600184BB4 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3D3CD9261DE5FBEE00167DC4 /* cxxreact-tvOS */; - targetProxy = 3D0574561DE5FF9600184BB4 /* PBXContainerItemProxy */; - }; - 3D383D661EBD27DB005632C8 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3D383D3D1EBD27B9005632C8 /* double-conversion-tvOS */; - targetProxy = 3D383D651EBD27DB005632C8 /* PBXContainerItemProxy */; - }; - 3D3CD94C1DE5FCE700167DC4 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3D3CD9191DE5FBEC00167DC4 /* cxxreact */; - targetProxy = 3D3CD94B1DE5FCE700167DC4 /* PBXContainerItemProxy */; - }; - 53D123991FBF1E0C001B8A10 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3D3C04B91DE3340900C268FA /* yoga */; - targetProxy = 53D123981FBF1E0C001B8A10 /* PBXContainerItemProxy */; - }; - ED296F7E214C957300B7C4FE /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = EDEBC6BA214B3E7000DD5AC8 /* jsi */; - targetProxy = ED296F7D214C957300B7C4FE /* PBXContainerItemProxy */; - }; - ED296F81214C971800B7C4FE /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = EBF21BDD1FC4989A0052F4D5 /* jsinspector-tvOS */; - targetProxy = ED296F80214C971800B7C4FE /* PBXContainerItemProxy */; - }; - ED296F97214C996500B7C4FE /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3D383D3D1EBD27B9005632C8 /* double-conversion-tvOS */; - targetProxy = ED296F96214C996500B7C4FE /* PBXContainerItemProxy */; - }; - ED296FCA214C9B6200B7C4FE /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = ED296F98214C9A0900B7C4FE /* jsi-tvOS */; - targetProxy = ED296FC9214C9B6200B7C4FE /* PBXContainerItemProxy */; - }; - ED296FF8214C9EAA00B7C4FE /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3D383D211EBD27B6005632C8 /* third-party-tvOS */; - targetProxy = ED296FF7214C9EAA00B7C4FE /* PBXContainerItemProxy */; - }; - ED296FFC214C9EC000B7C4FE /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3D3CD9261DE5FBEE00167DC4 /* cxxreact-tvOS */; - targetProxy = ED296FFB214C9EC000B7C4FE /* PBXContainerItemProxy */; - }; - ED296FFE214C9EC600B7C4FE /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = ED296F98214C9A0900B7C4FE /* jsi-tvOS */; - targetProxy = ED296FFD214C9EC600B7C4FE /* PBXContainerItemProxy */; - }; - ED29704E215012C700B7C4FE /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3D383D3D1EBD27B9005632C8 /* double-conversion-tvOS */; - targetProxy = ED29704D215012C700B7C4FE /* PBXContainerItemProxy */; - }; - ED2970662150237300B7C4FE /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = ED296FD0214C9CF800B7C4FE /* jsiexecutor-tvOS */; - targetProxy = ED2970652150237300B7C4FE /* PBXContainerItemProxy */; - }; - EDEBC74B214B46A700DD5AC8 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = EDEBC724214B45A300DD5AC8 /* jsiexecutor */; - targetProxy = EDEBC74A214B46A700DD5AC8 /* PBXContainerItemProxy */; - }; - EDEBC74F214B477400DD5AC8 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = EDEBC6BA214B3E7000DD5AC8 /* jsi */; - targetProxy = EDEBC74E214B477400DD5AC8 /* PBXContainerItemProxy */; - }; - EDEBC7CC214C516800DD5AC8 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 139D7E871E25C6D100323FB7 /* double-conversion */; - targetProxy = EDEBC7CB214C516800DD5AC8 /* PBXContainerItemProxy */; - }; - EDEBC7CE214C523F00DD5AC8 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3D3CD9191DE5FBEC00167DC4 /* cxxreact */; - targetProxy = EDEBC7CD214C523F00DD5AC8 /* PBXContainerItemProxy */; - }; - EDEBC7D3214C528C00DD5AC8 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 139D7ECD1E25DB7D00323FB7 /* third-party */; - targetProxy = EDEBC7D2214C528C00DD5AC8 /* PBXContainerItemProxy */; - }; - EDEBC7D7214C52FD00DD5AC8 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 139D7E871E25C6D100323FB7 /* double-conversion */; - targetProxy = EDEBC7D6214C52FD00DD5AC8 /* PBXContainerItemProxy */; - }; - EDEBC7D9214C628300DD5AC8 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = EBF21BBF1FC498900052F4D5 /* jsinspector */; - targetProxy = EDEBC7D8214C628300DD5AC8 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 139D7E8F1E25C6D100323FB7 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - OTHER_LDFLAGS = "-ObjC"; - PRIVATE_HEADERS_FOLDER_PATH = "/usr/local/include/double-conversion"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 139D7E901E25C6D100323FB7 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - OTHER_LDFLAGS = "-ObjC"; - PRIVATE_HEADERS_FOLDER_PATH = "/usr/local/include/double-conversion"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - }; - name = Release; - }; - 139D7ED51E25DB7D00323FB7 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/../third-party/boost_1_63_0", - "$(SRCROOT)/../third-party/folly-2018.10.22.00", - "$(SRCROOT)/../third-party/glog-0.3.5/exported", - ); - OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - USER_HEADER_SEARCH_PATHS = ""; - }; - name = Debug; - }; - 139D7ED61E25DB7D00323FB7 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/../third-party/boost_1_63_0", - "$(SRCROOT)/../third-party/folly-2018.10.22.00", - "$(SRCROOT)/../third-party/glog-0.3.5/exported", - ); - OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - USER_HEADER_SEARCH_PATHS = ""; - }; - name = Release; - }; - 2D2A28191D9B038B00D4039D /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = React; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/React; - SDKROOT = appletvos; - }; - name = Debug; - }; - 2D2A281A1D9B038B00D4039D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = React; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/React; - SDKROOT = appletvos; - }; - name = Release; - }; - 3D383D3A1EBD27B6005632C8 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/../third-party/boost_1_63_0", - "$(SRCROOT)/../third-party/folly-2018.10.22.00", - "$(SRCROOT)/../third-party/glog-0.3.5/exported", - ); - OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "third-party"; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - USER_HEADER_SEARCH_PATHS = ""; - }; - name = Debug; - }; - 3D383D3B1EBD27B6005632C8 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/../third-party/boost_1_63_0", - "$(SRCROOT)/../third-party/folly-2018.10.22.00", - "$(SRCROOT)/../third-party/glog-0.3.5/exported", - ); - OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "third-party"; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - USER_HEADER_SEARCH_PATHS = ""; - }; - name = Release; - }; - 3D383D601EBD27B9005632C8 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - OTHER_LDFLAGS = "-ObjC"; - PRIVATE_HEADERS_FOLDER_PATH = "/usr/local/include/double-conversion"; - PRODUCT_NAME = "double-conversion"; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 3D383D611EBD27B9005632C8 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - OTHER_LDFLAGS = "-ObjC"; - PRIVATE_HEADERS_FOLDER_PATH = "/usr/local/include/double-conversion"; - PRODUCT_NAME = "double-conversion"; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - }; - name = Release; - }; - 3D3C05981DE3340900C268FA /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/yoga; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 3D3C05991DE3340900C268FA /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/yoga; - RUN_CLANG_STATIC_ANALYZER = NO; - }; - name = Release; - }; - 3D3C06731DE3340C00C268FA /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = yoga; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/yoga; - SDKROOT = appletvos; - }; - name = Debug; - }; - 3D3C06741DE3340C00C268FA /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = yoga; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/yoga; - SDKROOT = appletvos; - }; - name = Release; - }; - 3D3CD9231DE5FBEC00167DC4 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/cxxreact; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 3D3CD9241DE5FBEC00167DC4 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/cxxreact; - RUN_CLANG_STATIC_ANALYZER = NO; - }; - name = Release; - }; - 3D3CD9301DE5FBEE00167DC4 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = cxxreact; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/cxxreact; - SDKROOT = appletvos; - }; - name = Debug; - }; - 3D3CD9311DE5FBEE00167DC4 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = cxxreact; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/cxxreact; - SDKROOT = appletvos; - }; - name = Release; - }; - 83CBBA201A601CBA00E9B192 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "RCT_DEBUG=1", - "RCT_DEV=1", - "RCT_NSASSERT=1", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 9.2; - WARNING_CFLAGS = ( - "-Wextra", - "-Wall", - "-Wno-semicolon-before-method-body", - ); - }; - name = Debug; - }; - 83CBBA211A601CBA00E9B192 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 9.2; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Wextra", - "-Wall", - "-Wno-semicolon-before-method-body", - ); - }; - name = Release; - }; - 83CBBA401A601D0F00E9B192 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "RCT_DEBUG=1", - "RCT_DEV=1", - "RCT_NSASSERT=1", - "RCT_METRO_PORT=${RCT_METRO_PORT}", - ); - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - OTHER_LDFLAGS = ( - "-ObjC", - "-weak_framework", - WebKit, - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/React; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 83CBBA411A601D0F00E9B192 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(inherited)", - "RCT_METRO_PORT=${RCT_METRO_PORT}", - ); - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - OTHER_LDFLAGS = ( - "-ObjC", - "-weak_framework", - WebKit, - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/React; - RUN_CLANG_STATIC_ANALYZER = NO; - }; - name = Release; - }; - EBF21BDA1FC498900052F4D5 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsinspector; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - EBF21BDB1FC498900052F4D5 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsinspector; - RUN_CLANG_STATIC_ANALYZER = NO; - }; - name = Release; - }; - EBF21BF81FC4989A0052F4D5 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsinspector; - SDKROOT = appletvos; - }; - name = Debug; - }; - EBF21BF91FC4989A0052F4D5 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsinspector; - SDKROOT = appletvos; - }; - name = Release; - }; - ED296FB4214C9A0900B7C4FE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/../third-party/boost_1_63_0", - "$(SRCROOT)/../third-party/folly-2018.10.22.00", - "$(SRCROOT)/../third-party/glog-0.3.5/src", - ); - OTHER_CFLAGS = ( - "-DFOLLY_NO_CONFIG", - "-DFOLLY_MOBILE=1", - "-DFOLLY_USE_LIBCPP=1", - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsi; - SDKROOT = appletvos; - }; - name = Debug; - }; - ED296FB5214C9A0900B7C4FE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/../third-party/boost_1_63_0", - "$(SRCROOT)/../third-party/folly-2018.10.22.00", - "$(SRCROOT)/../third-party/glog-0.3.5/src", - ); - OTHER_CFLAGS = ( - "-DFOLLY_NO_CONFIG", - "-DFOLLY_MOBILE=1", - "-DFOLLY_USE_LIBCPP=1", - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsi; - SDKROOT = appletvos; - }; - name = Release; - }; - ED296FEC214C9CF800B7C4FE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/../third-party/boost_1_63_0", - "$(SRCROOT)/../third-party/folly-2018.10.22.00", - "$(SRCROOT)/../third-party/glog-0.3.5/src", - ); - OTHER_CFLAGS = ( - "-DFOLLY_NO_CONFIG", - "-DFOLLY_MOBILE=1", - "-DFOLLY_USE_LIBCPP=1", - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsireact; - SDKROOT = appletvos; - }; - name = Debug; - }; - ED296FED214C9CF800B7C4FE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/../third-party/boost_1_63_0", - "$(SRCROOT)/../third-party/folly-2018.10.22.00", - "$(SRCROOT)/../third-party/glog-0.3.5/src", - ); - OTHER_CFLAGS = ( - "-DFOLLY_NO_CONFIG", - "-DFOLLY_MOBILE=1", - "-DFOLLY_USE_LIBCPP=1", - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsireact; - SDKROOT = appletvos; - }; - name = Release; - }; - EDEBC6D4214B3E7000DD5AC8 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsi; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - EDEBC6D5214B3E7000DD5AC8 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsi; - RUN_CLANG_STATIC_ANALYZER = NO; - }; - name = Release; - }; - EDEBC739214B45A300DD5AC8 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsireact; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - EDEBC73A214B45A300DD5AC8 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsireact; - RUN_CLANG_STATIC_ANALYZER = NO; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 139D7E8E1E25C6D100323FB7 /* Build configuration list for PBXNativeTarget "double-conversion" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 139D7E8F1E25C6D100323FB7 /* Debug */, - 139D7E901E25C6D100323FB7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 139D7ED41E25DB7D00323FB7 /* Build configuration list for PBXNativeTarget "third-party" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 139D7ED51E25DB7D00323FB7 /* Debug */, - 139D7ED61E25DB7D00323FB7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 2D2A281B1D9B038B00D4039D /* Build configuration list for PBXNativeTarget "React-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D2A28191D9B038B00D4039D /* Debug */, - 2D2A281A1D9B038B00D4039D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3D383D391EBD27B6005632C8 /* Build configuration list for PBXNativeTarget "third-party-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3D383D3A1EBD27B6005632C8 /* Debug */, - 3D383D3B1EBD27B6005632C8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3D383D5F1EBD27B9005632C8 /* Build configuration list for PBXNativeTarget "double-conversion-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3D383D601EBD27B9005632C8 /* Debug */, - 3D383D611EBD27B9005632C8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3D3C05971DE3340900C268FA /* Build configuration list for PBXNativeTarget "yoga" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3D3C05981DE3340900C268FA /* Debug */, - 3D3C05991DE3340900C268FA /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3D3C06721DE3340C00C268FA /* Build configuration list for PBXNativeTarget "yoga-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3D3C06731DE3340C00C268FA /* Debug */, - 3D3C06741DE3340C00C268FA /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3D3CD9221DE5FBEC00167DC4 /* Build configuration list for PBXNativeTarget "cxxreact" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3D3CD9231DE5FBEC00167DC4 /* Debug */, - 3D3CD9241DE5FBEC00167DC4 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3D3CD92F1DE5FBEE00167DC4 /* Build configuration list for PBXNativeTarget "cxxreact-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3D3CD9301DE5FBEE00167DC4 /* Debug */, - 3D3CD9311DE5FBEE00167DC4 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "React" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 83CBBA201A601CBA00E9B192 /* Debug */, - 83CBBA211A601CBA00E9B192 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 83CBBA3F1A601D0F00E9B192 /* Build configuration list for PBXNativeTarget "React" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 83CBBA401A601D0F00E9B192 /* Debug */, - 83CBBA411A601D0F00E9B192 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - EBF21BD91FC498900052F4D5 /* Build configuration list for PBXNativeTarget "jsinspector" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - EBF21BDA1FC498900052F4D5 /* Debug */, - EBF21BDB1FC498900052F4D5 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - EBF21BF71FC4989A0052F4D5 /* Build configuration list for PBXNativeTarget "jsinspector-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - EBF21BF81FC4989A0052F4D5 /* Debug */, - EBF21BF91FC4989A0052F4D5 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - ED296FB3214C9A0900B7C4FE /* Build configuration list for PBXNativeTarget "jsi-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - ED296FB4214C9A0900B7C4FE /* Debug */, - ED296FB5214C9A0900B7C4FE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - ED296FEB214C9CF800B7C4FE /* Build configuration list for PBXNativeTarget "jsiexecutor-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - ED296FEC214C9CF800B7C4FE /* Debug */, - ED296FED214C9CF800B7C4FE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - EDEBC6D3214B3E7000DD5AC8 /* Build configuration list for PBXNativeTarget "jsi" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - EDEBC6D4214B3E7000DD5AC8 /* Debug */, - EDEBC6D5214B3E7000DD5AC8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - EDEBC738214B45A300DD5AC8 /* Build configuration list for PBXNativeTarget "jsiexecutor" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - EDEBC739214B45A300DD5AC8 /* Debug */, - EDEBC73A214B45A300DD5AC8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/UIUtils/RCTUIUtils.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/UIUtils/RCTUIUtils.h deleted file mode 100644 index ad99d867..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/UIUtils/RCTUIUtils.h +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -#ifdef __cplusplus -extern "C" { -#endif - -// Get window and screen dimensions -typedef struct { - struct { - CGFloat width, height, scale, fontScale; - } window, screen; -} RCTDimensions; -extern __attribute__((visibility("default"))) -RCTDimensions RCTGetDimensions(CGFloat fontScale); - -// Get font size multiplier for font base size (Large) by content size category -extern __attribute__((visibility("default"))) -CGFloat RCTGetMultiplierForContentSizeCategory(UIContentSizeCategory category); - -#ifdef __cplusplus -} -#endif - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/UIUtils/RCTUIUtils.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/UIUtils/RCTUIUtils.m deleted file mode 100644 index dcc3353c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/UIUtils/RCTUIUtils.m +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTUIUtils.h" - -RCTDimensions RCTGetDimensions(CGFloat fontScale) -{ - UIScreen *mainScreen = UIScreen.mainScreen; - CGSize screenSize = mainScreen.bounds.size; - RCTDimensions result; - typeof (result.window) dims = { - .width = screenSize.width, - .height = screenSize.height, - .scale = mainScreen.scale, - .fontScale = fontScale - }; - result.window = dims; - result.screen = dims; - - return result; -} - -CGFloat RCTGetMultiplierForContentSizeCategory(UIContentSizeCategory category) -{ - static NSDictionary *multipliers = nil; - static dispatch_once_t token; - dispatch_once(&token, ^{ - multipliers = @{ - UIContentSizeCategoryExtraSmall: @0.823, - UIContentSizeCategorySmall: @0.882, - UIContentSizeCategoryMedium: @0.941, - UIContentSizeCategoryLarge: @1.0, - UIContentSizeCategoryExtraLarge: @1.118, - UIContentSizeCategoryExtraExtraLarge: @1.235, - UIContentSizeCategoryExtraExtraExtraLarge: @1.353, - UIContentSizeCategoryAccessibilityMedium: @1.786, - UIContentSizeCategoryAccessibilityLarge: @2.143, - UIContentSizeCategoryAccessibilityExtraLarge: @2.643, - UIContentSizeCategoryAccessibilityExtraExtraLarge: @3.143, - UIContentSizeCategoryAccessibilityExtraExtraExtraLarge: @3.571 - }; - }); - - double value = multipliers[category].doubleValue; - return value > 0.0 ? value : 1.0; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTActivityIndicatorView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTActivityIndicatorView.h deleted file mode 100644 index 55026efa..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTActivityIndicatorView.h +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTActivityIndicatorView : UIActivityIndicatorView -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTActivityIndicatorView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTActivityIndicatorView.m deleted file mode 100644 index e5d9fda4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTActivityIndicatorView.m +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTActivityIndicatorView.h" - -@implementation RCTActivityIndicatorView { -} - -- (void)setHidden:(BOOL)hidden -{ - if ([self hidesWhenStopped] && ![self isAnimating]) { - [super setHidden: YES]; - } else { - [super setHidden: hidden]; - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTActivityIndicatorViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTActivityIndicatorViewManager.h deleted file mode 100644 index be5d278e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTActivityIndicatorViewManager.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTConvert (UIActivityIndicatorView) - -+ (UIActivityIndicatorViewStyle)UIActivityIndicatorViewStyle:(id)json; - -@end - -@interface RCTActivityIndicatorViewManager : RCTViewManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTActivityIndicatorViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTActivityIndicatorViewManager.m deleted file mode 100644 index 5de5643a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTActivityIndicatorViewManager.m +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTActivityIndicatorViewManager.h" - -#import "RCTActivityIndicatorView.h" -#import "RCTConvert.h" - -@implementation RCTConvert (UIActivityIndicatorView) - -// NOTE: It's pointless to support UIActivityIndicatorViewStyleGray -// as we can set the color to any arbitrary value that we want to - -RCT_ENUM_CONVERTER(UIActivityIndicatorViewStyle, (@{ - @"large": @(UIActivityIndicatorViewStyleWhiteLarge), - @"small": @(UIActivityIndicatorViewStyleWhite), -}), UIActivityIndicatorViewStyleWhiteLarge, integerValue) - -@end - -@implementation RCTActivityIndicatorViewManager - -RCT_EXPORT_MODULE() - -- (UIView *)view -{ - return [RCTActivityIndicatorView new]; -} - -RCT_EXPORT_VIEW_PROPERTY(color, UIColor) -RCT_EXPORT_VIEW_PROPERTY(hidesWhenStopped, BOOL) -RCT_REMAP_VIEW_PROPERTY(size, activityIndicatorViewStyle, UIActivityIndicatorViewStyle) -RCT_CUSTOM_VIEW_PROPERTY(animating, BOOL, UIActivityIndicatorView) -{ - BOOL animating = json ? [RCTConvert BOOL:json] : [defaultView isAnimating]; - if (animating != [view isAnimating]) { - if (animating) { - [view startAnimating]; - } else { - [view stopAnimating]; - } - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTAnimationType.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTAnimationType.h deleted file mode 100644 index 9b03cf23..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTAnimationType.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -typedef NS_ENUM(NSInteger, RCTAnimationType) { - RCTAnimationTypeSpring = 0, - RCTAnimationTypeLinear, - RCTAnimationTypeEaseIn, - RCTAnimationTypeEaseOut, - RCTAnimationTypeEaseInEaseOut, - RCTAnimationTypeKeyboard, -}; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTAutoInsetsProtocol.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTAutoInsetsProtocol.h deleted file mode 100644 index a35f99f7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTAutoInsetsProtocol.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -/** - * Defines a View that wants to support auto insets adjustment - */ -@protocol RCTAutoInsetsProtocol - -@property (nonatomic, assign, readwrite) UIEdgeInsets contentInset; -@property (nonatomic, assign, readwrite) BOOL automaticallyAdjustContentInsets; - -/** - * Automatically adjusted content inset depends on view controller's top and bottom - * layout guides so if you've changed one of them (e.g. after rotation or manually) you should call this method - * to recalculate and refresh content inset. - * To handle case with changing navigation bar height call this method from viewDidLayoutSubviews: - * of your view controller. - */ -- (void)refreshContentInset; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTBorderDrawing.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTBorderDrawing.h deleted file mode 100644 index 6798dd90..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTBorderDrawing.h +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -typedef struct { - CGFloat topLeft; - CGFloat topRight; - CGFloat bottomLeft; - CGFloat bottomRight; -} RCTCornerRadii; - -typedef struct { - CGSize topLeft; - CGSize topRight; - CGSize bottomLeft; - CGSize bottomRight; -} RCTCornerInsets; - -typedef struct { - CGColorRef top; - CGColorRef left; - CGColorRef bottom; - CGColorRef right; -} RCTBorderColors; - -/** - * Determine if the border widths, colors and radii are all equal. - */ -RCT_EXTERN BOOL RCTBorderInsetsAreEqual(UIEdgeInsets borderInsets); -RCT_EXTERN BOOL RCTCornerRadiiAreEqual(RCTCornerRadii cornerRadii); -RCT_EXTERN BOOL RCTBorderColorsAreEqual(RCTBorderColors borderColors); - -/** - * Convert RCTCornerRadii to RCTCornerInsets by applying border insets. - * Effectively, returns radius - inset, with a lower bound of 0.0. - */ -RCT_EXTERN RCTCornerInsets RCTGetCornerInsets(RCTCornerRadii cornerRadii, - UIEdgeInsets borderInsets); - -/** - * Create a CGPath representing a rounded rectangle with the specified bounds - * and corner insets. Note that the CGPathRef must be released by the caller. - */ -RCT_EXTERN CGPathRef RCTPathCreateWithRoundedRect(CGRect bounds, - RCTCornerInsets cornerInsets, - const CGAffineTransform *transform); - -/** - * Draw a CSS-compliant border as an image. You can determine if it's scalable - * by inspecting the image's `capInsets`. - * - * `borderInsets` defines the border widths for each edge. - */ -RCT_EXTERN UIImage *RCTGetBorderImage(RCTBorderStyle borderStyle, - CGSize viewSize, - RCTCornerRadii cornerRadii, - UIEdgeInsets borderInsets, - RCTBorderColors borderColors, - CGColorRef backgroundColor, - BOOL drawToEdge); diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTBorderDrawing.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTBorderDrawing.m deleted file mode 100644 index a92db477..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTBorderDrawing.m +++ /dev/null @@ -1,543 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTBorderDrawing.h" -#import "RCTLog.h" - -static const CGFloat RCTViewBorderThreshold = 0.001; - -BOOL RCTBorderInsetsAreEqual(UIEdgeInsets borderInsets) -{ - return - ABS(borderInsets.left - borderInsets.right) < RCTViewBorderThreshold && - ABS(borderInsets.left - borderInsets.bottom) < RCTViewBorderThreshold && - ABS(borderInsets.left - borderInsets.top) < RCTViewBorderThreshold; -} - -BOOL RCTCornerRadiiAreEqual(RCTCornerRadii cornerRadii) -{ - return - ABS(cornerRadii.topLeft - cornerRadii.topRight) < RCTViewBorderThreshold && - ABS(cornerRadii.topLeft - cornerRadii.bottomLeft) < RCTViewBorderThreshold && - ABS(cornerRadii.topLeft - cornerRadii.bottomRight) < RCTViewBorderThreshold; -} - -BOOL RCTBorderColorsAreEqual(RCTBorderColors borderColors) -{ - return - CGColorEqualToColor(borderColors.left, borderColors.right) && - CGColorEqualToColor(borderColors.left, borderColors.top) && - CGColorEqualToColor(borderColors.left, borderColors.bottom); -} - -RCTCornerInsets RCTGetCornerInsets(RCTCornerRadii cornerRadii, - UIEdgeInsets edgeInsets) -{ - return (RCTCornerInsets) { - { - MAX(0, cornerRadii.topLeft - edgeInsets.left), - MAX(0, cornerRadii.topLeft - edgeInsets.top), - }, - { - MAX(0, cornerRadii.topRight - edgeInsets.right), - MAX(0, cornerRadii.topRight - edgeInsets.top), - }, - { - MAX(0, cornerRadii.bottomLeft - edgeInsets.left), - MAX(0, cornerRadii.bottomLeft - edgeInsets.bottom), - }, - { - MAX(0, cornerRadii.bottomRight - edgeInsets.right), - MAX(0, cornerRadii.bottomRight - edgeInsets.bottom), - } - }; -} - -static UIEdgeInsets RCTRoundInsetsToPixel(UIEdgeInsets edgeInsets) { - edgeInsets.top = RCTRoundPixelValue(edgeInsets.top); - edgeInsets.bottom = RCTRoundPixelValue(edgeInsets.bottom); - edgeInsets.left = RCTRoundPixelValue(edgeInsets.left); - edgeInsets.right = RCTRoundPixelValue(edgeInsets.right); - - return edgeInsets; -} - -static void RCTPathAddEllipticArc(CGMutablePathRef path, - const CGAffineTransform *m, - CGPoint origin, - CGSize size, - CGFloat startAngle, - CGFloat endAngle, - BOOL clockwise) -{ - CGFloat xScale = 1, yScale = 1, radius = 0; - if (size.width != 0) { - xScale = 1; - yScale = size.height / size.width; - radius = size.width; - } else if (size.height != 0) { - xScale = size.width / size.height; - yScale = 1; - radius = size.height; - } - - CGAffineTransform t = CGAffineTransformMakeTranslation(origin.x, origin.y); - t = CGAffineTransformScale(t, xScale, yScale); - if (m != NULL) { - t = CGAffineTransformConcat(t, *m); - } - - CGPathAddArc(path, &t, 0, 0, radius, startAngle, endAngle, clockwise); -} - -CGPathRef RCTPathCreateWithRoundedRect(CGRect bounds, - RCTCornerInsets cornerInsets, - const CGAffineTransform *transform) -{ - const CGFloat minX = CGRectGetMinX(bounds); - const CGFloat minY = CGRectGetMinY(bounds); - const CGFloat maxX = CGRectGetMaxX(bounds); - const CGFloat maxY = CGRectGetMaxY(bounds); - - const CGSize topLeft = { - MAX(0, MIN(cornerInsets.topLeft.width, bounds.size.width - cornerInsets.topRight.width)), - MAX(0, MIN(cornerInsets.topLeft.height, bounds.size.height - cornerInsets.bottomLeft.height)), - }; - const CGSize topRight = { - MAX(0, MIN(cornerInsets.topRight.width, bounds.size.width - cornerInsets.topLeft.width)), - MAX(0, MIN(cornerInsets.topRight.height, bounds.size.height - cornerInsets.bottomRight.height)), - }; - const CGSize bottomLeft = { - MAX(0, MIN(cornerInsets.bottomLeft.width, bounds.size.width - cornerInsets.bottomRight.width)), - MAX(0, MIN(cornerInsets.bottomLeft.height, bounds.size.height - cornerInsets.topLeft.height)), - }; - const CGSize bottomRight = { - MAX(0, MIN(cornerInsets.bottomRight.width, bounds.size.width - cornerInsets.bottomLeft.width)), - MAX(0, MIN(cornerInsets.bottomRight.height, bounds.size.height - cornerInsets.topRight.height)), - }; - - CGMutablePathRef path = CGPathCreateMutable(); - RCTPathAddEllipticArc(path, transform, (CGPoint){ - minX + topLeft.width, minY + topLeft.height - }, topLeft, M_PI, 3 * M_PI_2, NO); - RCTPathAddEllipticArc(path, transform, (CGPoint){ - maxX - topRight.width, minY + topRight.height - }, topRight, 3 * M_PI_2, 0, NO); - RCTPathAddEllipticArc(path, transform, (CGPoint){ - maxX - bottomRight.width, maxY - bottomRight.height - }, bottomRight, 0, M_PI_2, NO); - RCTPathAddEllipticArc(path, transform, (CGPoint){ - minX + bottomLeft.width, maxY - bottomLeft.height - }, bottomLeft, M_PI_2, M_PI, NO); - CGPathCloseSubpath(path); - return path; -} - -static void RCTEllipseGetIntersectionsWithLine(CGRect ellipseBounds, - CGPoint lineStart, - CGPoint lineEnd, - CGPoint intersections[2]) -{ - const CGPoint ellipseCenter = { - CGRectGetMidX(ellipseBounds), - CGRectGetMidY(ellipseBounds) - }; - - lineStart.x -= ellipseCenter.x; - lineStart.y -= ellipseCenter.y; - lineEnd.x -= ellipseCenter.x; - lineEnd.y -= ellipseCenter.y; - - const CGFloat m = (lineEnd.y - lineStart.y) / (lineEnd.x - lineStart.x); - const CGFloat a = ellipseBounds.size.width / 2; - const CGFloat b = ellipseBounds.size.height / 2; - const CGFloat c = lineStart.y - m * lineStart.x; - const CGFloat A = (b * b + a * a * m * m); - const CGFloat B = 2 * a * a * c * m; - const CGFloat D = sqrt((a * a * (b * b - c * c)) / A + pow(B / (2 * A), 2)); - - const CGFloat x_ = -B / (2 * A); - const CGFloat x1 = x_ + D; - const CGFloat x2 = x_ - D; - const CGFloat y1 = m * x1 + c; - const CGFloat y2 = m * x2 + c; - - intersections[0] = (CGPoint){x1 + ellipseCenter.x, y1 + ellipseCenter.y}; - intersections[1] = (CGPoint){x2 + ellipseCenter.x, y2 + ellipseCenter.y}; -} - -NS_INLINE BOOL RCTCornerRadiiAreAboveThreshold(RCTCornerRadii cornerRadii) { - return (cornerRadii.topLeft > RCTViewBorderThreshold || - cornerRadii.topRight > RCTViewBorderThreshold || - cornerRadii.bottomLeft > RCTViewBorderThreshold || - cornerRadii.bottomRight > RCTViewBorderThreshold); -} - -static CGPathRef RCTPathCreateOuterOutline(BOOL drawToEdge, CGRect rect, RCTCornerRadii cornerRadii) { - if (drawToEdge) { - return CGPathCreateWithRect(rect, NULL); - } - - return RCTPathCreateWithRoundedRect(rect, RCTGetCornerInsets(cornerRadii, UIEdgeInsetsZero), NULL); -} - -static CGContextRef RCTUIGraphicsBeginImageContext(CGSize size, CGColorRef backgroundColor, BOOL hasCornerRadii, BOOL drawToEdge) { - const CGFloat alpha = CGColorGetAlpha(backgroundColor); - const BOOL opaque = (drawToEdge || !hasCornerRadii) && alpha == 1.0; - UIGraphicsBeginImageContextWithOptions(size, opaque, 0.0); - return UIGraphicsGetCurrentContext(); -} - -static UIImage *RCTGetSolidBorderImage(RCTCornerRadii cornerRadii, - CGSize viewSize, - UIEdgeInsets borderInsets, - RCTBorderColors borderColors, - CGColorRef backgroundColor, - BOOL drawToEdge) -{ - const BOOL hasCornerRadii = RCTCornerRadiiAreAboveThreshold(cornerRadii); - const RCTCornerInsets cornerInsets = RCTGetCornerInsets(cornerRadii, borderInsets); - - // Incorrect render for borders that are not proportional to device pixel: borders get stretched and become - // significantly bigger than expected. - // Rdar: http://www.openradar.me/15959788 - borderInsets = RCTRoundInsetsToPixel(borderInsets); - - const BOOL makeStretchable = - (borderInsets.left + cornerInsets.topLeft.width + - borderInsets.right + cornerInsets.bottomRight.width <= viewSize.width) && - (borderInsets.left + cornerInsets.bottomLeft.width + - borderInsets.right + cornerInsets.topRight.width <= viewSize.width) && - (borderInsets.top + cornerInsets.topLeft.height + - borderInsets.bottom + cornerInsets.bottomRight.height <= viewSize.height) && - (borderInsets.top + cornerInsets.topRight.height + - borderInsets.bottom + cornerInsets.bottomLeft.height <= viewSize.height); - - UIEdgeInsets edgeInsets = (UIEdgeInsets){ - borderInsets.top + MAX(cornerInsets.topLeft.height, cornerInsets.topRight.height), - borderInsets.left + MAX(cornerInsets.topLeft.width, cornerInsets.bottomLeft.width), - borderInsets.bottom + MAX(cornerInsets.bottomLeft.height, cornerInsets.bottomRight.height), - borderInsets.right + MAX(cornerInsets.bottomRight.width, cornerInsets.topRight.width) - }; - - if (hasCornerRadii) { - // Asymmetrical edgeInsets cause strange artifacting on iOS 10 and earlier. - edgeInsets = (UIEdgeInsets){ - MAX(edgeInsets.top, edgeInsets.bottom), - MAX(edgeInsets.left, edgeInsets.right), - MAX(edgeInsets.top, edgeInsets.bottom), - MAX(edgeInsets.left, edgeInsets.right), - }; - } - - const CGSize size = makeStretchable ? (CGSize){ - // 1pt for the middle stretchable area along each axis - edgeInsets.left + 1 + edgeInsets.right, - edgeInsets.top + 1 + edgeInsets.bottom - } : viewSize; - - CGContextRef ctx = RCTUIGraphicsBeginImageContext(size, backgroundColor, hasCornerRadii, drawToEdge); - const CGRect rect = {.size = size}; - CGPathRef path = RCTPathCreateOuterOutline(drawToEdge, rect, cornerRadii); - - if (backgroundColor) { - CGContextSetFillColorWithColor(ctx, backgroundColor); - CGContextAddPath(ctx, path); - CGContextFillPath(ctx); - } - - CGContextAddPath(ctx, path); - CGPathRelease(path); - - CGPathRef insetPath = RCTPathCreateWithRoundedRect(UIEdgeInsetsInsetRect(rect, borderInsets), cornerInsets, NULL); - - CGContextAddPath(ctx, insetPath); - CGContextEOClip(ctx); - - BOOL hasEqualColors = RCTBorderColorsAreEqual(borderColors); - if ((drawToEdge || !hasCornerRadii) && hasEqualColors) { - - CGContextSetFillColorWithColor(ctx, borderColors.left); - CGContextAddRect(ctx, rect); - CGContextAddPath(ctx, insetPath); - CGContextEOFillPath(ctx); - - } else { - - CGPoint topLeft = (CGPoint){borderInsets.left, borderInsets.top}; - if (cornerInsets.topLeft.width > 0 && cornerInsets.topLeft.height > 0) { - CGPoint points[2]; - RCTEllipseGetIntersectionsWithLine((CGRect){ - topLeft, {2 * cornerInsets.topLeft.width, 2 * cornerInsets.topLeft.height} - }, CGPointZero, topLeft, points); - if (!isnan(points[1].x) && !isnan(points[1].y)) { - topLeft = points[1]; - } - } - - CGPoint bottomLeft = (CGPoint){borderInsets.left, size.height - borderInsets.bottom}; - if (cornerInsets.bottomLeft.width > 0 && cornerInsets.bottomLeft.height > 0) { - CGPoint points[2]; - RCTEllipseGetIntersectionsWithLine((CGRect){ - {bottomLeft.x, bottomLeft.y - 2 * cornerInsets.bottomLeft.height}, - {2 * cornerInsets.bottomLeft.width, 2 * cornerInsets.bottomLeft.height} - }, (CGPoint){0, size.height}, bottomLeft, points); - if (!isnan(points[1].x) && !isnan(points[1].y)) { - bottomLeft = points[1]; - } - } - - CGPoint topRight = (CGPoint){size.width - borderInsets.right, borderInsets.top}; - if (cornerInsets.topRight.width > 0 && cornerInsets.topRight.height > 0) { - CGPoint points[2]; - RCTEllipseGetIntersectionsWithLine((CGRect){ - {topRight.x - 2 * cornerInsets.topRight.width, topRight.y}, - {2 * cornerInsets.topRight.width, 2 * cornerInsets.topRight.height} - }, (CGPoint){size.width, 0}, topRight, points); - if (!isnan(points[0].x) && !isnan(points[0].y)) { - topRight = points[0]; - } - } - - CGPoint bottomRight = (CGPoint){size.width - borderInsets.right, size.height - borderInsets.bottom}; - if (cornerInsets.bottomRight.width > 0 && cornerInsets.bottomRight.height > 0) { - CGPoint points[2]; - RCTEllipseGetIntersectionsWithLine((CGRect){ - {bottomRight.x - 2 * cornerInsets.bottomRight.width, bottomRight.y - 2 * cornerInsets.bottomRight.height}, - {2 * cornerInsets.bottomRight.width, 2 * cornerInsets.bottomRight.height} - }, (CGPoint){size.width, size.height}, bottomRight, points); - if (!isnan(points[0].x) && !isnan(points[0].y)) { - bottomRight = points[0]; - } - } - - CGColorRef currentColor = NULL; - - // RIGHT - if (borderInsets.right > 0) { - - const CGPoint points[] = { - (CGPoint){size.width, 0}, - topRight, - bottomRight, - (CGPoint){size.width, size.height}, - }; - - currentColor = borderColors.right; - CGContextAddLines(ctx, points, sizeof(points)/sizeof(*points)); - } - - // BOTTOM - if (borderInsets.bottom > 0) { - - const CGPoint points[] = { - (CGPoint){0, size.height}, - bottomLeft, - bottomRight, - (CGPoint){size.width, size.height}, - }; - - if (!CGColorEqualToColor(currentColor, borderColors.bottom)) { - CGContextSetFillColorWithColor(ctx, currentColor); - CGContextFillPath(ctx); - currentColor = borderColors.bottom; - } - CGContextAddLines(ctx, points, sizeof(points)/sizeof(*points)); - } - - // LEFT - if (borderInsets.left > 0) { - - const CGPoint points[] = { - CGPointZero, - topLeft, - bottomLeft, - (CGPoint){0, size.height}, - }; - - if (!CGColorEqualToColor(currentColor, borderColors.left)) { - CGContextSetFillColorWithColor(ctx, currentColor); - CGContextFillPath(ctx); - currentColor = borderColors.left; - } - CGContextAddLines(ctx, points, sizeof(points)/sizeof(*points)); - } - - // TOP - if (borderInsets.top > 0) { - - const CGPoint points[] = { - CGPointZero, - topLeft, - topRight, - (CGPoint){size.width, 0}, - }; - - if (!CGColorEqualToColor(currentColor, borderColors.top)) { - CGContextSetFillColorWithColor(ctx, currentColor); - CGContextFillPath(ctx); - currentColor = borderColors.top; - } - CGContextAddLines(ctx, points, sizeof(points)/sizeof(*points)); - } - - CGContextSetFillColorWithColor(ctx, currentColor); - CGContextFillPath(ctx); - } - - CGPathRelease(insetPath); - - UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - - if (makeStretchable) { - image = [image resizableImageWithCapInsets:edgeInsets]; - } - - return image; -} - -// Currently, the dashed / dotted implementation only supports a single colour + -// single width, as that's currently required and supported on Android. -// -// Supporting individual widths + colours on each side is possible by modifying -// the current implementation. The idea is that we will draw four different lines -// and clip appropriately for each side (might require adjustment of phase so that -// they line up but even browsers don't do a good job at that). -// -// Firstly, create two paths for the outer and inner paths. The inner path is -// generated exactly the same way as the outer, just given an inset rect, derived -// from the insets on each side. Then clip using the odd-even rule -// (CGContextEOClip()). This will give us a nice rounded (possibly) clip mask. -// -// +----------------------------------+ -// |@@@@@@@@ Clipped Space @@@@@@@@@| -// |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -// |@@+----------------------+@@@@@@@@| -// |@@| |@@@@@@@@| -// |@@| |@@@@@@@@| -// |@@| |@@@@@@@@| -// |@@+----------------------+@@@@@@@@| -// |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -// +----------------------------------+ -// -// Afterwards, we create a clip path for each border side (CGContextSaveGState() -// and CGContextRestoreGState() when drawing each side). The clip mask for each -// segment is a trapezoid connecting corresponding edges of the inner and outer -// rects. For example, in the case of the top edge, the points would be: -// - (MinX(outer), MinY(outer)) -// - (MaxX(outer), MinY(outer)) -// - (MinX(inner) + topLeftRadius, MinY(inner) + topLeftRadius) -// - (MaxX(inner) - topRightRadius, MinY(inner) + topRightRadius) -// -// +------------------+ -// |\ /| -// | \ / | -// | \ top / | -// | \ / | -// | \ / | -// | +------+ | -// | | | | -// | | | | -// | | | | -// |left | |right| -// | | | | -// | | | | -// | +------+ | -// | / \ | -// | / \ | -// | / \ | -// | / bottom \ | -// |/ \| -// +------------------+ -// -// -// Note that this approach will produce discontinous colour changes at the edge -// (which is okay). The reason is that Quartz does not currently support drawing -// of gradients _along_ a path (NB: clipping a path and drawing a linear gradient -// is _not_ equivalent). - -static UIImage *RCTGetDashedOrDottedBorderImage(RCTBorderStyle borderStyle, - RCTCornerRadii cornerRadii, - CGSize viewSize, - UIEdgeInsets borderInsets, - RCTBorderColors borderColors, - CGColorRef backgroundColor, - BOOL drawToEdge) -{ - NSCParameterAssert(borderStyle == RCTBorderStyleDashed || borderStyle == RCTBorderStyleDotted); - - if (!RCTBorderColorsAreEqual(borderColors) || !RCTBorderInsetsAreEqual(borderInsets)) { - RCTLogWarn(@"Unsupported dashed / dotted border style"); - return nil; - } - - const CGFloat lineWidth = borderInsets.top; - if (lineWidth <= 0.0) { - return nil; - } - - const BOOL hasCornerRadii = RCTCornerRadiiAreAboveThreshold(cornerRadii); - CGContextRef ctx = RCTUIGraphicsBeginImageContext(viewSize, backgroundColor, hasCornerRadii, drawToEdge); - const CGRect rect = {.size = viewSize}; - - if (backgroundColor) { - CGPathRef outerPath = RCTPathCreateOuterOutline(drawToEdge, rect, cornerRadii); - CGContextAddPath(ctx, outerPath); - CGPathRelease(outerPath); - - CGContextSetFillColorWithColor(ctx, backgroundColor); - CGContextFillPath(ctx); - } - - // Stroking means that the width is divided in half and grows in both directions - // perpendicular to the path, that's why we inset by half the width, so that it - // reaches the edge of the rect. - CGRect pathRect = CGRectInset(rect, lineWidth / 2.0, lineWidth / 2.0); - CGPathRef path = RCTPathCreateWithRoundedRect(pathRect, RCTGetCornerInsets(cornerRadii, UIEdgeInsetsZero), NULL); - - CGFloat dashLengths[2]; - dashLengths[0] = dashLengths[1] = (borderStyle == RCTBorderStyleDashed ? 3 : 1) * lineWidth; - - CGContextSetLineWidth(ctx, lineWidth); - CGContextSetLineDash(ctx, 0, dashLengths, sizeof(dashLengths) / sizeof(*dashLengths)); - - CGContextSetStrokeColorWithColor(ctx, [UIColor yellowColor].CGColor); - - CGContextAddPath(ctx, path); - CGContextSetStrokeColorWithColor(ctx, borderColors.top); - CGContextStrokePath(ctx); - - CGPathRelease(path); - - UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - - return image; -} - -UIImage *RCTGetBorderImage(RCTBorderStyle borderStyle, - CGSize viewSize, - RCTCornerRadii cornerRadii, - UIEdgeInsets borderInsets, - RCTBorderColors borderColors, - CGColorRef backgroundColor, - BOOL drawToEdge) -{ - - switch (borderStyle) { - case RCTBorderStyleSolid: - return RCTGetSolidBorderImage(cornerRadii, viewSize, borderInsets, borderColors, backgroundColor, drawToEdge); - case RCTBorderStyleDashed: - case RCTBorderStyleDotted: - return RCTGetDashedOrDottedBorderImage(borderStyle, cornerRadii, viewSize, borderInsets, borderColors, backgroundColor, drawToEdge); - case RCTBorderStyleUnset: - break; - } - - return nil; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTBorderStyle.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTBorderStyle.h deleted file mode 100644 index 2bc79b4e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTBorderStyle.h +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -typedef NS_ENUM(NSInteger, RCTBorderStyle) { - RCTBorderStyleUnset = 0, - RCTBorderStyleSolid, - RCTBorderStyleDotted, - RCTBorderStyleDashed, -}; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTComponent.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTComponent.h deleted file mode 100644 index ac54b75c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTComponent.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -/** - * These block types can be used for mapping input event handlers from JS to view - * properties. Unlike JS method callbacks, these can be called multiple times. - */ -typedef void (^RCTDirectEventBlock)(NSDictionary *body); -typedef void (^RCTBubblingEventBlock)(NSDictionary *body); - -/** - * Logical node in a tree of application components. Both `ShadowView` and - * `UIView` conforms to this. Allows us to write utilities that reason about - * trees generally. - */ -@protocol RCTComponent - -@property (nonatomic, copy) NSNumber *reactTag; - -- (void)insertReactSubview:(id)subview atIndex:(NSInteger)atIndex; -- (void)removeReactSubview:(id)subview; -- (NSArray> *)reactSubviews; -- (id)reactSuperview; -- (NSNumber *)reactTagAtPoint:(CGPoint)point; - -// View/ShadowView is a root view -- (BOOL)isReactRootView; - -/** - * Called each time props have been set. - * Not all props have to be set - React can set only changed ones. - * @param changedProps String names of all set props. - */ -- (void)didSetProps:(NSArray *)changedProps; - -/** - * Called each time subviews have been updated - */ -- (void)didUpdateReactSubviews; - -@end - -// TODO: this is kinda dumb - let's come up with a -// better way of identifying root React views please! -static inline BOOL RCTIsReactRootView(NSNumber *reactTag) -{ - return reactTag.integerValue % 10 == 1; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTComponentData.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTComponentData.h deleted file mode 100644 index 7b1cf485..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTComponentData.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import - -@class RCTBridge; -@class RCTShadowView; -@class UIView; - -@interface RCTComponentData : NSObject - -@property (nonatomic, readonly) Class managerClass; -@property (nonatomic, copy, readonly) NSString *name; -@property (nonatomic, weak, readonly) RCTViewManager *manager; - -- (instancetype)initWithManagerClass:(Class)managerClass - bridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER; - -- (UIView *)createViewWithTag:(NSNumber *)tag; -- (RCTShadowView *)createShadowViewWithTag:(NSNumber *)tag; -- (void)setProps:(NSDictionary *)props forView:(id)view; -- (void)setProps:(NSDictionary *)props forShadowView:(RCTShadowView *)shadowView; - -- (NSDictionary *)viewConfig; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTComponentData.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTComponentData.m deleted file mode 100644 index 170b2e5d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTComponentData.m +++ /dev/null @@ -1,457 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTComponentData.h" - -#import - -#import "RCTBridge.h" -#import "RCTBridgeModule.h" -#import "RCTConvert.h" -#import "RCTParserUtils.h" -#import "RCTShadowView.h" -#import "RCTUtils.h" -#import "UIView+React.h" - -typedef void (^RCTPropBlock)(id view, id json); -typedef NSMutableDictionary RCTPropBlockDictionary; - -/** - * Get the converter function for the specified type - */ -static SEL selectorForType(NSString *type) -{ - const char *input = type.UTF8String; - return NSSelectorFromString([RCTParseType(&input) stringByAppendingString:@":"]); -} - - -@implementation RCTComponentData -{ - id _defaultView; // Only needed for RCT_CUSTOM_VIEW_PROPERTY - RCTPropBlockDictionary *_viewPropBlocks; - RCTPropBlockDictionary *_shadowPropBlocks; - __weak RCTBridge *_bridge; -} - -@synthesize manager = _manager; - -- (instancetype)initWithManagerClass:(Class)managerClass - bridge:(RCTBridge *)bridge -{ - if ((self = [super init])) { - _bridge = bridge; - _managerClass = managerClass; - _viewPropBlocks = [NSMutableDictionary new]; - _shadowPropBlocks = [NSMutableDictionary new]; - - _name = moduleNameForClass(managerClass); - } - return self; -} - -- (RCTViewManager *)manager -{ - if (!_manager) { - _manager = [_bridge moduleForClass:_managerClass]; - } - return _manager; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (UIView *)createViewWithTag:(NSNumber *)tag -{ - RCTAssertMainQueue(); - - UIView *view = [self.manager view]; - view.reactTag = tag; -#if !TARGET_OS_TV - view.multipleTouchEnabled = YES; -#endif - view.userInteractionEnabled = YES; // required for touch handling - view.layer.allowsGroupOpacity = YES; // required for touch handling - return view; -} - -- (RCTShadowView *)createShadowViewWithTag:(NSNumber *)tag -{ - RCTShadowView *shadowView = [self.manager shadowView]; - shadowView.reactTag = tag; - shadowView.viewName = _name; - return shadowView; -} - -- (void)callCustomSetter:(SEL)setter onView:(id)view withProp:(id)json isShadowView:(BOOL)isShadowView -{ - json = RCTNilIfNull(json); - if (!isShadowView) { - if (!json && !_defaultView) { - // Only create default view if json is null - _defaultView = [self createViewWithTag:nil]; - } - ((void (*)(id, SEL, id, id, id))objc_msgSend)(self.manager, setter, json, view, _defaultView); - } else { - ((void (*)(id, SEL, id, id))objc_msgSend)(self.manager, setter, json, view); - } -} - -static RCTPropBlock createEventSetter(NSString *propName, SEL setter, RCTBridge *bridge) -{ - __weak RCTBridge *weakBridge = bridge; - return ^(id target, id json) { - void (^eventHandler)(NSDictionary *event) = nil; - if ([RCTConvert BOOL:json]) { - __weak id weakTarget = target; - eventHandler = ^(NSDictionary *event) { - // The component no longer exists, we shouldn't send the event - id strongTarget = weakTarget; - if (!strongTarget) { - return; - } - - NSMutableDictionary *mutableEvent = [NSMutableDictionary dictionaryWithDictionary:event]; - mutableEvent[@"target"] = strongTarget.reactTag; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [weakBridge.eventDispatcher sendInputEventWithName:RCTNormalizeInputEventName(propName) body:mutableEvent]; -#pragma clang diagnostic pop - }; - } - ((void (*)(id, SEL, id))objc_msgSend)(target, setter, eventHandler); - }; -} - -static RCTPropBlock createNSInvocationSetter(NSMethodSignature *typeSignature, SEL type, SEL getter, SEL setter) -{ - NSInvocation *typeInvocation = [NSInvocation invocationWithMethodSignature:typeSignature]; - typeInvocation.selector = type; - typeInvocation.target = [RCTConvert class]; - - __block NSInvocation *targetInvocation = nil; - __block NSMutableData *defaultValue = nil; - - return ^(id target, id json) { - if (!target) { - return; - } - - // Get default value - if (!defaultValue) { - if (!json) { - // We only set the defaultValue when we first pass a non-null - // value, so if the first value sent for a prop is null, it's - // a no-op (we'd be resetting it to its default when its - // value is already the default). - return; - } - // Use NSMutableData to store defaultValue instead of malloc, so - // it will be freed automatically when setterBlock is released. - defaultValue = [[NSMutableData alloc] initWithLength:typeSignature.methodReturnLength]; - if ([target respondsToSelector:getter]) { - NSMethodSignature *signature = [target methodSignatureForSelector:getter]; - NSInvocation *sourceInvocation = [NSInvocation invocationWithMethodSignature:signature]; - sourceInvocation.selector = getter; - [sourceInvocation invokeWithTarget:target]; - [sourceInvocation getReturnValue:defaultValue.mutableBytes]; - } - } - - // Get value - BOOL freeValueOnCompletion = NO; - void *value = defaultValue.mutableBytes; - if (json) { - freeValueOnCompletion = YES; - value = malloc(typeSignature.methodReturnLength); - if (!value) { - // CWE - 391 : Unchecked error condition - // https://www.cvedetails.com/cwe-details/391/Unchecked-Error-Condition.html - // https://eli.thegreenplace.net/2009/10/30/handling-out-of-memory-conditions-in-c - abort(); - } - [typeInvocation setArgument:&json atIndex:2]; - [typeInvocation invoke]; - [typeInvocation getReturnValue:value]; - } - - // Set value - if (!targetInvocation) { - NSMethodSignature *signature = [target methodSignatureForSelector:setter]; - targetInvocation = [NSInvocation invocationWithMethodSignature:signature]; - targetInvocation.selector = setter; - } - [targetInvocation setArgument:value atIndex:2]; - [targetInvocation invokeWithTarget:target]; - if (freeValueOnCompletion) { - // Only free the value if we `malloc`d it locally, otherwise it - // points to `defaultValue.mutableBytes`, which is managed by ARC. - free(value); - } - }; -} - -- (RCTPropBlock)createPropBlock:(NSString *)name isShadowView:(BOOL)isShadowView -{ - // Get type - SEL type = NULL; - NSString *keyPath = nil; - SEL selector = NSSelectorFromString([NSString stringWithFormat:@"propConfig%@_%@", isShadowView ? @"Shadow" : @"", name]); - if ([_managerClass respondsToSelector:selector]) { - NSArray *typeAndKeyPath = ((NSArray *(*)(id, SEL))objc_msgSend)(_managerClass, selector); - type = selectorForType(typeAndKeyPath[0]); - keyPath = typeAndKeyPath.count > 1 ? typeAndKeyPath[1] : nil; - } else { - return ^(__unused id view, __unused id json) {}; - } - - // Check for custom setter - if ([keyPath isEqualToString:@"__custom__"]) { - // Get custom setter. There is no default view in the shadow case, so the selector is different. - NSString *selectorString; - if (!isShadowView) { - selectorString = [NSString stringWithFormat:@"set_%@:for%@View:withDefaultView:", name, isShadowView ? @"Shadow" : @""]; - } else { - selectorString = [NSString stringWithFormat:@"set_%@:forShadowView:", name]; - } - - SEL customSetter = NSSelectorFromString(selectorString); - __weak RCTComponentData *weakSelf = self; - return ^(id view, id json) { - [weakSelf callCustomSetter:customSetter onView:view withProp:json isShadowView:isShadowView]; - }; - } else { - // Disect keypath - NSString *key = name; - NSArray *parts = [keyPath componentsSeparatedByString:@"."]; - if (parts) { - key = parts.lastObject; - parts = [parts subarrayWithRange:(NSRange){0, parts.count - 1}]; - } - - // Get property getter - SEL getter = NSSelectorFromString(key); - - // Get property setter - SEL setter = NSSelectorFromString([NSString stringWithFormat:@"set%@%@:", - [key substringToIndex:1].uppercaseString, - [key substringFromIndex:1]]); - - // Build setter block - void (^setterBlock)(id target, id json) = nil; - if (type == NSSelectorFromString(@"RCTBubblingEventBlock:") || - type == NSSelectorFromString(@"RCTDirectEventBlock:")) { - // Special case for event handlers - setterBlock = createEventSetter(name, setter, _bridge); - } else { - // Ordinary property handlers - NSMethodSignature *typeSignature = [[RCTConvert class] methodSignatureForSelector:type]; - if (!typeSignature) { - RCTLogError(@"No +[RCTConvert %@] function found.", NSStringFromSelector(type)); - return ^(__unused id view, __unused id json){}; - } - switch (typeSignature.methodReturnType[0]) { - -#define RCT_CASE(_value, _type) \ - case _value: { \ - __block BOOL setDefaultValue = NO; \ - __block _type defaultValue; \ - _type (*convert)(id, SEL, id) = (typeof(convert))objc_msgSend; \ - _type (*get)(id, SEL) = (typeof(get))objc_msgSend; \ - void (*set)(id, SEL, _type) = (typeof(set))objc_msgSend; \ - setterBlock = ^(id target, id json) { \ - if (json) { \ - if (!setDefaultValue && target) { \ - if ([target respondsToSelector:getter]) { \ - defaultValue = get(target, getter); \ - } \ - setDefaultValue = YES; \ - } \ - set(target, setter, convert([RCTConvert class], type, json)); \ - } else if (setDefaultValue) { \ - set(target, setter, defaultValue); \ - } \ - }; \ - break; \ - } - - RCT_CASE(_C_SEL, SEL) - RCT_CASE(_C_CHARPTR, const char *) - RCT_CASE(_C_CHR, char) - RCT_CASE(_C_UCHR, unsigned char) - RCT_CASE(_C_SHT, short) - RCT_CASE(_C_USHT, unsigned short) - RCT_CASE(_C_INT, int) - RCT_CASE(_C_UINT, unsigned int) - RCT_CASE(_C_LNG, long) - RCT_CASE(_C_ULNG, unsigned long) - RCT_CASE(_C_LNG_LNG, long long) - RCT_CASE(_C_ULNG_LNG, unsigned long long) - RCT_CASE(_C_FLT, float) - RCT_CASE(_C_DBL, double) - RCT_CASE(_C_BOOL, BOOL) - RCT_CASE(_C_PTR, void *) - RCT_CASE(_C_ID, id) - - case _C_STRUCT_B: - default: { - setterBlock = createNSInvocationSetter(typeSignature, type, getter, setter); - break; - } - } - } - - return ^(__unused id view, __unused id json) { - // Follow keypath - id target = view; - for (NSString *part in parts) { - target = [target valueForKey:part]; - } - - // Set property with json - setterBlock(target, RCTNilIfNull(json)); - }; - } -} - -- (RCTPropBlock)propBlockForKey:(NSString *)name isShadowView:(BOOL)isShadowView -{ - RCTPropBlockDictionary *propBlocks = isShadowView ? _shadowPropBlocks : _viewPropBlocks; - RCTPropBlock propBlock = propBlocks[name]; - if (!propBlock) { - propBlock = [self createPropBlock:name isShadowView:isShadowView]; - -#if RCT_DEBUG - // Provide more useful log feedback if there's an error - RCTPropBlock unwrappedBlock = propBlock; - __weak __typeof(self) weakSelf = self; - propBlock = ^(id view, id json) { - NSString *logPrefix = [NSString stringWithFormat:@"Error setting property '%@' of %@ with tag #%@: ", - name, weakSelf.name, view.reactTag]; - RCTPerformBlockWithLogPrefix(^{ - unwrappedBlock(view, json); - }, logPrefix); - }; -#endif - propBlocks[name] = [propBlock copy]; - } - return propBlock; -} - -- (void)setProps:(NSDictionary *)props forView:(id)view -{ - if (!view) { - return; - } - - [props enumerateKeysAndObjectsUsingBlock:^(NSString *key, id json, __unused BOOL *stop) { - [self propBlockForKey:key isShadowView:NO](view, json); - }]; -} - -- (void)setProps:(NSDictionary *)props forShadowView:(RCTShadowView *)shadowView -{ - if (!shadowView) { - return; - } - - [props enumerateKeysAndObjectsUsingBlock:^(NSString *key, id json, __unused BOOL *stop) { - [self propBlockForKey:key isShadowView:YES](shadowView, json); - }]; -} - -- (NSDictionary *)viewConfig -{ - NSMutableArray *bubblingEvents = [NSMutableArray new]; - NSMutableArray *directEvents = [NSMutableArray new]; - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - if (RCTClassOverridesInstanceMethod(_managerClass, @selector(customBubblingEventTypes))) { - NSArray *events = [self.manager customBubblingEventTypes]; - for (NSString *event in events) { - [bubblingEvents addObject:RCTNormalizeInputEventName(event)]; - } - } -#pragma clang diagnostic pop - - unsigned int count = 0; - NSMutableDictionary *propTypes = [NSMutableDictionary new]; - Method *methods = class_copyMethodList(object_getClass(_managerClass), &count); - for (unsigned int i = 0; i < count; i++) { - SEL selector = method_getName(methods[i]); - const char *selectorName = sel_getName(selector); - if (strncmp(selectorName, "propConfig", strlen("propConfig")) != 0) { - continue; - } - - // We need to handle both propConfig_* and propConfigShadow_* methods - const char *underscorePos = strchr(selectorName + strlen("propConfig"), '_'); - if (!underscorePos) { - continue; - } - - NSString *name = @(underscorePos + 1); - NSString *type = ((NSArray *(*)(id, SEL))objc_msgSend)(_managerClass, selector)[0]; - if (RCT_DEBUG && propTypes[name] && ![propTypes[name] isEqualToString:type]) { - RCTLogError(@"Property '%@' of component '%@' redefined from '%@' " - "to '%@'", name, _name, propTypes[name], type); - } - - if ([type isEqualToString:@"RCTBubblingEventBlock"]) { - [bubblingEvents addObject:RCTNormalizeInputEventName(name)]; - propTypes[name] = @"BOOL"; - } else if ([type isEqualToString:@"RCTDirectEventBlock"]) { - [directEvents addObject:RCTNormalizeInputEventName(name)]; - propTypes[name] = @"BOOL"; - } else { - propTypes[name] = type; - } - } - free(methods); - -#if RCT_DEBUG - for (NSString *event in bubblingEvents) { - if ([directEvents containsObject:event]) { - RCTLogError(@"Component '%@' registered '%@' as both a bubbling event " - "and a direct event", _name, event); - } - } -#endif - - Class superClass = [_managerClass superclass]; - - return @{ - @"propTypes": propTypes, - @"directEvents": directEvents, - @"bubblingEvents": bubblingEvents, - @"baseModuleName": superClass == [NSObject class] ? (id)kCFNull : moduleNameForClass(superClass), - }; -} - -static NSString *moduleNameForClass(Class managerClass) -{ - // Hackety hack, this partially re-implements RCTBridgeModuleNameForClass - // We want to get rid of RCT and RK prefixes, but a lot of JS code still references - // view names by prefix. So, while RCTBridgeModuleNameForClass now drops these - // prefixes by default, we'll still keep them around here. - NSString *name = [managerClass moduleName]; - if (name.length == 0) { - name = NSStringFromClass(managerClass); - } - if ([name hasPrefix:@"RK"]) { - name = [name stringByReplacingCharactersInRange:(NSRange){0, @"RK".length} withString:@"RCT"]; - } - if ([name hasSuffix:@"Manager"]) { - name = [name substringToIndex:name.length - @"Manager".length]; - } - - RCTAssert(name.length, @"Invalid moduleName '%@'", name); - - return name; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTConvert+CoreLocation.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTConvert+CoreLocation.h deleted file mode 100644 index c021bb45..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTConvert+CoreLocation.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTConvert (CoreLocation) - -+ (CLLocationDegrees)CLLocationDegrees:(id)json; -+ (CLLocationDistance)CLLocationDistance:(id)json; -+ (CLLocationCoordinate2D)CLLocationCoordinate2D:(id)json; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTConvert+CoreLocation.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTConvert+CoreLocation.m deleted file mode 100644 index d7afdca7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTConvert+CoreLocation.m +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTConvert+CoreLocation.h" - -@implementation RCTConvert(CoreLocation) - -RCT_CONVERTER(CLLocationDegrees, CLLocationDegrees, doubleValue); -RCT_CONVERTER(CLLocationDistance, CLLocationDistance, doubleValue); - -+ (CLLocationCoordinate2D)CLLocationCoordinate2D:(id)json -{ - json = [self NSDictionary:json]; - return (CLLocationCoordinate2D){ - [self CLLocationDegrees:json[@"latitude"]], - [self CLLocationDegrees:json[@"longitude"]] - }; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTConvert+Transform.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTConvert+Transform.h deleted file mode 100644 index c5161b47..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTConvert+Transform.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTConvert.h" - -@interface RCTConvert (Transform) - -+ (CATransform3D)CATransform3D:(id)json; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTConvert+Transform.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTConvert+Transform.m deleted file mode 100644 index f6c7d009..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTConvert+Transform.m +++ /dev/null @@ -1,138 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTConvert+Transform.h" - -static const NSUInteger kMatrixArrayLength = 4 * 4; - -@implementation RCTConvert (Transform) - -+ (CGFloat)convertToRadians:(id)json -{ - if ([json isKindOfClass:[NSString class]]) { - NSString *stringValue = (NSString *)json; - if ([stringValue hasSuffix:@"deg"]) { - CGFloat degrees = [[stringValue substringToIndex:stringValue.length - 3] floatValue]; - return degrees * M_PI / 180; - } - if ([stringValue hasSuffix:@"rad"]) { - return [[stringValue substringToIndex:stringValue.length - 3] floatValue]; - } - } - return [json floatValue]; -} - -+ (CATransform3D)CATransform3DFromMatrix:(id)json -{ - CATransform3D transform = CATransform3DIdentity; - if (!json) { - return transform; - } - if (![json isKindOfClass:[NSArray class]]) { - RCTLogConvertError(json, @"a CATransform3D. Expected array for transform matrix."); - return transform; - } - if ([json count] != kMatrixArrayLength) { - RCTLogConvertError(json, @"a CATransform3D. Expected 4x4 matrix array."); - return transform; - } - for (NSUInteger i = 0; i < kMatrixArrayLength; i++) { - ((CGFloat *)&transform)[i] = [RCTConvert CGFloat:json[i]]; - } - return transform; -} - -+ (CATransform3D)CATransform3D:(id)json -{ - CATransform3D transform = CATransform3DIdentity; - if (!json) { - return transform; - } - if (![json isKindOfClass:[NSArray class]]) { - RCTLogConvertError(json, @"a CATransform3D. Did you pass something other than an array?"); - return transform; - } - // legacy matrix support - if ([(NSArray *)json count] == kMatrixArrayLength && [json[0] isKindOfClass:[NSNumber class]]) { - RCTLogWarn(@"[RCTConvert CATransform3D:] has deprecated a matrix as input. Pass an array of configs (which can contain a matrix key) instead."); - return [self CATransform3DFromMatrix:json]; - } - - CGFloat zeroScaleThreshold = FLT_EPSILON; - - for (NSDictionary *transformConfig in (NSArray *)json) { - if (transformConfig.count != 1) { - RCTLogConvertError(json, @"a CATransform3D. You must specify exactly one property per transform object."); - return transform; - } - NSString *property = transformConfig.allKeys[0]; - id value = transformConfig[property]; - - if ([property isEqualToString:@"matrix"]) { - transform = [self CATransform3DFromMatrix:value]; - - } else if ([property isEqualToString:@"perspective"]) { - transform.m34 = -1 / [value floatValue]; - - } else if ([property isEqualToString:@"rotateX"]) { - CGFloat rotate = [self convertToRadians:value]; - transform = CATransform3DRotate(transform, rotate, 1, 0, 0); - - } else if ([property isEqualToString:@"rotateY"]) { - CGFloat rotate = [self convertToRadians:value]; - transform = CATransform3DRotate(transform, rotate, 0, 1, 0); - - } else if ([property isEqualToString:@"rotate"] || [property isEqualToString:@"rotateZ"]) { - CGFloat rotate = [self convertToRadians:value]; - transform = CATransform3DRotate(transform, rotate, 0, 0, 1); - - } else if ([property isEqualToString:@"scale"]) { - CGFloat scale = [value floatValue]; - scale = ABS(scale) < zeroScaleThreshold ? zeroScaleThreshold : scale; - transform = CATransform3DScale(transform, scale, scale, 1); - - } else if ([property isEqualToString:@"scaleX"]) { - CGFloat scale = [value floatValue]; - scale = ABS(scale) < zeroScaleThreshold ? zeroScaleThreshold : scale; - transform = CATransform3DScale(transform, scale, 1, 1); - - } else if ([property isEqualToString:@"scaleY"]) { - CGFloat scale = [value floatValue]; - scale = ABS(scale) < zeroScaleThreshold ? zeroScaleThreshold : scale; - transform = CATransform3DScale(transform, 1, scale, 1); - - } else if ([property isEqualToString:@"translate"]) { - NSArray *array = (NSArray *)value; - CGFloat translateX = [array[0] floatValue]; - CGFloat translateY = [array[1] floatValue]; - CGFloat translateZ = array.count > 2 ? [array[2] floatValue] : 0; - transform = CATransform3DTranslate(transform, translateX, translateY, translateZ); - - } else if ([property isEqualToString:@"translateX"]) { - CGFloat translate = [value floatValue]; - transform = CATransform3DTranslate(transform, translate, 0, 0); - - } else if ([property isEqualToString:@"translateY"]) { - CGFloat translate = [value floatValue]; - transform = CATransform3DTranslate(transform, 0, translate, 0); - - } else if ([property isEqualToString:@"skewX"]) { - CGFloat skew = [self convertToRadians:value]; - transform.m21 = tanf(skew); - - } else if ([property isEqualToString:@"skewY"]) { - CGFloat skew = [self convertToRadians:value]; - transform.m12 = tanf(skew); - - } else { - RCTLogError(@"Unsupported transform type for a CATransform3D: %@.", property); - } - } - return transform; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTDatePicker.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTDatePicker.h deleted file mode 100644 index 9494bce3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTDatePicker.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTDatePicker : UIDatePicker - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTDatePicker.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTDatePicker.m deleted file mode 100644 index 0bc1676d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTDatePicker.m +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTDatePicker.h" - -#import "RCTUtils.h" -#import "UIView+React.h" - -@interface RCTDatePicker () - -@property (nonatomic, copy) RCTBubblingEventBlock onChange; - -@end - -@implementation RCTDatePicker - -- (instancetype)initWithFrame:(CGRect)frame -{ - if ((self = [super initWithFrame:frame])) { - [self addTarget:self action:@selector(didChange) - forControlEvents:UIControlEventValueChanged]; - } - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) - -- (void)didChange -{ - if (_onChange) { - _onChange(@{ @"timestamp": @(self.date.timeIntervalSince1970 * 1000.0) }); - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTDatePickerManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTDatePickerManager.h deleted file mode 100644 index 619be407..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTDatePickerManager.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -@interface RCTConvert(UIDatePicker) - -+ (UIDatePickerMode)UIDatePickerMode:(id)json; - -@end - -@interface RCTDatePickerManager : RCTViewManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTDatePickerManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTDatePickerManager.m deleted file mode 100644 index da94b210..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTDatePickerManager.m +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTDatePickerManager.h" - -#import "RCTBridge.h" -#import "RCTDatePicker.h" -#import "RCTEventDispatcher.h" -#import "UIView+React.h" - -@implementation RCTConvert(UIDatePicker) - -RCT_ENUM_CONVERTER(UIDatePickerMode, (@{ - @"time": @(UIDatePickerModeTime), - @"date": @(UIDatePickerModeDate), - @"datetime": @(UIDatePickerModeDateAndTime), - @"countdown": @(UIDatePickerModeCountDownTimer), // not supported yet -}), UIDatePickerModeTime, integerValue) - -@end - -@implementation RCTDatePickerManager - -RCT_EXPORT_MODULE() - -- (UIView *)view -{ - return [RCTDatePicker new]; -} - -RCT_EXPORT_VIEW_PROPERTY(date, NSDate) -RCT_EXPORT_VIEW_PROPERTY(locale, NSLocale) -RCT_EXPORT_VIEW_PROPERTY(minimumDate, NSDate) -RCT_EXPORT_VIEW_PROPERTY(maximumDate, NSDate) -RCT_EXPORT_VIEW_PROPERTY(minuteInterval, NSInteger) -RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock) -RCT_REMAP_VIEW_PROPERTY(mode, datePickerMode, UIDatePickerMode) -RCT_REMAP_VIEW_PROPERTY(timeZoneOffsetInMinutes, timeZone, NSTimeZone) - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTFont.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTFont.h deleted file mode 100644 index 909f8676..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTFont.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -typedef UIFont *(^RCTFontHandler)(CGFloat fontSize, NSString *fontWeightDescription); - -/** - * React Native will use the System font for rendering by default. If you want to - * provide a different base font, use this override. The font weight supplied to your - * handler will be one of "ultralight", "thin", "light", "regular", "medium", - * "semibold", "extrabold", "bold", "heavy", or "black". - */ -RCT_EXTERN void RCTSetDefaultFontHandler(RCTFontHandler handler); -RCT_EXTERN BOOL RCTHasFontHandlerSet(void); - -@interface RCTFont : NSObject - -/** - * Update a font with a given font-family, size, weight and style. - * If parameters are not specified, they'll be kept as-is. - * If font is nil, the default system font of size 14 will be used. - */ -+ (UIFont *)updateFont:(UIFont *)font - withFamily:(NSString *)family - size:(NSNumber *)size - weight:(NSString *)weight - style:(NSString *)style - variant:(NSArray *)variant - scaleMultiplier:(CGFloat)scaleMultiplier; - -+ (UIFont *)updateFont:(UIFont *)font withFamily:(NSString *)family; -+ (UIFont *)updateFont:(UIFont *)font withSize:(NSNumber *)size; -+ (UIFont *)updateFont:(UIFont *)font withWeight:(NSString *)weight; -+ (UIFont *)updateFont:(UIFont *)font withStyle:(NSString *)style; - -@end - -@interface RCTConvert (RCTFont) - -+ (UIFont *)UIFont:(id)json; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTFont.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTFont.mm deleted file mode 100644 index e26fcd89..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTFont.mm +++ /dev/null @@ -1,391 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAssert.h" -#import "RCTFont.h" -#import "RCTLog.h" - -#import - -#import - -typedef CGFloat RCTFontWeight; -static RCTFontWeight weightOfFont(UIFont *font) -{ - static NSArray *fontNames; - static NSArray *fontWeights; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - // We use two arrays instead of one map because - // the order is important for suffix matching. - fontNames = @[ - @"normal", - @"ultralight", - @"thin", - @"light", - @"regular", - @"medium", - @"semibold", - @"demibold", - @"extrabold", - @"bold", - @"heavy", - @"black" - ]; - fontWeights = @[ - @(UIFontWeightRegular), - @(UIFontWeightUltraLight), - @(UIFontWeightThin), - @(UIFontWeightLight), - @(UIFontWeightRegular), - @(UIFontWeightMedium), - @(UIFontWeightSemibold), - @(UIFontWeightSemibold), - @(UIFontWeightHeavy), - @(UIFontWeightBold), - @(UIFontWeightHeavy), - @(UIFontWeightBlack) - ]; - }); - - for (NSInteger i = 0; i < fontNames.count; i++) { - if ([font.fontName.lowercaseString hasSuffix:fontNames[i]]) { - return (RCTFontWeight)[fontWeights[i] doubleValue]; - } - } - - NSDictionary *traits = [font.fontDescriptor objectForKey:UIFontDescriptorTraitsAttribute]; - return (RCTFontWeight)[traits[UIFontWeightTrait] doubleValue]; -} - -static BOOL isItalicFont(UIFont *font) -{ - NSDictionary *traits = [font.fontDescriptor objectForKey:UIFontDescriptorTraitsAttribute]; - UIFontDescriptorSymbolicTraits symbolicTraits = [traits[UIFontSymbolicTrait] unsignedIntValue]; - return (symbolicTraits & UIFontDescriptorTraitItalic) != 0; -} - -static BOOL isCondensedFont(UIFont *font) -{ - NSDictionary *traits = [font.fontDescriptor objectForKey:UIFontDescriptorTraitsAttribute]; - UIFontDescriptorSymbolicTraits symbolicTraits = [traits[UIFontSymbolicTrait] unsignedIntValue]; - return (symbolicTraits & UIFontDescriptorTraitCondensed) != 0; -} - -static RCTFontHandler defaultFontHandler; - -void RCTSetDefaultFontHandler(RCTFontHandler handler) { - defaultFontHandler = handler; -} - -BOOL RCTHasFontHandlerSet() { - return defaultFontHandler != nil; -} - -// We pass a string description of the font weight to the defaultFontHandler because UIFontWeight -// is not defined pre-iOS 8.2. -// Furthermore, UIFontWeight's are lossy floats, so we must use an inexact compare to figure out -// which one we actually have. -static inline BOOL CompareFontWeights(UIFontWeight firstWeight, UIFontWeight secondWeight) { -#if CGFLOAT_IS_DOUBLE - return fabs(firstWeight - secondWeight) < 0.01; -#else - return fabsf(firstWeight - secondWeight) < 0.01; -#endif -} - -static NSString *FontWeightDescriptionFromUIFontWeight(UIFontWeight fontWeight) -{ - if (CompareFontWeights(fontWeight, UIFontWeightUltraLight)) { - return @"ultralight"; - } else if (CompareFontWeights(fontWeight, UIFontWeightThin)) { - return @"thin"; - } else if (CompareFontWeights(fontWeight, UIFontWeightLight)) { - return @"light"; - } else if (CompareFontWeights(fontWeight, UIFontWeightRegular)) { - return @"regular"; - } else if (CompareFontWeights(fontWeight, UIFontWeightMedium)) { - return @"medium"; - } else if (CompareFontWeights(fontWeight, UIFontWeightSemibold)) { - return @"semibold"; - } else if (CompareFontWeights(fontWeight, UIFontWeightBold)) { - return @"bold"; - } else if (CompareFontWeights(fontWeight, UIFontWeightHeavy)) { - return @"heavy"; - } else if (CompareFontWeights(fontWeight, UIFontWeightBlack)) { - return @"black"; - } - RCTAssert(NO, @"Unknown UIFontWeight passed in: %f", fontWeight); - return @"regular"; -} - -static UIFont *cachedSystemFont(CGFloat size, RCTFontWeight weight) -{ - static NSCache *fontCache; - static std::mutex fontCacheMutex; - - NSString *cacheKey = [NSString stringWithFormat:@"%.1f/%.2f", size, weight]; - UIFont *font; - { - std::lock_guard lock(fontCacheMutex); - if (!fontCache) { - fontCache = [NSCache new]; - } - font = [fontCache objectForKey:cacheKey]; - } - - if (!font) { - if (defaultFontHandler) { - NSString *fontWeightDescription = FontWeightDescriptionFromUIFontWeight(weight); - font = defaultFontHandler(size, fontWeightDescription); - } else if ([UIFont respondsToSelector:@selector(systemFontOfSize:weight:)]) { - // Only supported on iOS8.2 and above - font = [UIFont systemFontOfSize:size weight:weight]; - } else { - if (weight >= UIFontWeightBold) { - font = [UIFont boldSystemFontOfSize:size]; - } else if (weight >= UIFontWeightMedium) { - font = [UIFont fontWithName:@"HelveticaNeue-Medium" size:size]; - } else if (weight <= UIFontWeightLight) { - font = [UIFont fontWithName:@"HelveticaNeue-Light" size:size]; - } else { - font = [UIFont systemFontOfSize:size]; - } - } - - { - std::lock_guard lock(fontCacheMutex); - [fontCache setObject:font forKey:cacheKey]; - } - } - - return font; -} - -@implementation RCTConvert (RCTFont) - -+ (UIFont *)UIFont:(id)json -{ - json = [self NSDictionary:json]; - return [RCTFont updateFont:nil - withFamily:[RCTConvert NSString:json[@"fontFamily"]] - size:[RCTConvert NSNumber:json[@"fontSize"]] - weight:[RCTConvert NSString:json[@"fontWeight"]] - style:[RCTConvert NSString:json[@"fontStyle"]] - variant:[RCTConvert NSStringArray:json[@"fontVariant"]] - scaleMultiplier:1]; -} - -RCT_ENUM_CONVERTER(RCTFontWeight, (@{ - @"normal": @(UIFontWeightRegular), - @"bold": @(UIFontWeightBold), - @"100": @(UIFontWeightUltraLight), - @"200": @(UIFontWeightThin), - @"300": @(UIFontWeightLight), - @"400": @(UIFontWeightRegular), - @"500": @(UIFontWeightMedium), - @"600": @(UIFontWeightSemibold), - @"700": @(UIFontWeightBold), - @"800": @(UIFontWeightHeavy), - @"900": @(UIFontWeightBlack), - }), UIFontWeightRegular, doubleValue) - -typedef BOOL RCTFontStyle; -RCT_ENUM_CONVERTER(RCTFontStyle, (@{ - @"normal": @NO, - @"italic": @YES, - @"oblique": @YES, - }), NO, boolValue) - -typedef NSDictionary RCTFontVariantDescriptor; -+ (RCTFontVariantDescriptor *)RCTFontVariantDescriptor:(id)json -{ - static NSDictionary *mapping; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - mapping = @{ - @"small-caps": @{ - UIFontFeatureTypeIdentifierKey: @(kLowerCaseType), - UIFontFeatureSelectorIdentifierKey: @(kLowerCaseSmallCapsSelector), - }, - @"oldstyle-nums": @{ - UIFontFeatureTypeIdentifierKey: @(kNumberCaseType), - UIFontFeatureSelectorIdentifierKey: @(kLowerCaseNumbersSelector), - }, - @"lining-nums": @{ - UIFontFeatureTypeIdentifierKey: @(kNumberCaseType), - UIFontFeatureSelectorIdentifierKey: @(kUpperCaseNumbersSelector), - }, - @"tabular-nums": @{ - UIFontFeatureTypeIdentifierKey: @(kNumberSpacingType), - UIFontFeatureSelectorIdentifierKey: @(kMonospacedNumbersSelector), - }, - @"proportional-nums": @{ - UIFontFeatureTypeIdentifierKey: @(kNumberSpacingType), - UIFontFeatureSelectorIdentifierKey: @(kProportionalNumbersSelector), - }, - }; - }); - RCTFontVariantDescriptor *value = mapping[json]; - if (RCT_DEBUG && !value && [json description].length > 0) { - RCTLogError(@"Invalid RCTFontVariantDescriptor '%@'. should be one of: %@", json, - [[mapping allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]); - } - return value; -} - -RCT_ARRAY_CONVERTER(RCTFontVariantDescriptor) - -@end - -@implementation RCTFont - -+ (UIFont *)updateFont:(UIFont *)font - withFamily:(NSString *)family - size:(NSNumber *)size - weight:(NSString *)weight - style:(NSString *)style - variant:(NSArray *)variant - scaleMultiplier:(CGFloat)scaleMultiplier -{ - // Defaults - static NSString *defaultFontFamily; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - defaultFontFamily = [UIFont systemFontOfSize:14].familyName; - }); - const RCTFontWeight defaultFontWeight = UIFontWeightRegular; - const CGFloat defaultFontSize = 14; - - // Initialize properties to defaults - CGFloat fontSize = defaultFontSize; - RCTFontWeight fontWeight = defaultFontWeight; - NSString *familyName = defaultFontFamily; - BOOL isItalic = NO; - BOOL isCondensed = NO; - - if (font) { - familyName = font.familyName ?: defaultFontFamily; - fontSize = font.pointSize ?: defaultFontSize; - fontWeight = weightOfFont(font); - isItalic = isItalicFont(font); - isCondensed = isCondensedFont(font); - } - - // Get font attributes - fontSize = [RCTConvert CGFloat:size] ?: fontSize; - if (scaleMultiplier > 0.0 && scaleMultiplier != 1.0) { - fontSize = round(fontSize * scaleMultiplier); - } - familyName = [RCTConvert NSString:family] ?: familyName; - isItalic = style ? [RCTConvert RCTFontStyle:style] : isItalic; - fontWeight = weight ? [RCTConvert RCTFontWeight:weight] : fontWeight; - - BOOL didFindFont = NO; - - // Handle system font as special case. This ensures that we preserve - // the specific metrics of the standard system font as closely as possible. - if ([familyName isEqual:defaultFontFamily] || [familyName isEqualToString:@"System"]) { - font = cachedSystemFont(fontSize, fontWeight); - if (font) { - didFindFont = YES; - - if (isItalic || isCondensed) { - UIFontDescriptor *fontDescriptor = [font fontDescriptor]; - UIFontDescriptorSymbolicTraits symbolicTraits = fontDescriptor.symbolicTraits; - if (isItalic) { - symbolicTraits |= UIFontDescriptorTraitItalic; - } - if (isCondensed) { - symbolicTraits |= UIFontDescriptorTraitCondensed; - } - fontDescriptor = [fontDescriptor fontDescriptorWithSymbolicTraits:symbolicTraits]; - font = [UIFont fontWithDescriptor:fontDescriptor size:fontSize]; - } - } - } - - // Gracefully handle being given a font name rather than font family, for - // example: "Helvetica Light Oblique" rather than just "Helvetica". - if (!didFindFont && [UIFont fontNamesForFamilyName:familyName].count == 0) { - font = [UIFont fontWithName:familyName size:fontSize]; - if (font) { - // It's actually a font name, not a font family name, - // but we'll do what was meant, not what was said. - familyName = font.familyName; - fontWeight = weight ? fontWeight : weightOfFont(font); - isItalic = style ? isItalic : isItalicFont(font); - isCondensed = isCondensedFont(font); - } else { - // Not a valid font or family - RCTLogError(@"Unrecognized font family '%@'", familyName); - if ([UIFont respondsToSelector:@selector(systemFontOfSize:weight:)]) { - font = [UIFont systemFontOfSize:fontSize weight:fontWeight]; - } else if (fontWeight > UIFontWeightRegular) { - font = [UIFont boldSystemFontOfSize:fontSize]; - } else { - font = [UIFont systemFontOfSize:fontSize]; - } - } - } - - // Get the closest font that matches the given weight for the fontFamily - CGFloat closestWeight = INFINITY; - for (NSString *name in [UIFont fontNamesForFamilyName:familyName]) { - UIFont *match = [UIFont fontWithName:name size:fontSize]; - if (isItalic == isItalicFont(match) && - isCondensed == isCondensedFont(match)) { - CGFloat testWeight = weightOfFont(match); - if (ABS(testWeight - fontWeight) < ABS(closestWeight - fontWeight)) { - font = match; - closestWeight = testWeight; - } - } - } - - // If we still don't have a match at least return the first font in the fontFamily - // This is to support built-in font Zapfino and other custom single font families like Impact - if (!font) { - NSArray *names = [UIFont fontNamesForFamilyName:familyName]; - if (names.count > 0) { - font = [UIFont fontWithName:names[0] size:fontSize]; - } - } - - // Apply font variants to font object - if (variant) { - NSArray *fontFeatures = [RCTConvert RCTFontVariantDescriptorArray:variant]; - UIFontDescriptor *fontDescriptor = [font.fontDescriptor fontDescriptorByAddingAttributes:@{ - UIFontDescriptorFeatureSettingsAttribute: fontFeatures - }]; - font = [UIFont fontWithDescriptor:fontDescriptor size:fontSize]; - } - - return font; -} - -+ (UIFont *)updateFont:(UIFont *)font withFamily:(NSString *)family -{ - return [self updateFont:font withFamily:family size:nil weight:nil style:nil variant:nil scaleMultiplier:1]; -} - -+ (UIFont *)updateFont:(UIFont *)font withSize:(NSNumber *)size -{ - return [self updateFont:font withFamily:nil size:size weight:nil style:nil variant:nil scaleMultiplier:1]; -} - -+ (UIFont *)updateFont:(UIFont *)font withWeight:(NSString *)weight -{ - return [self updateFont:font withFamily:nil size:nil weight:weight style:nil variant:nil scaleMultiplier:1]; -} - -+ (UIFont *)updateFont:(UIFont *)font withStyle:(NSString *)style -{ - return [self updateFont:font withFamily:nil size:nil weight:nil style:style variant:nil scaleMultiplier:1]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTLayout.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTLayout.h deleted file mode 100644 index 57047b39..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTLayout.h +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RCTShadowView; - -typedef NS_ENUM(NSInteger, RCTDisplayType) { - RCTDisplayTypeNone, - RCTDisplayTypeFlex, - RCTDisplayTypeInline, -}; - -struct RCTLayoutMetrics { - CGRect frame; - CGRect contentFrame; - UIEdgeInsets borderWidth; - RCTDisplayType displayType; - UIUserInterfaceLayoutDirection layoutDirection; -}; -typedef struct CG_BOXABLE RCTLayoutMetrics RCTLayoutMetrics; - -struct RCTLayoutContext { - CGPoint absolutePosition; - __unsafe_unretained NSHashTable *_Nonnull affectedShadowViews; - __unsafe_unretained NSHashTable *_Nonnull other; -}; -typedef struct CG_BOXABLE RCTLayoutContext RCTLayoutContext; - -static inline BOOL RCTLayoutMetricsEqualToLayoutMetrics(RCTLayoutMetrics a, RCTLayoutMetrics b) -{ - return - CGRectEqualToRect(a.frame, b.frame) && - CGRectEqualToRect(a.contentFrame, b.contentFrame) && - UIEdgeInsetsEqualToEdgeInsets(a.borderWidth, b.borderWidth) && - a.displayType == b.displayType && - a.layoutDirection == b.layoutDirection; -} - -RCT_EXTERN RCTLayoutMetrics RCTLayoutMetricsFromYogaNode(YGNodeRef yogaNode); - -/** - * Converts float values between Yoga and CoreGraphics representations, - * especially in terms of edge cases. - */ -RCT_EXTERN float RCTYogaFloatFromCoreGraphicsFloat(CGFloat value); -RCT_EXTERN CGFloat RCTCoreGraphicsFloatFromYogaFloat(float value); - -/** - * Converts compound `YGValue` to simple `CGFloat` value. - */ -RCT_EXTERN CGFloat RCTCoreGraphicsFloatFromYogaValue(YGValue value, CGFloat baseFloatValue); - -/** - * Converts `YGDirection` to `UIUserInterfaceLayoutDirection` and vise versa. - */ -RCT_EXTERN YGDirection RCTYogaLayoutDirectionFromUIKitLayoutDirection(UIUserInterfaceLayoutDirection direction); -RCT_EXTERN UIUserInterfaceLayoutDirection RCTUIKitLayoutDirectionFromYogaLayoutDirection(YGDirection direction); - -/** - * Converts `YGDisplay` to `RCTDisplayType` and vise versa. - */ -RCT_EXTERN YGDisplay RCTYogaDisplayTypeFromReactDisplayType(RCTDisplayType displayType); -RCT_EXTERN RCTDisplayType RCTReactDisplayTypeFromYogaDisplayType(YGDisplay displayType); - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTLayout.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTLayout.m deleted file mode 100644 index 321199f8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTLayout.m +++ /dev/null @@ -1,143 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "RCTAssert.h" -#import "RCTShadowView+Layout.h" - -RCTLayoutMetrics RCTLayoutMetricsFromYogaNode(YGNodeRef yogaNode) -{ - RCTLayoutMetrics layoutMetrics; - - CGRect frame = (CGRect){ - (CGPoint){ - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetLeft(yogaNode)), - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetTop(yogaNode)) - }, - (CGSize){ - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetWidth(yogaNode)), - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetHeight(yogaNode)) - } - }; - - UIEdgeInsets padding = (UIEdgeInsets){ - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeTop)), - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeLeft)), - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeBottom)), - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeRight)) - }; - - UIEdgeInsets borderWidth = (UIEdgeInsets){ - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeTop)), - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeLeft)), - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeBottom)), - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeRight)) - }; - - UIEdgeInsets compoundInsets = (UIEdgeInsets){ - borderWidth.top + padding.top, - borderWidth.left + padding.left, - borderWidth.bottom + padding.bottom, - borderWidth.right + padding.right - }; - - CGRect bounds = (CGRect){CGPointZero, frame.size}; - CGRect contentFrame = UIEdgeInsetsInsetRect(bounds, compoundInsets); - - layoutMetrics.frame = frame; - layoutMetrics.borderWidth = borderWidth; - layoutMetrics.contentFrame = contentFrame; - layoutMetrics.displayType = RCTReactDisplayTypeFromYogaDisplayType(YGNodeStyleGetDisplay(yogaNode)); - layoutMetrics.layoutDirection = RCTUIKitLayoutDirectionFromYogaLayoutDirection(YGNodeLayoutGetDirection(yogaNode)); - - return layoutMetrics; -} - - -/** - * Yoga and CoreGraphics have different opinions about how "infinity" value - * should be represented. - * Yoga uses `NAN` which requires additional effort to compare all those values, - * whereas GoreGraphics uses `GFLOAT_MAX` which can be easyly compared with - * standard `==` operator. - */ - -float RCTYogaFloatFromCoreGraphicsFloat(CGFloat value) -{ - if (value == CGFLOAT_MAX || isnan(value) || isinf(value)) { - return YGUndefined; - } - - return value; -} - -CGFloat RCTCoreGraphicsFloatFromYogaFloat(float value) -{ - if (value == YGUndefined || isnan(value) || isinf(value)) { - return CGFLOAT_MAX; - } - - return value; -} - -CGFloat RCTCoreGraphicsFloatFromYogaValue(YGValue value, CGFloat baseFloatValue) -{ - switch (value.unit) { - case YGUnitPoint: - return RCTCoreGraphicsFloatFromYogaFloat(value.value); - case YGUnitPercent: - return RCTCoreGraphicsFloatFromYogaFloat(value.value) * baseFloatValue; - case YGUnitAuto: - case YGUnitUndefined: - return baseFloatValue; - } -} - -YGDirection RCTYogaLayoutDirectionFromUIKitLayoutDirection(UIUserInterfaceLayoutDirection direction) -{ - switch (direction) { - case UIUserInterfaceLayoutDirectionRightToLeft: - return YGDirectionRTL; - case UIUserInterfaceLayoutDirectionLeftToRight: - return YGDirectionLTR; - } -} - -UIUserInterfaceLayoutDirection RCTUIKitLayoutDirectionFromYogaLayoutDirection(YGDirection direction) -{ - switch (direction) { - case YGDirectionInherit: - case YGDirectionLTR: - return UIUserInterfaceLayoutDirectionLeftToRight; - case YGDirectionRTL: - return UIUserInterfaceLayoutDirectionRightToLeft; - } -} - -YGDisplay RCTYogaDisplayTypeFromReactDisplayType(RCTDisplayType displayType) -{ - switch (displayType) { - case RCTDisplayTypeNone: - return YGDisplayNone; - case RCTDisplayTypeFlex: - return YGDisplayFlex; - case RCTDisplayTypeInline: - RCTAssert(NO, @"RCTDisplayTypeInline cannot be converted to YGDisplay value."); - return YGDisplayNone; - } -} - -RCTDisplayType RCTReactDisplayTypeFromYogaDisplayType(YGDisplay displayType) -{ - switch (displayType) { - case YGDisplayFlex: - return RCTDisplayTypeFlex; - case YGDisplayNone: - return RCTDisplayTypeNone; - } -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTMaskedView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTMaskedView.h deleted file mode 100644 index e6992651..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTMaskedView.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTMaskedView : RCTView - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTMaskedView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTMaskedView.m deleted file mode 100644 index e9411c29..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTMaskedView.m +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTMaskedView.h" - -#import - -@implementation RCTMaskedView - -- (void)didUpdateReactSubviews -{ - // RCTMaskedView expects that the first subview rendered is the mask. - UIView *maskView = [self.reactSubviews firstObject]; - self.maskView = maskView; - - // Add the other subviews to the view hierarchy - for (NSUInteger i = 1; i < self.reactSubviews.count; i++) { - UIView *subview = [self.reactSubviews objectAtIndex:i]; - [self addSubview:subview]; - } -} - -- (void)displayLayer:(CALayer *)layer -{ - // RCTView uses displayLayer to do border rendering. - // We don't need to do that in RCTMaskedView, so we - // stub this method and override the default implementation. -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTMaskedViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTMaskedViewManager.h deleted file mode 100644 index 09adc288..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTMaskedViewManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTMaskedViewManager : RCTViewManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTMaskedViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTMaskedViewManager.m deleted file mode 100644 index 651b25bd..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTMaskedViewManager.m +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTMaskedViewManager.h" - -#import "RCTMaskedView.h" -#import "RCTUIManager.h" - -@implementation RCTMaskedViewManager - -RCT_EXPORT_MODULE() - -- (UIView *)view -{ - return [RCTMaskedView new]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalHostView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalHostView.h deleted file mode 100644 index e421e597..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalHostView.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import - -@class RCTBridge; -@class RCTModalHostViewController; -@class RCTTVRemoteHandler; - -@protocol RCTModalHostViewInteractor; - -@interface RCTModalHostView : UIView - -@property (nonatomic, copy) NSString *animationType; -@property (nonatomic, assign) UIModalPresentationStyle presentationStyle; -@property (nonatomic, assign, getter=isTransparent) BOOL transparent; - -@property (nonatomic, copy) RCTDirectEventBlock onShow; - -@property (nonatomic, copy) NSNumber *identifier; - -@property (nonatomic, weak) id delegate; - -@property (nonatomic, copy) NSArray *supportedOrientations; -@property (nonatomic, copy) RCTDirectEventBlock onOrientationChange; - -#if TARGET_OS_TV -@property (nonatomic, copy) RCTDirectEventBlock onRequestClose; -@property (nonatomic, strong) RCTTVRemoteHandler *tvRemoteHandler; -#endif - -- (instancetype)initWithBridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER; - -@end - -@protocol RCTModalHostViewInteractor - -- (void)presentModalHostView:(RCTModalHostView *)modalHostView withViewController:(RCTModalHostViewController *)viewController animated:(BOOL)animated; -- (void)dismissModalHostView:(RCTModalHostView *)modalHostView withViewController:(RCTModalHostViewController *)viewController animated:(BOOL)animated; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalHostView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalHostView.m deleted file mode 100644 index f586e4ad..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalHostView.m +++ /dev/null @@ -1,262 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTModalHostView.h" - -#import - -#import "RCTAssert.h" -#import "RCTBridge.h" -#import "RCTModalHostViewController.h" -#import "RCTTouchHandler.h" -#import "RCTUIManager.h" -#import "RCTUtils.h" -#import "UIView+React.h" -#if TARGET_OS_TV -#import "RCTTVRemoteHandler.h" -#endif - -@implementation RCTModalHostView -{ - __weak RCTBridge *_bridge; - BOOL _isPresented; - RCTModalHostViewController *_modalViewController; - RCTTouchHandler *_touchHandler; - UIView *_reactSubview; -#if TARGET_OS_TV - UITapGestureRecognizer *_menuButtonGestureRecognizer; -#else - UIInterfaceOrientation _lastKnownOrientation; -#endif - -} - -RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) -RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:coder) - -- (instancetype)initWithBridge:(RCTBridge *)bridge -{ - if ((self = [super initWithFrame:CGRectZero])) { - _bridge = bridge; - _modalViewController = [RCTModalHostViewController new]; - UIView *containerView = [UIView new]; - containerView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; - _modalViewController.view = containerView; - _touchHandler = [[RCTTouchHandler alloc] initWithBridge:bridge]; -#if TARGET_OS_TV - _menuButtonGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(menuButtonPressed:)]; - _menuButtonGestureRecognizer.allowedPressTypes = @[@(UIPressTypeMenu)]; - self.tvRemoteHandler = [RCTTVRemoteHandler new]; -#endif - _isPresented = NO; - - __weak typeof(self) weakSelf = self; - _modalViewController.boundsDidChangeBlock = ^(CGRect newBounds) { - [weakSelf notifyForBoundsChange:newBounds]; - }; - } - - return self; -} - -#if TARGET_OS_TV -- (void)menuButtonPressed:(__unused UIGestureRecognizer *)gestureRecognizer -{ - if (_onRequestClose) { - _onRequestClose(nil); - } -} - -- (void)setOnRequestClose:(RCTDirectEventBlock)onRequestClose -{ - _onRequestClose = onRequestClose; - if (_reactSubview) { - if (_onRequestClose && _menuButtonGestureRecognizer) { - [_reactSubview addGestureRecognizer:_menuButtonGestureRecognizer]; - } else { - [_reactSubview removeGestureRecognizer:_menuButtonGestureRecognizer]; - } - } -} -#endif - -- (void)notifyForBoundsChange:(CGRect)newBounds -{ - if (_reactSubview && _isPresented) { - [_bridge.uiManager setSize:newBounds.size forView:_reactSubview]; - [self notifyForOrientationChange]; - } -} - -- (void)notifyForOrientationChange -{ -#if !TARGET_OS_TV - if (!_onOrientationChange) { - return; - } - - UIInterfaceOrientation currentOrientation = [RCTSharedApplication() statusBarOrientation]; - if (currentOrientation == _lastKnownOrientation) { - return; - } - _lastKnownOrientation = currentOrientation; - - BOOL isPortrait = currentOrientation == UIInterfaceOrientationPortrait || currentOrientation == UIInterfaceOrientationPortraitUpsideDown; - NSDictionary *eventPayload = - @{ - @"orientation": isPortrait ? @"portrait" : @"landscape", - }; - _onOrientationChange(eventPayload); -#endif -} - -- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex -{ - RCTAssert(_reactSubview == nil, @"Modal view can only have one subview"); - [super insertReactSubview:subview atIndex:atIndex]; - [_touchHandler attachToView:subview]; -#if TARGET_OS_TV - for (NSString *key in [self.tvRemoteHandler.tvRemoteGestureRecognizers allKeys]) { - if (![key isEqualToString:RCTTVRemoteEventMenu]) { - [subview addGestureRecognizer:self.tvRemoteHandler.tvRemoteGestureRecognizers[key]]; - } - } - if (_onRequestClose) { - [subview addGestureRecognizer:_menuButtonGestureRecognizer]; - } -#endif - subview.autoresizingMask = UIViewAutoresizingFlexibleHeight | - UIViewAutoresizingFlexibleWidth; - - [_modalViewController.view insertSubview:subview atIndex:0]; - _reactSubview = subview; -} - -- (void)removeReactSubview:(UIView *)subview -{ - RCTAssert(subview == _reactSubview, @"Cannot remove view other than modal view"); - // Superclass (category) removes the `subview` from actual `superview`. - [super removeReactSubview:subview]; - [_touchHandler detachFromView:subview]; -#if TARGET_OS_TV - if (_menuButtonGestureRecognizer) { - [subview removeGestureRecognizer:_menuButtonGestureRecognizer]; - } - for (UIGestureRecognizer *gr in self.tvRemoteHandler.tvRemoteGestureRecognizers) { - [subview removeGestureRecognizer:gr]; - } -#endif - _reactSubview = nil; -} - -- (void)didUpdateReactSubviews -{ - // Do nothing, as subview (singular) is managed by `insertReactSubview:atIndex:` -} - -- (void)dismissModalViewController -{ - if (_isPresented) { - [_delegate dismissModalHostView:self withViewController:_modalViewController animated:[self hasAnimationType]]; - _isPresented = NO; - } -} - -- (void)didMoveToWindow -{ - [super didMoveToWindow]; - - // In the case where there is a LayoutAnimation, we will be reinserted into the view hierarchy but only for aesthetic purposes. - // In such a case, we should NOT represent the . - if (!self.userInteractionEnabled && ![self.superview.reactSubviews containsObject:self]) { - return; - } - - if (!_isPresented && self.window) { - RCTAssert(self.reactViewController, @"Can't present modal view controller without a presenting view controller"); - -#if !TARGET_OS_TV - _modalViewController.supportedInterfaceOrientations = [self supportedOrientationsMask]; -#endif - if ([self.animationType isEqualToString:@"fade"]) { - _modalViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; - } else if ([self.animationType isEqualToString:@"slide"]) { - _modalViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; - } - if (self.presentationStyle != UIModalPresentationNone) { - _modalViewController.modalPresentationStyle = self.presentationStyle; - } - [_delegate presentModalHostView:self withViewController:_modalViewController animated:[self hasAnimationType]]; - _isPresented = YES; - } -} - -- (void)didMoveToSuperview -{ - [super didMoveToSuperview]; - - if (_isPresented && !self.superview) { - [self dismissModalViewController]; - } -} - -- (void)invalidate -{ - dispatch_async(dispatch_get_main_queue(), ^{ - [self dismissModalViewController]; - }); -} - -- (BOOL)isTransparent -{ - return _modalViewController.modalPresentationStyle == UIModalPresentationOverFullScreen; -} - -- (BOOL)hasAnimationType -{ - return ![self.animationType isEqualToString:@"none"]; -} - -- (void)setTransparent:(BOOL)transparent -{ - if (self.isTransparent != transparent) { - return; - } - - _modalViewController.modalPresentationStyle = transparent ? UIModalPresentationOverFullScreen : UIModalPresentationFullScreen; -} - -#if !TARGET_OS_TV -- (UIInterfaceOrientationMask)supportedOrientationsMask -{ - if (_supportedOrientations.count == 0) { - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { - return UIInterfaceOrientationMaskAll; - } else { - return UIInterfaceOrientationMaskPortrait; - } - } - - UIInterfaceOrientationMask supportedOrientations = 0; - for (NSString *orientation in _supportedOrientations) { - if ([orientation isEqualToString:@"portrait"]) { - supportedOrientations |= UIInterfaceOrientationMaskPortrait; - } else if ([orientation isEqualToString:@"portrait-upside-down"]) { - supportedOrientations |= UIInterfaceOrientationMaskPortraitUpsideDown; - } else if ([orientation isEqualToString:@"landscape"]) { - supportedOrientations |= UIInterfaceOrientationMaskLandscape; - } else if ([orientation isEqualToString:@"landscape-left"]) { - supportedOrientations |= UIInterfaceOrientationMaskLandscapeLeft; - } else if ([orientation isEqualToString:@"landscape-right"]) { - supportedOrientations |= UIInterfaceOrientationMaskLandscapeRight; - } - } - return supportedOrientations; -} -#endif - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalHostViewController.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalHostViewController.h deleted file mode 100644 index c5af5ffc..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalHostViewController.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTModalHostViewController : UIViewController - -@property (nonatomic, copy) void (^boundsDidChangeBlock)(CGRect newBounds); - -#if !TARGET_OS_TV -@property (nonatomic, assign) UIInterfaceOrientationMask supportedInterfaceOrientations; -#endif - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalHostViewController.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalHostViewController.m deleted file mode 100644 index abd5369d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalHostViewController.m +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTModalHostViewController.h" - -#import "RCTLog.h" -#import "RCTModalHostView.h" - -@implementation RCTModalHostViewController -{ - CGRect _lastViewFrame; -#if !TARGET_OS_TV - UIStatusBarStyle _preferredStatusBarStyle; - BOOL _preferredStatusBarHidden; -#endif -} - -- (instancetype)init -{ - if (!(self = [super init])) { - return nil; - } - -#if !TARGET_OS_TV - _preferredStatusBarStyle = [RCTSharedApplication() statusBarStyle]; - _preferredStatusBarHidden = [RCTSharedApplication() isStatusBarHidden]; -#endif - - return self; -} - -- (void)viewDidLayoutSubviews -{ - [super viewDidLayoutSubviews]; - - if (self.boundsDidChangeBlock && !CGRectEqualToRect(_lastViewFrame, self.view.frame)) { - self.boundsDidChangeBlock(self.view.bounds); - _lastViewFrame = self.view.frame; - } -} - -#if !TARGET_OS_TV -- (UIStatusBarStyle)preferredStatusBarStyle -{ - return _preferredStatusBarStyle; -} - -- (BOOL)prefersStatusBarHidden -{ - return _preferredStatusBarHidden; -} - -#if RCT_DEV -- (UIInterfaceOrientationMask)supportedInterfaceOrientations -{ - UIInterfaceOrientationMask appSupportedOrientationsMask = [RCTSharedApplication() supportedInterfaceOrientationsForWindow:[RCTSharedApplication() keyWindow]]; - if (!(_supportedInterfaceOrientations & appSupportedOrientationsMask)) { - 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." - @"NOTE: This will crash in non-dev mode.", - (unsigned)_supportedInterfaceOrientations, - (unsigned)appSupportedOrientationsMask); - return UIInterfaceOrientationMaskAll; - } - - return _supportedInterfaceOrientations; -} -#endif // RCT_DEV -#endif // !TARGET_OS_TV - - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalHostViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalHostViewManager.h deleted file mode 100644 index f42cecc2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalHostViewManager.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import -#import - -@interface RCTConvert (RCTModalHostView) - -+ (UIModalPresentationStyle)UIModalPresentationStyle:(id)json; - -@end - -typedef void (^RCTModalViewInteractionBlock)(UIViewController *reactViewController, UIViewController *viewController, BOOL animated, dispatch_block_t completionBlock); - -@interface RCTModalHostViewManager : RCTViewManager - -/** - * `presentationBlock` and `dismissalBlock` allow you to control how a Modal interacts with your case, - * e.g. in case you have a native navigator that has its own way to display a modal. - * If these are not specified, it falls back to the UIViewController standard way of presenting. - */ -@property (nonatomic, strong) RCTModalViewInteractionBlock presentationBlock; -@property (nonatomic, strong) RCTModalViewInteractionBlock dismissalBlock; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalHostViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalHostViewManager.m deleted file mode 100644 index 6377683d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalHostViewManager.m +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTModalHostViewManager.h" - -#import "RCTBridge.h" -#import "RCTModalHostView.h" -#import "RCTModalHostViewController.h" -#import "RCTModalManager.h" -#import "RCTShadowView.h" -#import "RCTUtils.h" - -@implementation RCTConvert (RCTModalHostView) - -RCT_ENUM_CONVERTER(UIModalPresentationStyle, (@{ - @"fullScreen": @(UIModalPresentationFullScreen), -#if !TARGET_OS_TV - @"pageSheet": @(UIModalPresentationPageSheet), - @"formSheet": @(UIModalPresentationFormSheet), -#endif - @"overFullScreen": @(UIModalPresentationOverFullScreen), -}), UIModalPresentationFullScreen, integerValue) - -@end - -@interface RCTModalHostShadowView : RCTShadowView - -@end - -@implementation RCTModalHostShadowView - -- (void)insertReactSubview:(id)subview atIndex:(NSInteger)atIndex -{ - [super insertReactSubview:subview atIndex:atIndex]; - if ([subview isKindOfClass:[RCTShadowView class]]) { - ((RCTShadowView *)subview).size = RCTScreenSize(); - } -} - -@end - -@interface RCTModalHostViewManager () - -@end - -@implementation RCTModalHostViewManager -{ - NSHashTable *_hostViews; -} - -RCT_EXPORT_MODULE() - -- (UIView *)view -{ - RCTModalHostView *view = [[RCTModalHostView alloc] initWithBridge:self.bridge]; - view.delegate = self; - if (!_hostViews) { - _hostViews = [NSHashTable weakObjectsHashTable]; - } - [_hostViews addObject:view]; - return view; -} - -- (void)presentModalHostView:(RCTModalHostView *)modalHostView withViewController:(RCTModalHostViewController *)viewController animated:(BOOL)animated -{ - dispatch_block_t completionBlock = ^{ - if (modalHostView.onShow) { - modalHostView.onShow(nil); - } - }; - if (_presentationBlock) { - _presentationBlock([modalHostView reactViewController], viewController, animated, completionBlock); - } else { - [[modalHostView reactViewController] presentViewController:viewController animated:animated completion:completionBlock]; - } -} - -- (void)dismissModalHostView:(RCTModalHostView *)modalHostView withViewController:(RCTModalHostViewController *)viewController animated:(BOOL)animated -{ - dispatch_block_t completionBlock = ^{ - if (modalHostView.identifier) { - [[self.bridge moduleForClass:[RCTModalManager class]] modalDismissed:modalHostView.identifier]; - } - }; - if (_dismissalBlock) { - _dismissalBlock([modalHostView reactViewController], viewController, animated, completionBlock); - } else { - [viewController dismissViewControllerAnimated:animated completion:completionBlock]; - } -} - - -- (RCTShadowView *)shadowView -{ - return [RCTModalHostShadowView new]; -} - -- (void)invalidate -{ - for (RCTModalHostView *hostView in _hostViews) { - [hostView invalidate]; - } - [_hostViews removeAllObjects]; -} - -RCT_EXPORT_VIEW_PROPERTY(animationType, NSString) -RCT_EXPORT_VIEW_PROPERTY(presentationStyle, UIModalPresentationStyle) -RCT_EXPORT_VIEW_PROPERTY(transparent, BOOL) -RCT_EXPORT_VIEW_PROPERTY(onShow, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(identifier, NSNumber) -RCT_EXPORT_VIEW_PROPERTY(supportedOrientations, NSArray) -RCT_EXPORT_VIEW_PROPERTY(onOrientationChange, RCTDirectEventBlock) - -#if TARGET_OS_TV -RCT_EXPORT_VIEW_PROPERTY(onRequestClose, RCTDirectEventBlock) -#endif - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalManager.h deleted file mode 100644 index 8ce1a29d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalManager.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -@interface RCTModalManager : RCTEventEmitter - -- (void)modalDismissed:(NSNumber *)modalID; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalManager.m deleted file mode 100644 index 5303866d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTModalManager.m +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTModalManager.h" - -@interface RCTModalManager () - -@property BOOL shouldEmit; - -@end - -@implementation RCTModalManager - -RCT_EXPORT_MODULE(); - -- (NSArray *)supportedEvents -{ - return @[ @"modalDismissed" ]; -} - -- (void)startObserving -{ - _shouldEmit = YES; -} - -- (void)stopObserving -{ - _shouldEmit = NO; -} - -- (void)modalDismissed:(NSNumber *)modalID -{ - if (_shouldEmit) { - [self sendEventWithName:@"modalDismissed" body:@{ @"modalID": modalID }]; - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTPicker.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTPicker.h deleted file mode 100644 index 2bb0b489..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTPicker.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTPicker : UIPickerView - -@property (nonatomic, copy) NSArray *items; -@property (nonatomic, assign) NSInteger selectedIndex; - -@property (nonatomic, strong) UIColor *color; -@property (nonatomic, strong) UIFont *font; -@property (nonatomic, assign) NSTextAlignment textAlign; - -@property (nonatomic, copy) RCTBubblingEventBlock onChange; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTPicker.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTPicker.m deleted file mode 100644 index cc135780..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTPicker.m +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTPicker.h" - -#import "RCTConvert.h" -#import "RCTUtils.h" - -@interface RCTPicker() -@end - -@implementation RCTPicker - -- (instancetype)initWithFrame:(CGRect)frame -{ - if ((self = [super initWithFrame:frame])) { - _color = [UIColor blackColor]; - _font = [UIFont systemFontOfSize:21]; // TODO: selected title default should be 23.5 - _selectedIndex = NSNotFound; - _textAlign = NSTextAlignmentCenter; - self.delegate = self; - [self selectRow:0 inComponent:0 animated:YES]; // Workaround for missing selection indicator lines (see https://stackoverflow.com/questions/39564660/uipickerview-selection-indicator-not-visible-in-ios10) - } - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) - -- (void)setItems:(NSArray *)items -{ - _items = [items copy]; - [self setNeedsLayout]; -} - -- (void)setSelectedIndex:(NSInteger)selectedIndex -{ - if (_selectedIndex != selectedIndex) { - BOOL animated = _selectedIndex != NSNotFound; // Don't animate the initial value - _selectedIndex = selectedIndex; - dispatch_async(dispatch_get_main_queue(), ^{ - [self selectRow:selectedIndex inComponent:0 animated:animated]; - }); - } -} - -#pragma mark - UIPickerViewDataSource protocol - -- (NSInteger)numberOfComponentsInPickerView:(__unused UIPickerView *)pickerView -{ - return 1; -} - -- (NSInteger)pickerView:(__unused UIPickerView *)pickerView -numberOfRowsInComponent:(__unused NSInteger)component -{ - return _items.count; -} - -#pragma mark - UIPickerViewDelegate methods - -- (NSString *)pickerView:(__unused UIPickerView *)pickerView - titleForRow:(NSInteger)row - forComponent:(__unused NSInteger)component -{ - return [RCTConvert NSString:_items[row][@"label"]]; -} - -- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component { - return _font.pointSize + 19; -} - -- (UIView *)pickerView:(UIPickerView *)pickerView - viewForRow:(NSInteger)row - forComponent:(NSInteger)component - reusingView:(UILabel *)label -{ - if (!label) { - label = [[UILabel alloc] initWithFrame:(CGRect){ - CGPointZero, - { - [pickerView rowSizeForComponent:component].width, - [pickerView rowSizeForComponent:component].height, - } - }]; - } - - label.font = _font; - - label.textColor = [RCTConvert UIColor:_items[row][@"textColor"]] ?: _color; - - label.textAlignment = _textAlign; - label.text = [self pickerView:pickerView titleForRow:row forComponent:component]; - return label; -} - -- (void)pickerView:(__unused UIPickerView *)pickerView - didSelectRow:(NSInteger)row inComponent:(__unused NSInteger)component -{ - _selectedIndex = row; - if (_onChange && _items.count > (NSUInteger)row) { - _onChange(@{ - @"newIndex": @(row), - @"newValue": RCTNullIfNil(_items[row][@"value"]), - }); - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTPickerManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTPickerManager.h deleted file mode 100644 index 79de2ee4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTPickerManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTPickerManager : RCTViewManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTPickerManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTPickerManager.m deleted file mode 100644 index 48387109..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTPickerManager.m +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTPickerManager.h" - -#import "RCTBridge.h" -#import "RCTPicker.h" -#import "RCTFont.h" - -@implementation RCTPickerManager - -RCT_EXPORT_MODULE() - -- (UIView *)view -{ - return [RCTPicker new]; -} - -RCT_EXPORT_VIEW_PROPERTY(items, NSArray) -RCT_EXPORT_VIEW_PROPERTY(selectedIndex, NSInteger) -RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock) -RCT_EXPORT_VIEW_PROPERTY(color, UIColor) -RCT_EXPORT_VIEW_PROPERTY(textAlign, NSTextAlignment) -RCT_CUSTOM_VIEW_PROPERTY(fontSize, NSNumber, RCTPicker) -{ - view.font = [RCTFont updateFont:view.font withSize:json ?: @(defaultView.font.pointSize)]; -} -RCT_CUSTOM_VIEW_PROPERTY(fontWeight, NSString, __unused RCTPicker) -{ - view.font = [RCTFont updateFont:view.font withWeight:json]; // defaults to normal -} -RCT_CUSTOM_VIEW_PROPERTY(fontStyle, NSString, __unused RCTPicker) -{ - view.font = [RCTFont updateFont:view.font withStyle:json]; // defaults to normal -} -RCT_CUSTOM_VIEW_PROPERTY(fontFamily, NSString, RCTPicker) -{ - view.font = [RCTFont updateFont:view.font withFamily:json ?: defaultView.font.familyName]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTPointerEvents.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTPointerEvents.h deleted file mode 100644 index 86dda22d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTPointerEvents.h +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -typedef NS_ENUM(NSInteger, RCTPointerEvents) { - RCTPointerEventsUnspecified = 0, // Default - RCTPointerEventsNone, - RCTPointerEventsBoxNone, - RCTPointerEventsBoxOnly, -}; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTProgressViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTProgressViewManager.h deleted file mode 100644 index 67a4f0df..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTProgressViewManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTProgressViewManager : RCTViewManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTProgressViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTProgressViewManager.m deleted file mode 100644 index c4a19075..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTProgressViewManager.m +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTProgressViewManager.h" - -#import "RCTConvert.h" - -@implementation RCTConvert (RCTProgressViewManager) - -RCT_ENUM_CONVERTER(UIProgressViewStyle, (@{ - @"default": @(UIProgressViewStyleDefault), -#if !TARGET_OS_TV - @"bar": @(UIProgressViewStyleBar), -#endif -}), UIProgressViewStyleDefault, integerValue) - -@end - -@implementation RCTProgressViewManager - -RCT_EXPORT_MODULE() - -- (UIView *)view -{ - return [UIProgressView new]; -} - -RCT_EXPORT_VIEW_PROPERTY(progressViewStyle, UIProgressViewStyle) -RCT_EXPORT_VIEW_PROPERTY(progress, float) -RCT_EXPORT_VIEW_PROPERTY(progressTintColor, UIColor) -RCT_EXPORT_VIEW_PROPERTY(trackTintColor, UIColor) -RCT_EXPORT_VIEW_PROPERTY(progressImage, UIImage) -RCT_EXPORT_VIEW_PROPERTY(trackImage, UIImage) - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTRefreshControl.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTRefreshControl.h deleted file mode 100644 index 64fda72c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTRefreshControl.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -@interface RCTRefreshControl : UIRefreshControl - -@property (nonatomic, copy) NSString *title; -@property (nonatomic, copy) RCTDirectEventBlock onRefresh; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTRefreshControl.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTRefreshControl.m deleted file mode 100644 index 24090c83..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTRefreshControl.m +++ /dev/null @@ -1,163 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTRefreshControl.h" - -#import "RCTUtils.h" - -@implementation RCTRefreshControl { - BOOL _isInitialRender; - BOOL _currentRefreshingState; - UInt64 _currentRefreshingStateClock; - UInt64 _currentRefreshingStateTimestamp; - BOOL _refreshingProgrammatically; - NSString *_title; - UIColor *_titleColor; -} - -- (instancetype)init -{ - if ((self = [super init])) { - [self addTarget:self action:@selector(refreshControlValueChanged) forControlEvents:UIControlEventValueChanged]; - _currentRefreshingStateClock = 1; - _currentRefreshingStateTimestamp = 0; - _isInitialRender = true; - _currentRefreshingState = false; - } - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) - -- (void)layoutSubviews -{ - [super layoutSubviews]; - - // Fix for bug #7976 - // TODO: Remove when updating to use iOS 10 refreshControl UIScrollView prop. - if (self.backgroundColor == nil) { - self.backgroundColor = [UIColor clearColor]; - } - - // If the control is refreshing when mounted we need to call - // beginRefreshing in layoutSubview or it doesn't work. - if (_currentRefreshingState && _isInitialRender) { - [self beginRefreshingProgrammatically]; - } - _isInitialRender = false; -} - -- (void)beginRefreshingProgrammatically -{ - UInt64 beginRefreshingTimestamp = _currentRefreshingStateTimestamp; - _refreshingProgrammatically = YES; - // When using begin refreshing we need to adjust the ScrollView content offset manually. - UIScrollView *scrollView = (UIScrollView *)self.superview; - CGPoint offset = {scrollView.contentOffset.x, scrollView.contentOffset.y - self.frame.size.height}; - - // `beginRefreshing` must be called after the animation is done. This is why it is impossible - // to use `setContentOffset` with `animated:YES`. - [UIView animateWithDuration:0.25 - delay:0 - options:UIViewAnimationOptionBeginFromCurrentState - animations:^(void) { - [scrollView setContentOffset:offset]; - } completion:^(__unused BOOL finished) { - if(beginRefreshingTimestamp == self->_currentRefreshingStateTimestamp) { - [super beginRefreshing]; - [self setCurrentRefreshingState:super.refreshing]; - } - }]; -} - -- (void)endRefreshingProgrammatically -{ - // The contentOffset of the scrollview MUST be greater than 0 before calling - // endRefreshing otherwise the next pull to refresh will not work properly. - UIScrollView *scrollView = (UIScrollView *)self.superview; - if (_refreshingProgrammatically && scrollView.contentOffset.y < 0) { - UInt64 endRefreshingTimestamp = _currentRefreshingStateTimestamp; - CGPoint offset = {scrollView.contentOffset.x, 0}; - [UIView animateWithDuration:0.25 - delay:0 - options:UIViewAnimationOptionBeginFromCurrentState - animations:^(void) { - [scrollView setContentOffset:offset]; - } completion:^(__unused BOOL finished) { - if(endRefreshingTimestamp == self->_currentRefreshingStateTimestamp) { - [super endRefreshing]; - [self setCurrentRefreshingState:super.refreshing]; - } - }]; - } else { - [super endRefreshing]; - } -} - -- (NSString *)title -{ - return _title; -} - -- (void)setTitle:(NSString *)title -{ - _title = title; - [self _updateTitle]; -} - -- (void)setTitleColor:(UIColor *)color -{ - _titleColor = color; - [self _updateTitle]; -} - -- (void)_updateTitle -{ - if (!_title) { - return; - } - - NSMutableDictionary *attributes = [NSMutableDictionary dictionary]; - if (_titleColor) { - attributes[NSForegroundColorAttributeName] = _titleColor; - } - - self.attributedTitle = [[NSAttributedString alloc] initWithString:_title attributes:attributes]; -} - -- (void)setRefreshing:(BOOL)refreshing -{ - if (_currentRefreshingState != refreshing) { - [self setCurrentRefreshingState:refreshing]; - - if (refreshing) { - if (!_isInitialRender) { - [self beginRefreshingProgrammatically]; - } - } else { - [self endRefreshingProgrammatically]; - } - } -} - -- (void)setCurrentRefreshingState:(BOOL)refreshing -{ - _currentRefreshingState = refreshing; - _currentRefreshingStateTimestamp = _currentRefreshingStateClock++; -} - -- (void)refreshControlValueChanged -{ - [self setCurrentRefreshingState:super.refreshing]; - _refreshingProgrammatically = NO; - - if (_onRefresh) { - _onRefresh(nil); - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTRefreshControlManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTRefreshControlManager.h deleted file mode 100644 index 9d268511..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTRefreshControlManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTRefreshControlManager : RCTViewManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTRefreshControlManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTRefreshControlManager.m deleted file mode 100644 index 5bfef4af..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTRefreshControlManager.m +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTRefreshControlManager.h" - -#import "RCTRefreshControl.h" - -@implementation RCTRefreshControlManager - -RCT_EXPORT_MODULE() - -- (UIView *)view -{ - return [RCTRefreshControl new]; -} - -RCT_EXPORT_VIEW_PROPERTY(onRefresh, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(refreshing, BOOL) -RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor) -RCT_EXPORT_VIEW_PROPERTY(title, NSString) -RCT_EXPORT_VIEW_PROPERTY(titleColor, UIColor) - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTRootShadowView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTRootShadowView.h deleted file mode 100644 index 775274fd..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTRootShadowView.h +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -@interface RCTRootShadowView : RCTShadowView - -/** - * Available size to layout all views. - * Defaults to {INFINITY, INFINITY} - */ -@property (nonatomic, assign) CGSize availableSize; - -/** - * Layout direction (LTR or RTL) inherited from native environment and - * is using as a base direction value in layout engine. - * Defaults to value inferred from current locale. - */ -@property (nonatomic, assign) YGDirection baseDirection; - -- (void)layoutWithAffectedShadowViews:(NSHashTable *)affectedShadowViews; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTRootShadowView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTRootShadowView.m deleted file mode 100644 index 3e7ed812..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTRootShadowView.m +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTRootShadowView.h" - -#import "RCTI18nUtil.h" -#import "RCTShadowView+Layout.h" - -@implementation RCTRootShadowView - -- (instancetype)init -{ - if (self = [super init]) { - _baseDirection = [[RCTI18nUtil sharedInstance] isRTL] ? YGDirectionRTL : YGDirectionLTR; - _availableSize = CGSizeMake(INFINITY, INFINITY); - } - - return self; -} - -- (void)layoutWithAffectedShadowViews:(NSHashTable *)affectedShadowViews -{ - NSHashTable *other = [NSHashTable new]; - - RCTLayoutContext layoutContext = {}; - layoutContext.absolutePosition = CGPointZero; - layoutContext.affectedShadowViews = affectedShadowViews; - layoutContext.other = other; - - [self layoutWithMinimumSize:CGSizeZero - maximumSize:_availableSize - layoutDirection:RCTUIKitLayoutDirectionFromYogaLayoutDirection(_baseDirection) - layoutContext:layoutContext]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSegmentedControl.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSegmentedControl.h deleted file mode 100644 index 8e50659f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSegmentedControl.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTSegmentedControl : UISegmentedControl - -@property (nonatomic, copy) NSArray *values; -@property (nonatomic, assign) NSInteger selectedIndex; -@property (nonatomic, copy) RCTBubblingEventBlock onChange; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSegmentedControl.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSegmentedControl.m deleted file mode 100644 index adbde608..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSegmentedControl.m +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSegmentedControl.h" - -#import "RCTConvert.h" -#import "RCTEventDispatcher.h" -#import "UIView+React.h" - -@implementation RCTSegmentedControl - -- (instancetype)initWithFrame:(CGRect)frame -{ - if ((self = [super initWithFrame:frame])) { - _selectedIndex = self.selectedSegmentIndex; - [self addTarget:self action:@selector(didChange) - forControlEvents:UIControlEventValueChanged]; - } - return self; -} - -- (void)setValues:(NSArray *)values -{ - _values = [values copy]; - [self removeAllSegments]; - for (NSString *value in values) { - [self insertSegmentWithTitle:value atIndex:self.numberOfSegments animated:NO]; - } - super.selectedSegmentIndex = _selectedIndex; -} - -- (void)setSelectedIndex:(NSInteger)selectedIndex -{ - _selectedIndex = selectedIndex; - super.selectedSegmentIndex = selectedIndex; -} - -- (void)didChange -{ - _selectedIndex = self.selectedSegmentIndex; - if (_onChange) { - _onChange(@{ - @"value": [self titleForSegmentAtIndex:_selectedIndex], - @"selectedSegmentIndex": @(_selectedIndex) - }); - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSegmentedControlManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSegmentedControlManager.h deleted file mode 100644 index 42cbd802..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSegmentedControlManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTSegmentedControlManager : RCTViewManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSegmentedControlManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSegmentedControlManager.m deleted file mode 100644 index 2994065d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSegmentedControlManager.m +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSegmentedControlManager.h" - -#import "RCTBridge.h" -#import "RCTConvert.h" -#import "RCTSegmentedControl.h" - -@implementation RCTSegmentedControlManager - -RCT_EXPORT_MODULE() - -- (UIView *)view -{ - return [RCTSegmentedControl new]; -} - -RCT_EXPORT_VIEW_PROPERTY(values, NSArray) -RCT_EXPORT_VIEW_PROPERTY(selectedIndex, NSInteger) -RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor) -RCT_EXPORT_VIEW_PROPERTY(momentary, BOOL) -RCT_EXPORT_VIEW_PROPERTY(enabled, BOOL) -RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock) - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTShadowView+Internal.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTShadowView+Internal.h deleted file mode 100644 index e2133351..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTShadowView+Internal.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@class RCTRootShadowView; - -@interface RCTShadowView (Internal) - -@property (nonatomic, weak, readwrite) RCTRootShadowView *rootView; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTShadowView+Internal.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTShadowView+Internal.m deleted file mode 100644 index 0f482817..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTShadowView+Internal.m +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTShadowView+Layout.h" - -@interface RCTShadowView () -{ - __weak RCTRootShadowView *_rootView; -} - -@end - -@implementation RCTShadowView (Internal) - -- (void)setRootView:(RCTRootShadowView *)rootView -{ - _rootView = rootView; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTShadowView+Layout.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTShadowView+Layout.h deleted file mode 100644 index e99d60da..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTShadowView+Layout.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTShadowView (Layout) - -#pragma mark - Computed Layout-Inferred Metrics - -@property (nonatomic, readonly) UIEdgeInsets paddingAsInsets; -@property (nonatomic, readonly) UIEdgeInsets borderAsInsets; -@property (nonatomic, readonly) UIEdgeInsets compoundInsets; -@property (nonatomic, readonly) CGSize availableSize; -@property (nonatomic, readonly) CGRect contentFrame; - -#pragma mark - Dirty Propagation Control - -/** - * Designated method to control dirty propagation mechanism. - * Dirties the shadow view (and all affected shadow views, usually a superview) - * in terms of layout. - * The default implementaion does nothing. - */ -- (void)dirtyLayout; - -/** - * Designated method to control dirty propagation mechanism. - * Clears (makes not dirty) the shadow view. - * The default implementaion does nothing. - */ -- (void)clearLayout; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTShadowView+Layout.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTShadowView+Layout.m deleted file mode 100644 index a4c39f20..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTShadowView+Layout.m +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTShadowView+Layout.h" - -#import - -#import "RCTAssert.h" - -@implementation RCTShadowView (Layout) - -#pragma mark - Computed Layout-Inferred Metrics - -- (UIEdgeInsets)paddingAsInsets -{ - YGNodeRef yogaNode = self.yogaNode; - return (UIEdgeInsets){ - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeTop)), - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeLeft)), - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeBottom)), - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeRight)) - }; -} - -- (UIEdgeInsets)borderAsInsets -{ - YGNodeRef yogaNode = self.yogaNode; - return (UIEdgeInsets){ - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeTop)), - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeLeft)), - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeBottom)), - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeRight)) - }; -} - -- (UIEdgeInsets)compoundInsets -{ - UIEdgeInsets borderAsInsets = self.borderAsInsets; - UIEdgeInsets paddingAsInsets = self.paddingAsInsets; - - return (UIEdgeInsets){ - borderAsInsets.top + paddingAsInsets.top, - borderAsInsets.left + paddingAsInsets.left, - borderAsInsets.bottom + paddingAsInsets.bottom, - borderAsInsets.right + paddingAsInsets.right - }; -} - -- (CGSize)availableSize -{ - return self.layoutMetrics.contentFrame.size; -} - -- (CGRect)contentFrame -{ - return self.layoutMetrics.contentFrame; -} - -#pragma mark - Dirty Propagation Control - -- (void)dirtyLayout -{ - // The default implementaion does nothing. -} - -- (void)clearLayout -{ - // The default implementaion does nothing. -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTShadowView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTShadowView.h deleted file mode 100644 index 07161f9c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTShadowView.h +++ /dev/null @@ -1,243 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import -#import - -@class RCTRootShadowView; -@class RCTSparseArray; - -typedef void (^RCTApplierBlock)(NSDictionary *viewRegistry); - -/** - * ShadowView tree mirrors RCT view tree. Every node is highly stateful. - * 1. A node is in one of three lifecycles: uninitialized, computed, dirtied. - * 1. RCTBridge may call any of the padding/margin/width/height/top/left setters. A setter would dirty - * the node and all of its ancestors. - * 2. At the end of each Bridge transaction, we call collectUpdatedFrames:widthConstraint:heightConstraint - * at the root node to recursively lay out the entire hierarchy. - * 3. If a node is "computed" and the constraint passed from above is identical to the constraint used to - * perform the last computation, we skip laying out the subtree entirely. - */ -@interface RCTShadowView : NSObject - -/** - * Yoga Config which will be used to create `yogaNode` property. - * Override in subclass to enable special Yoga features. - * Defaults to suitable to current device configuration. - */ -+ (YGConfigRef)yogaConfig; - -/** - * RCTComponent interface. - */ -- (NSArray *)reactSubviews NS_REQUIRES_SUPER; -- (RCTShadowView *)reactSuperview NS_REQUIRES_SUPER; -- (void)insertReactSubview:(RCTShadowView *)subview atIndex:(NSInteger)atIndex NS_REQUIRES_SUPER; -- (void)removeReactSubview:(RCTShadowView *)subview NS_REQUIRES_SUPER; - -@property (nonatomic, weak, readonly) RCTRootShadowView *rootView; -@property (nonatomic, weak, readonly) RCTShadowView *superview; -@property (nonatomic, assign, readonly) YGNodeRef yogaNode; -@property (nonatomic, copy) NSString *viewName; -@property (nonatomic, copy) RCTDirectEventBlock onLayout; - -/** - * Computed layout of the view. - */ -@property (nonatomic, assign) RCTLayoutMetrics layoutMetrics; - -/** - * In some cases we need a way to specify some environmental data to shadow view - * to improve layout (or do something similar), so `localData` serves these needs. - * For example, any stateful embedded native views may benefit from this. - * Have in mind that this data is not supposed to interfere with the state of - * the shadow view. - * Please respect one-directional data flow of React. - * Use `-[RCTUIManager setLocalData:forView:]` to set this property - * (to provide local/environmental data for a shadow view) from the main thread. - */ -- (void)setLocalData:(NSObject *)localData; - -/** - * isNewView - Used to track the first time the view is introduced into the hierarchy. It is initialized YES, then is - * set to NO in RCTUIManager after the layout pass is done and all frames have been extracted to be applied to the - * corresponding UIViews. - */ -@property (nonatomic, assign, getter=isNewView) BOOL newView; - -/** - * Position and dimensions. - * Defaults to { 0, 0, NAN, NAN }. - */ -@property (nonatomic, assign) YGValue top; -@property (nonatomic, assign) YGValue left; -@property (nonatomic, assign) YGValue bottom; -@property (nonatomic, assign) YGValue right; -@property (nonatomic, assign) YGValue start; -@property (nonatomic, assign) YGValue end; - -@property (nonatomic, assign) YGValue width; -@property (nonatomic, assign) YGValue height; - -@property (nonatomic, assign) YGValue minWidth; -@property (nonatomic, assign) YGValue maxWidth; -@property (nonatomic, assign) YGValue minHeight; -@property (nonatomic, assign) YGValue maxHeight; - -/** - * Convenient alias to `width` and `height` in pixels. - * Defaults to NAN in case of non-pixel dimension. - */ -@property (nonatomic, assign) CGSize size; - -/** - * Border. Defaults to { 0, 0, 0, 0 }. - */ -@property (nonatomic, assign) float borderWidth; -@property (nonatomic, assign) float borderTopWidth; -@property (nonatomic, assign) float borderLeftWidth; -@property (nonatomic, assign) float borderBottomWidth; -@property (nonatomic, assign) float borderRightWidth; -@property (nonatomic, assign) float borderStartWidth; -@property (nonatomic, assign) float borderEndWidth; - -/** - * Margin. Defaults to { 0, 0, 0, 0 }. - */ -@property (nonatomic, assign) YGValue margin; -@property (nonatomic, assign) YGValue marginVertical; -@property (nonatomic, assign) YGValue marginHorizontal; -@property (nonatomic, assign) YGValue marginTop; -@property (nonatomic, assign) YGValue marginLeft; -@property (nonatomic, assign) YGValue marginBottom; -@property (nonatomic, assign) YGValue marginRight; -@property (nonatomic, assign) YGValue marginStart; -@property (nonatomic, assign) YGValue marginEnd; - -/** - * Padding. Defaults to { 0, 0, 0, 0 }. - */ -@property (nonatomic, assign) YGValue padding; -@property (nonatomic, assign) YGValue paddingVertical; -@property (nonatomic, assign) YGValue paddingHorizontal; -@property (nonatomic, assign) YGValue paddingTop; -@property (nonatomic, assign) YGValue paddingLeft; -@property (nonatomic, assign) YGValue paddingBottom; -@property (nonatomic, assign) YGValue paddingRight; -@property (nonatomic, assign) YGValue paddingStart; -@property (nonatomic, assign) YGValue paddingEnd; - -/** - * Flexbox properties. All zero/disabled by default - */ -@property (nonatomic, assign) YGFlexDirection flexDirection; -@property (nonatomic, assign) YGJustify justifyContent; -@property (nonatomic, assign) YGAlign alignSelf; -@property (nonatomic, assign) YGAlign alignItems; -@property (nonatomic, assign) YGAlign alignContent; -@property (nonatomic, assign) YGPositionType position; -@property (nonatomic, assign) YGWrap flexWrap; -@property (nonatomic, assign) YGDisplay display; - -@property (nonatomic, assign) float flex; -@property (nonatomic, assign) float flexGrow; -@property (nonatomic, assign) float flexShrink; -@property (nonatomic, assign) YGValue flexBasis; - -@property (nonatomic, assign) float aspectRatio; - -/** - * Interface direction (LTR or RTL) - */ -@property (nonatomic, assign) YGDirection direction; - -/** - * Clipping properties - */ -@property (nonatomic, assign) YGOverflow overflow; - -/** - * Represents the natural size of the view, which is used when explicit size is not set or is ambiguous. - * Defaults to `{UIViewNoIntrinsicMetric, UIViewNoIntrinsicMetric}`. - */ -@property (nonatomic, assign) CGSize intrinsicContentSize; - -#pragma mark - Layout - -/** - * Initiates layout starts from the view. - */ -- (void)layoutWithMinimumSize:(CGSize)minimumSize - maximumSize:(CGSize)maximumSize - layoutDirection:(UIUserInterfaceLayoutDirection)layoutDirection - layoutContext:(RCTLayoutContext)layoutContext; - -/** - * Applies computed layout metrics to the view. - */ -- (void)layoutWithMetrics:(RCTLayoutMetrics)layoutMetrics - layoutContext:(RCTLayoutContext)layoutContext; - -/** - * Calculates (if needed) and applies layout to subviews. - */ -- (void)layoutSubviewsWithContext:(RCTLayoutContext)layoutContext; - -/** - * Measures shadow view without side-effects. - * Default implementation uses Yoga for measuring. - */ -- (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize - maximumSize:(CGSize)maximumSize; - -/** - * Returns whether or not this view can have any subviews. - * Adding/inserting a child view to leaf view (`canHaveSubviews` equals `NO`) - * will throw an error. - * Return `NO` for components which must not have any descendants - * (like , for example.) - * Defaults to `YES`. Can be overridden in subclasses. - * Don't confuse this with `isYogaLeafNode`. - */ -- (BOOL)canHaveSubviews; - -/** - * Returns whether or not this node acts as a leaf node in the eyes of Yoga. - * For example `RCTTextShadowView` has children which it does not want Yoga - * to lay out so in the eyes of Yoga it is a leaf node. - * Defaults to `NO`. Can be overridden in subclasses. - * Don't confuse this with `canHaveSubviews`. - */ -- (BOOL)isYogaLeafNode; - -/** - * As described in RCTComponent protocol. - */ -- (void)didUpdateReactSubviews NS_REQUIRES_SUPER; -- (void)didSetProps:(NSArray *)changedProps NS_REQUIRES_SUPER; - -/** - * Computes the recursive offset, meaning the sum of all descendant offsets - - * this is the sum of all positions inset from parents. This is not merely the - * sum of `top`/`left`s, as this function uses the *actual* positions of - * children, not the style specified positions - it computes this based on the - * resulting layout. It does not yet compensate for native scroll view insets or - * transforms or anchor points. - */ -- (CGRect)measureLayoutRelativeToAncestor:(RCTShadowView *)ancestor; - -/** - * Checks if the current shadow view is a descendant of the provided `ancestor` - */ -- (BOOL)viewIsDescendantOf:(RCTShadowView *)ancestor; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTShadowView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTShadowView.m deleted file mode 100644 index 40c0cdaf..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTShadowView.m +++ /dev/null @@ -1,691 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTShadowView.h" - -#import "RCTConvert.h" -#import "RCTI18nUtil.h" -#import "RCTLayout.h" -#import "RCTLog.h" -#import "RCTShadowView+Layout.h" -#import "RCTUtils.h" -#import "UIView+Private.h" -#import "UIView+React.h" - -typedef void (^RCTActionBlock)(RCTShadowView *shadowViewSelf, id value); -typedef void (^RCTResetActionBlock)(RCTShadowView *shadowViewSelf); - -typedef NS_ENUM(unsigned int, meta_prop_t) { - META_PROP_LEFT, - META_PROP_TOP, - META_PROP_RIGHT, - META_PROP_BOTTOM, - META_PROP_START, - META_PROP_END, - META_PROP_HORIZONTAL, - META_PROP_VERTICAL, - META_PROP_ALL, - META_PROP_COUNT, -}; - -@implementation RCTShadowView -{ - NSDictionary *_lastParentProperties; - NSMutableArray *_reactSubviews; - BOOL _recomputePadding; - BOOL _recomputeMargin; - BOOL _recomputeBorder; - YGValue _paddingMetaProps[META_PROP_COUNT]; - YGValue _marginMetaProps[META_PROP_COUNT]; - YGValue _borderMetaProps[META_PROP_COUNT]; -} - -+ (YGConfigRef)yogaConfig -{ - static YGConfigRef yogaConfig; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - yogaConfig = YGConfigNew(); - YGConfigSetPointScaleFactor(yogaConfig, RCTScreenScale()); - YGConfigSetUseLegacyStretchBehaviour(yogaConfig, true); - }); - return yogaConfig; -} - -@synthesize reactTag = _reactTag; - -// YogaNode API - -static void RCTPrint(YGNodeRef node) -{ - RCTShadowView *shadowView = (__bridge RCTShadowView *)YGNodeGetContext(node); - printf("%s(%lld), ", shadowView.viewName.UTF8String, (long long)shadowView.reactTag.integerValue); -} - -#define RCT_SET_YGVALUE(ygvalue, setter, ...) \ -switch (ygvalue.unit) { \ - case YGUnitAuto: \ - case YGUnitUndefined: \ - setter(__VA_ARGS__, YGUndefined); \ - break; \ - case YGUnitPoint: \ - setter(__VA_ARGS__, ygvalue.value); \ - break; \ - case YGUnitPercent: \ - setter##Percent(__VA_ARGS__, ygvalue.value); \ - break; \ -} - -#define RCT_SET_YGVALUE_AUTO(ygvalue, setter, ...) \ -switch (ygvalue.unit) { \ - case YGUnitAuto: \ - setter##Auto(__VA_ARGS__); \ - break; \ - case YGUnitUndefined: \ - setter(__VA_ARGS__, YGUndefined); \ - break; \ - case YGUnitPoint: \ - setter(__VA_ARGS__, ygvalue.value); \ - break; \ - case YGUnitPercent: \ - setter##Percent(__VA_ARGS__, ygvalue.value); \ - break; \ -} - -static void RCTProcessMetaPropsPadding(const YGValue metaProps[META_PROP_COUNT], YGNodeRef node) { - if (![[RCTI18nUtil sharedInstance] doLeftAndRightSwapInRTL]) { - RCT_SET_YGVALUE(metaProps[META_PROP_START], YGNodeStyleSetPadding, node, YGEdgeStart); - RCT_SET_YGVALUE(metaProps[META_PROP_END], YGNodeStyleSetPadding, node, YGEdgeEnd); - RCT_SET_YGVALUE(metaProps[META_PROP_LEFT], YGNodeStyleSetPadding, node, YGEdgeLeft); - RCT_SET_YGVALUE(metaProps[META_PROP_RIGHT], YGNodeStyleSetPadding, node, YGEdgeRight); - } else { - YGValue start = metaProps[META_PROP_START].unit == YGUnitUndefined ? metaProps[META_PROP_LEFT] : metaProps[META_PROP_START]; - YGValue end = metaProps[META_PROP_END].unit == YGUnitUndefined ? metaProps[META_PROP_RIGHT] : metaProps[META_PROP_END]; - RCT_SET_YGVALUE(start, YGNodeStyleSetPadding, node, YGEdgeStart); - RCT_SET_YGVALUE(end, YGNodeStyleSetPadding, node, YGEdgeEnd); - } - RCT_SET_YGVALUE(metaProps[META_PROP_TOP], YGNodeStyleSetPadding, node, YGEdgeTop); - RCT_SET_YGVALUE(metaProps[META_PROP_BOTTOM], YGNodeStyleSetPadding, node, YGEdgeBottom); - RCT_SET_YGVALUE(metaProps[META_PROP_HORIZONTAL], YGNodeStyleSetPadding, node, YGEdgeHorizontal); - RCT_SET_YGVALUE(metaProps[META_PROP_VERTICAL], YGNodeStyleSetPadding, node, YGEdgeVertical); - RCT_SET_YGVALUE(metaProps[META_PROP_ALL], YGNodeStyleSetPadding, node, YGEdgeAll); -} - -static void RCTProcessMetaPropsMargin(const YGValue metaProps[META_PROP_COUNT], YGNodeRef node) { - if (![[RCTI18nUtil sharedInstance] doLeftAndRightSwapInRTL]) { - RCT_SET_YGVALUE_AUTO(metaProps[META_PROP_START], YGNodeStyleSetMargin, node, YGEdgeStart); - RCT_SET_YGVALUE_AUTO(metaProps[META_PROP_END], YGNodeStyleSetMargin, node, YGEdgeEnd); - RCT_SET_YGVALUE_AUTO(metaProps[META_PROP_LEFT], YGNodeStyleSetMargin, node, YGEdgeLeft); - RCT_SET_YGVALUE_AUTO(metaProps[META_PROP_RIGHT], YGNodeStyleSetMargin, node, YGEdgeRight); - } else { - YGValue start = metaProps[META_PROP_START].unit == YGUnitUndefined ? metaProps[META_PROP_LEFT] : metaProps[META_PROP_START]; - YGValue end = metaProps[META_PROP_END].unit == YGUnitUndefined ? metaProps[META_PROP_RIGHT] : metaProps[META_PROP_END]; - RCT_SET_YGVALUE_AUTO(start, YGNodeStyleSetMargin, node, YGEdgeStart); - RCT_SET_YGVALUE_AUTO(end, YGNodeStyleSetMargin, node, YGEdgeEnd); - } - RCT_SET_YGVALUE_AUTO(metaProps[META_PROP_TOP], YGNodeStyleSetMargin, node, YGEdgeTop); - RCT_SET_YGVALUE_AUTO(metaProps[META_PROP_BOTTOM], YGNodeStyleSetMargin, node, YGEdgeBottom); - RCT_SET_YGVALUE_AUTO(metaProps[META_PROP_HORIZONTAL], YGNodeStyleSetMargin, node, YGEdgeHorizontal); - RCT_SET_YGVALUE_AUTO(metaProps[META_PROP_VERTICAL], YGNodeStyleSetMargin, node, YGEdgeVertical); - RCT_SET_YGVALUE_AUTO(metaProps[META_PROP_ALL], YGNodeStyleSetMargin, node, YGEdgeAll); -} - -static void RCTProcessMetaPropsBorder(const YGValue metaProps[META_PROP_COUNT], YGNodeRef node) { - if (![[RCTI18nUtil sharedInstance] doLeftAndRightSwapInRTL]) { - YGNodeStyleSetBorder(node, YGEdgeStart, metaProps[META_PROP_START].value); - YGNodeStyleSetBorder(node, YGEdgeEnd, metaProps[META_PROP_END].value); - YGNodeStyleSetBorder(node, YGEdgeLeft, metaProps[META_PROP_LEFT].value); - YGNodeStyleSetBorder(node, YGEdgeRight, metaProps[META_PROP_RIGHT].value); - } else { - const float start = YGFloatIsUndefined(metaProps[META_PROP_START].value) ? metaProps[META_PROP_LEFT].value : metaProps[META_PROP_START].value; - const float end = YGFloatIsUndefined(metaProps[META_PROP_END].value) ? metaProps[META_PROP_RIGHT].value : metaProps[META_PROP_END].value; - YGNodeStyleSetBorder(node, YGEdgeStart, start); - YGNodeStyleSetBorder(node, YGEdgeEnd, end); - } - YGNodeStyleSetBorder(node, YGEdgeTop, metaProps[META_PROP_TOP].value); - YGNodeStyleSetBorder(node, YGEdgeBottom, metaProps[META_PROP_BOTTOM].value); - YGNodeStyleSetBorder(node, YGEdgeHorizontal, metaProps[META_PROP_HORIZONTAL].value); - YGNodeStyleSetBorder(node, YGEdgeVertical, metaProps[META_PROP_VERTICAL].value); - YGNodeStyleSetBorder(node, YGEdgeAll, metaProps[META_PROP_ALL].value); -} - -- (CGRect)measureLayoutRelativeToAncestor:(RCTShadowView *)ancestor -{ - CGPoint offset = CGPointZero; - NSInteger depth = 30; // max depth to search - RCTShadowView *shadowView = self; - while (depth && shadowView && shadowView != ancestor) { - offset.x += shadowView.layoutMetrics.frame.origin.x; - offset.y += shadowView.layoutMetrics.frame.origin.y; - shadowView = shadowView->_superview; - depth--; - } - if (ancestor != shadowView) { - return CGRectNull; - } - return (CGRect){offset, self.layoutMetrics.frame.size}; -} - -- (BOOL)viewIsDescendantOf:(RCTShadowView *)ancestor -{ - NSInteger depth = 30; // max depth to search - RCTShadowView *shadowView = self; - while (depth && shadowView && shadowView != ancestor) { - shadowView = shadowView->_superview; - depth--; - } - return ancestor == shadowView; -} - -- (instancetype)init -{ - if (self = [super init]) { - for (unsigned int ii = 0; ii < META_PROP_COUNT; ii++) { - _paddingMetaProps[ii] = YGValueUndefined; - _marginMetaProps[ii] = YGValueUndefined; - _borderMetaProps[ii] = YGValueUndefined; - } - - _intrinsicContentSize = CGSizeMake(UIViewNoIntrinsicMetric, UIViewNoIntrinsicMetric); - - _newView = YES; - - _reactSubviews = [NSMutableArray array]; - - _yogaNode = YGNodeNewWithConfig([[self class] yogaConfig]); - YGNodeSetContext(_yogaNode, (__bridge void *)self); - YGNodeSetPrintFunc(_yogaNode, RCTPrint); - } - return self; -} - -- (BOOL)isReactRootView -{ - return RCTIsReactRootView(self.reactTag); -} - -- (void)dealloc -{ - YGNodeFree(_yogaNode); -} - -- (BOOL)canHaveSubviews -{ - return YES; -} - -- (BOOL)isYogaLeafNode -{ - return NO; -} - -- (void)insertReactSubview:(RCTShadowView *)subview atIndex:(NSInteger)atIndex -{ - RCTAssert(self.canHaveSubviews, @"Attempt to insert subview inside leaf view."); - - [_reactSubviews insertObject:subview atIndex:atIndex]; - if (![self isYogaLeafNode]) { - YGNodeInsertChild(_yogaNode, subview.yogaNode, (uint32_t)atIndex); - } - subview->_superview = self; -} - -- (void)removeReactSubview:(RCTShadowView *)subview -{ - subview->_superview = nil; - [_reactSubviews removeObject:subview]; - if (![self isYogaLeafNode]) { - YGNodeRemoveChild(_yogaNode, subview.yogaNode); - } -} - -- (NSArray *)reactSubviews -{ - return _reactSubviews; -} - -- (RCTShadowView *)reactSuperview -{ - return _superview; -} - -#pragma mark - Layout - -- (void)layoutWithMinimumSize:(CGSize)minimumSize - maximumSize:(CGSize)maximumSize - layoutDirection:(UIUserInterfaceLayoutDirection)layoutDirection - layoutContext:(RCTLayoutContext)layoutContext -{ - YGNodeRef yogaNode = _yogaNode; - - CGSize oldMinimumSize = (CGSize){ - RCTCoreGraphicsFloatFromYogaValue(YGNodeStyleGetMinWidth(yogaNode), 0.0), - RCTCoreGraphicsFloatFromYogaValue(YGNodeStyleGetMinHeight(yogaNode), 0.0) - }; - - if (!CGSizeEqualToSize(oldMinimumSize, minimumSize)) { - YGNodeStyleSetMinWidth(yogaNode, RCTYogaFloatFromCoreGraphicsFloat(minimumSize.width)); - YGNodeStyleSetMinHeight(yogaNode, RCTYogaFloatFromCoreGraphicsFloat(minimumSize.height)); - } - - YGNodeCalculateLayout( - yogaNode, - RCTYogaFloatFromCoreGraphicsFloat(maximumSize.width), - RCTYogaFloatFromCoreGraphicsFloat(maximumSize.height), - RCTYogaLayoutDirectionFromUIKitLayoutDirection(layoutDirection) - ); - - RCTAssert(!YGNodeIsDirty(yogaNode), @"Attempt to get layout metrics from dirtied Yoga node."); - - if (!YGNodeGetHasNewLayout(yogaNode)) { - return; - } - - YGNodeSetHasNewLayout(yogaNode, false); - - RCTLayoutMetrics layoutMetrics = RCTLayoutMetricsFromYogaNode(yogaNode); - - layoutContext.absolutePosition.x += layoutMetrics.frame.origin.x; - layoutContext.absolutePosition.y += layoutMetrics.frame.origin.y; - - [self layoutWithMetrics:layoutMetrics - layoutContext:layoutContext]; - - [self layoutSubviewsWithContext:layoutContext]; -} - -- (void)layoutWithMetrics:(RCTLayoutMetrics)layoutMetrics - layoutContext:(RCTLayoutContext)layoutContext -{ - if (!RCTLayoutMetricsEqualToLayoutMetrics(self.layoutMetrics, layoutMetrics)) { - self.layoutMetrics = layoutMetrics; - [layoutContext.affectedShadowViews addObject:self]; - } -} - -- (void)layoutSubviewsWithContext:(RCTLayoutContext)layoutContext -{ - RCTLayoutMetrics layoutMetrics = self.layoutMetrics; - - if (layoutMetrics.displayType == RCTDisplayTypeNone) { - return; - } - - for (RCTShadowView *childShadowView in _reactSubviews) { - YGNodeRef childYogaNode = childShadowView.yogaNode; - - RCTAssert(!YGNodeIsDirty(childYogaNode), @"Attempt to get layout metrics from dirtied Yoga node."); - - if (!YGNodeGetHasNewLayout(childYogaNode)) { - continue; - } - - YGNodeSetHasNewLayout(childYogaNode, false); - - RCTLayoutMetrics childLayoutMetrics = RCTLayoutMetricsFromYogaNode(childYogaNode); - - layoutContext.absolutePosition.x += childLayoutMetrics.frame.origin.x; - layoutContext.absolutePosition.y += childLayoutMetrics.frame.origin.y; - - [childShadowView layoutWithMetrics:childLayoutMetrics - layoutContext:layoutContext]; - - // Recursive call. - [childShadowView layoutSubviewsWithContext:layoutContext]; - } -} - -- (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximumSize -{ - YGNodeRef clonedYogaNode = YGNodeClone(self.yogaNode); - YGNodeRef constraintYogaNode = YGNodeNewWithConfig([[self class] yogaConfig]); - - YGNodeInsertChild(constraintYogaNode, clonedYogaNode, 0); - - YGNodeStyleSetMinWidth(constraintYogaNode, RCTYogaFloatFromCoreGraphicsFloat(minimumSize.width)); - YGNodeStyleSetMinHeight(constraintYogaNode, RCTYogaFloatFromCoreGraphicsFloat(minimumSize.height)); - YGNodeStyleSetMaxWidth(constraintYogaNode, RCTYogaFloatFromCoreGraphicsFloat(maximumSize.width)); - YGNodeStyleSetMaxHeight(constraintYogaNode, RCTYogaFloatFromCoreGraphicsFloat(maximumSize.height)); - - YGNodeCalculateLayout( - constraintYogaNode, - YGUndefined, - YGUndefined, - RCTYogaLayoutDirectionFromUIKitLayoutDirection(self.layoutMetrics.layoutDirection) - ); - - CGSize measuredSize = (CGSize){ - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetWidth(constraintYogaNode)), - RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetHeight(constraintYogaNode)), - }; - - YGNodeRemoveChild(constraintYogaNode, clonedYogaNode); - YGNodeFree(constraintYogaNode); - YGNodeFree(clonedYogaNode); - - return measuredSize; -} - -- (NSNumber *)reactTagAtPoint:(CGPoint)point -{ - for (RCTShadowView *shadowView in _reactSubviews) { - if (CGRectContainsPoint(shadowView.layoutMetrics.frame, point)) { - CGPoint relativePoint = point; - CGPoint origin = shadowView.layoutMetrics.frame.origin; - relativePoint.x -= origin.x; - relativePoint.y -= origin.y; - return [shadowView reactTagAtPoint:relativePoint]; - } - } - return self.reactTag; -} - -- (NSString *)description -{ - NSString *description = super.description; - description = [[description substringToIndex:description.length - 1] stringByAppendingFormat:@"; viewName: %@; reactTag: %@; frame: %@>", self.viewName, self.reactTag, NSStringFromCGRect(self.layoutMetrics.frame)]; - return description; -} - -- (void)addRecursiveDescriptionToString:(NSMutableString *)string atLevel:(NSUInteger)level -{ - for (NSUInteger i = 0; i < level; i++) { - [string appendString:@" | "]; - } - - [string appendString:self.description]; - [string appendString:@"\n"]; - - for (RCTShadowView *subview in _reactSubviews) { - [subview addRecursiveDescriptionToString:string atLevel:level + 1]; - } -} - -- (NSString *)recursiveDescription -{ - NSMutableString *description = [NSMutableString string]; - [self addRecursiveDescriptionToString:description atLevel:0]; - return description; -} - -// Margin - -#define RCT_MARGIN_PROPERTY(prop, metaProp) \ -- (void)setMargin##prop:(YGValue)value \ -{ \ - _marginMetaProps[META_PROP_##metaProp] = value; \ - _recomputeMargin = YES; \ -} \ -- (YGValue)margin##prop \ -{ \ - return _marginMetaProps[META_PROP_##metaProp]; \ -} - -RCT_MARGIN_PROPERTY(, ALL) -RCT_MARGIN_PROPERTY(Vertical, VERTICAL) -RCT_MARGIN_PROPERTY(Horizontal, HORIZONTAL) -RCT_MARGIN_PROPERTY(Top, TOP) -RCT_MARGIN_PROPERTY(Left, LEFT) -RCT_MARGIN_PROPERTY(Bottom, BOTTOM) -RCT_MARGIN_PROPERTY(Right, RIGHT) -RCT_MARGIN_PROPERTY(Start, START) -RCT_MARGIN_PROPERTY(End, END) - -// Padding - -#define RCT_PADDING_PROPERTY(prop, metaProp) \ -- (void)setPadding##prop:(YGValue)value \ -{ \ - _paddingMetaProps[META_PROP_##metaProp] = value; \ - _recomputePadding = YES; \ -} \ -- (YGValue)padding##prop \ -{ \ - return _paddingMetaProps[META_PROP_##metaProp]; \ -} - -RCT_PADDING_PROPERTY(, ALL) -RCT_PADDING_PROPERTY(Vertical, VERTICAL) -RCT_PADDING_PROPERTY(Horizontal, HORIZONTAL) -RCT_PADDING_PROPERTY(Top, TOP) -RCT_PADDING_PROPERTY(Left, LEFT) -RCT_PADDING_PROPERTY(Bottom, BOTTOM) -RCT_PADDING_PROPERTY(Right, RIGHT) -RCT_PADDING_PROPERTY(Start, START) -RCT_PADDING_PROPERTY(End, END) - -// Border - -#define RCT_BORDER_PROPERTY(prop, metaProp) \ -- (void)setBorder##prop##Width:(float)value \ -{ \ - _borderMetaProps[META_PROP_##metaProp].value = value; \ - _recomputeBorder = YES; \ -} \ -- (float)border##prop##Width \ -{ \ - return _borderMetaProps[META_PROP_##metaProp].value; \ -} - -RCT_BORDER_PROPERTY(, ALL) -RCT_BORDER_PROPERTY(Top, TOP) -RCT_BORDER_PROPERTY(Left, LEFT) -RCT_BORDER_PROPERTY(Bottom, BOTTOM) -RCT_BORDER_PROPERTY(Right, RIGHT) -RCT_BORDER_PROPERTY(Start, START) -RCT_BORDER_PROPERTY(End, END) - -// Dimensions -#define RCT_DIMENSION_PROPERTY(setProp, getProp, cssProp) \ -- (void)set##setProp:(YGValue)value \ -{ \ - RCT_SET_YGVALUE_AUTO(value, YGNodeStyleSet##cssProp, _yogaNode); \ -} \ -- (YGValue)getProp \ -{ \ - return YGNodeStyleGet##cssProp(_yogaNode); \ -} - -#define RCT_MIN_MAX_DIMENSION_PROPERTY(setProp, getProp, cssProp) \ -- (void)set##setProp:(YGValue)value \ -{ \ - RCT_SET_YGVALUE(value, YGNodeStyleSet##cssProp, _yogaNode); \ -} \ -- (YGValue)getProp \ -{ \ - return YGNodeStyleGet##cssProp(_yogaNode); \ -} - -RCT_DIMENSION_PROPERTY(Width, width, Width) -RCT_DIMENSION_PROPERTY(Height, height, Height) -RCT_MIN_MAX_DIMENSION_PROPERTY(MinWidth, minWidth, MinWidth) -RCT_MIN_MAX_DIMENSION_PROPERTY(MinHeight, minHeight, MinHeight) -RCT_MIN_MAX_DIMENSION_PROPERTY(MaxWidth, maxWidth, MaxWidth) -RCT_MIN_MAX_DIMENSION_PROPERTY(MaxHeight, maxHeight, MaxHeight) - -// Position - -#define RCT_POSITION_PROPERTY(setProp, getProp, edge) \ -- (void)set##setProp:(YGValue)value \ -{ \ - RCT_SET_YGVALUE(value, YGNodeStyleSetPosition, _yogaNode, edge); \ -} \ -- (YGValue)getProp \ -{ \ - return YGNodeStyleGetPosition(_yogaNode, edge); \ -} - - -RCT_POSITION_PROPERTY(Top, top, YGEdgeTop) -RCT_POSITION_PROPERTY(Bottom, bottom, YGEdgeBottom) -RCT_POSITION_PROPERTY(Start, start, YGEdgeStart) -RCT_POSITION_PROPERTY(End, end, YGEdgeEnd) - -- (void)setLeft:(YGValue)value -{ - YGEdge edge = [[RCTI18nUtil sharedInstance] doLeftAndRightSwapInRTL] ? YGEdgeStart : YGEdgeLeft; - RCT_SET_YGVALUE(value, YGNodeStyleSetPosition, _yogaNode, edge); -} -- (YGValue)left -{ - YGEdge edge = [[RCTI18nUtil sharedInstance] doLeftAndRightSwapInRTL] ? YGEdgeStart : YGEdgeLeft; - return YGNodeStyleGetPosition(_yogaNode, edge); -} - -- (void)setRight:(YGValue)value -{ - YGEdge edge = [[RCTI18nUtil sharedInstance] doLeftAndRightSwapInRTL] ? YGEdgeEnd : YGEdgeRight; - RCT_SET_YGVALUE(value, YGNodeStyleSetPosition, _yogaNode, edge); -} -- (YGValue)right -{ - YGEdge edge = [[RCTI18nUtil sharedInstance] doLeftAndRightSwapInRTL] ? YGEdgeEnd : YGEdgeRight; - return YGNodeStyleGetPosition(_yogaNode, edge); -} - -// Size - -- (CGSize)size -{ - YGValue width = YGNodeStyleGetWidth(_yogaNode); - YGValue height = YGNodeStyleGetHeight(_yogaNode); - - return CGSizeMake( - width.unit == YGUnitPoint ? width.value : NAN, - height.unit == YGUnitPoint ? height.value : NAN - ); -} - -- (void)setSize:(CGSize)size -{ - YGNodeStyleSetWidth(_yogaNode, size.width); - YGNodeStyleSetHeight(_yogaNode, size.height); -} - -// IntrinsicContentSize - -static inline YGSize RCTShadowViewMeasure(YGNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode) -{ - RCTShadowView *shadowView = (__bridge RCTShadowView *)YGNodeGetContext(node); - - CGSize intrinsicContentSize = shadowView->_intrinsicContentSize; - // Replace `UIViewNoIntrinsicMetric` (which equals `-1`) with zero. - intrinsicContentSize.width = MAX(0, intrinsicContentSize.width); - intrinsicContentSize.height = MAX(0, intrinsicContentSize.height); - - YGSize result; - - switch (widthMode) { - case YGMeasureModeUndefined: - result.width = intrinsicContentSize.width; - break; - case YGMeasureModeExactly: - result.width = width; - break; - case YGMeasureModeAtMost: - result.width = MIN(width, intrinsicContentSize.width); - break; - } - - switch (heightMode) { - case YGMeasureModeUndefined: - result.height = intrinsicContentSize.height; - break; - case YGMeasureModeExactly: - result.height = height; - break; - case YGMeasureModeAtMost: - result.height = MIN(height, intrinsicContentSize.height); - break; - } - - return result; -} - -- (void)setIntrinsicContentSize:(CGSize)intrinsicContentSize -{ - if (CGSizeEqualToSize(_intrinsicContentSize, intrinsicContentSize)) { - return; - } - - _intrinsicContentSize = intrinsicContentSize; - - if (CGSizeEqualToSize(_intrinsicContentSize, CGSizeMake(UIViewNoIntrinsicMetric, UIViewNoIntrinsicMetric))) { - YGNodeSetMeasureFunc(_yogaNode, NULL); - } else { - YGNodeSetMeasureFunc(_yogaNode, RCTShadowViewMeasure); - } - - YGNodeMarkDirty(_yogaNode); -} - -// Local Data - -- (void)setLocalData:(__unused NSObject *)localData -{ - // Do nothing by default. -} - -// Flex - -- (void)setFlexBasis:(YGValue)value -{ - RCT_SET_YGVALUE_AUTO(value, YGNodeStyleSetFlexBasis, _yogaNode); -} - -- (YGValue)flexBasis -{ - return YGNodeStyleGetFlexBasis(_yogaNode); -} - -#define RCT_STYLE_PROPERTY(setProp, getProp, cssProp, type) \ -- (void)set##setProp:(type)value \ -{ \ - YGNodeStyleSet##cssProp(_yogaNode, value); \ -} \ -- (type)getProp \ -{ \ - return YGNodeStyleGet##cssProp(_yogaNode); \ -} - -RCT_STYLE_PROPERTY(Flex, flex, Flex, float) -RCT_STYLE_PROPERTY(FlexGrow, flexGrow, FlexGrow, float) -RCT_STYLE_PROPERTY(FlexShrink, flexShrink, FlexShrink, float) -RCT_STYLE_PROPERTY(FlexDirection, flexDirection, FlexDirection, YGFlexDirection) -RCT_STYLE_PROPERTY(JustifyContent, justifyContent, JustifyContent, YGJustify) -RCT_STYLE_PROPERTY(AlignSelf, alignSelf, AlignSelf, YGAlign) -RCT_STYLE_PROPERTY(AlignItems, alignItems, AlignItems, YGAlign) -RCT_STYLE_PROPERTY(AlignContent, alignContent, AlignContent, YGAlign) -RCT_STYLE_PROPERTY(Position, position, PositionType, YGPositionType) -RCT_STYLE_PROPERTY(FlexWrap, flexWrap, FlexWrap, YGWrap) -RCT_STYLE_PROPERTY(Overflow, overflow, Overflow, YGOverflow) -RCT_STYLE_PROPERTY(Display, display, Display, YGDisplay) -RCT_STYLE_PROPERTY(Direction, direction, Direction, YGDirection) -RCT_STYLE_PROPERTY(AspectRatio, aspectRatio, AspectRatio, float) - -- (void)didUpdateReactSubviews -{ - // Does nothing by default -} - -- (void)didSetProps:(__unused NSArray *)changedProps -{ - if (_recomputePadding) { - RCTProcessMetaPropsPadding(_paddingMetaProps, _yogaNode); - } - if (_recomputeMargin) { - RCTProcessMetaPropsMargin(_marginMetaProps, _yogaNode); - } - if (_recomputeBorder) { - RCTProcessMetaPropsBorder(_borderMetaProps, _yogaNode); - } - _recomputeMargin = NO; - _recomputePadding = NO; - _recomputeBorder = NO; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSlider.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSlider.h deleted file mode 100644 index 749225cc..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSlider.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTSlider : UISlider - -@property (nonatomic, copy) RCTBubblingEventBlock onValueChange; -@property (nonatomic, copy) RCTBubblingEventBlock onSlidingComplete; - -@property (nonatomic, assign) float step; -@property (nonatomic, assign) float lastValue; - -@property (nonatomic, strong) UIImage *trackImage; -@property (nonatomic, strong) UIImage *minimumTrackImage; -@property (nonatomic, strong) UIImage *maximumTrackImage; - -@property (nonatomic, strong) UIImage *thumbImage; - - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSlider.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSlider.m deleted file mode 100644 index 11898a82..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSlider.m +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSlider.h" - -@implementation RCTSlider -{ - float _unclippedValue; -} - -- (void)setValue:(float)value -{ - _unclippedValue = value; - super.value = value; -} - -- (void)setMinimumValue:(float)minimumValue -{ - super.minimumValue = minimumValue; - super.value = _unclippedValue; -} - -- (void)setMaximumValue:(float)maximumValue -{ - super.maximumValue = maximumValue; - super.value = _unclippedValue; -} - -- (void)setTrackImage:(UIImage *)trackImage -{ - if (trackImage != _trackImage) { - _trackImage = trackImage; - CGFloat width = trackImage.size.width / 2; - UIImage *minimumTrackImage = [trackImage resizableImageWithCapInsets:(UIEdgeInsets){ - 0, width, 0, width - } resizingMode:UIImageResizingModeStretch]; - UIImage *maximumTrackImage = [trackImage resizableImageWithCapInsets:(UIEdgeInsets){ - 0, width, 0, width - } resizingMode:UIImageResizingModeStretch]; - [self setMinimumTrackImage:minimumTrackImage forState:UIControlStateNormal]; - [self setMaximumTrackImage:maximumTrackImage forState:UIControlStateNormal]; - } -} - -- (void)setMinimumTrackImage:(UIImage *)minimumTrackImage -{ - _trackImage = nil; - minimumTrackImage = [minimumTrackImage resizableImageWithCapInsets:(UIEdgeInsets){ - 0, minimumTrackImage.size.width, 0, 0 - } resizingMode:UIImageResizingModeStretch]; - [self setMinimumTrackImage:minimumTrackImage forState:UIControlStateNormal]; -} - -- (UIImage *)minimumTrackImage -{ - return [self thumbImageForState:UIControlStateNormal]; -} - -- (void)setMaximumTrackImage:(UIImage *)maximumTrackImage -{ - _trackImage = nil; - maximumTrackImage = [maximumTrackImage resizableImageWithCapInsets:(UIEdgeInsets){ - 0, 0, 0, maximumTrackImage.size.width - } resizingMode:UIImageResizingModeStretch]; - [self setMaximumTrackImage:maximumTrackImage forState:UIControlStateNormal]; -} - -- (UIImage *)maximumTrackImage -{ - return [self thumbImageForState:UIControlStateNormal]; -} - -- (void)setThumbImage:(UIImage *)thumbImage -{ - [self setThumbImage:thumbImage forState:UIControlStateNormal]; -} - -- (UIImage *)thumbImage -{ - return [self thumbImageForState:UIControlStateNormal]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSliderManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSliderManager.h deleted file mode 100644 index ffdf5209..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSliderManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTSliderManager : RCTViewManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSliderManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSliderManager.m deleted file mode 100644 index eb564c99..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSliderManager.m +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSliderManager.h" - -#import "RCTBridge.h" -#import "RCTEventDispatcher.h" -#import "RCTSlider.h" -#import "UIView+React.h" - -@implementation RCTSliderManager - -RCT_EXPORT_MODULE() - -- (UIView *)view -{ - RCTSlider *slider = [RCTSlider new]; - [slider addTarget:self action:@selector(sliderValueChanged:) - forControlEvents:UIControlEventValueChanged]; - [slider addTarget:self action:@selector(sliderTouchEnd:) - forControlEvents:(UIControlEventTouchUpInside | - UIControlEventTouchUpOutside | - UIControlEventTouchCancel)]; - return slider; -} - -static void RCTSendSliderEvent(RCTSlider *sender, BOOL continuous) -{ - float value = sender.value; - - if (sender.step > 0 && - sender.step <= (sender.maximumValue - sender.minimumValue)) { - - value = - MAX(sender.minimumValue, - MIN(sender.maximumValue, - sender.minimumValue + round((sender.value - sender.minimumValue) / sender.step) * sender.step - ) - ); - - [sender setValue:value animated:YES]; - } - - if (continuous) { - if (sender.onValueChange && sender.lastValue != value) { - sender.onValueChange(@{ - @"value": @(value), - }); - } - } else { - if (sender.onSlidingComplete) { - sender.onSlidingComplete(@{ - @"value": @(value), - }); - } - } - - sender.lastValue = value; -} - -- (void)sliderValueChanged:(RCTSlider *)sender -{ - RCTSendSliderEvent(sender, YES); -} - -- (void)sliderTouchEnd:(RCTSlider *)sender -{ - RCTSendSliderEvent(sender, NO); -} - -RCT_EXPORT_VIEW_PROPERTY(value, float); -RCT_EXPORT_VIEW_PROPERTY(step, float); -RCT_EXPORT_VIEW_PROPERTY(trackImage, UIImage); -RCT_EXPORT_VIEW_PROPERTY(minimumTrackImage, UIImage); -RCT_EXPORT_VIEW_PROPERTY(maximumTrackImage, UIImage); -RCT_EXPORT_VIEW_PROPERTY(minimumValue, float); -RCT_EXPORT_VIEW_PROPERTY(maximumValue, float); -RCT_EXPORT_VIEW_PROPERTY(minimumTrackTintColor, UIColor); -RCT_EXPORT_VIEW_PROPERTY(maximumTrackTintColor, UIColor); -RCT_EXPORT_VIEW_PROPERTY(onValueChange, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onSlidingComplete, RCTBubblingEventBlock); -RCT_EXPORT_VIEW_PROPERTY(thumbTintColor, UIColor); -RCT_EXPORT_VIEW_PROPERTY(thumbImage, UIImage); -RCT_CUSTOM_VIEW_PROPERTY(disabled, BOOL, RCTSlider) -{ - if (json) { - view.enabled = !([RCTConvert BOOL:json]); - } else { - view.enabled = defaultView.enabled; - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSwitch.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSwitch.h deleted file mode 100644 index 13c6b486..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSwitch.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTSwitch : UISwitch - -@property (nonatomic, assign) BOOL wasOn; -@property (nonatomic, copy) RCTBubblingEventBlock onChange; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSwitch.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSwitch.m deleted file mode 100644 index e0a8902f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSwitch.m +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSwitch.h" - -#import "RCTEventDispatcher.h" -#import "UIView+React.h" - -@implementation RCTSwitch - -- (void)setOn:(BOOL)on animated:(BOOL)animated { - _wasOn = on; - [super setOn:on animated:animated]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSwitchManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSwitchManager.h deleted file mode 100644 index 57242079..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSwitchManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTSwitchManager : RCTViewManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSwitchManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSwitchManager.m deleted file mode 100644 index 0aa33fba..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTSwitchManager.m +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSwitchManager.h" - -#import "RCTBridge.h" -#import "RCTEventDispatcher.h" -#import "RCTSwitch.h" -#import "UIView+React.h" - -@implementation RCTSwitchManager - -RCT_EXPORT_MODULE() - -- (UIView *)view -{ - RCTSwitch *switcher = [RCTSwitch new]; - [switcher addTarget:self - action:@selector(onChange:) - forControlEvents:UIControlEventValueChanged]; - return switcher; -} - -- (void)onChange:(RCTSwitch *)sender -{ - if (sender.wasOn != sender.on) { - if (sender.onChange) { - sender.onChange(@{ @"value": @(sender.on) }); - } - sender.wasOn = sender.on; - } -} - -RCT_EXPORT_VIEW_PROPERTY(onTintColor, UIColor); -RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor); -RCT_EXPORT_VIEW_PROPERTY(thumbTintColor, UIColor); -RCT_REMAP_VIEW_PROPERTY(value, on, BOOL); -RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock); -RCT_CUSTOM_VIEW_PROPERTY(disabled, BOOL, RCTSwitch) -{ - if (json) { - view.enabled = !([RCTConvert BOOL:json]); - } else { - view.enabled = defaultView.enabled; - } -} -RCT_REMAP_VIEW_PROPERTY(thumbColor, thumbTintColor, UIColor); -RCT_REMAP_VIEW_PROPERTY(trackColorForFalse, tintColor, UIColor); -RCT_REMAP_VIEW_PROPERTY(trackColorForTrue, onTintColor, UIColor); - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTTVView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTTVView.h deleted file mode 100644 index 8329b085..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTTVView.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -#import - -// A RCTView with additional properties and methods for user interaction using the Apple TV focus engine. -@interface RCTTVView : RCTView - -/** - * TV event handlers - */ -@property (nonatomic, assign) BOOL isTVSelectable; // True if this view is TV-focusable - -/** - * Properties for Apple TV focus parallax effects - */ -@property (nonatomic, copy) NSDictionary *tvParallaxProperties; - -/** - * TV preferred focus - */ -@property (nonatomic, assign) BOOL hasTVPreferredFocus; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTTVView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTTVView.m deleted file mode 100644 index 3c40eec8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTTVView.m +++ /dev/null @@ -1,246 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTVView.h" - -#import "RCTAutoInsetsProtocol.h" -#import "RCTBorderDrawing.h" -#import "RCTBridge.h" -#import "RCTConvert.h" -#import "RCTEventDispatcher.h" -#import "RCTLog.h" -#import "RCTRootViewInternal.h" -#import "RCTTVNavigationEventEmitter.h" -#import "RCTUtils.h" -#import "RCTView.h" -#import "UIView+React.h" - -@implementation RCTTVView -{ - UITapGestureRecognizer *_selectRecognizer; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - dispatch_once(&onceToken, ^{ - defaultTVParallaxProperties = @{ - @"enabled": @YES, - @"shiftDistanceX": @2.0f, - @"shiftDistanceY": @2.0f, - @"tiltAngle": @0.05f, - @"magnification": @1.0f, - @"pressMagnification": @1.0f, - @"pressDuration": @0.3f, - @"pressDelay": @0.0f - }; - }); - self.tvParallaxProperties = defaultTVParallaxProperties; - } - - return self; -} - -static NSDictionary* defaultTVParallaxProperties = nil; -static dispatch_once_t onceToken; - -- (void)setTvParallaxProperties:(NSDictionary *)tvParallaxProperties { - if (_tvParallaxProperties == nil) { - _tvParallaxProperties = [defaultTVParallaxProperties copy]; - return; - } - - NSMutableDictionary *newParallaxProperties = [NSMutableDictionary dictionaryWithDictionary:_tvParallaxProperties]; - for (NSString *k in [defaultTVParallaxProperties allKeys]) { - if (tvParallaxProperties[k]) { - newParallaxProperties[k] = tvParallaxProperties[k]; - } - } - _tvParallaxProperties = [newParallaxProperties copy]; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:unused) - -- (void)setIsTVSelectable:(BOOL)isTVSelectable { - self->_isTVSelectable = isTVSelectable; - if (isTVSelectable) { - UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] - initWithTarget:self - action:@selector(handleSelect:)]; - recognizer.allowedPressTypes = @[@(UIPressTypeSelect)]; - _selectRecognizer = recognizer; - [self addGestureRecognizer:_selectRecognizer]; - } else { - if(_selectRecognizer) { - [self removeGestureRecognizer:_selectRecognizer]; - } - } -} - -- (void)handleSelect:(__unused UIGestureRecognizer *)r -{ - if ([self.tvParallaxProperties[@"enabled"] boolValue] == YES) { - float magnification = [self.tvParallaxProperties[@"magnification"] floatValue]; - float pressMagnification = [self.tvParallaxProperties[@"pressMagnification"] floatValue]; - - // Duration of press animation - float pressDuration = [self.tvParallaxProperties[@"pressDuration"] floatValue]; - - // Delay of press animation - float pressDelay = [self.tvParallaxProperties[@"pressDelay"] floatValue]; - - [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:pressDelay]]; - - [UIView animateWithDuration:(pressDuration/2) - animations:^{ - self.transform = CGAffineTransformMakeScale(pressMagnification, pressMagnification); - } - completion:^(__unused BOOL finished1){ - [UIView animateWithDuration:(pressDuration/2) - animations:^{ - self.transform = CGAffineTransformMakeScale(magnification, magnification); - } - completion:^(__unused BOOL finished2) { - [[NSNotificationCenter defaultCenter] postNotificationName:RCTTVNavigationEventNotification - object:@{@"eventType":@"select",@"tag":self.reactTag}]; - }]; - }]; - - } else { - [[NSNotificationCenter defaultCenter] postNotificationName:RCTTVNavigationEventNotification - object:@{@"eventType":@"select",@"tag":self.reactTag}]; - } -} - -- (BOOL)isUserInteractionEnabled -{ - return YES; -} - -- (BOOL)canBecomeFocused -{ - return (self.isTVSelectable); -} - -- (void)addParallaxMotionEffects -{ - // Size of shift movements - CGFloat const shiftDistanceX = [self.tvParallaxProperties[@"shiftDistanceX"] floatValue]; - CGFloat const shiftDistanceY = [self.tvParallaxProperties[@"shiftDistanceY"] floatValue]; - - // Make horizontal movements shift the centre left and right - UIInterpolatingMotionEffect *xShift = [[UIInterpolatingMotionEffect alloc] - initWithKeyPath:@"center.x" - type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis]; - xShift.minimumRelativeValue = @( shiftDistanceX * -1.0f); - xShift.maximumRelativeValue = @( shiftDistanceX); - - // Make vertical movements shift the centre up and down - UIInterpolatingMotionEffect *yShift = [[UIInterpolatingMotionEffect alloc] - initWithKeyPath:@"center.y" - type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis]; - yShift.minimumRelativeValue = @( shiftDistanceY * -1.0f); - yShift.maximumRelativeValue = @( shiftDistanceY); - - // Size of tilt movements - CGFloat const tiltAngle = [self.tvParallaxProperties[@"tiltAngle"] floatValue]; - - // Now make horizontal movements effect a rotation about the Y axis for side-to-side rotation. - UIInterpolatingMotionEffect *xTilt = [[UIInterpolatingMotionEffect alloc] - initWithKeyPath:@"layer.transform" - type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis]; - - // CATransform3D value for minimumRelativeValue - CATransform3D transMinimumTiltAboutY = CATransform3DIdentity; - transMinimumTiltAboutY.m34 = 1.0 / 500; - transMinimumTiltAboutY = CATransform3DRotate(transMinimumTiltAboutY, tiltAngle * -1.0, 0, 1, 0); - - // CATransform3D value for minimumRelativeValue - CATransform3D transMaximumTiltAboutY = CATransform3DIdentity; - transMaximumTiltAboutY.m34 = 1.0 / 500; - transMaximumTiltAboutY = CATransform3DRotate(transMaximumTiltAboutY, tiltAngle, 0, 1, 0); - - // Set the transform property boundaries for the interpolation - xTilt.minimumRelativeValue = [NSValue valueWithCATransform3D: transMinimumTiltAboutY]; - xTilt.maximumRelativeValue = [NSValue valueWithCATransform3D: transMaximumTiltAboutY]; - - // Now make vertical movements effect a rotation about the X axis for up and down rotation. - UIInterpolatingMotionEffect *yTilt = [[UIInterpolatingMotionEffect alloc] - initWithKeyPath:@"layer.transform" - type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis]; - - // CATransform3D value for minimumRelativeValue - CATransform3D transMinimumTiltAboutX = CATransform3DIdentity; - transMinimumTiltAboutX.m34 = 1.0 / 500; - transMinimumTiltAboutX = CATransform3DRotate(transMinimumTiltAboutX, tiltAngle * -1.0, 1, 0, 0); - - // CATransform3D value for minimumRelativeValue - CATransform3D transMaximumTiltAboutX = CATransform3DIdentity; - transMaximumTiltAboutX.m34 = 1.0 / 500; - transMaximumTiltAboutX = CATransform3DRotate(transMaximumTiltAboutX, tiltAngle, 1, 0, 0); - - // Set the transform property boundaries for the interpolation - yTilt.minimumRelativeValue = [NSValue valueWithCATransform3D: transMinimumTiltAboutX]; - yTilt.maximumRelativeValue = [NSValue valueWithCATransform3D: transMaximumTiltAboutX]; - - // Add all of the motion effects to this group - self.motionEffects = @[xShift, yShift, xTilt, yTilt]; - - float magnification = [self.tvParallaxProperties[@"magnification"] floatValue]; - - [UIView animateWithDuration:0.2 animations:^{ - self.transform = CGAffineTransformMakeScale(magnification, magnification); - }]; -} - -- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator -{ - if (context.nextFocusedView == self && self.isTVSelectable ) { - [self becomeFirstResponder]; - [coordinator addCoordinatedAnimations:^(void){ - if([self.tvParallaxProperties[@"enabled"] boolValue]) { - [self addParallaxMotionEffects]; - } - [[NSNotificationCenter defaultCenter] postNotificationName:RCTTVNavigationEventNotification - object:@{@"eventType":@"focus",@"tag":self.reactTag}]; - } completion:^(void){}]; - } else { - [coordinator addCoordinatedAnimations:^(void){ - [[NSNotificationCenter defaultCenter] postNotificationName:RCTTVNavigationEventNotification - object:@{@"eventType":@"blur",@"tag":self.reactTag}]; - [UIView animateWithDuration:0.2 animations:^{ - self.transform = CGAffineTransformMakeScale(1, 1); - }]; - - for (UIMotionEffect *effect in [self.motionEffects copy]){ - [self removeMotionEffect:effect]; - } - } completion:^(void){}]; - [self resignFirstResponder]; - } -} - -- (void)setHasTVPreferredFocus:(BOOL)hasTVPreferredFocus -{ - _hasTVPreferredFocus = hasTVPreferredFocus; - if (hasTVPreferredFocus) { - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - UIView *rootview = self; - while (![rootview isReactRootView] && rootview != nil) { - rootview = [rootview superview]; - } - if (rootview == nil) return; - - rootview = [rootview superview]; - - [rootview setNeedsFocusUpdate]; - [rootview updateFocusIfNeeded]; - }); - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTTextDecorationLineType.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTTextDecorationLineType.h deleted file mode 100644 index 968333fa..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTTextDecorationLineType.h +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -typedef NS_ENUM(NSInteger, RCTTextDecorationLineType) { - RCTTextDecorationLineTypeNone = 0, - RCTTextDecorationLineTypeUnderline, - RCTTextDecorationLineTypeStrikethrough, - RCTTextDecorationLineTypeUnderlineStrikethrough, -}; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTView.h deleted file mode 100644 index a4ef2b3e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTView.h +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import -#import - -@protocol RCTAutoInsetsProtocol; - -@class RCTView; - -@interface RCTView : UIView - -/** - * Accessibility event handlers - */ -@property (nonatomic, copy) RCTDirectEventBlock onAccessibilityAction; -@property (nonatomic, copy) RCTDirectEventBlock onAccessibilityTap; -@property (nonatomic, copy) RCTDirectEventBlock onMagicTap; -@property (nonatomic, copy) RCTDirectEventBlock onAccessibilityEscape; - -/** - * Accessibility properties - */ -@property (nonatomic, copy) NSArray *accessibilityActions; - -/** - * Used to control how touch events are processed. - */ -@property (nonatomic, assign) RCTPointerEvents pointerEvents; - -+ (void)autoAdjustInsetsForView:(UIView *)parentView - withScrollView:(UIScrollView *)scrollView - updateOffset:(BOOL)updateOffset; - -/** - * Find the first view controller whose view, or any subview is the specified view. - */ -+ (UIEdgeInsets)contentInsetsForView:(UIView *)curView; - -/** - * Layout direction of the view. - * This is inherited from UIView+React, but we override it here - * to improve performance and make subclassing/overriding possible/easier. - */ -@property (nonatomic, assign) UIUserInterfaceLayoutDirection reactLayoutDirection; - -/** - * This is an optimization used to improve performance - * for large scrolling views with many subviews, such as a - * list or table. If set to YES, any clipped subviews will - * be removed from the view hierarchy whenever -updateClippedSubviews - * is called. This would typically be triggered by a scroll event - */ -@property (nonatomic, assign) BOOL removeClippedSubviews; - -/** - * Hide subviews if they are outside the view bounds. - * This is an optimisation used predominantly with RKScrollViews - * but it is applied recursively to all subviews that have - * removeClippedSubviews set to YES - */ -- (void)updateClippedSubviews; - -/** - * Border radii. - */ -@property (nonatomic, assign) CGFloat borderRadius; -@property (nonatomic, assign) CGFloat borderTopLeftRadius; -@property (nonatomic, assign) CGFloat borderTopRightRadius; -@property (nonatomic, assign) CGFloat borderTopStartRadius; -@property (nonatomic, assign) CGFloat borderTopEndRadius; -@property (nonatomic, assign) CGFloat borderBottomLeftRadius; -@property (nonatomic, assign) CGFloat borderBottomRightRadius; -@property (nonatomic, assign) CGFloat borderBottomStartRadius; -@property (nonatomic, assign) CGFloat borderBottomEndRadius; - -/** - * Border colors (actually retained). - */ -@property (nonatomic, assign) CGColorRef borderTopColor; -@property (nonatomic, assign) CGColorRef borderRightColor; -@property (nonatomic, assign) CGColorRef borderBottomColor; -@property (nonatomic, assign) CGColorRef borderLeftColor; -@property (nonatomic, assign) CGColorRef borderStartColor; -@property (nonatomic, assign) CGColorRef borderEndColor; -@property (nonatomic, assign) CGColorRef borderColor; - -/** - * Border widths. - */ -@property (nonatomic, assign) CGFloat borderTopWidth; -@property (nonatomic, assign) CGFloat borderRightWidth; -@property (nonatomic, assign) CGFloat borderBottomWidth; -@property (nonatomic, assign) CGFloat borderLeftWidth; -@property (nonatomic, assign) CGFloat borderStartWidth; -@property (nonatomic, assign) CGFloat borderEndWidth; -@property (nonatomic, assign) CGFloat borderWidth; - -/** - * Border styles. - */ -@property (nonatomic, assign) RCTBorderStyle borderStyle; - -/** - * Insets used when hit testing inside this view. - */ -@property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTView.m deleted file mode 100644 index 1493bbed..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTView.m +++ /dev/null @@ -1,841 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTView.h" - -#import "RCTAutoInsetsProtocol.h" -#import "RCTBorderDrawing.h" -#import "RCTConvert.h" -#import "RCTLog.h" -#import "RCTUtils.h" -#import "UIView+React.h" -#import "RCTI18nUtil.h" - -@implementation UIView (RCTViewUnmounting) - -- (void)react_remountAllSubviews -{ - // Normal views don't support unmounting, so all - // this does is forward message to our subviews, - // in case any of those do support it - - for (UIView *subview in self.subviews) { - [subview react_remountAllSubviews]; - } -} - -- (void)react_updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(UIView *)clipView -{ - // Even though we don't support subview unmounting - // we do support clipsToBounds, so if that's enabled - // we'll update the clipping - - if (self.clipsToBounds && self.subviews.count > 0) { - clipRect = [clipView convertRect:clipRect toView:self]; - clipRect = CGRectIntersection(clipRect, self.bounds); - clipView = self; - } - - // Normal views don't support unmounting, so all - // this does is forward message to our subviews, - // in case any of those do support it - - for (UIView *subview in self.subviews) { - [subview react_updateClippedSubviewsWithClipRect:clipRect relativeToView:clipView]; - } -} - -- (UIView *)react_findClipView -{ - UIView *testView = self; - UIView *clipView = nil; - CGRect clipRect = self.bounds; - // We will only look for a clipping view up the view hierarchy until we hit the root view. - while (testView) { - if (testView.clipsToBounds) { - if (clipView) { - CGRect testRect = [clipView convertRect:clipRect toView:testView]; - if (!CGRectContainsRect(testView.bounds, testRect)) { - clipView = testView; - clipRect = CGRectIntersection(testView.bounds, testRect); - } - } else { - clipView = testView; - clipRect = [self convertRect:self.bounds toView:clipView]; - } - } - if ([testView isReactRootView]) { - break; - } - testView = testView.superview; - } - return clipView ?: self.window; -} - -@end - -static NSString *RCTRecursiveAccessibilityLabel(UIView *view) -{ - NSMutableString *str = [NSMutableString stringWithString:@""]; - for (UIView *subview in view.subviews) { - NSString *label = subview.accessibilityLabel; - if (!label) { - label = RCTRecursiveAccessibilityLabel(subview); - } - if (label && label.length > 0) { - if (str.length > 0) { - [str appendString:@" "]; - } - [str appendString:label]; - } - } - return str; -} - -@implementation RCTView -{ - UIColor *_backgroundColor; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if ((self = [super initWithFrame:frame])) { - _borderWidth = -1; - _borderTopWidth = -1; - _borderRightWidth = -1; - _borderBottomWidth = -1; - _borderLeftWidth = -1; - _borderStartWidth = -1; - _borderEndWidth = -1; - _borderTopLeftRadius = -1; - _borderTopRightRadius = -1; - _borderTopStartRadius = -1; - _borderTopEndRadius = -1; - _borderBottomLeftRadius = -1; - _borderBottomRightRadius = -1; - _borderBottomStartRadius = -1; - _borderBottomEndRadius = -1; - _borderStyle = RCTBorderStyleSolid; - _hitTestEdgeInsets = UIEdgeInsetsZero; - - _backgroundColor = super.backgroundColor; - } - - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:unused) - -- (void)setReactLayoutDirection:(UIUserInterfaceLayoutDirection)layoutDirection -{ - if (_reactLayoutDirection != layoutDirection) { - _reactLayoutDirection = layoutDirection; - [self.layer setNeedsDisplay]; - } - - if ([self respondsToSelector:@selector(setSemanticContentAttribute:)]) { - self.semanticContentAttribute = - layoutDirection == UIUserInterfaceLayoutDirectionLeftToRight ? - UISemanticContentAttributeForceLeftToRight : - UISemanticContentAttributeForceRightToLeft; - } -} - -- (NSString *)accessibilityLabel -{ - NSString *label = super.accessibilityLabel; - if (label) { - return label; - } - return RCTRecursiveAccessibilityLabel(self); -} - -- (NSArray *)accessibilityCustomActions -{ - if (!_accessibilityActions.count) { - return nil; - } - - NSMutableArray *actions = [NSMutableArray array]; - for (NSString *action in _accessibilityActions) { - [actions addObject:[[UIAccessibilityCustomAction alloc] initWithName:action - target:self - selector:@selector(didActivateAccessibilityCustomAction:)]]; - } - - return [actions copy]; -} - -- (BOOL)didActivateAccessibilityCustomAction:(UIAccessibilityCustomAction *)action -{ - if (!_onAccessibilityAction) { - return NO; - } - - _onAccessibilityAction(@{ - @"action": action.name, - @"target": self.reactTag - }); - - return YES; -} - -- (void)setPointerEvents:(RCTPointerEvents)pointerEvents -{ - _pointerEvents = pointerEvents; - self.userInteractionEnabled = (pointerEvents != RCTPointerEventsNone); - if (pointerEvents == RCTPointerEventsBoxNone) { - self.accessibilityViewIsModal = NO; - } -} - -- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - BOOL canReceiveTouchEvents = ([self isUserInteractionEnabled] && ![self isHidden]); - if(!canReceiveTouchEvents) { - return nil; - } - - // `hitSubview` is the topmost subview which was hit. The hit point can - // be outside the bounds of `view` (e.g., if -clipsToBounds is NO). - UIView *hitSubview = nil; - BOOL isPointInside = [self pointInside:point withEvent:event]; - BOOL needsHitSubview = !(_pointerEvents == RCTPointerEventsNone || _pointerEvents == RCTPointerEventsBoxOnly); - if (needsHitSubview && (![self clipsToBounds] || isPointInside)) { - // Take z-index into account when calculating the touch target. - NSArray *sortedSubviews = [self reactZIndexSortedSubviews]; - - // The default behaviour of UIKit is that if a view does not contain a point, - // then no subviews will be returned from hit testing, even if they contain - // the hit point. By doing hit testing directly on the subviews, we bypass - // the strict containment policy (i.e., UIKit guarantees that every ancestor - // of the hit view will return YES from -pointInside:withEvent:). See: - // - https://developer.apple.com/library/ios/qa/qa2013/qa1812.html - for (UIView *subview in [sortedSubviews reverseObjectEnumerator]) { - CGPoint convertedPoint = [subview convertPoint:point fromView:self]; - hitSubview = [subview hitTest:convertedPoint withEvent:event]; - if (hitSubview != nil) { - break; - } - } - } - - UIView *hitView = (isPointInside ? self : nil); - - switch (_pointerEvents) { - case RCTPointerEventsNone: - return nil; - case RCTPointerEventsUnspecified: - return hitSubview ?: hitView; - case RCTPointerEventsBoxOnly: - return hitView; - case RCTPointerEventsBoxNone: - return hitSubview; - default: - RCTLogError(@"Invalid pointer-events specified %lld on %@", (long long)_pointerEvents, self); - return hitSubview ?: hitView; - } -} - -- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event -{ - if (UIEdgeInsetsEqualToEdgeInsets(self.hitTestEdgeInsets, UIEdgeInsetsZero)) { - return [super pointInside:point withEvent:event]; - } - CGRect hitFrame = UIEdgeInsetsInsetRect(self.bounds, self.hitTestEdgeInsets); - return CGRectContainsPoint(hitFrame, point); -} - -- (UIView *)reactAccessibilityElement -{ - return self; -} - -- (BOOL)isAccessibilityElement -{ - if (self.reactAccessibilityElement == self) { - return [super isAccessibilityElement]; - } - - return NO; -} - -- (BOOL)accessibilityActivate -{ - if (_onAccessibilityTap) { - _onAccessibilityTap(nil); - return YES; - } else { - return NO; - } -} - -- (BOOL)accessibilityPerformMagicTap -{ - if (_onMagicTap) { - _onMagicTap(nil); - return YES; - } else { - return NO; - } -} - -- (BOOL)accessibilityPerformEscape -{ - if (_onAccessibilityEscape) { - _onAccessibilityEscape(nil); - return YES; - } else { - return NO; - } -} - -- (NSString *)description -{ - NSString *superDescription = super.description; - NSRange semicolonRange = [superDescription rangeOfString:@";"]; - NSString *replacement = [NSString stringWithFormat:@"; reactTag: %@;", self.reactTag]; - return [superDescription stringByReplacingCharactersInRange:semicolonRange withString:replacement]; -} - -#pragma mark - Statics for dealing with layoutGuides - -+ (void)autoAdjustInsetsForView:(UIView *)parentView - withScrollView:(UIScrollView *)scrollView - updateOffset:(BOOL)updateOffset -{ - UIEdgeInsets baseInset = parentView.contentInset; - CGFloat previousInsetTop = scrollView.contentInset.top; - CGPoint contentOffset = scrollView.contentOffset; - - if (parentView.automaticallyAdjustContentInsets) { - UIEdgeInsets autoInset = [self contentInsetsForView:parentView]; - baseInset.top += autoInset.top; - baseInset.bottom += autoInset.bottom; - baseInset.left += autoInset.left; - baseInset.right += autoInset.right; - } - scrollView.contentInset = baseInset; - scrollView.scrollIndicatorInsets = baseInset; - - if (updateOffset) { - // If we're adjusting the top inset, then let's also adjust the contentOffset so that the view - // elements above the top guide do not cover the content. - // This is generally only needed when your views are initially laid out, for - // manual changes to contentOffset, you can optionally disable this step - CGFloat currentInsetTop = scrollView.contentInset.top; - if (currentInsetTop != previousInsetTop) { - contentOffset.y -= (currentInsetTop - previousInsetTop); - scrollView.contentOffset = contentOffset; - } - } -} - -+ (UIEdgeInsets)contentInsetsForView:(UIView *)view -{ - while (view) { - UIViewController *controller = view.reactViewController; - if (controller) { - return (UIEdgeInsets){ - controller.topLayoutGuide.length, 0, - controller.bottomLayoutGuide.length, 0 - }; - } - view = view.superview; - } - return UIEdgeInsetsZero; -} - -#pragma mark - View unmounting - -- (void)react_remountAllSubviews -{ - if (_removeClippedSubviews) { - for (UIView *view in self.reactSubviews) { - if (view.superview != self) { - [self addSubview:view]; - [view react_remountAllSubviews]; - } - } - } else { - // If _removeClippedSubviews is false, we must already be showing all subviews - [super react_remountAllSubviews]; - } -} - -- (void)react_updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(UIView *)clipView -{ - // TODO (#5906496): for scrollviews (the primary use-case) we could - // optimize this by only doing a range check along the scroll axis, - // instead of comparing the whole frame - - if (!_removeClippedSubviews) { - // Use default behavior if unmounting is disabled - return [super react_updateClippedSubviewsWithClipRect:clipRect relativeToView:clipView]; - } - - if (self.reactSubviews.count == 0) { - // Do nothing if we have no subviews - return; - } - - if (CGSizeEqualToSize(self.bounds.size, CGSizeZero)) { - // Do nothing if layout hasn't happened yet - return; - } - - // Convert clipping rect to local coordinates - clipRect = [clipView convertRect:clipRect toView:self]; - clipRect = CGRectIntersection(clipRect, self.bounds); - clipView = self; - - // Mount / unmount views - for (UIView *view in self.reactSubviews) { - if (!CGSizeEqualToSize(CGRectIntersection(clipRect, view.frame).size, CGSizeZero)) { - // View is at least partially visible, so remount it if unmounted - [self addSubview:view]; - - // Then test its subviews - if (CGRectContainsRect(clipRect, view.frame)) { - // View is fully visible, so remount all subviews - [view react_remountAllSubviews]; - } else { - // View is partially visible, so update clipped subviews - [view react_updateClippedSubviewsWithClipRect:clipRect relativeToView:clipView]; - } - - } else if (view.superview) { - - // View is completely outside the clipRect, so unmount it - [view removeFromSuperview]; - } - } -} - -- (void)setRemoveClippedSubviews:(BOOL)removeClippedSubviews -{ - if (!removeClippedSubviews && _removeClippedSubviews) { - [self react_remountAllSubviews]; - } - _removeClippedSubviews = removeClippedSubviews; -} - -- (void)didUpdateReactSubviews -{ - if (_removeClippedSubviews) { - [self updateClippedSubviews]; - } else { - [super didUpdateReactSubviews]; - } -} - -- (void)updateClippedSubviews -{ - // Find a suitable view to use for clipping - UIView *clipView = [self react_findClipView]; - if (clipView) { - [self react_updateClippedSubviewsWithClipRect:clipView.bounds relativeToView:clipView]; - } -} - -- (void)layoutSubviews -{ - // TODO (#5906496): this a nasty performance drain, but necessary - // to prevent gaps appearing when the loading spinner disappears. - // We might be able to fix this another way by triggering a call - // to updateClippedSubviews manually after loading - - [super layoutSubviews]; - - if (_removeClippedSubviews) { - [self updateClippedSubviews]; - } -} - -#pragma mark - Borders - -- (UIColor *)backgroundColor -{ - return _backgroundColor; -} - -- (void)setBackgroundColor:(UIColor *)backgroundColor -{ - if ([_backgroundColor isEqual:backgroundColor]) { - return; - } - - _backgroundColor = backgroundColor; - [self.layer setNeedsDisplay]; -} - -static CGFloat RCTDefaultIfNegativeTo(CGFloat defaultValue, CGFloat x) { - return x >= 0 ? x : defaultValue; -}; - -- (UIEdgeInsets)bordersAsInsets -{ - const CGFloat borderWidth = MAX(0, _borderWidth); - const BOOL isRTL = _reactLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft; - - if ([[RCTI18nUtil sharedInstance] doLeftAndRightSwapInRTL]) { - const CGFloat borderStartWidth = RCTDefaultIfNegativeTo(_borderLeftWidth, _borderStartWidth); - const CGFloat borderEndWidth = RCTDefaultIfNegativeTo(_borderRightWidth, _borderEndWidth); - - const CGFloat directionAwareBorderLeftWidth = isRTL ? borderEndWidth : borderStartWidth; - const CGFloat directionAwareBorderRightWidth = isRTL ? borderStartWidth : borderEndWidth; - - return (UIEdgeInsets) { - RCTDefaultIfNegativeTo(borderWidth, _borderTopWidth), - RCTDefaultIfNegativeTo(borderWidth, directionAwareBorderLeftWidth), - RCTDefaultIfNegativeTo(borderWidth, _borderBottomWidth), - RCTDefaultIfNegativeTo(borderWidth, directionAwareBorderRightWidth), - }; - } - - const CGFloat directionAwareBorderLeftWidth = isRTL ? _borderEndWidth : _borderStartWidth; - const CGFloat directionAwareBorderRightWidth = isRTL ? _borderStartWidth : _borderEndWidth; - - return (UIEdgeInsets) { - RCTDefaultIfNegativeTo(borderWidth, _borderTopWidth), - RCTDefaultIfNegativeTo(borderWidth, RCTDefaultIfNegativeTo(_borderLeftWidth, directionAwareBorderLeftWidth)), - RCTDefaultIfNegativeTo(borderWidth, _borderBottomWidth), - RCTDefaultIfNegativeTo(borderWidth, RCTDefaultIfNegativeTo(_borderRightWidth, directionAwareBorderRightWidth)), - }; -} - -- (RCTCornerRadii)cornerRadii -{ - const BOOL isRTL = _reactLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft; - const CGFloat radius = MAX(0, _borderRadius); - - CGFloat topLeftRadius; - CGFloat topRightRadius; - CGFloat bottomLeftRadius; - CGFloat bottomRightRadius; - - if ([[RCTI18nUtil sharedInstance] doLeftAndRightSwapInRTL]) { - const CGFloat topStartRadius = RCTDefaultIfNegativeTo(_borderTopLeftRadius, _borderTopStartRadius); - const CGFloat topEndRadius = RCTDefaultIfNegativeTo(_borderTopRightRadius, _borderTopEndRadius); - const CGFloat bottomStartRadius = RCTDefaultIfNegativeTo(_borderBottomLeftRadius, _borderBottomStartRadius); - const CGFloat bottomEndRadius = RCTDefaultIfNegativeTo(_borderBottomRightRadius, _borderBottomEndRadius); - - const CGFloat directionAwareTopLeftRadius = isRTL ? topEndRadius : topStartRadius; - const CGFloat directionAwareTopRightRadius = isRTL ? topStartRadius : topEndRadius; - const CGFloat directionAwareBottomLeftRadius = isRTL ? bottomEndRadius : bottomStartRadius; - const CGFloat directionAwareBottomRightRadius = isRTL ? bottomStartRadius : bottomEndRadius; - - topLeftRadius = RCTDefaultIfNegativeTo(radius, directionAwareTopLeftRadius); - topRightRadius = RCTDefaultIfNegativeTo(radius, directionAwareTopRightRadius); - bottomLeftRadius = RCTDefaultIfNegativeTo(radius, directionAwareBottomLeftRadius); - bottomRightRadius = RCTDefaultIfNegativeTo(radius, directionAwareBottomRightRadius); - } else { - const CGFloat directionAwareTopLeftRadius = isRTL ? _borderTopEndRadius : _borderTopStartRadius; - const CGFloat directionAwareTopRightRadius = isRTL ? _borderTopStartRadius : _borderTopEndRadius; - const CGFloat directionAwareBottomLeftRadius = isRTL ? _borderBottomEndRadius : _borderBottomStartRadius; - const CGFloat directionAwareBottomRightRadius = isRTL ? _borderBottomStartRadius : _borderBottomEndRadius; - - topLeftRadius = RCTDefaultIfNegativeTo(radius, RCTDefaultIfNegativeTo(_borderTopLeftRadius, directionAwareTopLeftRadius)); - topRightRadius = RCTDefaultIfNegativeTo(radius, RCTDefaultIfNegativeTo(_borderTopRightRadius, directionAwareTopRightRadius)); - bottomLeftRadius = RCTDefaultIfNegativeTo(radius, RCTDefaultIfNegativeTo(_borderBottomLeftRadius, directionAwareBottomLeftRadius)); - bottomRightRadius = RCTDefaultIfNegativeTo(radius, RCTDefaultIfNegativeTo(_borderBottomRightRadius, directionAwareBottomRightRadius)); - } - - // Get scale factors required to prevent radii from overlapping - const CGSize size = self.bounds.size; - const CGFloat topScaleFactor = RCTZeroIfNaN(MIN(1, size.width / (topLeftRadius + topRightRadius))); - const CGFloat bottomScaleFactor = RCTZeroIfNaN(MIN(1, size.width / (bottomLeftRadius + bottomRightRadius))); - const CGFloat rightScaleFactor = RCTZeroIfNaN(MIN(1, size.height / (topRightRadius + bottomRightRadius))); - const CGFloat leftScaleFactor = RCTZeroIfNaN(MIN(1, size.height / (topLeftRadius + bottomLeftRadius))); - - // Return scaled radii - return (RCTCornerRadii){ - topLeftRadius * MIN(topScaleFactor, leftScaleFactor), - topRightRadius * MIN(topScaleFactor, rightScaleFactor), - bottomLeftRadius * MIN(bottomScaleFactor, leftScaleFactor), - bottomRightRadius * MIN(bottomScaleFactor, rightScaleFactor), - }; -} - -- (RCTBorderColors)borderColors -{ - const BOOL isRTL = _reactLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft; - - if ([[RCTI18nUtil sharedInstance] doLeftAndRightSwapInRTL]) { - const CGColorRef borderStartColor = _borderStartColor ?: _borderLeftColor; - const CGColorRef borderEndColor = _borderEndColor ?: _borderRightColor; - - const CGColorRef directionAwareBorderLeftColor = isRTL ? borderEndColor : borderStartColor; - const CGColorRef directionAwareBorderRightColor = isRTL ? borderStartColor : borderEndColor; - - return (RCTBorderColors){ - _borderTopColor ?: _borderColor, - directionAwareBorderLeftColor ?: _borderColor, - _borderBottomColor ?: _borderColor, - directionAwareBorderRightColor ?: _borderColor, - }; - } - - const CGColorRef directionAwareBorderLeftColor = isRTL ? _borderEndColor : _borderStartColor; - const CGColorRef directionAwareBorderRightColor = isRTL ? _borderStartColor : _borderEndColor; - - return (RCTBorderColors){ - _borderTopColor ?: _borderColor, - directionAwareBorderLeftColor ?: _borderLeftColor ?: _borderColor, - _borderBottomColor ?: _borderColor, - directionAwareBorderRightColor ?: _borderRightColor ?: _borderColor, - }; -} - -- (void)reactSetFrame:(CGRect)frame -{ - // If frame is zero, or below the threshold where the border radii can - // be rendered as a stretchable image, we'll need to re-render. - // TODO: detect up-front if re-rendering is necessary - CGSize oldSize = self.bounds.size; - [super reactSetFrame:frame]; - if (!CGSizeEqualToSize(self.bounds.size, oldSize)) { - [self.layer setNeedsDisplay]; - } -} - -- (void)displayLayer:(CALayer *)layer -{ - if (CGSizeEqualToSize(layer.bounds.size, CGSizeZero)) { - return; - } - - RCTUpdateShadowPathForView(self); - - const RCTCornerRadii cornerRadii = [self cornerRadii]; - const UIEdgeInsets borderInsets = [self bordersAsInsets]; - const RCTBorderColors borderColors = [self borderColors]; - - BOOL useIOSBorderRendering = - !RCTRunningInTestEnvironment() && - RCTCornerRadiiAreEqual(cornerRadii) && - RCTBorderInsetsAreEqual(borderInsets) && - RCTBorderColorsAreEqual(borderColors) && - _borderStyle == RCTBorderStyleSolid && - - // iOS draws borders in front of the content whereas CSS draws them behind - // the content. For this reason, only use iOS border drawing when clipping - // or when the border is hidden. - - (borderInsets.top == 0 || (borderColors.top && CGColorGetAlpha(borderColors.top) == 0) || self.clipsToBounds); - - // iOS clips to the outside of the border, but CSS clips to the inside. To - // solve this, we'll need to add a container view inside the main view to - // correctly clip the subviews. - - if (useIOSBorderRendering) { - layer.cornerRadius = cornerRadii.topLeft; - layer.borderColor = borderColors.left; - layer.borderWidth = borderInsets.left; - layer.backgroundColor = _backgroundColor.CGColor; - layer.contents = nil; - layer.needsDisplayOnBoundsChange = NO; - layer.mask = nil; - return; - } - - UIImage *image = RCTGetBorderImage(_borderStyle, - layer.bounds.size, - cornerRadii, - borderInsets, - borderColors, - _backgroundColor.CGColor, - self.clipsToBounds); - - layer.backgroundColor = NULL; - - if (image == nil) { - layer.contents = nil; - layer.needsDisplayOnBoundsChange = NO; - return; - } - - CGRect contentsCenter = ({ - CGSize size = image.size; - UIEdgeInsets insets = image.capInsets; - CGRectMake( - insets.left / size.width, - insets.top / size.height, - (CGFloat)1.0 / size.width, - (CGFloat)1.0 / size.height - ); - }); - - if (RCTRunningInTestEnvironment()) { - const CGSize size = self.bounds.size; - UIGraphicsBeginImageContextWithOptions(size, NO, image.scale); - [image drawInRect:(CGRect){CGPointZero, size}]; - image = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - contentsCenter = CGRectMake(0, 0, 1, 1); - } - - layer.contents = (id)image.CGImage; - layer.contentsScale = image.scale; - layer.needsDisplayOnBoundsChange = YES; - layer.magnificationFilter = kCAFilterNearest; - - const BOOL isResizable = !UIEdgeInsetsEqualToEdgeInsets(image.capInsets, UIEdgeInsetsZero); - if (isResizable) { - layer.contentsCenter = contentsCenter; - } else { - layer.contentsCenter = CGRectMake(0.0, 0.0, 1.0, 1.0); - } - - [self updateClippingForLayer:layer]; -} - -static BOOL RCTLayerHasShadow(CALayer *layer) -{ - return layer.shadowOpacity * CGColorGetAlpha(layer.shadowColor) > 0; -} - -static void RCTUpdateShadowPathForView(RCTView *view) -{ - if (RCTLayerHasShadow(view.layer)) { - if (CGColorGetAlpha(view.backgroundColor.CGColor) > 0.999) { - - // If view has a solid background color, calculate shadow path from border - const RCTCornerRadii cornerRadii = [view cornerRadii]; - const RCTCornerInsets cornerInsets = RCTGetCornerInsets(cornerRadii, UIEdgeInsetsZero); - CGPathRef shadowPath = RCTPathCreateWithRoundedRect(view.bounds, cornerInsets, NULL); - view.layer.shadowPath = shadowPath; - CGPathRelease(shadowPath); - - } else { - - // Can't accurately calculate box shadow, so fall back to pixel-based shadow - view.layer.shadowPath = nil; - - RCTLogAdvice(@"View #%@ of type %@ has a shadow set but cannot calculate " - "shadow efficiently. Consider setting a background color to " - "fix this, or apply the shadow to a more specific component.", - view.reactTag, [view class]); - } - } -} - -- (void)updateClippingForLayer:(CALayer *)layer -{ - CALayer *mask = nil; - CGFloat cornerRadius = 0; - - if (self.clipsToBounds) { - - const RCTCornerRadii cornerRadii = [self cornerRadii]; - if (RCTCornerRadiiAreEqual(cornerRadii)) { - - cornerRadius = cornerRadii.topLeft; - - } else { - - CAShapeLayer *shapeLayer = [CAShapeLayer layer]; - CGPathRef path = RCTPathCreateWithRoundedRect(self.bounds, RCTGetCornerInsets(cornerRadii, UIEdgeInsetsZero), NULL); - shapeLayer.path = path; - CGPathRelease(path); - mask = shapeLayer; - } - } - - layer.cornerRadius = cornerRadius; - layer.mask = mask; -} - -#pragma mark Border Color - -#define setBorderColor(side) \ - - (void)setBorder##side##Color:(CGColorRef)color \ - { \ - if (CGColorEqualToColor(_border##side##Color, color)) { \ - return; \ - } \ - CGColorRelease(_border##side##Color); \ - _border##side##Color = CGColorRetain(color); \ - [self.layer setNeedsDisplay]; \ - } - -setBorderColor() -setBorderColor(Top) -setBorderColor(Right) -setBorderColor(Bottom) -setBorderColor(Left) -setBorderColor(Start) -setBorderColor(End) - -#pragma mark - Border Width - -#define setBorderWidth(side) \ - - (void)setBorder##side##Width:(CGFloat)width \ - { \ - if (_border##side##Width == width) { \ - return; \ - } \ - _border##side##Width = width; \ - [self.layer setNeedsDisplay]; \ - } - -setBorderWidth() -setBorderWidth(Top) -setBorderWidth(Right) -setBorderWidth(Bottom) -setBorderWidth(Left) -setBorderWidth(Start) -setBorderWidth(End) - -#pragma mark - Border Radius - -#define setBorderRadius(side) \ - - (void)setBorder##side##Radius:(CGFloat)radius \ - { \ - if (_border##side##Radius == radius) { \ - return; \ - } \ - _border##side##Radius = radius; \ - [self.layer setNeedsDisplay]; \ - } - -setBorderRadius() -setBorderRadius(TopLeft) -setBorderRadius(TopRight) -setBorderRadius(TopStart) -setBorderRadius(TopEnd) -setBorderRadius(BottomLeft) -setBorderRadius(BottomRight) -setBorderRadius(BottomStart) -setBorderRadius(BottomEnd) - -#pragma mark - Border Style - -#define setBorderStyle(side) \ - - (void)setBorder##side##Style:(RCTBorderStyle)style \ - { \ - if (_border##side##Style == style) { \ - return; \ - } \ - _border##side##Style = style; \ - [self.layer setNeedsDisplay]; \ - } - -setBorderStyle() - -- (void)dealloc -{ - CGColorRelease(_borderColor); - CGColorRelease(_borderTopColor); - CGColorRelease(_borderRightColor); - CGColorRelease(_borderBottomColor); - CGColorRelease(_borderLeftColor); - CGColorRelease(_borderStartColor); - CGColorRelease(_borderEndColor); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTViewManager.h deleted file mode 100644 index 38a6dbd6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTViewManager.h +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import -#import -#import -#import - -@class RCTBridge; -@class RCTShadowView; -@class RCTSparseArray; -@class RCTUIManager; - -typedef void (^RCTViewManagerUIBlock)(RCTUIManager *uiManager, NSDictionary *viewRegistry); - -@interface RCTViewManager : NSObject - -/** - * The bridge can be used to access both the RCTUIIManager and the RCTEventDispatcher, - * allowing the manager (or the views that it manages) to manipulate the view - * hierarchy and send events back to the JS context. - */ -@property (nonatomic, weak) RCTBridge *bridge; - -/** - * This method instantiates a native view to be managed by the module. Override - * this to return a custom view instance, which may be preconfigured with default - * properties, subviews, etc. This method will be called many times, and should - * return a fresh instance each time. The view module MUST NOT cache the returned - * view and return the same instance for subsequent calls. - */ -- (UIView *)view; - -/** - * This method instantiates a shadow view to be managed by the module. If omitted, - * an ordinary RCTShadowView instance will be created, which is typically fine for - * most view types. As with the -view method, the -shadowView method should return - * a fresh instance each time it is called. - */ -- (RCTShadowView *)shadowView; - -/** - * DEPRECATED: declare properties of type RCTBubblingEventBlock instead - * - * Returns an array of names of events that can be sent by native views. This - * should return bubbling, directly-dispatched event types. The event name - * should not include a prefix such as 'on' or 'top', as this will be applied - * as needed. When subscribing to the event, use the 'Captured' suffix to - * indicate the captured form, or omit the suffix for the bubbling form. - * - * Note that this method is not inherited when you subclass a view module, and - * you should not call [super customBubblingEventTypes] when overriding it. - */ -- (NSArray *)customBubblingEventTypes __deprecated_msg("Use RCTBubblingEventBlock props instead."); - -/** - * This handles the simple case, where JS and native property names match. - */ -#define RCT_EXPORT_VIEW_PROPERTY(name, type) \ -+ (NSArray *)propConfig_##name RCT_DYNAMIC { return @[@#type]; } - -/** - * This macro maps a named property to an arbitrary key path in the view. - */ -#define RCT_REMAP_VIEW_PROPERTY(name, keyPath, type) \ -+ (NSArray *)propConfig_##name RCT_DYNAMIC { return @[@#type, @#keyPath]; } - -/** - * This macro can be used when you need to provide custom logic for setting - * view properties. The macro should be followed by a method body, which can - * refer to "json", "view" and "defaultView" to implement the required logic. - */ -#define RCT_CUSTOM_VIEW_PROPERTY(name, type, viewClass) \ -RCT_REMAP_VIEW_PROPERTY(name, __custom__, type) \ -- (void)set_##name:(id)json forView:(viewClass *)view withDefaultView:(viewClass *)defaultView RCT_DYNAMIC - -/** - * This macro is used to map properties to the shadow view, instead of the view. - */ -#define RCT_EXPORT_SHADOW_PROPERTY(name, type) \ -+ (NSArray *)propConfigShadow_##name RCT_DYNAMIC { return @[@#type]; } - -/** - * This macro maps a named property to an arbitrary key path in the shadow view. - */ -#define RCT_REMAP_SHADOW_PROPERTY(name, keyPath, type) \ -+ (NSArray *)propConfigShadow_##name RCT_DYNAMIC { return @[@#type, @#keyPath]; } - -/** - * This macro can be used when you need to provide custom logic for setting - * shadow view properties. The macro should be followed by a method body, which can - * refer to "json" and "view". - */ -#define RCT_CUSTOM_SHADOW_PROPERTY(name, type, viewClass) \ -RCT_REMAP_SHADOW_PROPERTY(name, __custom__, type) \ -- (void)set_##name:(id)json forShadowView:(viewClass *)view RCT_DYNAMIC - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTViewManager.m deleted file mode 100644 index 0c8a4627..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTViewManager.m +++ /dev/null @@ -1,353 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTViewManager.h" - -#import "RCTBorderStyle.h" -#import "RCTBridge.h" -#import "RCTConvert.h" -#import "RCTEventDispatcher.h" -#import "RCTLog.h" -#import "RCTShadowView.h" -#import "RCTUIManager.h" -#import "RCTUIManagerUtils.h" -#import "RCTUtils.h" -#import "RCTView.h" -#import "UIView+React.h" -#import "RCTConvert+Transform.h" - -#if TARGET_OS_TV -#import "RCTTVView.h" -#endif - -@implementation RCTConvert(UIAccessibilityTraits) - -RCT_MULTI_ENUM_CONVERTER(UIAccessibilityTraits, (@{ - @"none": @(UIAccessibilityTraitNone), - @"button": @(UIAccessibilityTraitButton), - @"link": @(UIAccessibilityTraitLink), - @"header": @(UIAccessibilityTraitHeader), - @"search": @(UIAccessibilityTraitSearchField), - @"image": @(UIAccessibilityTraitImage), - @"imagebutton": @(UIAccessibilityTraitImage | UIAccessibilityTraitButton), - @"selected": @(UIAccessibilityTraitSelected), - @"plays": @(UIAccessibilityTraitPlaysSound), - @"key": @(UIAccessibilityTraitKeyboardKey), - @"keyboardkey": @(UIAccessibilityTraitKeyboardKey), - @"text": @(UIAccessibilityTraitStaticText), - @"summary": @(UIAccessibilityTraitSummaryElement), - @"disabled": @(UIAccessibilityTraitNotEnabled), - @"frequentUpdates": @(UIAccessibilityTraitUpdatesFrequently), - @"startsMedia": @(UIAccessibilityTraitStartsMediaSession), - @"adjustable": @(UIAccessibilityTraitAdjustable), - @"allowsDirectInteraction": @(UIAccessibilityTraitAllowsDirectInteraction), - @"pageTurn": @(UIAccessibilityTraitCausesPageTurn), -}), UIAccessibilityTraitNone, unsignedLongLongValue) - -@end - -@implementation RCTViewManager - -@synthesize bridge = _bridge; - -RCT_EXPORT_MODULE() - -- (dispatch_queue_t)methodQueue -{ - return RCTGetUIManagerQueue(); -} - -- (UIView *)view -{ -#if TARGET_OS_TV - return [RCTTVView new]; -#else - return [RCTView new]; -#endif -} - -- (RCTShadowView *)shadowView -{ - return [RCTShadowView new]; -} - -- (NSArray *)customBubblingEventTypes -{ - return @[ - - // Generic events - @"press", - @"change", - @"focus", - @"blur", - @"submitEditing", - @"endEditing", - @"keyPress", - - // Touch events - @"touchStart", - @"touchMove", - @"touchCancel", - @"touchEnd", - ]; -} - -#pragma mark - View properties - -#if TARGET_OS_TV -// Apple TV properties -RCT_EXPORT_VIEW_PROPERTY(isTVSelectable, BOOL) -RCT_EXPORT_VIEW_PROPERTY(hasTVPreferredFocus, BOOL) -RCT_EXPORT_VIEW_PROPERTY(tvParallaxProperties, NSDictionary) -#endif - -RCT_EXPORT_VIEW_PROPERTY(nativeID, NSString) - -// Acessibility related properties -RCT_REMAP_VIEW_PROPERTY(accessible, reactAccessibilityElement.isAccessibilityElement, BOOL) -RCT_REMAP_VIEW_PROPERTY(accessibilityActions, reactAccessibilityElement.accessibilityActions, NSArray) -RCT_REMAP_VIEW_PROPERTY(accessibilityLabel, reactAccessibilityElement.accessibilityLabel, NSString) -RCT_REMAP_VIEW_PROPERTY(accessibilityHint, reactAccessibilityElement.accessibilityHint, NSString) -RCT_REMAP_VIEW_PROPERTY(accessibilityTraits, reactAccessibilityElement.accessibilityTraits, UIAccessibilityTraits) -RCT_REMAP_VIEW_PROPERTY(accessibilityViewIsModal, reactAccessibilityElement.accessibilityViewIsModal, BOOL) -RCT_REMAP_VIEW_PROPERTY(accessibilityElementsHidden, reactAccessibilityElement.accessibilityElementsHidden, BOOL) -RCT_REMAP_VIEW_PROPERTY(accessibilityIgnoresInvertColors, reactAccessibilityElement.shouldAccessibilityIgnoresInvertColors, BOOL) -RCT_REMAP_VIEW_PROPERTY(onAccessibilityAction, reactAccessibilityElement.onAccessibilityAction, RCTDirectEventBlock) -RCT_REMAP_VIEW_PROPERTY(onAccessibilityTap, reactAccessibilityElement.onAccessibilityTap, RCTDirectEventBlock) -RCT_REMAP_VIEW_PROPERTY(onMagicTap, reactAccessibilityElement.onMagicTap, RCTDirectEventBlock) -RCT_REMAP_VIEW_PROPERTY(onAccessibilityEscape, reactAccessibilityElement.onAccessibilityEscape, RCTDirectEventBlock) -RCT_REMAP_VIEW_PROPERTY(testID, reactAccessibilityElement.accessibilityIdentifier, NSString) - -RCT_EXPORT_VIEW_PROPERTY(backgroundColor, UIColor) -RCT_REMAP_VIEW_PROPERTY(backfaceVisibility, layer.doubleSided, css_backface_visibility_t) -RCT_REMAP_VIEW_PROPERTY(opacity, alpha, CGFloat) -RCT_REMAP_VIEW_PROPERTY(shadowColor, layer.shadowColor, CGColor) -RCT_REMAP_VIEW_PROPERTY(shadowOffset, layer.shadowOffset, CGSize) -RCT_REMAP_VIEW_PROPERTY(shadowOpacity, layer.shadowOpacity, float) -RCT_REMAP_VIEW_PROPERTY(shadowRadius, layer.shadowRadius, CGFloat) -RCT_CUSTOM_VIEW_PROPERTY(overflow, YGOverflow, RCTView) -{ - if (json) { - view.clipsToBounds = [RCTConvert YGOverflow:json] != YGOverflowVisible; - } else { - view.clipsToBounds = defaultView.clipsToBounds; - } -} -RCT_CUSTOM_VIEW_PROPERTY(shouldRasterizeIOS, BOOL, RCTView) -{ - view.layer.shouldRasterize = json ? [RCTConvert BOOL:json] : defaultView.layer.shouldRasterize; - view.layer.rasterizationScale = view.layer.shouldRasterize ? [UIScreen mainScreen].scale : defaultView.layer.rasterizationScale; -} - -RCT_CUSTOM_VIEW_PROPERTY(transform, CATransform3D, RCTView) -{ - view.layer.transform = json ? [RCTConvert CATransform3D:json] : defaultView.layer.transform; - // TODO: Improve this by enabling edge antialiasing only for transforms with rotation or skewing - view.layer.allowsEdgeAntialiasing = !CATransform3DIsIdentity(view.layer.transform); -} - -RCT_CUSTOM_VIEW_PROPERTY(accessibilityRole, UIAccessibilityTraits, RCTView) -{ - // This mask must be kept in sync with the AccessibilityRoles enum defined in ViewAccessibility.js and DeprecatedViewAccessibility.js - const UIAccessibilityTraits AccessibilityRolesMask = UIAccessibilityTraitNone | UIAccessibilityTraitButton | UIAccessibilityTraitLink | UIAccessibilityTraitSearchField | UIAccessibilityTraitImage | UIAccessibilityTraitKeyboardKey | UIAccessibilityTraitStaticText | UIAccessibilityTraitAdjustable | UIAccessibilityTraitHeader | UIAccessibilityTraitSummaryElement; - - UIAccessibilityTraits newTraits = json ? [RCTConvert UIAccessibilityTraits:json] : defaultView.accessibilityTraits; - UIAccessibilityTraits maskedTraits = newTraits & AccessibilityRolesMask; - view.reactAccessibilityElement.accessibilityTraits = (view.reactAccessibilityElement.accessibilityTraits & ~AccessibilityRolesMask) | maskedTraits; -} - -RCT_CUSTOM_VIEW_PROPERTY(accessibilityStates, UIAccessibilityTraits, RCTView) -{ - // This mask must be kept in sync with the AccessibilityStates enum defined in ViewAccessibility.js and DeprecatedViewAccessibility.js - const UIAccessibilityTraits AccessibilityStatesMask = UIAccessibilityTraitNotEnabled | UIAccessibilityTraitSelected; - - UIAccessibilityTraits newTraits = json ? [RCTConvert UIAccessibilityTraits:json] : defaultView.accessibilityTraits; - UIAccessibilityTraits maskedTraits = newTraits & AccessibilityStatesMask; - view.reactAccessibilityElement.accessibilityTraits = (view.reactAccessibilityElement.accessibilityTraits & ~AccessibilityStatesMask) | maskedTraits; -} - -RCT_CUSTOM_VIEW_PROPERTY(pointerEvents, RCTPointerEvents, RCTView) -{ - if ([view respondsToSelector:@selector(setPointerEvents:)]) { - view.pointerEvents = json ? [RCTConvert RCTPointerEvents:json] : defaultView.pointerEvents; - return; - } - - if (!json) { - view.userInteractionEnabled = defaultView.userInteractionEnabled; - return; - } - - switch ([RCTConvert RCTPointerEvents:json]) { - case RCTPointerEventsUnspecified: - // Pointer events "unspecified" acts as if a stylesheet had not specified, - // which is different than "auto" in CSS (which cannot and will not be - // supported in `React`. "auto" may override a parent's "none". - // Unspecified values do not. - // This wouldn't override a container view's `userInteractionEnabled = NO` - view.userInteractionEnabled = YES; - case RCTPointerEventsNone: - view.userInteractionEnabled = NO; - break; - default: - RCTLogError(@"UIView base class does not support pointerEvent value: %@", json); - } -} -RCT_CUSTOM_VIEW_PROPERTY(removeClippedSubviews, BOOL, RCTView) -{ - if ([view respondsToSelector:@selector(setRemoveClippedSubviews:)]) { - view.removeClippedSubviews = json ? [RCTConvert BOOL:json] : defaultView.removeClippedSubviews; - } -} -RCT_CUSTOM_VIEW_PROPERTY(borderRadius, CGFloat, RCTView) { - if ([view respondsToSelector:@selector(setBorderRadius:)]) { - view.borderRadius = json ? [RCTConvert CGFloat:json] : defaultView.borderRadius; - } else { - view.layer.cornerRadius = json ? [RCTConvert CGFloat:json] : defaultView.layer.cornerRadius; - } -} -RCT_CUSTOM_VIEW_PROPERTY(borderColor, CGColor, RCTView) -{ - if ([view respondsToSelector:@selector(setBorderColor:)]) { - view.borderColor = json ? [RCTConvert CGColor:json] : defaultView.borderColor; - } else { - view.layer.borderColor = json ? [RCTConvert CGColor:json] : defaultView.layer.borderColor; - } -} -RCT_CUSTOM_VIEW_PROPERTY(borderWidth, float, RCTView) -{ - if ([view respondsToSelector:@selector(setBorderWidth:)]) { - view.borderWidth = json ? [RCTConvert CGFloat:json] : defaultView.borderWidth; - } else { - view.layer.borderWidth = json ? [RCTConvert CGFloat:json] : defaultView.layer.borderWidth; - } -} -RCT_CUSTOM_VIEW_PROPERTY(borderStyle, RCTBorderStyle, RCTView) -{ - if ([view respondsToSelector:@selector(setBorderStyle:)]) { - view.borderStyle = json ? [RCTConvert RCTBorderStyle:json] : defaultView.borderStyle; - } -} -RCT_CUSTOM_VIEW_PROPERTY(hitSlop, UIEdgeInsets, RCTView) -{ - if ([view respondsToSelector:@selector(setHitTestEdgeInsets:)]) { - if (json) { - UIEdgeInsets hitSlopInsets = [RCTConvert UIEdgeInsets:json]; - view.hitTestEdgeInsets = UIEdgeInsetsMake(-hitSlopInsets.top, -hitSlopInsets.left, -hitSlopInsets.bottom, -hitSlopInsets.right); - } else { - view.hitTestEdgeInsets = defaultView.hitTestEdgeInsets; - } - } -} - -#define RCT_VIEW_BORDER_PROPERTY(SIDE) \ -RCT_CUSTOM_VIEW_PROPERTY(border##SIDE##Width, float, RCTView) \ -{ \ - if ([view respondsToSelector:@selector(setBorder##SIDE##Width:)]) { \ - view.border##SIDE##Width = json ? [RCTConvert CGFloat:json] : defaultView.border##SIDE##Width; \ - } \ -} \ -RCT_CUSTOM_VIEW_PROPERTY(border##SIDE##Color, UIColor, RCTView) \ -{ \ - if ([view respondsToSelector:@selector(setBorder##SIDE##Color:)]) { \ - view.border##SIDE##Color = json ? [RCTConvert CGColor:json] : defaultView.border##SIDE##Color; \ - } \ -} - -RCT_VIEW_BORDER_PROPERTY(Top) -RCT_VIEW_BORDER_PROPERTY(Right) -RCT_VIEW_BORDER_PROPERTY(Bottom) -RCT_VIEW_BORDER_PROPERTY(Left) -RCT_VIEW_BORDER_PROPERTY(Start) -RCT_VIEW_BORDER_PROPERTY(End) - -#define RCT_VIEW_BORDER_RADIUS_PROPERTY(SIDE) \ -RCT_CUSTOM_VIEW_PROPERTY(border##SIDE##Radius, CGFloat, RCTView) \ -{ \ - if ([view respondsToSelector:@selector(setBorder##SIDE##Radius:)]) { \ - view.border##SIDE##Radius = json ? [RCTConvert CGFloat:json] : defaultView.border##SIDE##Radius; \ - } \ -} \ - -RCT_VIEW_BORDER_RADIUS_PROPERTY(TopLeft) -RCT_VIEW_BORDER_RADIUS_PROPERTY(TopRight) -RCT_VIEW_BORDER_RADIUS_PROPERTY(TopStart) -RCT_VIEW_BORDER_RADIUS_PROPERTY(TopEnd) -RCT_VIEW_BORDER_RADIUS_PROPERTY(BottomLeft) -RCT_VIEW_BORDER_RADIUS_PROPERTY(BottomRight) -RCT_VIEW_BORDER_RADIUS_PROPERTY(BottomStart) -RCT_VIEW_BORDER_RADIUS_PROPERTY(BottomEnd) - -RCT_REMAP_VIEW_PROPERTY(display, reactDisplay, YGDisplay) -RCT_REMAP_VIEW_PROPERTY(zIndex, reactZIndex, NSInteger) - -#pragma mark - ShadowView properties - -RCT_EXPORT_SHADOW_PROPERTY(top, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(right, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(start, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(end, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(bottom, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(left, YGValue) - -RCT_EXPORT_SHADOW_PROPERTY(width, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(height, YGValue) - -RCT_EXPORT_SHADOW_PROPERTY(minWidth, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(maxWidth, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(minHeight, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(maxHeight, YGValue) - -RCT_EXPORT_SHADOW_PROPERTY(borderTopWidth, float) -RCT_EXPORT_SHADOW_PROPERTY(borderRightWidth, float) -RCT_EXPORT_SHADOW_PROPERTY(borderBottomWidth, float) -RCT_EXPORT_SHADOW_PROPERTY(borderLeftWidth, float) -RCT_EXPORT_SHADOW_PROPERTY(borderStartWidth, float) -RCT_EXPORT_SHADOW_PROPERTY(borderEndWidth, float) -RCT_EXPORT_SHADOW_PROPERTY(borderWidth, float) - -RCT_EXPORT_SHADOW_PROPERTY(marginTop, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(marginRight, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(marginBottom, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(marginLeft, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(marginStart, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(marginEnd, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(marginVertical, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(marginHorizontal, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(margin, YGValue) - -RCT_EXPORT_SHADOW_PROPERTY(paddingTop, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(paddingRight, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(paddingBottom, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(paddingLeft, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(paddingStart, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(paddingEnd, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(paddingVertical, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(paddingHorizontal, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(padding, YGValue) - -RCT_EXPORT_SHADOW_PROPERTY(flex, float) -RCT_EXPORT_SHADOW_PROPERTY(flexGrow, float) -RCT_EXPORT_SHADOW_PROPERTY(flexShrink, float) -RCT_EXPORT_SHADOW_PROPERTY(flexBasis, YGValue) -RCT_EXPORT_SHADOW_PROPERTY(flexDirection, YGFlexDirection) -RCT_EXPORT_SHADOW_PROPERTY(flexWrap, YGWrap) -RCT_EXPORT_SHADOW_PROPERTY(justifyContent, YGJustify) -RCT_EXPORT_SHADOW_PROPERTY(alignItems, YGAlign) -RCT_EXPORT_SHADOW_PROPERTY(alignSelf, YGAlign) -RCT_EXPORT_SHADOW_PROPERTY(alignContent, YGAlign) -RCT_EXPORT_SHADOW_PROPERTY(position, YGPositionType) -RCT_EXPORT_SHADOW_PROPERTY(aspectRatio, float) - -RCT_EXPORT_SHADOW_PROPERTY(overflow, YGOverflow) -RCT_EXPORT_SHADOW_PROPERTY(display, YGDisplay) - -RCT_EXPORT_SHADOW_PROPERTY(onLayout, RCTDirectEventBlock) - -RCT_EXPORT_SHADOW_PROPERTY(direction, YGDirection) - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWKWebView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWKWebView.h deleted file mode 100644 index 04b6e4e4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWKWebView.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import -#import - -@class RCTWKWebView; - -@protocol RCTWKWebViewDelegate - -- (BOOL)webView:(RCTWKWebView *)webView -shouldStartLoadForRequest:(NSMutableDictionary *)request - withCallback:(RCTDirectEventBlock)callback; - -@end - -@interface RCTWKWebView : RCTView - -@property (nonatomic, weak) id delegate; -@property (nonatomic, copy) NSDictionary *source; -@property (nonatomic, assign) BOOL messagingEnabled; -@property (nonatomic, copy) NSString *injectedJavaScript; -@property (nonatomic, assign) BOOL scrollEnabled; -@property (nonatomic, assign) CGFloat decelerationRate; -@property (nonatomic, assign) BOOL allowsInlineMediaPlayback; -@property (nonatomic, assign) BOOL bounces; -@property (nonatomic, assign) BOOL mediaPlaybackRequiresUserAction; -#if WEBKIT_IOS_10_APIS_AVAILABLE -@property (nonatomic, assign) WKDataDetectorTypes dataDetectorTypes; -#endif -@property (nonatomic, assign) UIEdgeInsets contentInset; -@property (nonatomic, assign) BOOL automaticallyAdjustContentInsets; - -+ (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential; -- (void)postMessage:(NSString *)message; -- (void)injectJavaScript:(NSString *)script; -- (void)goForward; -- (void)goBack; -- (void)reload; -- (void)stopLoading; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWKWebView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWKWebView.m deleted file mode 100644 index 54c976cf..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWKWebView.m +++ /dev/null @@ -1,435 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTWKWebView.h" -#import -#import "RCTAutoInsetsProtocol.h" - -static NSString *const MessageHanderName = @"ReactNative"; -static NSURLCredential* clientAuthenticationCredential; - - -@interface RCTWKWebView () -@property (nonatomic, copy) RCTDirectEventBlock onLoadingStart; -@property (nonatomic, copy) RCTDirectEventBlock onLoadingFinish; -@property (nonatomic, copy) RCTDirectEventBlock onLoadingError; -@property (nonatomic, copy) RCTDirectEventBlock onShouldStartLoadWithRequest; -@property (nonatomic, copy) RCTDirectEventBlock onMessage; -@property (nonatomic, copy) WKWebView *webView; -@end - -@implementation RCTWKWebView -{ - UIColor * _savedBackgroundColor; -} - -- (void)dealloc -{ - -} - -/** - * See https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/DisplayWebContent/Tasks/WebKitAvail.html. - */ -+ (BOOL)dynamicallyLoadWebKitIfAvailable -{ - static BOOL _webkitAvailable=NO; - static dispatch_once_t onceToken; - - dispatch_once(&onceToken, ^{ - NSBundle *webKitBundle = [NSBundle bundleWithPath:@"/System/Library/Frameworks/WebKit.framework"]; - if (webKitBundle) { - _webkitAvailable = [webKitBundle load]; - } - }); - - return _webkitAvailable; -} - - -- (instancetype)initWithFrame:(CGRect)frame -{ - if ((self = [super initWithFrame:frame])) { - super.backgroundColor = [UIColor clearColor]; - _bounces = YES; - _scrollEnabled = YES; - _automaticallyAdjustContentInsets = YES; - _contentInset = UIEdgeInsetsZero; - } - return self; -} - -- (void)didMoveToWindow -{ - if (self.window != nil) { - if (![[self class] dynamicallyLoadWebKitIfAvailable]) { - return; - }; - - WKWebViewConfiguration *wkWebViewConfig = [WKWebViewConfiguration new]; - wkWebViewConfig.userContentController = [WKUserContentController new]; - [wkWebViewConfig.userContentController addScriptMessageHandler: self name: MessageHanderName]; - wkWebViewConfig.allowsInlineMediaPlayback = _allowsInlineMediaPlayback; -#if WEBKIT_IOS_10_APIS_AVAILABLE - wkWebViewConfig.mediaTypesRequiringUserActionForPlayback = _mediaPlaybackRequiresUserAction - ? WKAudiovisualMediaTypeAll - : WKAudiovisualMediaTypeNone; - wkWebViewConfig.dataDetectorTypes = _dataDetectorTypes; -#else - wkWebViewConfig.mediaPlaybackRequiresUserAction = _mediaPlaybackRequiresUserAction; -#endif - - _webView = [[WKWebView alloc] initWithFrame:self.bounds configuration: wkWebViewConfig]; - _webView.scrollView.delegate = self; - _webView.UIDelegate = self; - _webView.navigationDelegate = self; - _webView.scrollView.scrollEnabled = _scrollEnabled; - _webView.scrollView.bounces = _bounces; - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ - if ([_webView.scrollView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) { - _webView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; - } -#endif - - [self addSubview:_webView]; - - [self visitSource]; - } -} - -- (void)setBackgroundColor:(UIColor *)backgroundColor -{ - _savedBackgroundColor = backgroundColor; - if (_webView == nil) { - return; - } - - CGFloat alpha = CGColorGetAlpha(backgroundColor.CGColor); - self.opaque = _webView.opaque = (alpha == 1.0); - _webView.scrollView.backgroundColor = backgroundColor; - _webView.backgroundColor = backgroundColor; -} - -/** - * This method is called whenever JavaScript running within the web view calls: - * - window.webkit.messageHandlers.[MessageHanderName].postMessage - */ -- (void)userContentController:(WKUserContentController *)userContentController - didReceiveScriptMessage:(WKScriptMessage *)message -{ - if (_onMessage != nil) { - NSMutableDictionary *event = [self baseEvent]; - [event addEntriesFromDictionary: @{@"data": message.body}]; - _onMessage(event); - } -} - -- (void)setSource:(NSDictionary *)source -{ - if (![_source isEqualToDictionary:source]) { - _source = [source copy]; - - if (_webView != nil) { - [self visitSource]; - } - } -} - -- (void)setContentInset:(UIEdgeInsets)contentInset -{ - _contentInset = contentInset; - [RCTView autoAdjustInsetsForView:self - withScrollView:_webView.scrollView - updateOffset:NO]; -} - -- (void)refreshContentInset -{ - [RCTView autoAdjustInsetsForView:self - withScrollView:_webView.scrollView - updateOffset:YES]; -} - -- (void)visitSource -{ - // Check for a static html source first - NSString *html = [RCTConvert NSString:_source[@"html"]]; - if (html) { - NSURL *baseURL = [RCTConvert NSURL:_source[@"baseUrl"]]; - if (!baseURL) { - baseURL = [NSURL URLWithString:@"about:blank"]; - } - [_webView loadHTMLString:html baseURL:baseURL]; - return; - } - - NSURLRequest *request = [RCTConvert NSURLRequest:_source]; - // Because of the way React works, as pages redirect, we actually end up - // passing the redirect urls back here, so we ignore them if trying to load - // the same url. We'll expose a call to 'reload' to allow a user to load - // the existing page. - if ([request.URL isEqual:_webView.URL]) { - return; - } - if (!request.URL) { - // Clear the webview - [_webView loadHTMLString:@"" baseURL:nil]; - return; - } - [_webView loadRequest:request]; -} - - -- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView -{ - scrollView.decelerationRate = _decelerationRate; -} - -- (void)setScrollEnabled:(BOOL)scrollEnabled -{ - _scrollEnabled = scrollEnabled; - _webView.scrollView.scrollEnabled = scrollEnabled; -} - -- (void)postMessage:(NSString *)message -{ - NSDictionary *eventInitDict = @{@"data": message}; - NSString *source = [NSString - stringWithFormat:@"document.dispatchEvent(new MessageEvent('message', %@));", - RCTJSONStringify(eventInitDict, NULL) - ]; - [self evaluateJS: source thenCall: nil]; -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - - // Ensure webview takes the position and dimensions of RCTWKWebView - _webView.frame = self.bounds; -} - -- (NSMutableDictionary *)baseEvent -{ - NSDictionary *event = @{ - @"url": _webView.URL.absoluteString ?: @"", - @"title": _webView.title, - @"loading" : @(_webView.loading), - @"canGoBack": @(_webView.canGoBack), - @"canGoForward" : @(_webView.canGoForward) - }; - return [[NSMutableDictionary alloc] initWithDictionary: event]; -} - -#pragma mark - WKNavigationDelegate methods - -/** - * Decides whether to allow or cancel a navigation. - * @see https://fburl.com/42r9fxob - */ -- (void) webView:(WKWebView *)webView - decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction - decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler -{ - static NSDictionary *navigationTypes; - static dispatch_once_t onceToken; - - dispatch_once(&onceToken, ^{ - navigationTypes = @{ - @(WKNavigationTypeLinkActivated): @"click", - @(WKNavigationTypeFormSubmitted): @"formsubmit", - @(WKNavigationTypeBackForward): @"backforward", - @(WKNavigationTypeReload): @"reload", - @(WKNavigationTypeFormResubmitted): @"formresubmit", - @(WKNavigationTypeOther): @"other", - }; - }); - - WKNavigationType navigationType = navigationAction.navigationType; - NSURLRequest *request = navigationAction.request; - - if (_onShouldStartLoadWithRequest) { - NSMutableDictionary *event = [self baseEvent]; - [event addEntriesFromDictionary: @{ - @"url": (request.URL).absoluteString, - @"navigationType": navigationTypes[@(navigationType)] - }]; - if (![self.delegate webView:self - shouldStartLoadForRequest:event - withCallback:_onShouldStartLoadWithRequest]) { - decisionHandler(WKNavigationResponsePolicyCancel); - return; - } - } - - if (_onLoadingStart) { - // We have this check to filter out iframe requests and whatnot - BOOL isTopFrame = [request.URL isEqual:request.mainDocumentURL]; - if (isTopFrame) { - NSMutableDictionary *event = [self baseEvent]; - [event addEntriesFromDictionary: @{ - @"url": (request.URL).absoluteString, - @"navigationType": navigationTypes[@(navigationType)] - }]; - _onLoadingStart(event); - } - } - - // Allow all navigation by default - decisionHandler(WKNavigationResponsePolicyAllow); -} - -/** - * Called when an error occurs while the web view is loading content. - * @see https://fburl.com/km6vqenw - */ -- (void) webView:(WKWebView *)webView - didFailProvisionalNavigation:(WKNavigation *)navigation - withError:(NSError *)error -{ - if (_onLoadingError) { - if ([error.domain isEqualToString:NSURLErrorDomain] && error.code == NSURLErrorCancelled) { - // NSURLErrorCancelled is reported when a page has a redirect OR if you load - // a new URL in the WebView before the previous one came back. We can just - // ignore these since they aren't real errors. - // http://stackoverflow.com/questions/1024748/how-do-i-fix-nsurlerrordomain-error-999-in-iphone-3-0-os - return; - } - - NSMutableDictionary *event = [self baseEvent]; - [event addEntriesFromDictionary:@{ - @"didFailProvisionalNavigation": @YES, - @"domain": error.domain, - @"code": @(error.code), - @"description": error.localizedDescription, - }]; - _onLoadingError(event); - } - - [self setBackgroundColor: _savedBackgroundColor]; -} - -+ (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential { - clientAuthenticationCredential = credential; -} - -- (void) webView:(WKWebView *)webView - didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge - completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable))completionHandler -{ - if (!clientAuthenticationCredential) { - completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil); - return; - } - if ([[challenge protectionSpace] authenticationMethod] == NSURLAuthenticationMethodClientCertificate) { - completionHandler(NSURLSessionAuthChallengeUseCredential, clientAuthenticationCredential); - } else { - completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil); -} -} - -- (void)evaluateJS:(NSString *)js - thenCall: (void (^)(NSString*)) callback -{ - [self.webView evaluateJavaScript: js completionHandler: ^(id result, NSError *error) { - if (error == nil && callback != nil) { - callback([NSString stringWithFormat:@"%@", result]); - } - }]; -} - - -/** - * Called when the navigation is complete. - * @see https://fburl.com/rtys6jlb - */ -- (void) webView:(WKWebView *)webView - didFinishNavigation:(WKNavigation *)navigation -{ - if (_messagingEnabled) { - #if RCT_DEV - - // Implementation inspired by Lodash.isNative. - NSString *isPostMessageNative = @"String(String(window.postMessage) === String(Object.hasOwnProperty).replace('hasOwnProperty', 'postMessage'))"; - [self evaluateJS: isPostMessageNative thenCall: ^(NSString *result) { - if (! [result isEqualToString:@"true"]) { - RCTLogError(@"Setting onMessage on a WebView overrides existing values of window.postMessage, but a previous value was defined"); - } - }]; - #endif - - NSString *source = [NSString stringWithFormat: - @"(function() {" - "window.originalPostMessage = window.postMessage;" - - "window.postMessage = function(data) {" - "window.webkit.messageHandlers.%@.postMessage(String(data));" - "};" - "})();", - MessageHanderName - ]; - [self evaluateJS: source thenCall: nil]; - } - - if (_injectedJavaScript) { - [self evaluateJS: _injectedJavaScript thenCall: ^(NSString *jsEvaluationValue) { - NSMutableDictionary *event = [self baseEvent]; - event[@"jsEvaluationValue"] = jsEvaluationValue; - if (self.onLoadingFinish) { - self.onLoadingFinish(event); - } - }]; - } else if (_onLoadingFinish) { - _onLoadingFinish([self baseEvent]); - } - - [self setBackgroundColor: _savedBackgroundColor]; -} - -- (void)injectJavaScript:(NSString *)script -{ - [self evaluateJS: script thenCall: nil]; -} - -- (void)goForward -{ - [_webView goForward]; -} - -- (void)goBack -{ - [_webView goBack]; -} - -- (void)reload -{ - /** - * When the initial load fails due to network connectivity issues, - * [_webView reload] doesn't reload the webpage. Therefore, we must - * manually call [_webView loadRequest:request]. - */ - NSURLRequest *request = [RCTConvert NSURLRequest:self.source]; - if (request.URL && !_webView.URL.absoluteString.length) { - [_webView loadRequest:request]; - } - else { - [_webView reload]; - } -} - -- (void)stopLoading -{ - [_webView stopLoading]; -} - -- (void)setBounces:(BOOL)bounces -{ - _bounces = bounces; - _webView.scrollView.bounces = bounces; -} -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWKWebViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWKWebViewManager.h deleted file mode 100644 index cf44faf2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWKWebViewManager.h +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTWKWebViewManager : RCTViewManager -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWKWebViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWKWebViewManager.m deleted file mode 100644 index 9d329472..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWKWebViewManager.m +++ /dev/null @@ -1,170 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTWKWebViewManager.h" - -#import "RCTUIManager.h" -#import "RCTWKWebView.h" -#import - -@interface RCTWKWebViewManager () -@end - -@implementation RCTWKWebViewManager -{ - NSConditionLock *_shouldStartLoadLock; - BOOL _shouldStartLoad; -} - -RCT_EXPORT_MODULE() - -- (UIView *)view -{ - RCTWKWebView *webView = [RCTWKWebView new]; - webView.delegate = self; - return webView; -} - -RCT_EXPORT_VIEW_PROPERTY(source, NSDictionary) -RCT_EXPORT_VIEW_PROPERTY(onLoadingStart, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onLoadingFinish, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onLoadingError, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onShouldStartLoadWithRequest, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(injectedJavaScript, NSString) -RCT_EXPORT_VIEW_PROPERTY(allowsInlineMediaPlayback, BOOL) -RCT_EXPORT_VIEW_PROPERTY(mediaPlaybackRequiresUserAction, BOOL) -#if WEBKIT_IOS_10_APIS_AVAILABLE -RCT_EXPORT_VIEW_PROPERTY(dataDetectorTypes, WKDataDetectorTypes) -#endif -RCT_EXPORT_VIEW_PROPERTY(contentInset, UIEdgeInsets) -RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustContentInsets, BOOL) - -/** - * Expose methods to enable messaging the webview. - */ -RCT_EXPORT_VIEW_PROPERTY(messagingEnabled, BOOL) -RCT_EXPORT_VIEW_PROPERTY(onMessage, RCTDirectEventBlock) - -RCT_EXPORT_METHOD(postMessage:(nonnull NSNumber *)reactTag message:(NSString *)message) -{ - [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - RCTWKWebView *view = viewRegistry[reactTag]; - if (![view isKindOfClass:[RCTWKWebView class]]) { - RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view); - } else { - [view postMessage:message]; - } - }]; -} - -RCT_CUSTOM_VIEW_PROPERTY(bounces, BOOL, RCTWKWebView) { - view.bounces = json == nil ? true : [RCTConvert BOOL: json]; -} - -RCT_CUSTOM_VIEW_PROPERTY(scrollEnabled, BOOL, RCTWKWebView) { - view.scrollEnabled = json == nil ? true : [RCTConvert BOOL: json]; -} - -RCT_CUSTOM_VIEW_PROPERTY(decelerationRate, CGFloat, RCTWKWebView) { - view.decelerationRate = json == nil ? UIScrollViewDecelerationRateNormal : [RCTConvert CGFloat: json]; -} - -RCT_EXPORT_METHOD(injectJavaScript:(nonnull NSNumber *)reactTag script:(NSString *)script) -{ - [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - RCTWKWebView *view = viewRegistry[reactTag]; - if (![view isKindOfClass:[RCTWKWebView class]]) { - RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view); - } else { - [view injectJavaScript:script]; - } - }]; -} - -RCT_EXPORT_METHOD(goBack:(nonnull NSNumber *)reactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - RCTWKWebView *view = viewRegistry[reactTag]; - if (![view isKindOfClass:[RCTWKWebView class]]) { - RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view); - } else { - [view goBack]; - } - }]; -} - -RCT_EXPORT_METHOD(goForward:(nonnull NSNumber *)reactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - RCTWKWebView *view = viewRegistry[reactTag]; - if (![view isKindOfClass:[RCTWKWebView class]]) { - RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view); - } else { - [view goForward]; - } - }]; -} - -RCT_EXPORT_METHOD(reload:(nonnull NSNumber *)reactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - RCTWKWebView *view = viewRegistry[reactTag]; - if (![view isKindOfClass:[RCTWKWebView class]]) { - RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view); - } else { - [view reload]; - } - }]; -} - -RCT_EXPORT_METHOD(stopLoading:(nonnull NSNumber *)reactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - RCTWKWebView *view = viewRegistry[reactTag]; - if (![view isKindOfClass:[RCTWKWebView class]]) { - RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view); - } else { - [view stopLoading]; - } - }]; -} - -#pragma mark - Exported synchronous methods - -- (BOOL) webView:(RCTWKWebView *)webView -shouldStartLoadForRequest:(NSMutableDictionary *)request - withCallback:(RCTDirectEventBlock)callback -{ - _shouldStartLoadLock = [[NSConditionLock alloc] initWithCondition:arc4random()]; - _shouldStartLoad = YES; - request[@"lockIdentifier"] = @(_shouldStartLoadLock.condition); - callback(request); - - // Block the main thread for a maximum of 250ms until the JS thread returns - if ([_shouldStartLoadLock lockWhenCondition:0 beforeDate:[NSDate dateWithTimeIntervalSinceNow:.25]]) { - BOOL returnValue = _shouldStartLoad; - [_shouldStartLoadLock unlock]; - _shouldStartLoadLock = nil; - return returnValue; - } else { - RCTLogWarn(@"Did not receive response to shouldStartLoad in time, defaulting to YES"); - return YES; - } -} - -RCT_EXPORT_METHOD(startLoadWithResult:(BOOL)result lockIdentifier:(NSInteger)lockIdentifier) -{ - if ([_shouldStartLoadLock tryLockWhenCondition:lockIdentifier]) { - _shouldStartLoad = result; - [_shouldStartLoadLock unlockWithCondition:0]; - } else { - RCTLogWarn(@"startLoadWithResult invoked with invalid lockIdentifier: " - "got %lld, expected %lld", (long long)lockIdentifier, (long long)_shouldStartLoadLock.condition); - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWebView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWebView.h deleted file mode 100644 index 4fa9d62d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWebView.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@class RCTWebView; - -/** - * Special scheme used to pass messages to the injectedJavaScript - * code without triggering a page load. Usage: - * - * window.location.href = RCTJSNavigationScheme + '://hello' - */ -extern NSString *const RCTJSNavigationScheme; - -@protocol RCTWebViewDelegate - -- (BOOL)webView:(RCTWebView *)webView -shouldStartLoadForRequest:(NSMutableDictionary *)request - withCallback:(RCTDirectEventBlock)callback; - -@end - -@interface RCTWebView : RCTView - -@property (nonatomic, weak) id delegate; - -@property (nonatomic, copy) NSDictionary *source; -@property (nonatomic, assign) UIEdgeInsets contentInset; -@property (nonatomic, assign) BOOL automaticallyAdjustContentInsets; -@property (nonatomic, assign) BOOL messagingEnabled; -@property (nonatomic, copy) NSString *injectedJavaScript; -@property (nonatomic, assign) BOOL scalesPageToFit; - -- (void)goForward; -- (void)goBack; -- (void)reload; -- (void)stopLoading; -- (void)postMessage:(NSString *)message; -- (void)injectJavaScript:(NSString *)script; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWebView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWebView.m deleted file mode 100644 index 8f61e380..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWebView.m +++ /dev/null @@ -1,351 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTWebView.h" - -#import - -#import "RCTAutoInsetsProtocol.h" -#import "RCTConvert.h" -#import "RCTEventDispatcher.h" -#import "RCTLog.h" -#import "RCTUtils.h" -#import "RCTView.h" -#import "UIView+React.h" - -NSString *const RCTJSNavigationScheme = @"react-js-navigation"; - -static NSString *const kPostMessageHost = @"postMessage"; - -@interface RCTWebView () - -@property (nonatomic, copy) RCTDirectEventBlock onLoadingStart; -@property (nonatomic, copy) RCTDirectEventBlock onLoadingFinish; -@property (nonatomic, copy) RCTDirectEventBlock onLoadingError; -@property (nonatomic, copy) RCTDirectEventBlock onShouldStartLoadWithRequest; -@property (nonatomic, copy) RCTDirectEventBlock onMessage; - -@end - -@implementation RCTWebView -{ - UIWebView *_webView; - NSString *_injectedJavaScript; -} - -- (void)dealloc -{ - _webView.delegate = nil; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if ((self = [super initWithFrame:frame])) { - super.backgroundColor = [UIColor clearColor]; - _automaticallyAdjustContentInsets = YES; - _contentInset = UIEdgeInsetsZero; - _webView = [[UIWebView alloc] initWithFrame:self.bounds]; - _webView.delegate = self; -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ - if ([_webView.scrollView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) { - _webView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; - } -#endif - [self addSubview:_webView]; - } - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) - -- (void)goForward -{ - [_webView goForward]; -} - -- (void)goBack -{ - [_webView goBack]; -} - -- (void)reload -{ - NSURLRequest *request = [RCTConvert NSURLRequest:self.source]; - if (request.URL && !_webView.request.URL.absoluteString.length) { - [_webView loadRequest:request]; - } - else { - [_webView reload]; - } -} - -- (void)stopLoading -{ - [_webView stopLoading]; -} - -- (void)postMessage:(NSString *)message -{ - NSDictionary *eventInitDict = @{ - @"data": message, - }; - NSString *source = [NSString - stringWithFormat:@"document.dispatchEvent(new MessageEvent('message', %@));", - RCTJSONStringify(eventInitDict, NULL) - ]; - [_webView stringByEvaluatingJavaScriptFromString:source]; -} - -- (void)injectJavaScript:(NSString *)script -{ - [_webView stringByEvaluatingJavaScriptFromString:script]; -} - -- (void)setSource:(NSDictionary *)source -{ - if (![_source isEqualToDictionary:source]) { - _source = [source copy]; - - // Check for a static html source first - NSString *html = [RCTConvert NSString:source[@"html"]]; - if (html) { - NSURL *baseURL = [RCTConvert NSURL:source[@"baseUrl"]]; - if (!baseURL) { - baseURL = [NSURL URLWithString:@"about:blank"]; - } - [_webView loadHTMLString:html baseURL:baseURL]; - return; - } - - NSURLRequest *request = [RCTConvert NSURLRequest:source]; - // Because of the way React works, as pages redirect, we actually end up - // passing the redirect urls back here, so we ignore them if trying to load - // the same url. We'll expose a call to 'reload' to allow a user to load - // the existing page. - if ([request.URL isEqual:_webView.request.URL]) { - return; - } - if (!request.URL) { - // Clear the webview - [_webView loadHTMLString:@"" baseURL:nil]; - return; - } - [_webView loadRequest:request]; - } -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - _webView.frame = self.bounds; -} - -- (void)setContentInset:(UIEdgeInsets)contentInset -{ - _contentInset = contentInset; - [RCTView autoAdjustInsetsForView:self - withScrollView:_webView.scrollView - updateOffset:NO]; -} - -- (void)setScalesPageToFit:(BOOL)scalesPageToFit -{ - if (_webView.scalesPageToFit != scalesPageToFit) { - _webView.scalesPageToFit = scalesPageToFit; - [_webView reload]; - } -} - -- (BOOL)scalesPageToFit -{ - return _webView.scalesPageToFit; -} - -- (void)setBackgroundColor:(UIColor *)backgroundColor -{ - CGFloat alpha = CGColorGetAlpha(backgroundColor.CGColor); - self.opaque = _webView.opaque = (alpha == 1.0); - _webView.backgroundColor = backgroundColor; -} - -- (UIColor *)backgroundColor -{ - return _webView.backgroundColor; -} - -- (NSMutableDictionary *)baseEvent -{ - NSMutableDictionary *event = [[NSMutableDictionary alloc] initWithDictionary:@{ - @"url": _webView.request.URL.absoluteString ?: @"", - @"loading" : @(_webView.loading), - @"title": [_webView stringByEvaluatingJavaScriptFromString:@"document.title"], - @"canGoBack": @(_webView.canGoBack), - @"canGoForward" : @(_webView.canGoForward), - }]; - - return event; -} - -- (void)refreshContentInset -{ - [RCTView autoAdjustInsetsForView:self - withScrollView:_webView.scrollView - updateOffset:YES]; -} - -#pragma mark - UIWebViewDelegate methods - -- (BOOL)webView:(__unused UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request - navigationType:(UIWebViewNavigationType)navigationType -{ - BOOL isJSNavigation = [request.URL.scheme isEqualToString:RCTJSNavigationScheme]; - - static NSDictionary *navigationTypes; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - navigationTypes = @{ - @(UIWebViewNavigationTypeLinkClicked): @"click", - @(UIWebViewNavigationTypeFormSubmitted): @"formsubmit", - @(UIWebViewNavigationTypeBackForward): @"backforward", - @(UIWebViewNavigationTypeReload): @"reload", - @(UIWebViewNavigationTypeFormResubmitted): @"formresubmit", - @(UIWebViewNavigationTypeOther): @"other", - }; - }); - - // skip this for the JS Navigation handler - if (!isJSNavigation && _onShouldStartLoadWithRequest) { - NSMutableDictionary *event = [self baseEvent]; - [event addEntriesFromDictionary: @{ - @"url": (request.URL).absoluteString, - @"navigationType": navigationTypes[@(navigationType)] - }]; - if (![self.delegate webView:self - shouldStartLoadForRequest:event - withCallback:_onShouldStartLoadWithRequest]) { - return NO; - } - } - - if (_onLoadingStart) { - // We have this check to filter out iframe requests and whatnot - BOOL isTopFrame = [request.URL isEqual:request.mainDocumentURL]; - if (isTopFrame) { - NSMutableDictionary *event = [self baseEvent]; - [event addEntriesFromDictionary: @{ - @"url": (request.URL).absoluteString, - @"navigationType": navigationTypes[@(navigationType)] - }]; - _onLoadingStart(event); - } - } - - if (isJSNavigation && [request.URL.host isEqualToString:kPostMessageHost]) { - NSString *data = request.URL.query; - data = [data stringByReplacingOccurrencesOfString:@"+" withString:@" "]; - data = [data stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet]; - - NSMutableDictionary *event = [self baseEvent]; - [event addEntriesFromDictionary: @{ - @"data": data, - }]; - - NSString *source = @"document.dispatchEvent(new MessageEvent('message:received'));"; - - [_webView stringByEvaluatingJavaScriptFromString:source]; - - _onMessage(event); - } - - // JS Navigation handler - return !isJSNavigation; -} - -- (void)webView:(__unused UIWebView *)webView didFailLoadWithError:(NSError *)error -{ - if (_onLoadingError) { - if ([error.domain isEqualToString:NSURLErrorDomain] && error.code == NSURLErrorCancelled) { - // NSURLErrorCancelled is reported when a page has a redirect OR if you load - // a new URL in the WebView before the previous one came back. We can just - // ignore these since they aren't real errors. - // http://stackoverflow.com/questions/1024748/how-do-i-fix-nsurlerrordomain-error-999-in-iphone-3-0-os - return; - } - - if ([error.domain isEqualToString:@"WebKitErrorDomain"] && error.code == 102) { - // Error code 102 "Frame load interrupted" is raised by the UIWebView if - // its delegate returns FALSE from webView:shouldStartLoadWithRequest:navigationType - // when the URL is from an http redirect. This is a common pattern when - // implementing OAuth with a WebView. - return; - } - - NSMutableDictionary *event = [self baseEvent]; - [event addEntriesFromDictionary:@{ - @"domain": error.domain, - @"code": @(error.code), - @"description": error.localizedDescription, - }]; - _onLoadingError(event); - } -} - -- (void)webViewDidFinishLoad:(UIWebView *)webView -{ - if (_messagingEnabled) { - #if RCT_DEV - // See isNative in lodash - NSString *testPostMessageNative = @"String(window.postMessage) === String(Object.hasOwnProperty).replace('hasOwnProperty', 'postMessage')"; - BOOL postMessageIsNative = [ - [webView stringByEvaluatingJavaScriptFromString:testPostMessageNative] - isEqualToString:@"true" - ]; - if (!postMessageIsNative) { - RCTLogError(@"Setting onMessage on a WebView overrides existing values of window.postMessage, but a previous value was defined"); - } - #endif - NSString *source = [NSString stringWithFormat: - @"(function() {" - "window.originalPostMessage = window.postMessage;" - - "var messageQueue = [];" - "var messagePending = false;" - - "function processQueue() {" - "if (!messageQueue.length || messagePending) return;" - "messagePending = true;" - "window.location = '%@://%@?' + encodeURIComponent(messageQueue.shift());" - "}" - - "window.postMessage = function(data) {" - "messageQueue.push(String(data));" - "processQueue();" - "};" - - "document.addEventListener('message:received', function(e) {" - "messagePending = false;" - "processQueue();" - "});" - "})();", RCTJSNavigationScheme, kPostMessageHost - ]; - [webView stringByEvaluatingJavaScriptFromString:source]; - } - if (_injectedJavaScript != nil) { - NSString *jsEvaluationValue = [webView stringByEvaluatingJavaScriptFromString:_injectedJavaScript]; - - NSMutableDictionary *event = [self baseEvent]; - event[@"jsEvaluationValue"] = jsEvaluationValue; - - _onLoadingFinish(event); - } - // we only need the final 'finishLoad' call so only fire the event when we're actually done loading. - else if (_onLoadingFinish && !webView.loading && ![webView.request.URL.absoluteString isEqualToString:@"about:blank"]) { - _onLoadingFinish([self baseEvent]); - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWebViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWebViewManager.h deleted file mode 100644 index d06ea1b8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWebViewManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTWebViewManager : RCTViewManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWebViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWebViewManager.m deleted file mode 100644 index fc39f7cb..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWebViewManager.m +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTWebViewManager.h" - -#import "RCTBridge.h" -#import "RCTUIManager.h" -#import "RCTWebView.h" -#import "UIView+React.h" - -@interface RCTWebViewManager () - -@end - -@implementation RCTWebViewManager -{ - NSConditionLock *_shouldStartLoadLock; - BOOL _shouldStartLoad; -} - -RCT_EXPORT_MODULE() - -- (UIView *)view -{ - RCTWebView *webView = [RCTWebView new]; - webView.delegate = self; - return webView; -} - -RCT_EXPORT_VIEW_PROPERTY(source, NSDictionary) -RCT_REMAP_VIEW_PROPERTY(bounces, _webView.scrollView.bounces, BOOL) -RCT_REMAP_VIEW_PROPERTY(scrollEnabled, _webView.scrollView.scrollEnabled, BOOL) -RCT_REMAP_VIEW_PROPERTY(decelerationRate, _webView.scrollView.decelerationRate, CGFloat) -RCT_EXPORT_VIEW_PROPERTY(scalesPageToFit, BOOL) -RCT_EXPORT_VIEW_PROPERTY(messagingEnabled, BOOL) -RCT_EXPORT_VIEW_PROPERTY(injectedJavaScript, NSString) -RCT_EXPORT_VIEW_PROPERTY(contentInset, UIEdgeInsets) -RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustContentInsets, BOOL) -RCT_EXPORT_VIEW_PROPERTY(onLoadingStart, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onLoadingFinish, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onLoadingError, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onMessage, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onShouldStartLoadWithRequest, RCTDirectEventBlock) -RCT_REMAP_VIEW_PROPERTY(allowsInlineMediaPlayback, _webView.allowsInlineMediaPlayback, BOOL) -RCT_REMAP_VIEW_PROPERTY(mediaPlaybackRequiresUserAction, _webView.mediaPlaybackRequiresUserAction, BOOL) -RCT_REMAP_VIEW_PROPERTY(dataDetectorTypes, _webView.dataDetectorTypes, UIDataDetectorTypes) - -RCT_EXPORT_METHOD(goBack:(nonnull NSNumber *)reactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - RCTWebView *view = viewRegistry[reactTag]; - if (![view isKindOfClass:[RCTWebView class]]) { - RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view); - } else { - [view goBack]; - } - }]; -} - -RCT_EXPORT_METHOD(goForward:(nonnull NSNumber *)reactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - RCTWebView *view = viewRegistry[reactTag]; - if (![view isKindOfClass:[RCTWebView class]]) { - RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view); - } else { - [view goForward]; - } - }]; -} - -RCT_EXPORT_METHOD(reload:(nonnull NSNumber *)reactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - RCTWebView *view = viewRegistry[reactTag]; - if (![view isKindOfClass:[RCTWebView class]]) { - RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view); - } else { - [view reload]; - } - }]; -} - -RCT_EXPORT_METHOD(stopLoading:(nonnull NSNumber *)reactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - RCTWebView *view = viewRegistry[reactTag]; - if (![view isKindOfClass:[RCTWebView class]]) { - RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view); - } else { - [view stopLoading]; - } - }]; -} - -RCT_EXPORT_METHOD(postMessage:(nonnull NSNumber *)reactTag message:(NSString *)message) -{ - [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - RCTWebView *view = viewRegistry[reactTag]; - if (![view isKindOfClass:[RCTWebView class]]) { - RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view); - } else { - [view postMessage:message]; - } - }]; -} - -RCT_EXPORT_METHOD(injectJavaScript:(nonnull NSNumber *)reactTag script:(NSString *)script) -{ - [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - RCTWebView *view = viewRegistry[reactTag]; - if (![view isKindOfClass:[RCTWebView class]]) { - RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view); - } else { - [view injectJavaScript:script]; - } - }]; -} - -#pragma mark - Exported synchronous methods - -- (BOOL)webView:(__unused RCTWebView *)webView -shouldStartLoadForRequest:(NSMutableDictionary *)request - withCallback:(RCTDirectEventBlock)callback -{ - _shouldStartLoadLock = [[NSConditionLock alloc] initWithCondition:arc4random()]; - _shouldStartLoad = YES; - request[@"lockIdentifier"] = @(_shouldStartLoadLock.condition); - callback(request); - - // Block the main thread for a maximum of 250ms until the JS thread returns - if ([_shouldStartLoadLock lockWhenCondition:0 beforeDate:[NSDate dateWithTimeIntervalSinceNow:.25]]) { - BOOL returnValue = _shouldStartLoad; - [_shouldStartLoadLock unlock]; - _shouldStartLoadLock = nil; - return returnValue; - } else { - RCTLogWarn(@"Did not receive response to shouldStartLoad in time, defaulting to YES"); - return YES; - } -} - -RCT_EXPORT_METHOD(startLoadWithResult:(BOOL)result lockIdentifier:(NSInteger)lockIdentifier) -{ - if ([_shouldStartLoadLock tryLockWhenCondition:lockIdentifier]) { - _shouldStartLoad = result; - [_shouldStartLoadLock unlockWithCondition:0]; - } else { - RCTLogWarn(@"startLoadWithResult invoked with invalid lockIdentifier: " - "got %lld, expected %lld", (long long)lockIdentifier, (long long)_shouldStartLoadLock.condition); - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWrapperViewController.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWrapperViewController.h deleted file mode 100644 index 623b37bf..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWrapperViewController.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@class RCTWrapperViewController; - -@interface RCTWrapperViewController : UIViewController - -- (instancetype)initWithContentView:(UIView *)contentView NS_DESIGNATED_INITIALIZER; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWrapperViewController.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWrapperViewController.m deleted file mode 100644 index e32425e4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/RCTWrapperViewController.m +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTWrapperViewController.h" - -#import - -#import "RCTEventDispatcher.h" -#import "RCTUtils.h" -#import "UIView+React.h" -#import "RCTAutoInsetsProtocol.h" - -@implementation RCTWrapperViewController -{ - UIView *_wrapperView; - UIView *_contentView; - RCTEventDispatcher *_eventDispatcher; - CGFloat _previousTopLayoutLength; - CGFloat _previousBottomLayoutLength; - - id _currentTopLayoutGuide; - id _currentBottomLayoutGuide; -} - -- (instancetype)initWithContentView:(UIView *)contentView -{ - RCTAssertParam(contentView); - - if ((self = [super initWithNibName:nil bundle:nil])) { - _contentView = contentView; - self.automaticallyAdjustsScrollViewInsets = NO; - } - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)initWithNibName:(NSString *)nn bundle:(NSBundle *)nb) -RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) - -- (void)viewWillLayoutSubviews -{ - [super viewWillLayoutSubviews]; - - _currentTopLayoutGuide = self.topLayoutGuide; - _currentBottomLayoutGuide = self.bottomLayoutGuide; -} - -static BOOL RCTFindScrollViewAndRefreshContentInsetInView(UIView *view) -{ - if ([view conformsToProtocol:@protocol(RCTAutoInsetsProtocol)]) { - [(id ) view refreshContentInset]; - return YES; - } - for (UIView *subview in view.subviews) { - if (RCTFindScrollViewAndRefreshContentInsetInView(subview)) { - return YES; - } - } - return NO; -} - -- (void)viewDidLayoutSubviews -{ - [super viewDidLayoutSubviews]; - - if (_previousTopLayoutLength != _currentTopLayoutGuide.length || - _previousBottomLayoutLength != _currentBottomLayoutGuide.length) { - RCTFindScrollViewAndRefreshContentInsetInView(_contentView); - _previousTopLayoutLength = _currentTopLayoutGuide.length; - _previousBottomLayoutLength = _currentBottomLayoutGuide.length; - } -} - -- (void)loadView -{ - // Add a wrapper so that the wrapper view managed by the - // UINavigationController doesn't end up resetting the frames for - //`contentView` which is a react-managed view. - _wrapperView = [[UIView alloc] initWithFrame:_contentView.bounds]; - [_wrapperView addSubview:_contentView]; - self.view = _wrapperView; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaShadowView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaShadowView.h deleted file mode 100644 index bb000179..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaShadowView.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface RCTSafeAreaShadowView : RCTShadowView - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaShadowView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaShadowView.m deleted file mode 100644 index 9c66d6be..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaShadowView.m +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSafeAreaShadowView.h" - -#import -#import - -#import "RCTSafeAreaViewLocalData.h" - -@implementation RCTSafeAreaShadowView - -- (void)setLocalData:(RCTSafeAreaViewLocalData *)localData -{ - RCTAssert([localData isKindOfClass:[RCTSafeAreaViewLocalData class]], - @"Local data object for `RCTSafeAreaShadowView` must be `RCTSafeAreaViewLocalData` instance."); - - UIEdgeInsets insets = localData.insets; - - super.paddingLeft = (YGValue){insets.left, YGUnitPoint}; - super.paddingRight = (YGValue){insets.right, YGUnitPoint}; - super.paddingTop = (YGValue){insets.top, YGUnitPoint}; - super.paddingBottom = (YGValue){insets.bottom, YGUnitPoint}; - - [self didSetProps:@[@"paddingLeft", @"paddingRight", @"paddingTop", @"paddingBottom"]]; -} - -/** - * Removing support for setting padding from any outside code - * to prevent interferring this with local data. - */ -- (void)setPadding:(YGValue)value {} -- (void)setPaddingLeft:(YGValue)value {} -- (void)setPaddingRight:(YGValue)value {} -- (void)setPaddingTop:(YGValue)value {} -- (void)setPaddingBottom:(YGValue)value {} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaView.h deleted file mode 100644 index 9a8c2efc..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaView.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RCTBridge; - -@interface RCTSafeAreaView : RCTView - -- (instancetype)initWithBridge:(RCTBridge *)bridge; - -@property (nonatomic, assign) BOOL emulateUnlessSupported; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaView.m deleted file mode 100644 index 7e3c8562..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaView.m +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSafeAreaView.h" - -#import -#import - -#import "RCTSafeAreaViewLocalData.h" - -@implementation RCTSafeAreaView { - __weak RCTBridge *_bridge; - UIEdgeInsets _currentSafeAreaInsets; -} - -- (instancetype)initWithBridge:(RCTBridge *)bridge -{ - if (self = [super initWithFrame:CGRectZero]) { - _bridge = bridge; - _emulateUnlessSupported = YES; // The default. - } - - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)decoder) -RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) - -- (BOOL)isSupportedByOS -{ - return [self respondsToSelector:@selector(safeAreaInsets)]; -} - -- (UIEdgeInsets)safeAreaInsetsIfSupportedAndEnabled -{ -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ - if (self.isSupportedByOS) { - return self.safeAreaInsets; - } -#endif - return self.emulateUnlessSupported ? self.emulatedSafeAreaInsets : UIEdgeInsetsZero; -} - -- (UIEdgeInsets)emulatedSafeAreaInsets -{ - UIViewController* vc = self.reactViewController; - - if (!vc) { - return UIEdgeInsetsZero; - } - - CGFloat topLayoutOffset = vc.topLayoutGuide.length; - CGFloat bottomLayoutOffset = vc.bottomLayoutGuide.length; - CGRect safeArea = vc.view.bounds; - safeArea.origin.y += topLayoutOffset; - safeArea.size.height -= topLayoutOffset + bottomLayoutOffset; - CGRect localSafeArea = [vc.view convertRect:safeArea toView:self]; - UIEdgeInsets safeAreaInsets = UIEdgeInsetsMake(0, 0, 0, 0); - if (CGRectGetMinY(localSafeArea) > CGRectGetMinY(self.bounds)) { - safeAreaInsets.top = CGRectGetMinY(localSafeArea) - CGRectGetMinY(self.bounds); - } - if (CGRectGetMaxY(localSafeArea) < CGRectGetMaxY(self.bounds)) { - safeAreaInsets.bottom = CGRectGetMaxY(self.bounds) - CGRectGetMaxY(localSafeArea); - } - - return safeAreaInsets; -} - -static BOOL UIEdgeInsetsEqualToEdgeInsetsWithThreshold(UIEdgeInsets insets1, UIEdgeInsets insets2, CGFloat threshold) { - return - ABS(insets1.left - insets2.left) <= threshold && - ABS(insets1.right - insets2.right) <= threshold && - ABS(insets1.top - insets2.top) <= threshold && - ABS(insets1.bottom - insets2.bottom) <= threshold; -} - -- (void)safeAreaInsetsDidChange -{ - [self invalidateSafeAreaInsets]; -} - -- (void)invalidateSafeAreaInsets -{ - [self setSafeAreaInsets:self.safeAreaInsetsIfSupportedAndEnabled]; -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - - if (!self.isSupportedByOS && self.emulateUnlessSupported) { - [self invalidateSafeAreaInsets]; - } -} - -- (void)setSafeAreaInsets:(UIEdgeInsets)safeAreaInsets -{ - if (UIEdgeInsetsEqualToEdgeInsetsWithThreshold(safeAreaInsets, _currentSafeAreaInsets, 1.0 / RCTScreenScale())) { - return; - } - - _currentSafeAreaInsets = safeAreaInsets; - - RCTSafeAreaViewLocalData *localData = [[RCTSafeAreaViewLocalData alloc] initWithInsets:safeAreaInsets]; - [_bridge.uiManager setLocalData:localData forView:self]; -} - -- (void)setEmulateUnlessSupported:(BOOL)emulateUnlessSupported -{ - if (_emulateUnlessSupported == emulateUnlessSupported) { - return; - } - - _emulateUnlessSupported = emulateUnlessSupported; - - [self invalidateSafeAreaInsets]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.h deleted file mode 100644 index e72c1127..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface RCTSafeAreaViewLocalData : NSObject - -- (instancetype)initWithInsets:(UIEdgeInsets)insets; - -@property (atomic, readonly) UIEdgeInsets insets; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.m deleted file mode 100644 index ca108bf3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.m +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSafeAreaViewLocalData.h" - -@implementation RCTSafeAreaViewLocalData - -- (instancetype)initWithInsets:(UIEdgeInsets)insets -{ - if (self = [super init]) { - _insets = insets; - } - - return self; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaViewManager.h deleted file mode 100644 index 5dcfb038..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaViewManager.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface RCTSafeAreaViewManager : RCTViewManager - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaViewManager.m deleted file mode 100644 index 6baf0c1b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/SafeAreaView/RCTSafeAreaViewManager.m +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSafeAreaViewManager.h" - -#import "RCTSafeAreaShadowView.h" -#import "RCTSafeAreaView.h" -#import "RCTUIManager.h" - -@implementation RCTSafeAreaViewManager - -RCT_EXPORT_MODULE() - -RCT_EXPORT_VIEW_PROPERTY(emulateUnlessSupported, BOOL) - -- (UIView *)view -{ - return [[RCTSafeAreaView alloc] initWithBridge:self.bridge]; -} - -- (RCTSafeAreaShadowView *)shadowView -{ - return [RCTSafeAreaShadowView new]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollContentShadowView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollContentShadowView.h deleted file mode 100644 index 2e1bd897..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollContentShadowView.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTScrollContentShadowView : RCTShadowView - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollContentShadowView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollContentShadowView.m deleted file mode 100644 index 7d4e2f78..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollContentShadowView.m +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTScrollContentShadowView.h" - -#import - -#import "RCTUtils.h" - -@implementation RCTScrollContentShadowView - -- (void)layoutWithMetrics:(RCTLayoutMetrics)layoutMetrics - layoutContext:(RCTLayoutContext)layoutContext -{ - if (layoutMetrics.layoutDirection == UIUserInterfaceLayoutDirectionRightToLeft) { - // Motivation: - // Yoga place `contentView` on the right side of `scrollView` when RTL layout is enfoced. - // That breaks everything; it is completely pointless to (re)position `contentView` - // because it is `contentView`'s job. So, we work around it here. - - layoutContext.absolutePosition.x += layoutMetrics.frame.size.width; - layoutMetrics.frame.origin.x = 0; - } - - [super layoutWithMetrics:layoutMetrics layoutContext:layoutContext]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollContentView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollContentView.h deleted file mode 100644 index 8d93a2a6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollContentView.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTScrollContentView : RCTView - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollContentView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollContentView.m deleted file mode 100644 index 99689d56..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollContentView.m +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTScrollContentView.h" - -#import -#import - -#import "RCTScrollView.h" - -@implementation RCTScrollContentView - -- (void)reactSetFrame:(CGRect)frame -{ - [super reactSetFrame:frame]; - - RCTScrollView *scrollView = (RCTScrollView *)self.superview.superview; - - if (!scrollView) { - return; - } - - RCTAssert([scrollView isKindOfClass:[RCTScrollView class]], - @"Unexpected view hierarchy of RCTScrollView component."); - - [scrollView updateContentOffsetIfNeeded]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollContentViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollContentViewManager.h deleted file mode 100644 index 21db0a1e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollContentViewManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTScrollContentViewManager : RCTViewManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollContentViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollContentViewManager.m deleted file mode 100644 index 2f345a8c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollContentViewManager.m +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTScrollContentViewManager.h" - -#import "RCTScrollContentShadowView.h" -#import "RCTScrollContentView.h" - -@implementation RCTScrollContentViewManager - -RCT_EXPORT_MODULE() - -- (RCTScrollContentView *)view -{ - return [RCTScrollContentView new]; -} - -- (RCTShadowView *)shadowView -{ - return [RCTScrollContentShadowView new]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollView.h deleted file mode 100644 index 6ef40fa8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollView.h +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import -#import - -@protocol UIScrollViewDelegate; - -@interface RCTScrollView : RCTView - -- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher NS_DESIGNATED_INITIALIZER; - -/** - * The `RCTScrollView` may have at most one single subview. This will ensure - * that the scroll view's `contentSize` will be efficiently set to the size of - * the single subview's frame. That frame size will be determined somewhat - * efficiently since it will have already been computed by the off-main-thread - * layout system. - */ -@property (nonatomic, readonly) UIView *contentView; - -/** - * If the `contentSize` is not specified (or is specified as {0, 0}, then the - * `contentSize` will automatically be determined by the size of the subview. - */ -@property (nonatomic, assign) CGSize contentSize; - -/** - * The underlying scrollView (TODO: can we remove this?) - */ -@property (nonatomic, readonly) UIScrollView *scrollView; - -@property (nonatomic, assign) UIEdgeInsets contentInset; -@property (nonatomic, assign) BOOL automaticallyAdjustContentInsets; -@property (nonatomic, assign) BOOL DEPRECATED_sendUpdatedChildFrames; -@property (nonatomic, assign) NSTimeInterval scrollEventThrottle; -@property (nonatomic, assign) BOOL centerContent; -@property (nonatomic, copy) NSDictionary *maintainVisibleContentPosition; -@property (nonatomic, assign) BOOL scrollToOverflowEnabled; -@property (nonatomic, assign) int snapToInterval; -@property (nonatomic, copy) NSArray *snapToOffsets; -@property (nonatomic, assign) BOOL snapToStart; -@property (nonatomic, assign) BOOL snapToEnd; -@property (nonatomic, copy) NSString *snapToAlignment; - -// NOTE: currently these event props are only declared so we can export the -// event names to JS - we don't call the blocks directly because scroll events -// need to be coalesced before sending, for performance reasons. -@property (nonatomic, copy) RCTDirectEventBlock onScrollBeginDrag; -@property (nonatomic, copy) RCTDirectEventBlock onScroll; -@property (nonatomic, copy) RCTDirectEventBlock onScrollToTop; -@property (nonatomic, copy) RCTDirectEventBlock onScrollEndDrag; -@property (nonatomic, copy) RCTDirectEventBlock onMomentumScrollBegin; -@property (nonatomic, copy) RCTDirectEventBlock onMomentumScrollEnd; - -@end - -@interface RCTScrollView (Internal) - -- (void)updateContentOffsetIfNeeded; - -@end - -@interface RCTEventDispatcher (RCTScrollView) - -/** - * Send a fake scroll event. - */ -- (void)sendFakeScrollEvent:(NSNumber *)reactTag; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollView.m deleted file mode 100644 index 46b2a69b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollView.m +++ /dev/null @@ -1,1181 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTScrollView.h" - -#import - -#import "RCTConvert.h" -#import "RCTEventDispatcher.h" -#import "RCTLog.h" -#import "RCTUIManager.h" -#import "RCTUIManagerObserverCoordinator.h" -#import "RCTUIManagerUtils.h" -#import "RCTUtils.h" -#import "UIView+Private.h" -#import "UIView+React.h" - -#if !TARGET_OS_TV -#import "RCTRefreshControl.h" -#endif - -@interface RCTScrollEvent : NSObject - -- (instancetype)initWithEventName:(NSString *)eventName - reactTag:(NSNumber *)reactTag - scrollViewContentOffset:(CGPoint)scrollViewContentOffset - scrollViewContentInset:(UIEdgeInsets)scrollViewContentInset - scrollViewContentSize:(CGSize)scrollViewContentSize - scrollViewFrame:(CGRect)scrollViewFrame - scrollViewZoomScale:(CGFloat)scrollViewZoomScale - userData:(NSDictionary *)userData - coalescingKey:(uint16_t)coalescingKey NS_DESIGNATED_INITIALIZER; - -@end - -@implementation RCTScrollEvent -{ - CGPoint _scrollViewContentOffset; - UIEdgeInsets _scrollViewContentInset; - CGSize _scrollViewContentSize; - CGRect _scrollViewFrame; - CGFloat _scrollViewZoomScale; - NSDictionary *_userData; - uint16_t _coalescingKey; -} - -@synthesize viewTag = _viewTag; -@synthesize eventName = _eventName; - -- (instancetype)initWithEventName:(NSString *)eventName - reactTag:(NSNumber *)reactTag - scrollViewContentOffset:(CGPoint)scrollViewContentOffset - scrollViewContentInset:(UIEdgeInsets)scrollViewContentInset - scrollViewContentSize:(CGSize)scrollViewContentSize - scrollViewFrame:(CGRect)scrollViewFrame - scrollViewZoomScale:(CGFloat)scrollViewZoomScale - userData:(NSDictionary *)userData - coalescingKey:(uint16_t)coalescingKey -{ - RCTAssertParam(reactTag); - - if ((self = [super init])) { - _eventName = [eventName copy]; - _viewTag = reactTag; - _scrollViewContentOffset = scrollViewContentOffset; - _scrollViewContentInset = scrollViewContentInset; - _scrollViewContentSize = scrollViewContentSize; - _scrollViewFrame = scrollViewFrame; - _scrollViewZoomScale = scrollViewZoomScale; - _userData = userData; - _coalescingKey = coalescingKey; - } - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (uint16_t)coalescingKey -{ - return _coalescingKey; -} - -- (NSDictionary *)body -{ - NSDictionary *body = @{ - @"contentOffset": @{ - @"x": @(_scrollViewContentOffset.x), - @"y": @(_scrollViewContentOffset.y) - }, - @"contentInset": @{ - @"top": @(_scrollViewContentInset.top), - @"left": @(_scrollViewContentInset.left), - @"bottom": @(_scrollViewContentInset.bottom), - @"right": @(_scrollViewContentInset.right) - }, - @"contentSize": @{ - @"width": @(_scrollViewContentSize.width), - @"height": @(_scrollViewContentSize.height) - }, - @"layoutMeasurement": @{ - @"width": @(_scrollViewFrame.size.width), - @"height": @(_scrollViewFrame.size.height) - }, - @"zoomScale": @(_scrollViewZoomScale ?: 1), - }; - - if (_userData) { - NSMutableDictionary *mutableBody = [body mutableCopy]; - [mutableBody addEntriesFromDictionary:_userData]; - body = mutableBody; - } - - return body; -} - -- (BOOL)canCoalesce -{ - return YES; -} - -- (RCTScrollEvent *)coalesceWithEvent:(RCTScrollEvent *)newEvent -{ - NSArray *updatedChildFrames = [_userData[@"updatedChildFrames"] arrayByAddingObjectsFromArray:newEvent->_userData[@"updatedChildFrames"]]; - if (updatedChildFrames) { - NSMutableDictionary *userData = [newEvent->_userData mutableCopy]; - userData[@"updatedChildFrames"] = updatedChildFrames; - newEvent->_userData = userData; - } - - return newEvent; -} - -+ (NSString *)moduleDotMethod -{ - return @"RCTEventEmitter.receiveEvent"; -} - -- (NSArray *)arguments -{ - return @[self.viewTag, RCTNormalizeInputEventName(self.eventName), [self body]]; -} - -@end - -/** - * Include a custom scroll view subclass because we want to limit certain - * default UIKit behaviors such as textFields automatically scrolling - * scroll views that contain them. - */ -@interface RCTCustomScrollView : UIScrollView - -@property (nonatomic, assign) BOOL centerContent; -#if !TARGET_OS_TV -@property (nonatomic, strong) UIView *customRefreshControl; -@property (nonatomic, assign) BOOL pinchGestureEnabled; -#endif - -@end - - -@implementation RCTCustomScrollView - -- (instancetype)initWithFrame:(CGRect)frame -{ - if ((self = [super initWithFrame:frame])) { - [self.panGestureRecognizer addTarget:self action:@selector(handleCustomPan:)]; - - if ([self respondsToSelector:@selector(setSemanticContentAttribute:)]) { - // We intentionaly force `UIScrollView`s `semanticContentAttribute` to `LTR` here - // because this attribute affects a position of vertical scrollbar; we don't want this - // scrollbar flip because we also flip it with whole `UIScrollView` flip. - self.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight; - } - - #if !TARGET_OS_TV - _pinchGestureEnabled = YES; - #endif - } - return self; -} - -- (UIView *)contentView -{ - return ((RCTScrollView *)self.superview).contentView; -} - -/** - * @return Whether or not the scroll view interaction should be blocked because - * JS was found to be the responder. - */ -- (BOOL)_shouldDisableScrollInteraction -{ - // Since this may be called on every pan, we need to make sure to only climb - // the hierarchy on rare occasions. - UIView *JSResponder = [RCTUIManager JSResponder]; - if (JSResponder && JSResponder != self.superview) { - BOOL superviewHasResponder = [self isDescendantOfView:JSResponder]; - return superviewHasResponder; - } - return NO; -} - -- (void)handleCustomPan:(__unused UIPanGestureRecognizer *)sender -{ - if ([self _shouldDisableScrollInteraction] && ![[RCTUIManager JSResponder] isKindOfClass:[RCTScrollView class]]) { - self.panGestureRecognizer.enabled = NO; - self.panGestureRecognizer.enabled = YES; - // TODO: If mid bounce, animate the scroll view to a non-bounced position - // while disabling (but only if `stopScrollInteractionIfJSHasResponder` was - // called *during* a `pan`). Currently, it will just snap into place which - // is not so bad either. - // Another approach: - // self.scrollEnabled = NO; - // self.scrollEnabled = YES; - } -} - -- (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated -{ - // Limiting scroll area to an area where we actually have content. - CGSize contentSize = self.contentSize; - UIEdgeInsets contentInset = self.contentInset; - CGSize fullSize = CGSizeMake( - contentSize.width + contentInset.left + contentInset.right, - contentSize.height + contentInset.top + contentInset.bottom); - - rect = CGRectIntersection((CGRect){CGPointZero, fullSize}, rect); - if (CGRectIsNull(rect)) { - return; - } - - [super scrollRectToVisible:rect animated:animated]; -} - -/** - * Returning `YES` cancels touches for the "inner" `view` and causes a scroll. - * Returning `NO` causes touches to be directed to that inner view and prevents - * the scroll view from scrolling. - * - * `YES` -> Allows scrolling. - * `NO` -> Doesn't allow scrolling. - * - * By default this returns NO for all views that are UIControls and YES for - * everything else. What that does is allows scroll views to scroll even when a - * touch started inside of a `UIControl` (`UIButton` etc). For React scroll - * views, we want the default to be the same behavior as `UIControl`s so we - * return `YES` by default. But there's one case where we want to block the - * scrolling no matter what: When JS believes it has its own responder lock on - * a view that is *above* the scroll view in the hierarchy. So we abuse this - * `touchesShouldCancelInContentView` API in order to stop the scroll view from - * scrolling in this case. - * - * We are not aware of *any* other solution to the problem because alternative - * approaches require that we disable the scrollview *before* touches begin or - * move. This approach (`touchesShouldCancelInContentView`) works even if the - * JS responder is set after touches start/move because - * `touchesShouldCancelInContentView` is called as soon as the scroll view has - * been touched and dragged *just* far enough to decide to begin the "drag" - * movement of the scroll interaction. Returning `NO`, will cause the drag - * operation to fail. - * - * `touchesShouldCancelInContentView` will stop the *initialization* of a - * scroll pan gesture and most of the time this is sufficient. On rare - * occasion, the scroll gesture would have already initialized right before JS - * notifies native of the JS responder being set. In order to recover from that - * timing issue we have a fallback that kills any ongoing pan gesture that - * occurs when native is notified of a JS responder. - * - * Note: Explicitly returning `YES`, instead of relying on the default fixes - * (at least) one bug where if you have a UIControl inside a UIScrollView and - * tap on the UIControl and then start dragging (to scroll), it won't scroll. - * Chat with @andras for more details. - * - * In order to have this called, you must have delaysContentTouches set to NO - * (which is the not the `UIKit` default). - */ -- (BOOL)touchesShouldCancelInContentView:(__unused UIView *)view -{ - //TODO: shouldn't this call super if _shouldDisableScrollInteraction returns NO? - return ![self _shouldDisableScrollInteraction]; -} - -/* - * Automatically centers the content such that if the content is smaller than the - * ScrollView, we force it to be centered, but when you zoom or the content otherwise - * becomes larger than the ScrollView, there is no padding around the content but it - * can still fill the whole view. - */ -- (void)setContentOffset:(CGPoint)contentOffset -{ - UIView *contentView = [self contentView]; - if (contentView && _centerContent) { - CGSize subviewSize = contentView.frame.size; - CGSize scrollViewSize = self.bounds.size; - if (subviewSize.width <= scrollViewSize.width) { - contentOffset.x = -(scrollViewSize.width - subviewSize.width) / 2.0; - } - if (subviewSize.height <= scrollViewSize.height) { - contentOffset.y = -(scrollViewSize.height - subviewSize.height) / 2.0; - } - } - - super.contentOffset = CGPointMake( - RCTSanitizeNaNValue(contentOffset.x, @"scrollView.contentOffset.x"), - RCTSanitizeNaNValue(contentOffset.y, @"scrollView.contentOffset.y")); -} - -- (void)setFrame:(CGRect)frame -{ - // Preserving and revalidating `contentOffset`. - CGPoint originalOffset = self.contentOffset; - - [super setFrame:frame]; - - UIEdgeInsets contentInset = self.contentInset; - CGSize contentSize = self.contentSize; - - // If contentSize has not been measured yet we can't check bounds. - if (CGSizeEqualToSize(contentSize, CGSizeZero)) { - self.contentOffset = originalOffset; - } else { - // Make sure offset don't exceed bounds. This could happen on screen rotation. - CGSize boundsSize = self.bounds.size; - self.contentOffset = CGPointMake( - MAX(-contentInset.left, MIN(contentSize.width - boundsSize.width + contentInset.right, originalOffset.x)), - MAX(-contentInset.top, MIN(contentSize.height - boundsSize.height + contentInset.bottom, originalOffset.y))); - } -} - -#if !TARGET_OS_TV -- (void)setCustomRefreshControl:(UIView *)refreshControl -{ - if (_customRefreshControl) { - [_customRefreshControl removeFromSuperview]; - } - _customRefreshControl = refreshControl; - [self addSubview:_customRefreshControl]; -} - -- (void)setPinchGestureEnabled:(BOOL)pinchGestureEnabled -{ - self.pinchGestureRecognizer.enabled = pinchGestureEnabled; - _pinchGestureEnabled = pinchGestureEnabled; -} - -- (void)didMoveToWindow -{ - [super didMoveToWindow]; - // ScrollView enables pinch gesture late in its lifecycle. So simply setting it - // in the setter gets overriden when the view loads. - self.pinchGestureRecognizer.enabled = _pinchGestureEnabled; -} -#endif //TARGET_OS_TV - -@end - -@interface RCTScrollView () - -@end - -@implementation RCTScrollView -{ - RCTEventDispatcher *_eventDispatcher; - CGRect _prevFirstVisibleFrame; - __weak UIView *_firstVisibleView; - RCTCustomScrollView *_scrollView; - UIView *_contentView; - NSTimeInterval _lastScrollDispatchTime; - NSMutableArray *_cachedChildFrames; - BOOL _allowNextScrollNoMatterWhat; - CGRect _lastClippedToRect; - uint16_t _coalescingKey; - NSString *_lastEmittedEventName; - NSHashTable *_scrollListeners; -} - -- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher -{ - RCTAssertParam(eventDispatcher); - - if ((self = [super initWithFrame:CGRectZero])) { - _eventDispatcher = eventDispatcher; - - _scrollView = [[RCTCustomScrollView alloc] initWithFrame:CGRectZero]; - _scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - _scrollView.delegate = self; - _scrollView.delaysContentTouches = NO; - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ - // `contentInsetAdjustmentBehavior` is only available since iOS 11. - // We set the default behavior to "never" so that iOS - // doesn't do weird things to UIScrollView insets automatically - // and keeps it as an opt-in behavior. - if ([_scrollView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) { - if (@available(iOS 11.0, *)) { - _scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; - } - } -#endif - - _automaticallyAdjustContentInsets = YES; - _DEPRECATED_sendUpdatedChildFrames = NO; - _contentInset = UIEdgeInsetsZero; - _contentSize = CGSizeZero; - _lastClippedToRect = CGRectNull; - - _scrollEventThrottle = 0.0; - _lastScrollDispatchTime = 0; - _cachedChildFrames = [NSMutableArray new]; - - _scrollListeners = [NSHashTable weakObjectsHashTable]; - - [self addSubview:_scrollView]; - } - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) -RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) - -static inline void RCTApplyTransformationAccordingLayoutDirection(UIView *view, UIUserInterfaceLayoutDirection layoutDirection) { - view.transform = - layoutDirection == UIUserInterfaceLayoutDirectionLeftToRight ? - CGAffineTransformIdentity : - CGAffineTransformMakeScale(-1, 1); -} - -- (void)setReactLayoutDirection:(UIUserInterfaceLayoutDirection)layoutDirection -{ - [super setReactLayoutDirection:layoutDirection]; - - RCTApplyTransformationAccordingLayoutDirection(_scrollView, layoutDirection); - RCTApplyTransformationAccordingLayoutDirection(_contentView, layoutDirection); -} - -- (void)setRemoveClippedSubviews:(__unused BOOL)removeClippedSubviews -{ - // Does nothing -} - -- (void)insertReactSubview:(UIView *)view atIndex:(NSInteger)atIndex -{ - [super insertReactSubview:view atIndex:atIndex]; -#if !TARGET_OS_TV - if ([view conformsToProtocol:@protocol(RCTCustomRefreshContolProtocol)]) { - [_scrollView setCustomRefreshControl:(UIView *)view]; - if (![view isKindOfClass:[UIRefreshControl class]] - && [view conformsToProtocol:@protocol(UIScrollViewDelegate)]) { - [self addScrollListener:(UIView *)view]; - } - } else -#endif - { - RCTAssert(_contentView == nil, @"RCTScrollView may only contain a single subview"); - _contentView = view; - RCTApplyTransformationAccordingLayoutDirection(_contentView, self.reactLayoutDirection); - [_scrollView addSubview:view]; - } -} - -- (void)removeReactSubview:(UIView *)subview -{ - [super removeReactSubview:subview]; -#if !TARGET_OS_TV - if ([subview conformsToProtocol:@protocol(RCTCustomRefreshContolProtocol)]) { - [_scrollView setCustomRefreshControl:nil]; - if (![subview isKindOfClass:[UIRefreshControl class]] - && [subview conformsToProtocol:@protocol(UIScrollViewDelegate)]) { - [self removeScrollListener:(UIView *)subview]; - } - } else -#endif - { - RCTAssert(_contentView == subview, @"Attempted to remove non-existent subview"); - _contentView = nil; - } -} - -- (void)didUpdateReactSubviews -{ - // Do nothing, as subviews are managed by `insertReactSubview:atIndex:` -} - -- (void)didSetProps:(NSArray *)changedProps -{ - if ([changedProps containsObject:@"contentSize"]) { - [self updateContentOffsetIfNeeded]; - } -} - -- (BOOL)centerContent -{ - return _scrollView.centerContent; -} - -- (void)setCenterContent:(BOOL)centerContent -{ - _scrollView.centerContent = centerContent; -} - -- (void)setClipsToBounds:(BOOL)clipsToBounds -{ - super.clipsToBounds = clipsToBounds; - _scrollView.clipsToBounds = clipsToBounds; -} - -- (void)dealloc -{ - _scrollView.delegate = nil; - [_eventDispatcher.bridge.uiManager.observerCoordinator removeObserver:self]; -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - RCTAssert(self.subviews.count == 1, @"we should only have exactly one subview"); - RCTAssert([self.subviews lastObject] == _scrollView, @"our only subview should be a scrollview"); - -#if !TARGET_OS_TV - // Adjust the refresh control frame if the scrollview layout changes. - UIView *refreshControl = _scrollView.customRefreshControl; - if (refreshControl && refreshControl.isRefreshing) { - refreshControl.frame = (CGRect){_scrollView.contentOffset, {_scrollView.frame.size.width, refreshControl.frame.size.height}}; - } -#endif - - [self updateClippedSubviews]; -} - -- (void)updateClippedSubviews -{ - // Find a suitable view to use for clipping - UIView *clipView = [self react_findClipView]; - if (!clipView) { - return; - } - - static const CGFloat leeway = 1.0; - - const CGSize contentSize = _scrollView.contentSize; - const CGRect bounds = _scrollView.bounds; - const BOOL scrollsHorizontally = contentSize.width > bounds.size.width; - const BOOL scrollsVertically = contentSize.height > bounds.size.height; - - const BOOL shouldClipAgain = - CGRectIsNull(_lastClippedToRect) || - !CGRectEqualToRect(_lastClippedToRect, bounds) || - (scrollsHorizontally && (bounds.size.width < leeway || fabs(_lastClippedToRect.origin.x - bounds.origin.x) >= leeway)) || - (scrollsVertically && (bounds.size.height < leeway || fabs(_lastClippedToRect.origin.y - bounds.origin.y) >= leeway)); - - if (shouldClipAgain) { - const CGRect clipRect = CGRectInset(clipView.bounds, -leeway, -leeway); - [self react_updateClippedSubviewsWithClipRect:clipRect relativeToView:clipView]; - _lastClippedToRect = bounds; - } -} - -- (void)setContentInset:(UIEdgeInsets)contentInset -{ - if (UIEdgeInsetsEqualToEdgeInsets(contentInset, _contentInset)) { - return; - } - - CGPoint contentOffset = _scrollView.contentOffset; - - _contentInset = contentInset; - [RCTView autoAdjustInsetsForView:self - withScrollView:_scrollView - updateOffset:NO]; - - _scrollView.contentOffset = contentOffset; -} - -- (BOOL)isHorizontal:(UIScrollView *)scrollView -{ - return scrollView.contentSize.width > self.frame.size.width; -} - -- (void)scrollToOffset:(CGPoint)offset -{ - [self scrollToOffset:offset animated:YES]; -} - -- (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated -{ - if (!CGPointEqualToPoint(_scrollView.contentOffset, offset)) { - CGRect maxRect = CGRectMake(fmin(-_scrollView.contentInset.left, 0), - fmin(-_scrollView.contentInset.top, 0), - fmax(_scrollView.contentSize.width - _scrollView.bounds.size.width + _scrollView.contentInset.right + fmax(_scrollView.contentInset.left, 0), 0.01), - fmax(_scrollView.contentSize.height - _scrollView.bounds.size.height + _scrollView.contentInset.bottom + fmax(_scrollView.contentInset.top, 0), 0.01)); // Make width and height greater than 0 - // Ensure at least one scroll event will fire - _allowNextScrollNoMatterWhat = YES; - if (!CGRectContainsPoint(maxRect, offset) && !self.scrollToOverflowEnabled) { - CGFloat x = fmax(offset.x, CGRectGetMinX(maxRect)); - x = fmin(x, CGRectGetMaxX(maxRect)); - CGFloat y = fmax(offset.y, CGRectGetMinY(maxRect)); - y = fmin(y, CGRectGetMaxY(maxRect)); - offset = CGPointMake(x, y); - } - [_scrollView setContentOffset:offset animated:animated]; - } -} - -/** - * If this is a vertical scroll view, scrolls to the bottom. - * If this is a horizontal scroll view, scrolls to the right. - */ -- (void)scrollToEnd:(BOOL)animated -{ - BOOL isHorizontal = [self isHorizontal:_scrollView]; - CGPoint offset; - if (isHorizontal) { - CGFloat offsetX = _scrollView.contentSize.width - _scrollView.bounds.size.width + _scrollView.contentInset.right; - offset = CGPointMake(fmax(offsetX, 0), 0); - } else { - CGFloat offsetY = _scrollView.contentSize.height - _scrollView.bounds.size.height + _scrollView.contentInset.bottom; - offset = CGPointMake(0, fmax(offsetY, 0)); - } - if (!CGPointEqualToPoint(_scrollView.contentOffset, offset)) { - // Ensure at least one scroll event will fire - _allowNextScrollNoMatterWhat = YES; - [_scrollView setContentOffset:offset animated:animated]; - } -} - -- (void)zoomToRect:(CGRect)rect animated:(BOOL)animated -{ - [_scrollView zoomToRect:rect animated:animated]; -} - -- (void)refreshContentInset -{ - [RCTView autoAdjustInsetsForView:self - withScrollView:_scrollView - updateOffset:YES]; -} - -#pragma mark - ScrollView delegate - -#define RCT_SEND_SCROLL_EVENT(_eventName, _userData) { \ - NSString *eventName = NSStringFromSelector(@selector(_eventName)); \ - [self sendScrollEventWithName:eventName scrollView:_scrollView userData:_userData]; \ -} - -#define RCT_FORWARD_SCROLL_EVENT(call) \ -for (NSObject *scrollViewListener in _scrollListeners) { \ - if ([scrollViewListener respondsToSelector:_cmd]) { \ - [scrollViewListener call]; \ - } \ -} - -#define RCT_SCROLL_EVENT_HANDLER(delegateMethod, eventName) \ -- (void)delegateMethod:(UIScrollView *)scrollView \ -{ \ - RCT_SEND_SCROLL_EVENT(eventName, nil); \ - RCT_FORWARD_SCROLL_EVENT(delegateMethod:scrollView); \ -} - -RCT_SCROLL_EVENT_HANDLER(scrollViewWillBeginDecelerating, onMomentumScrollBegin) -RCT_SCROLL_EVENT_HANDLER(scrollViewDidZoom, onScroll) -RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop) - -- (void)addScrollListener:(NSObject *)scrollListener -{ - [_scrollListeners addObject:scrollListener]; -} - -- (void)removeScrollListener:(NSObject *)scrollListener -{ - [_scrollListeners removeObject:scrollListener]; -} - -- (void)scrollViewDidScroll:(UIScrollView *)scrollView -{ - [self updateClippedSubviews]; - NSTimeInterval now = CACurrentMediaTime(); - /** - * TODO: this logic looks wrong, and it may be because it is. Currently, if _scrollEventThrottle - * is set to zero (the default), the "didScroll" event is only sent once per scroll, instead of repeatedly - * while scrolling as expected. However, if you "fix" that bug, ScrollView will generate repeated - * warnings, and behave strangely (ListView works fine however), so don't fix it unless you fix that too! - */ - if (_allowNextScrollNoMatterWhat || - (_scrollEventThrottle > 0 && _scrollEventThrottle < (now - _lastScrollDispatchTime))) { - - if (_DEPRECATED_sendUpdatedChildFrames) { - // Calculate changed frames - RCT_SEND_SCROLL_EVENT(onScroll, (@{@"updatedChildFrames": [self calculateChildFramesData]})); - } else { - RCT_SEND_SCROLL_EVENT(onScroll, nil); - } - - // Update dispatch time - _lastScrollDispatchTime = now; - _allowNextScrollNoMatterWhat = NO; - } - RCT_FORWARD_SCROLL_EVENT(scrollViewDidScroll:scrollView); -} - -- (NSArray *)calculateChildFramesData -{ - NSMutableArray *updatedChildFrames = [NSMutableArray new]; - [[_contentView reactSubviews] enumerateObjectsUsingBlock: - ^(UIView *subview, NSUInteger idx, __unused BOOL *stop) { - - // Check if new or changed - CGRect newFrame = subview.frame; - BOOL frameChanged = NO; - if (self->_cachedChildFrames.count <= idx) { - frameChanged = YES; - [self->_cachedChildFrames addObject:[NSValue valueWithCGRect:newFrame]]; - } else if (!CGRectEqualToRect(newFrame, [self->_cachedChildFrames[idx] CGRectValue])) { - frameChanged = YES; - self->_cachedChildFrames[idx] = [NSValue valueWithCGRect:newFrame]; - } - - // Create JS frame object - if (frameChanged) { - [updatedChildFrames addObject: @{ - @"index": @(idx), - @"x": @(newFrame.origin.x), - @"y": @(newFrame.origin.y), - @"width": @(newFrame.size.width), - @"height": @(newFrame.size.height), - }]; - } - }]; - - return updatedChildFrames; -} - -- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView -{ - _allowNextScrollNoMatterWhat = YES; // Ensure next scroll event is recorded, regardless of throttle - RCT_SEND_SCROLL_EVENT(onScrollBeginDrag, nil); - RCT_FORWARD_SCROLL_EVENT(scrollViewWillBeginDragging:scrollView); -} - -- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset -{ - if (self.snapToOffsets) { - // An alternative to enablePaging and snapToInterval which allows setting custom - // stopping points that don't have to be the same distance apart. Often seen in - // apps which feature horizonally scrolling items. snapToInterval does not enforce - // scrolling one interval at a time but guarantees that the scroll will stop at - // a snap offset point. - - // Find which axis to snap - BOOL isHorizontal = [self isHorizontal:scrollView]; - CGFloat velocityAlongAxis = isHorizontal ? velocity.x : velocity.y; - CGFloat offsetAlongAxis = isHorizontal ? _scrollView.contentOffset.x : _scrollView.contentOffset.y; - - // Calculate maximum content offset - CGSize viewportSize = [self _calculateViewportSize]; - CGFloat maximumOffset = isHorizontal - ? MAX(0, _scrollView.contentSize.width - viewportSize.width) - : MAX(0, _scrollView.contentSize.height - viewportSize.height); - - // Calculate the snap offsets adjacent to the initial offset target - CGFloat targetOffset = isHorizontal ? targetContentOffset->x : targetContentOffset->y; - CGFloat smallerOffset = 0.0; - CGFloat largerOffset = maximumOffset; - - for (int i = 0; i < self.snapToOffsets.count; i++) { - CGFloat offset = [[self.snapToOffsets objectAtIndex:i] floatValue]; - - if (offset <= targetOffset) { - if (targetOffset - offset < targetOffset - smallerOffset) { - smallerOffset = offset; - } - } - - if (offset >= targetOffset) { - if (offset - targetOffset < largerOffset - targetOffset) { - largerOffset = offset; - } - } - } - - // Calculate the nearest offset - CGFloat nearestOffset = targetOffset - smallerOffset < largerOffset - targetOffset - ? smallerOffset - : largerOffset; - - CGFloat firstOffset = [[self.snapToOffsets firstObject] floatValue]; - CGFloat lastOffset = [[self.snapToOffsets lastObject] floatValue]; - - // if scrolling after the last snap offset and snapping to the - // end of the list is disabled, then we allow free scrolling - if (!self.snapToEnd && targetOffset >= lastOffset) { - if (offsetAlongAxis >= lastOffset) { - // free scrolling - } else { - // snap to end - targetOffset = lastOffset; - } - } else if (!self.snapToStart && targetOffset <= firstOffset) { - if (offsetAlongAxis <= firstOffset) { - // free scrolling - } else { - // snap to beginning - targetOffset = firstOffset; - } - } else if (velocityAlongAxis > 0.0) { - targetOffset = largerOffset; - } else if (velocityAlongAxis < 0.0) { - targetOffset = smallerOffset; - } else { - targetOffset = nearestOffset; - } - - // Make sure the new offset isn't out of bounds - targetOffset = MIN(MAX(0, targetOffset), maximumOffset); - - // Set new targetContentOffset - if (isHorizontal) { - targetContentOffset->x = targetOffset; - } else { - targetContentOffset->y = targetOffset; - } - } else if (self.snapToInterval) { - // An alternative to enablePaging which allows setting custom stopping intervals, - // smaller than a full page size. Often seen in apps which feature horizonally - // scrolling items. snapToInterval does not enforce scrolling one interval at a time - // but guarantees that the scroll will stop at an interval point. - CGFloat snapToIntervalF = (CGFloat)self.snapToInterval; - - // Find which axis to snap - BOOL isHorizontal = [self isHorizontal:scrollView]; - - // What is the current offset? - CGFloat velocityAlongAxis = isHorizontal ? velocity.x : velocity.y; - CGFloat targetContentOffsetAlongAxis = isHorizontal ? targetContentOffset->x : targetContentOffset->y; - - // Offset based on desired alignment - CGFloat frameLength = isHorizontal ? self.frame.size.width : self.frame.size.height; - CGFloat alignmentOffset = 0.0f; - if ([self.snapToAlignment isEqualToString: @"center"]) { - alignmentOffset = (frameLength * 0.5f) + (snapToIntervalF * 0.5f); - } else if ([self.snapToAlignment isEqualToString: @"end"]) { - alignmentOffset = frameLength; - } - - // Pick snap point based on direction and proximity - CGFloat fractionalIndex = (targetContentOffsetAlongAxis + alignmentOffset) / snapToIntervalF; - NSInteger snapIndex = - velocityAlongAxis > 0.0 ? - ceil(fractionalIndex) : - velocityAlongAxis < 0.0 ? - floor(fractionalIndex) : - round(fractionalIndex); - CGFloat newTargetContentOffset = (snapIndex * snapToIntervalF) - alignmentOffset; - - // Set new targetContentOffset - if (isHorizontal) { - targetContentOffset->x = newTargetContentOffset; - } else { - targetContentOffset->y = newTargetContentOffset; - } - } - - NSDictionary *userData = @{ - @"velocity": @{ - @"x": @(velocity.x), - @"y": @(velocity.y) - }, - @"targetContentOffset": @{ - @"x": @(targetContentOffset->x), - @"y": @(targetContentOffset->y) - } - }; - RCT_SEND_SCROLL_EVENT(onScrollEndDrag, userData); - RCT_FORWARD_SCROLL_EVENT(scrollViewWillEndDragging:scrollView withVelocity:velocity targetContentOffset:targetContentOffset); -} - -- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate -{ - RCT_FORWARD_SCROLL_EVENT(scrollViewDidEndDragging:scrollView willDecelerate:decelerate); -} - -- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view -{ - RCT_SEND_SCROLL_EVENT(onScrollBeginDrag, nil); - RCT_FORWARD_SCROLL_EVENT(scrollViewWillBeginZooming:scrollView withView:view); -} - -- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale -{ - RCT_SEND_SCROLL_EVENT(onScrollEndDrag, nil); - RCT_FORWARD_SCROLL_EVENT(scrollViewDidEndZooming:scrollView withView:view atScale:scale); -} - -- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView -{ - // Fire a final scroll event - _allowNextScrollNoMatterWhat = YES; - [self scrollViewDidScroll:scrollView]; - - // Fire the end deceleration event - RCT_SEND_SCROLL_EVENT(onMomentumScrollEnd, nil); - RCT_FORWARD_SCROLL_EVENT(scrollViewDidEndDecelerating:scrollView); -} - -- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView -{ - // Fire a final scroll event - _allowNextScrollNoMatterWhat = YES; - [self scrollViewDidScroll:scrollView]; - - // Fire the end deceleration event - RCT_SEND_SCROLL_EVENT(onMomentumScrollEnd, nil); - RCT_FORWARD_SCROLL_EVENT(scrollViewDidEndScrollingAnimation:scrollView); -} - -- (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView -{ - for (NSObject *scrollListener in _scrollListeners) { - if ([scrollListener respondsToSelector:_cmd] && - ![scrollListener scrollViewShouldScrollToTop:scrollView]) { - return NO; - } - } - return YES; -} - -- (UIView *)viewForZoomingInScrollView:(__unused UIScrollView *)scrollView -{ - return _contentView; -} - -#pragma mark - Setters - -- (CGSize)_calculateViewportSize -{ - CGSize viewportSize = self.bounds.size; - if (_automaticallyAdjustContentInsets) { - UIEdgeInsets contentInsets = [RCTView contentInsetsForView:self]; - viewportSize = CGSizeMake(self.bounds.size.width - contentInsets.left - contentInsets.right, - self.bounds.size.height - contentInsets.top - contentInsets.bottom); - } - return viewportSize; -} - -- (CGPoint)calculateOffsetForContentSize:(CGSize)newContentSize -{ - CGPoint oldOffset = _scrollView.contentOffset; - CGPoint newOffset = oldOffset; - - CGSize oldContentSize = _scrollView.contentSize; - CGSize viewportSize = [self _calculateViewportSize]; - - BOOL fitsinViewportY = oldContentSize.height <= viewportSize.height && newContentSize.height <= viewportSize.height; - if (newContentSize.height < oldContentSize.height && !fitsinViewportY) { - CGFloat offsetHeight = oldOffset.y + viewportSize.height; - if (oldOffset.y < 0) { - // overscrolled on top, leave offset alone - } else if (offsetHeight > oldContentSize.height) { - // overscrolled on the bottom, preserve overscroll amount - newOffset.y = MAX(0, oldOffset.y - (oldContentSize.height - newContentSize.height)); - } else if (offsetHeight > newContentSize.height) { - // offset falls outside of bounds, scroll back to end of list - newOffset.y = MAX(0, newContentSize.height - viewportSize.height); - } - } - - BOOL fitsinViewportX = oldContentSize.width <= viewportSize.width && newContentSize.width <= viewportSize.width; - if (newContentSize.width < oldContentSize.width && !fitsinViewportX) { - CGFloat offsetHeight = oldOffset.x + viewportSize.width; - if (oldOffset.x < 0) { - // overscrolled at the beginning, leave offset alone - } else if (offsetHeight > oldContentSize.width && newContentSize.width > viewportSize.width) { - // overscrolled at the end, preserve overscroll amount as much as possible - newOffset.x = MAX(0, oldOffset.x - (oldContentSize.width - newContentSize.width)); - } else if (offsetHeight > newContentSize.width) { - // offset falls outside of bounds, scroll back to end - newOffset.x = MAX(0, newContentSize.width - viewportSize.width); - } - } - - // all other cases, offset doesn't change - return newOffset; -} - -/** - * Once you set the `contentSize`, to a nonzero value, it is assumed to be - * managed by you, and we'll never automatically compute the size for you, - * unless you manually reset it back to {0, 0} - */ -- (CGSize)contentSize -{ - if (!CGSizeEqualToSize(_contentSize, CGSizeZero)) { - return _contentSize; - } - - return _contentView.frame.size; -} - -- (void)updateContentOffsetIfNeeded -{ - CGSize contentSize = self.contentSize; - if (!CGSizeEqualToSize(_scrollView.contentSize, contentSize)) { - // When contentSize is set manually, ScrollView internals will reset - // contentOffset to {0, 0}. Since we potentially set contentSize whenever - // anything in the ScrollView updates, we workaround this issue by manually - // adjusting contentOffset whenever this happens - CGPoint newOffset = [self calculateOffsetForContentSize:contentSize]; - _scrollView.contentSize = contentSize; - _scrollView.contentOffset = newOffset; - } -} - -// maintainVisibleContentPosition is used to allow seamless loading of content from both ends of -// the scrollview without the visible content jumping in position. -- (void)setMaintainVisibleContentPosition:(NSDictionary *)maintainVisibleContentPosition -{ - if (maintainVisibleContentPosition != nil && _maintainVisibleContentPosition == nil) { - [_eventDispatcher.bridge.uiManager.observerCoordinator addObserver:self]; - } else if (maintainVisibleContentPosition == nil && _maintainVisibleContentPosition != nil) { - [_eventDispatcher.bridge.uiManager.observerCoordinator removeObserver:self]; - } - _maintainVisibleContentPosition = maintainVisibleContentPosition; -} - -#pragma mark - RCTUIManagerObserver - -- (void)uiManagerWillPerformMounting:(RCTUIManager *)manager -{ - RCTAssertUIManagerQueue(); - [manager prependUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { - BOOL horz = [self isHorizontal:self->_scrollView]; - NSUInteger minIdx = [self->_maintainVisibleContentPosition[@"minIndexForVisible"] integerValue]; - for (NSUInteger ii = minIdx; ii < self->_contentView.subviews.count; ++ii) { - // Find the first entirely visible view. This must be done after we update the content offset - // or it will tend to grab rows that were made visible by the shift in position - UIView *subview = self->_contentView.subviews[ii]; - if ((horz - ? subview.frame.origin.x >= self->_scrollView.contentOffset.x - : subview.frame.origin.y >= self->_scrollView.contentOffset.y) || - ii == self->_contentView.subviews.count - 1) { - self->_prevFirstVisibleFrame = subview.frame; - self->_firstVisibleView = subview; - break; - } - } - }]; - [manager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { - if (self->_maintainVisibleContentPosition == nil) { - return; // The prop might have changed in the previous UIBlocks, so need to abort here. - } - NSNumber *autoscrollThreshold = self->_maintainVisibleContentPosition[@"autoscrollToTopThreshold"]; - // TODO: detect and handle/ignore re-ordering - if ([self isHorizontal:self->_scrollView]) { - CGFloat deltaX = self->_firstVisibleView.frame.origin.x - self->_prevFirstVisibleFrame.origin.x; - if (ABS(deltaX) > 0.1) { - self->_scrollView.contentOffset = CGPointMake( - self->_scrollView.contentOffset.x + deltaX, - self->_scrollView.contentOffset.y - ); - if (autoscrollThreshold != nil) { - // If the offset WAS within the threshold of the start, animate to the start. - if (self->_scrollView.contentOffset.x - deltaX <= [autoscrollThreshold integerValue]) { - [self scrollToOffset:CGPointMake(0, self->_scrollView.contentOffset.y) animated:YES]; - } - } - } - } else { - CGRect newFrame = self->_firstVisibleView.frame; - CGFloat deltaY = newFrame.origin.y - self->_prevFirstVisibleFrame.origin.y; - if (ABS(deltaY) > 0.1) { - self->_scrollView.contentOffset = CGPointMake( - self->_scrollView.contentOffset.x, - self->_scrollView.contentOffset.y + deltaY - ); - if (autoscrollThreshold != nil) { - // If the offset WAS within the threshold of the start, animate to the start. - if (self->_scrollView.contentOffset.y - deltaY <= [autoscrollThreshold integerValue]) { - [self scrollToOffset:CGPointMake(self->_scrollView.contentOffset.x, 0) animated:YES]; - } - } - } - } - }]; -} - -// Note: setting several properties of UIScrollView has the effect of -// resetting its contentOffset to {0, 0}. To prevent this, we generate -// setters here that will record the contentOffset beforehand, and -// restore it after the property has been set. - -#define RCT_SET_AND_PRESERVE_OFFSET(setter, getter, type) \ -- (void)setter:(type)value \ -{ \ - CGPoint contentOffset = _scrollView.contentOffset; \ - [_scrollView setter:value]; \ - _scrollView.contentOffset = contentOffset; \ -} \ -- (type)getter \ -{ \ - return [_scrollView getter]; \ -} - -RCT_SET_AND_PRESERVE_OFFSET(setAlwaysBounceHorizontal, alwaysBounceHorizontal, BOOL) -RCT_SET_AND_PRESERVE_OFFSET(setAlwaysBounceVertical, alwaysBounceVertical, BOOL) -RCT_SET_AND_PRESERVE_OFFSET(setBounces, bounces, BOOL) -RCT_SET_AND_PRESERVE_OFFSET(setBouncesZoom, bouncesZoom, BOOL) -RCT_SET_AND_PRESERVE_OFFSET(setCanCancelContentTouches, canCancelContentTouches, BOOL) -RCT_SET_AND_PRESERVE_OFFSET(setDecelerationRate, decelerationRate, CGFloat) -RCT_SET_AND_PRESERVE_OFFSET(setDirectionalLockEnabled, isDirectionalLockEnabled, BOOL) -RCT_SET_AND_PRESERVE_OFFSET(setIndicatorStyle, indicatorStyle, UIScrollViewIndicatorStyle) -RCT_SET_AND_PRESERVE_OFFSET(setKeyboardDismissMode, keyboardDismissMode, UIScrollViewKeyboardDismissMode) -RCT_SET_AND_PRESERVE_OFFSET(setMaximumZoomScale, maximumZoomScale, CGFloat) -RCT_SET_AND_PRESERVE_OFFSET(setMinimumZoomScale, minimumZoomScale, CGFloat) -RCT_SET_AND_PRESERVE_OFFSET(setScrollEnabled, isScrollEnabled, BOOL) -#if !TARGET_OS_TV -RCT_SET_AND_PRESERVE_OFFSET(setPagingEnabled, isPagingEnabled, BOOL) -RCT_SET_AND_PRESERVE_OFFSET(setScrollsToTop, scrollsToTop, BOOL) -#endif -RCT_SET_AND_PRESERVE_OFFSET(setShowsHorizontalScrollIndicator, showsHorizontalScrollIndicator, BOOL) -RCT_SET_AND_PRESERVE_OFFSET(setShowsVerticalScrollIndicator, showsVerticalScrollIndicator, BOOL) -RCT_SET_AND_PRESERVE_OFFSET(setZoomScale, zoomScale, CGFloat); -RCT_SET_AND_PRESERVE_OFFSET(setScrollIndicatorInsets, scrollIndicatorInsets, UIEdgeInsets); - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ -- (void)setContentInsetAdjustmentBehavior:(UIScrollViewContentInsetAdjustmentBehavior)behavior -{ - // `contentInsetAdjustmentBehavior` is available since iOS 11. - if ([_scrollView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) { - CGPoint contentOffset = _scrollView.contentOffset; - if (@available(iOS 11.0, *)) { - _scrollView.contentInsetAdjustmentBehavior = behavior; - } - _scrollView.contentOffset = contentOffset; - } -} -#endif - -- (void)sendScrollEventWithName:(NSString *)eventName - scrollView:(UIScrollView *)scrollView - userData:(NSDictionary *)userData -{ - if (![_lastEmittedEventName isEqualToString:eventName]) { - _coalescingKey++; - _lastEmittedEventName = [eventName copy]; - } - RCTScrollEvent *scrollEvent = [[RCTScrollEvent alloc] initWithEventName:eventName - reactTag:self.reactTag - scrollViewContentOffset:scrollView.contentOffset - scrollViewContentInset:scrollView.contentInset - scrollViewContentSize:scrollView.contentSize - scrollViewFrame:scrollView.frame - scrollViewZoomScale:scrollView.zoomScale - userData:userData - coalescingKey:_coalescingKey]; - [_eventDispatcher sendEvent:scrollEvent]; -} - -@end - -@implementation RCTEventDispatcher (RCTScrollView) - -- (void)sendFakeScrollEvent:(NSNumber *)reactTag -{ - // Use the selector here in case the onScroll block property is ever renamed - NSString *eventName = NSStringFromSelector(@selector(onScroll)); - RCTScrollEvent *fakeScrollEvent = [[RCTScrollEvent alloc] initWithEventName:eventName - reactTag:reactTag - scrollViewContentOffset:CGPointZero - scrollViewContentInset:UIEdgeInsetsZero - scrollViewContentSize:CGSizeZero - scrollViewFrame:CGRectZero - scrollViewZoomScale:0 - userData:nil - coalescingKey:0]; - [self sendEvent:fakeScrollEvent]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollViewManager.h deleted file mode 100644 index 5912c894..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollViewManager.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -@interface RCTConvert (UIScrollView) - -+ (UIScrollViewKeyboardDismissMode)UIScrollViewKeyboardDismissMode:(id)json; - -@end - -@interface RCTScrollViewManager : RCTViewManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollViewManager.m deleted file mode 100644 index a9714f8d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollViewManager.m +++ /dev/null @@ -1,213 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTScrollViewManager.h" - -#import "RCTBridge.h" -#import "RCTScrollView.h" -#import "RCTShadowView.h" -#import "RCTUIManager.h" - -@interface RCTScrollView (Private) - -- (NSArray *)calculateChildFramesData; - -@end - -@implementation RCTConvert (UIScrollView) - -RCT_ENUM_CONVERTER(UIScrollViewKeyboardDismissMode, (@{ - @"none": @(UIScrollViewKeyboardDismissModeNone), - @"on-drag": @(UIScrollViewKeyboardDismissModeOnDrag), - @"interactive": @(UIScrollViewKeyboardDismissModeInteractive), - // Backwards compatibility - @"onDrag": @(UIScrollViewKeyboardDismissModeOnDrag), -}), UIScrollViewKeyboardDismissModeNone, integerValue) - -RCT_ENUM_CONVERTER(UIScrollViewIndicatorStyle, (@{ - @"default": @(UIScrollViewIndicatorStyleDefault), - @"black": @(UIScrollViewIndicatorStyleBlack), - @"white": @(UIScrollViewIndicatorStyleWhite), -}), UIScrollViewIndicatorStyleDefault, integerValue) - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ -RCT_ENUM_CONVERTER(UIScrollViewContentInsetAdjustmentBehavior, (@{ - @"automatic": @(UIScrollViewContentInsetAdjustmentAutomatic), - @"scrollableAxes": @(UIScrollViewContentInsetAdjustmentScrollableAxes), - @"never": @(UIScrollViewContentInsetAdjustmentNever), - @"always": @(UIScrollViewContentInsetAdjustmentAlways), -}), UIScrollViewContentInsetAdjustmentNever, integerValue) -#endif - -@end - -@implementation RCTScrollViewManager - -RCT_EXPORT_MODULE() - -- (UIView *)view -{ - return [[RCTScrollView alloc] initWithEventDispatcher:self.bridge.eventDispatcher]; -} - -RCT_EXPORT_VIEW_PROPERTY(alwaysBounceHorizontal, BOOL) -RCT_EXPORT_VIEW_PROPERTY(alwaysBounceVertical, BOOL) -RCT_EXPORT_VIEW_PROPERTY(bounces, BOOL) -RCT_EXPORT_VIEW_PROPERTY(bouncesZoom, BOOL) -RCT_EXPORT_VIEW_PROPERTY(canCancelContentTouches, BOOL) -RCT_EXPORT_VIEW_PROPERTY(centerContent, BOOL) -RCT_EXPORT_VIEW_PROPERTY(maintainVisibleContentPosition, NSDictionary) -RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustContentInsets, BOOL) -RCT_EXPORT_VIEW_PROPERTY(decelerationRate, CGFloat) -RCT_EXPORT_VIEW_PROPERTY(directionalLockEnabled, BOOL) -RCT_EXPORT_VIEW_PROPERTY(indicatorStyle, UIScrollViewIndicatorStyle) -RCT_EXPORT_VIEW_PROPERTY(keyboardDismissMode, UIScrollViewKeyboardDismissMode) -RCT_EXPORT_VIEW_PROPERTY(maximumZoomScale, CGFloat) -RCT_EXPORT_VIEW_PROPERTY(minimumZoomScale, CGFloat) -RCT_EXPORT_VIEW_PROPERTY(scrollEnabled, BOOL) -#if !TARGET_OS_TV -RCT_EXPORT_VIEW_PROPERTY(pagingEnabled, BOOL) -RCT_REMAP_VIEW_PROPERTY(pinchGestureEnabled, scrollView.pinchGestureEnabled, BOOL) -RCT_EXPORT_VIEW_PROPERTY(scrollsToTop, BOOL) -#endif -RCT_EXPORT_VIEW_PROPERTY(showsHorizontalScrollIndicator, BOOL) -RCT_EXPORT_VIEW_PROPERTY(showsVerticalScrollIndicator, BOOL) -RCT_EXPORT_VIEW_PROPERTY(scrollEventThrottle, NSTimeInterval) -RCT_EXPORT_VIEW_PROPERTY(zoomScale, CGFloat) -RCT_EXPORT_VIEW_PROPERTY(contentInset, UIEdgeInsets) -RCT_EXPORT_VIEW_PROPERTY(scrollIndicatorInsets, UIEdgeInsets) -RCT_EXPORT_VIEW_PROPERTY(scrollToOverflowEnabled, BOOL) -RCT_EXPORT_VIEW_PROPERTY(snapToInterval, int) -RCT_EXPORT_VIEW_PROPERTY(snapToOffsets, NSArray) -RCT_EXPORT_VIEW_PROPERTY(snapToStart, BOOL) -RCT_EXPORT_VIEW_PROPERTY(snapToEnd, BOOL) -RCT_EXPORT_VIEW_PROPERTY(snapToAlignment, NSString) -RCT_REMAP_VIEW_PROPERTY(contentOffset, scrollView.contentOffset, CGPoint) -RCT_EXPORT_VIEW_PROPERTY(onScrollBeginDrag, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onScroll, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onScrollToTop, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onScrollEndDrag, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onMomentumScrollBegin, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onMomentumScrollEnd, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(DEPRECATED_sendUpdatedChildFrames, BOOL) -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ -RCT_EXPORT_VIEW_PROPERTY(contentInsetAdjustmentBehavior, UIScrollViewContentInsetAdjustmentBehavior) -#endif - -// overflow is used both in css-layout as well as by react-native. In css-layout -// we always want to treat overflow as scroll but depending on what the overflow -// is set to from js we want to clip drawing or not. This piece of code ensures -// that css-layout is always treating the contents of a scroll container as -// overflow: 'scroll'. -RCT_CUSTOM_SHADOW_PROPERTY(overflow, YGOverflow, RCTShadowView) { -#pragma unused (json) - view.overflow = YGOverflowScroll; -} - -RCT_EXPORT_METHOD(getContentSize:(nonnull NSNumber *)reactTag - callback:(RCTResponseSenderBlock)callback) -{ - [self.bridge.uiManager addUIBlock: - ^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - - RCTScrollView *view = viewRegistry[reactTag]; - if (!view || ![view isKindOfClass:[RCTScrollView class]]) { - RCTLogError(@"Cannot find RCTScrollView with tag #%@", reactTag); - return; - } - - CGSize size = view.scrollView.contentSize; - callback(@[@{ - @"width" : @(size.width), - @"height" : @(size.height) - }]); - }]; -} - -RCT_EXPORT_METHOD(calculateChildFrames:(nonnull NSNumber *)reactTag - callback:(RCTResponseSenderBlock)callback) -{ - [self.bridge.uiManager addUIBlock: - ^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { - - RCTScrollView *view = viewRegistry[reactTag]; - if (!view || ![view isKindOfClass:[RCTScrollView class]]) { - RCTLogError(@"Cannot find RCTScrollView with tag #%@", reactTag); - return; - } - - NSArray *childFrames = [view calculateChildFramesData]; - if (childFrames) { - callback(@[childFrames]); - } - }]; -} - -RCT_EXPORT_METHOD(scrollTo:(nonnull NSNumber *)reactTag - offsetX:(CGFloat)x - offsetY:(CGFloat)y - animated:(BOOL)animated) -{ - [self.bridge.uiManager addUIBlock: - ^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry){ - UIView *view = viewRegistry[reactTag]; - if ([view conformsToProtocol:@protocol(RCTScrollableProtocol)]) { - [(id)view scrollToOffset:(CGPoint){x, y} animated:animated]; - } else { - RCTLogError(@"tried to scrollTo: on non-RCTScrollableProtocol view %@ " - "with tag #%@", view, reactTag); - } - }]; -} - -RCT_EXPORT_METHOD(scrollToEnd:(nonnull NSNumber *)reactTag - animated:(BOOL)animated) -{ - [self.bridge.uiManager addUIBlock: - ^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry){ - UIView *view = viewRegistry[reactTag]; - if ([view conformsToProtocol:@protocol(RCTScrollableProtocol)]) { - [(id)view scrollToEnd:animated]; - } else { - RCTLogError(@"tried to scrollTo: on non-RCTScrollableProtocol view %@ " - "with tag #%@", view, reactTag); - } - }]; -} - -RCT_EXPORT_METHOD(zoomToRect:(nonnull NSNumber *)reactTag - withRect:(CGRect)rect - animated:(BOOL)animated) -{ - [self.bridge.uiManager addUIBlock: - ^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry){ - UIView *view = viewRegistry[reactTag]; - if ([view conformsToProtocol:@protocol(RCTScrollableProtocol)]) { - [(id)view zoomToRect:rect animated:animated]; - } else { - RCTLogError(@"tried to zoomToRect: on non-RCTScrollableProtocol view %@ " - "with tag #%@", view, reactTag); - } - }]; -} - -RCT_EXPORT_METHOD(flashScrollIndicators:(nonnull NSNumber *)reactTag) -{ - [self.bridge.uiManager addUIBlock: - ^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry){ - - RCTScrollView *view = viewRegistry[reactTag]; - if (!view || ![view isKindOfClass:[RCTScrollView class]]) { - RCTLogError(@"Cannot find RCTScrollView with tag #%@", reactTag); - return; - } - - [view.scrollView flashScrollIndicators]; - }]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollableProtocol.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollableProtocol.h deleted file mode 100644 index e7720c05..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/ScrollView/RCTScrollableProtocol.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -/** - * Contains any methods related to scrolling. Any `RCTView` that has scrolling - * features should implement these methods. - */ -@protocol RCTScrollableProtocol - -@property (nonatomic, readonly) CGSize contentSize; - -- (void)scrollToOffset:(CGPoint)offset; -- (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated; -/** - * If this is a vertical scroll view, scrolls to the bottom. - * If this is a horizontal scroll view, scrolls to the right. - */ -- (void)scrollToEnd:(BOOL)animated; -- (void)zoomToRect:(CGRect)rect animated:(BOOL)animated; - -- (void)addScrollListener:(NSObject *)scrollListener; -- (void)removeScrollListener:(NSObject *)scrollListener; - -@end - -/** - * Denotes a view which implements custom pull to refresh functionality. - */ -@protocol RCTCustomRefreshContolProtocol - -@property (nonatomic, copy) RCTDirectEventBlock onRefresh; -@property (nonatomic, readonly, getter=isRefreshing) BOOL refreshing; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/UIView+Private.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/UIView+Private.h deleted file mode 100644 index 6725e645..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/UIView+Private.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface UIView (Private) - -// remove clipped subviews implementation -- (void)react_remountAllSubviews; -- (void)react_updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(UIView *)clipView; -- (UIView *)react_findClipView; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/UIView+React.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/UIView+React.h deleted file mode 100644 index b6c4feb2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/UIView+React.h +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -@class RCTShadowView; - -@interface UIView (React) - -/** - * RCTComponent interface. - */ -- (NSArray *)reactSubviews NS_REQUIRES_SUPER; -- (UIView *)reactSuperview NS_REQUIRES_SUPER; -- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex NS_REQUIRES_SUPER; -- (void)removeReactSubview:(UIView *)subview NS_REQUIRES_SUPER; - -/** - * The native id of the view, used to locate view from native codes - */ -@property (nonatomic, copy) NSString *nativeID; - -/** - * Determines whether or not a view should ignore inverted colors or not. Used to set - * UIView property accessibilityIgnoresInvertColors in iOS 11+. - */ -@property (nonatomic, assign) BOOL shouldAccessibilityIgnoresInvertColors; - -/** - * Layout direction of the view. - * Internally backed to `semanticContentAttribute` property. - * Defaults to `LeftToRight` in case of ambiguity. - */ -@property (nonatomic, assign) UIUserInterfaceLayoutDirection reactLayoutDirection; - -/** - * Yoga `display` style property. Can be `flex` or `none`. - * Defaults to `flex`. - * May be used to temporary hide the view in a very efficient way. - */ -@property (nonatomic, assign) YGDisplay reactDisplay; - -/** - * The z-index of the view. - */ -@property (nonatomic, assign) NSInteger reactZIndex; - -/** - * Subviews sorted by z-index. Note that this method doesn't do any caching (yet) - * and sorts all the views each call. - */ -- (NSArray *)reactZIndexSortedSubviews; - -/** - * Updates the subviews array based on the reactSubviews. Default behavior is - * to insert the sortedReactSubviews into the UIView. - */ -- (void)didUpdateReactSubviews; - -/** - * Called each time props have been set. - * The default implementation does nothing. - */ -- (void)didSetProps:(NSArray *)changedProps; - -/** - * Used by the UIIManager to set the view frame. - * May be overriden to disable animation, etc. - */ -- (void)reactSetFrame:(CGRect)frame; - -/** - * This method finds and returns the containing view controller for the view. - */ -- (UIViewController *)reactViewController; - -/** - * This method attaches the specified controller as a child of the - * the owning view controller of this view. Returns NO if no view - * controller is found (which may happen if the view is not currently - * attached to the view hierarchy). - */ -- (void)reactAddControllerToClosestParent:(UIViewController *)controller; - -/** - * Focus manipulation. - */ -- (void)reactFocus; -- (void)reactFocusIfNeeded; -- (void)reactBlur; - -/** - * Useful properties for computing layout. - */ -@property (nonatomic, readonly) UIEdgeInsets reactBorderInsets; -@property (nonatomic, readonly) UIEdgeInsets reactPaddingInsets; -@property (nonatomic, readonly) UIEdgeInsets reactCompoundInsets; -@property (nonatomic, readonly) CGRect reactContentFrame; - -/** - * The (sub)view which represents this view in terms of accessibility. - * ViewManager will apply all accessibility properties directly to this view. - * May be overriten in view subclass which needs to be accessiblitywise - * transparent in favour of some subview. - * Defaults to `self`. - */ -@property (nonatomic, readonly) UIView *reactAccessibilityElement; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/UIView+React.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/UIView+React.m deleted file mode 100644 index 0afeed12..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/Views/UIView+React.m +++ /dev/null @@ -1,300 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "UIView+React.h" - -#import - -#import "RCTAssert.h" -#import "RCTLog.h" -#import "RCTShadowView.h" - -@implementation UIView (React) - -- (NSNumber *)reactTag -{ - return objc_getAssociatedObject(self, _cmd); -} - -- (void)setReactTag:(NSNumber *)reactTag -{ - objc_setAssociatedObject(self, @selector(reactTag), reactTag, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -- (NSNumber *)nativeID -{ - return objc_getAssociatedObject(self, _cmd); -} - -- (void)setNativeID:(NSNumber *)nativeID -{ - objc_setAssociatedObject(self, @selector(nativeID), nativeID, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -- (BOOL)shouldAccessibilityIgnoresInvertColors -{ -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ - if (@available(iOS 11.0, *)) { - return self.accessibilityIgnoresInvertColors; - } -#endif - return NO; -} - -- (void)setShouldAccessibilityIgnoresInvertColors:(BOOL)shouldAccessibilityIgnoresInvertColors -{ -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ - if (@available(iOS 11.0, *)) { - self.accessibilityIgnoresInvertColors = shouldAccessibilityIgnoresInvertColors; - } -#endif -} - -- (BOOL)isReactRootView -{ - return RCTIsReactRootView(self.reactTag); -} - -- (NSNumber *)reactTagAtPoint:(CGPoint)point -{ - UIView *view = [self hitTest:point withEvent:nil]; - while (view && !view.reactTag) { - view = view.superview; - } - return view.reactTag; -} - -- (NSArray *)reactSubviews -{ - return objc_getAssociatedObject(self, _cmd); -} - -- (UIView *)reactSuperview -{ - return self.superview; -} - -- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex -{ - // We access the associated object directly here in case someone overrides - // the `reactSubviews` getter method and returns an immutable array. - NSMutableArray *subviews = objc_getAssociatedObject(self, @selector(reactSubviews)); - if (!subviews) { - subviews = [NSMutableArray new]; - objc_setAssociatedObject(self, @selector(reactSubviews), subviews, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - } - [subviews insertObject:subview atIndex:atIndex]; -} - -- (void)removeReactSubview:(UIView *)subview -{ - // We access the associated object directly here in case someone overrides - // the `reactSubviews` getter method and returns an immutable array. - NSMutableArray *subviews = objc_getAssociatedObject(self, @selector(reactSubviews)); - [subviews removeObject:subview]; - [subview removeFromSuperview]; -} - -#pragma mark - Display - -- (YGDisplay)reactDisplay -{ - return self.isHidden ? YGDisplayNone : YGDisplayFlex; -} - -- (void)setReactDisplay:(YGDisplay)display -{ - self.hidden = display == YGDisplayNone; -} - -#pragma mark - Layout Direction - -- (UIUserInterfaceLayoutDirection)reactLayoutDirection -{ - if ([self respondsToSelector:@selector(semanticContentAttribute)]) { - return [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.semanticContentAttribute]; - } else { - return [objc_getAssociatedObject(self, @selector(reactLayoutDirection)) integerValue]; - } -} - -- (void)setReactLayoutDirection:(UIUserInterfaceLayoutDirection)layoutDirection -{ - if ([self respondsToSelector:@selector(setSemanticContentAttribute:)]) { - self.semanticContentAttribute = - layoutDirection == UIUserInterfaceLayoutDirectionLeftToRight ? - UISemanticContentAttributeForceLeftToRight : - UISemanticContentAttributeForceRightToLeft; - } else { - objc_setAssociatedObject(self, @selector(reactLayoutDirection), @(layoutDirection), OBJC_ASSOCIATION_RETAIN_NONATOMIC); - } -} - -#pragma mark - zIndex - -- (NSInteger)reactZIndex -{ - return self.layer.zPosition; -} - -- (void)setReactZIndex:(NSInteger)reactZIndex -{ - self.layer.zPosition = reactZIndex; -} - -- (NSArray *)reactZIndexSortedSubviews -{ - // Check if sorting is required - in most cases it won't be. - BOOL sortingRequired = NO; - for (UIView *subview in self.subviews) { - if (subview.reactZIndex != 0) { - sortingRequired = YES; - break; - } - } - return sortingRequired ? [self.reactSubviews sortedArrayUsingComparator:^NSComparisonResult(UIView *a, UIView *b) { - if (a.reactZIndex > b.reactZIndex) { - return NSOrderedDescending; - } else { - // Ensure sorting is stable by treating equal zIndex as ascending so - // that original order is preserved. - return NSOrderedAscending; - } - }] : self.subviews; -} - -- (void)didUpdateReactSubviews -{ - for (UIView *subview in self.reactSubviews) { - [self addSubview:subview]; - } -} - -- (void)didSetProps:(__unused NSArray *)changedProps -{ - // The default implementation does nothing. -} - -- (void)reactSetFrame:(CGRect)frame -{ - // These frames are in terms of anchorPoint = topLeft, but internally the - // views are anchorPoint = center for easier scale and rotation animations. - // Convert the frame so it works with anchorPoint = center. - CGPoint position = {CGRectGetMidX(frame), CGRectGetMidY(frame)}; - CGRect bounds = {CGPointZero, frame.size}; - - // Avoid crashes due to nan coords - if (isnan(position.x) || isnan(position.y) || - isnan(bounds.origin.x) || isnan(bounds.origin.y) || - isnan(bounds.size.width) || isnan(bounds.size.height)) { - RCTLogError(@"Invalid layout for (%@)%@. position: %@. bounds: %@", - self.reactTag, self, NSStringFromCGPoint(position), NSStringFromCGRect(bounds)); - return; - } - - self.center = position; - self.bounds = bounds; -} - -- (UIViewController *)reactViewController -{ - id responder = [self nextResponder]; - while (responder) { - if ([responder isKindOfClass:[UIViewController class]]) { - return responder; - } - responder = [responder nextResponder]; - } - return nil; -} - -- (void)reactAddControllerToClosestParent:(UIViewController *)controller -{ - if (!controller.parentViewController) { - UIView *parentView = (UIView *)self.reactSuperview; - while (parentView) { - if (parentView.reactViewController) { - [parentView.reactViewController addChildViewController:controller]; - [controller didMoveToParentViewController:parentView.reactViewController]; - break; - } - parentView = (UIView *)parentView.reactSuperview; - } - return; - } -} - -/** - * Focus manipulation. - */ -- (BOOL)reactIsFocusNeeded -{ - return [(NSNumber *)objc_getAssociatedObject(self, @selector(reactIsFocusNeeded)) boolValue]; -} - -- (void)setReactIsFocusNeeded:(BOOL)isFocusNeeded -{ - objc_setAssociatedObject(self, @selector(reactIsFocusNeeded), @(isFocusNeeded), OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -- (void)reactFocus { - if (![self becomeFirstResponder]) { - self.reactIsFocusNeeded = YES; - } -} - -- (void)reactFocusIfNeeded { - if (self.reactIsFocusNeeded) { - if ([self becomeFirstResponder]) { - self.reactIsFocusNeeded = NO; - } - } -} - -- (void)reactBlur { - [self resignFirstResponder]; -} - -#pragma mark - Layout - -- (UIEdgeInsets)reactBorderInsets -{ - CGFloat borderWidth = self.layer.borderWidth; - return UIEdgeInsetsMake(borderWidth, borderWidth, borderWidth, borderWidth); -} - -- (UIEdgeInsets)reactPaddingInsets -{ - return UIEdgeInsetsZero; -} - -- (UIEdgeInsets)reactCompoundInsets -{ - UIEdgeInsets borderInsets = self.reactBorderInsets; - UIEdgeInsets paddingInsets = self.reactPaddingInsets; - - return UIEdgeInsetsMake( - borderInsets.top + paddingInsets.top, - borderInsets.left + paddingInsets.left, - borderInsets.bottom + paddingInsets.bottom, - borderInsets.right + paddingInsets.right - ); -} - -- (CGRect)reactContentFrame -{ - return UIEdgeInsetsInsetRect(self.bounds, self.reactCompoundInsets); -} - -#pragma mark - Accessiblity - -- (UIView *)reactAccessibilityElement -{ - return self; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/third-party.xcconfig b/ios/ElectrodeApiImpl/Libraries/ReactNative/React/third-party.xcconfig deleted file mode 100644 index 3ce55a00..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/React/third-party.xcconfig +++ /dev/null @@ -1,12 +0,0 @@ -// -// folly.xcconfig -// CxxReact -// -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. -// - -HEADER_SEARCH_PATHS = $(SRCROOT)/../third-party/boost_1_63_0 $(SRCROOT)/../third-party/folly-2018.10.22.00 $(SRCROOT)/../third-party/glog-0.3.5/src -OTHER_CFLAGS = -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/BUCK deleted file mode 100644 index 65995e06..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/BUCK +++ /dev/null @@ -1,55 +0,0 @@ -load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load( - "//tools/build_defs/oss:rn_defs.bzl", - "ANDROID", - "APPLE", - "get_apple_compiler_flags", - "get_apple_inspector_flags", - "rn_xplat_cxx_library", - "subdir_glob", -) - -APPLE_COMPILER_FLAGS = get_apple_compiler_flags() - -rn_xplat_cxx_library( - name = "better", - srcs = glob( - ["**/*.cpp"], - exclude = glob(["tests/**/*.cpp"]), - ), - headers = glob( - ["**/*.h"], - exclude = glob(["tests/**/*.h"]), - ), - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "*.h"), - ], - prefix = "better", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - force_static = True, - macosx_tests_override = [], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - tests = [], - visibility = ["PUBLIC"], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//third-party/glog:glog", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/better.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/better.h deleted file mode 100644 index b2f3f61f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/better.h +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -namespace facebook { -namespace better { - -/* - * `Better` is a trivial collection of basic tools borrowed from other low-level - * general purpose libraries (like Folly, Abseil or Boost). The main goals of - * Better: - * - Make the codebase more portable; - * - Make the dependency list explicit (by decoupling it as a dependency list of - * Better); - * - Make relying on modern C++ patterns and tools in code simple and easy. - * - Make executing experiments with different dependencies easier. - * - * What should be part of Better and what should not? Should I add some piece of - * functionality in the Better? Here is a quick checklist. - * - * If one of the following is true, yes, go for it: - * - If some feature is already in some future C++ standard (possibly in draft - * stage) and it's already implemented in some 3rd party library. - * - If some standardized feature of C++ is implemented in the standard not in - * the most efficient way (because the standard enforces some tricky constraints - * (like always-valid iterators) which nobody uses and should use), but you have - * a library that does it right providing exact same interface. - * - * If one of the following is true, please do *NOT* do it (at least as part of - * the library): - * - You want to use some very fancy pattern that your favorite library (but - * nothing else) provides, and You want to make this pattern very command in the - * code base. Your hope is that this pattern will conquer the world and be - * a part of the C++ standard eventually. - * - You favorite library provides some general purpose container that 10x times - * faster than the standard one, so You want to use that in the code base. That - * container does not have compatible API though (because it's a clear trade-off - * with efficiency, of course). - */ - -/* - * Configuration - */ - -/* - * Enables using Folly containers instead of standard ones (such as map, vector, - * string, optional and etc.) - */ -#define BETTER_USE_FOLLY_CONTAINERS - -} // namespace better -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/map.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/map.h deleted file mode 100644 index 4b190195..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/map.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#ifdef BETTER_USE_FOLLY_CONTAINERS - -#include - -#else - -#include - -#endif - -namespace facebook { -namespace better { - -/* - * Note: In Better, `map` aliases to `unorderd_map` because everyone agrees that - * an *ordered* map is nonsense and was a huge mistake for standardization. If - * you need an *ordered* map, feel free to introduce that as - * `better::ordered_map`. - */ - -#ifdef BETTER_USE_FOLLY_CONTAINERS - -template -using map = folly::F14FastMap; - -#else - -template -using map = std::unordered_map; - -#endif - -} // namespace better -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/mutex.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/mutex.h deleted file mode 100644 index 327d2f14..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/mutex.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include - -namespace facebook { -namespace better { - -template -using shared_lock = std::shared_lock; - -template -using shared_mutex = folly::SharedMutex; - -} // namespace better -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/optional.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/optional.h deleted file mode 100644 index 7ed99e27..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/optional.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#ifdef BETTER_USE_FOLLY_CONTAINERS - -#include - -#else - -#include - -#endif - -namespace facebook { -namespace better { - -#ifdef BETTER_USE_FOLLY_CONTAINERS - -template -using optional = folly::Optional; - -#else - -template -using optional = std::optional; - -#endif - -} // namespace better -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/set.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/set.h deleted file mode 100644 index fd25392b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/set.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#ifdef BETTER_USE_FOLLY_CONTAINERS - -#include - -#else - -#include - -#endif - -namespace facebook { -namespace better { - -#ifdef BETTER_USE_FOLLY_CONTAINERS - -template -using set = folly::F14FastSet; - -#else - -template -using set = std::unordered_set; - -#endif - -} // namespace better -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/string.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/string.h deleted file mode 100644 index 1b8add7e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/string.h +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#ifdef BETTER_USE_FOLLY_CONTAINERS - -#include - -#else - -#include - -#endif - -namespace facebook { -namespace better { - -#ifdef BETTER_USE_FOLLY_CONTAINERS - -using string = folly::fbstring; - -#else - -using string = std::string; - -#endif - -} // namespace better -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/vector.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/vector.h deleted file mode 100644 index f5f13058..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/better/vector.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#ifdef BETTER_USE_FOLLY_CONTAINERS - -#include - -#else - -#include - -#endif - -namespace facebook { -namespace better { - -#ifdef BETTER_USE_FOLLY_CONTAINERS - -template -using vector = folly::fbvector; - -#else - -template -using vector = std::vector; - -#endif - -} // namespace better -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/config/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/config/BUCK deleted file mode 100644 index 97c6090b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/config/BUCK +++ /dev/null @@ -1,45 +0,0 @@ -load("@fbsource//tools/build_defs:default_platform_defs.bzl", "ANDROID", "APPLE") -load("@fbsource//tools/build_defs:glob_defs.bzl", "subdir_glob") -load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "flags", "get_debug_preprocessor_flags", "get_static_library_ios_flags") -load("@fbsource//tools/build_defs/oss:rn_defs.bzl", "get_apple_inspector_flags", "rn_xplat_cxx_library") - -APPLE_COMPILER_FLAGS = flags.get_flag_value( - get_static_library_ios_flags(), - "compiler_flags", -) - -rn_xplat_cxx_library( - name = "config", - srcs = glob(["**/*.cpp"]), - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "**/*.h"), - ], - prefix = "react/config", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - force_static = True, - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - visibility = [ - "PUBLIC", - ], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//third-party/glog:glog", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/config/ReactNativeConfig.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/config/ReactNativeConfig.cpp deleted file mode 100644 index 208705ed..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/config/ReactNativeConfig.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ReactNativeConfig.h" - -namespace facebook { -namespace react { - -/** - * ReactNative configuration as provided by the hosting app. - * Provide a sub-class implementation to allow app specific customization. - */ -ReactNativeConfig::ReactNativeConfig() {} - -ReactNativeConfig::~ReactNativeConfig() {} - -EmptyReactNativeConfig::EmptyReactNativeConfig() {} - -bool EmptyReactNativeConfig::getBool(const std::string ¶m) const { - return false; -} - -std::string EmptyReactNativeConfig::getString(const std::string ¶m) const { - return ""; -} - -int64_t EmptyReactNativeConfig::getInt64(const std::string ¶m) const { - return 0; -} - -double EmptyReactNativeConfig::getDouble(const std::string ¶m) const { - return 0.0; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/config/ReactNativeConfig.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/config/ReactNativeConfig.h deleted file mode 100644 index 922d2c12..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/config/ReactNativeConfig.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -namespace facebook { -namespace react { - -/** - * ReactNative configuration as provided by the hosting app. - * Provide a sub-class implementation to allow app specific customization. - */ -class ReactNativeConfig { -public: - ReactNativeConfig(); - virtual ~ReactNativeConfig(); - - virtual bool getBool(const std::string ¶m) const = 0; - virtual std::string getString(const std::string ¶m) const = 0; - virtual int64_t getInt64(const std::string ¶m) const = 0; - virtual double getDouble(const std::string ¶m) const = 0; -}; - -/** - * Empty configuration that will always provide "falsy" values. - */ -class EmptyReactNativeConfig : public ReactNativeConfig { -public: - EmptyReactNativeConfig(); - - bool getBool(const std::string ¶m) const override; - std::string getString(const std::string ¶m) const override; - int64_t getInt64(const std::string ¶m) const override; - double getDouble(const std::string ¶m) const override; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/Android.mk b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/Android.mk deleted file mode 100644 index cd234d41..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/Android.mk +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := reactnative - -LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) - -LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) - -LOCAL_CFLAGS := \ - -DLOG_TAG=\"ReactNative\" - -LOCAL_CFLAGS += -fexceptions -frtti -Wno-unused-lambda-capture - -LOCAL_STATIC_LIBRARIES := boost -LOCAL_SHARED_LIBRARIES := jsinspector libfolly_json glog - -include $(BUILD_STATIC_LIBRARY) - -$(call import-module,fb) -$(call import-module,folly) -$(call import-module,jsc) -$(call import-module,glog) -$(call import-module,jsinspector) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/BUCK deleted file mode 100644 index 929d766b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/BUCK +++ /dev/null @@ -1,150 +0,0 @@ -load("@fbsource//tools/build_defs:glob_defs.bzl", "subdir_glob") -load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "APPLE", "get_android_inspector_flags", "get_apple_compiler_flags", "get_apple_inspector_flags", "get_debug_preprocessor_flags", "react_native_xplat_target", "rn_xplat_cxx_library") - -CXX_LIBRARY_COMPILER_FLAGS = [ - "-std=c++14", - "-Wall", -] - -rn_xplat_cxx_library( - name = "module", - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "CxxModule.h"), - ("", "JsArgumentHelpers.h"), - ("", "JsArgumentHelpers-inl.h"), - ], - prefix = "cxxreact", - ), - compiler_flags = CXX_LIBRARY_COMPILER_FLAGS, - fbobjc_compiler_flags = get_apple_compiler_flags(), - force_static = True, - visibility = [ - "PUBLIC", - ], - deps = [ - "xplat//folly:molly", - ], -) - -rn_xplat_cxx_library( - name = "jsbigstring", - srcs = [ - "JSBigString.cpp", - ], - header_namespace = "", - exported_headers = subdir_glob( - [("", "JSBigString.h")], - prefix = "cxxreact", - ), - compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [ - "-fexceptions", - "-frtti", - ], - fbobjc_compiler_flags = get_apple_compiler_flags(), - force_static = True, - visibility = [ - "PUBLIC", - ], - deps = [ - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//folly:scope_guard", - ], -) - -rn_xplat_cxx_library( - name = "samplemodule", - srcs = ["SampleCxxModule.cpp"], - header_namespace = "", - exported_headers = ["SampleCxxModule.h"], - compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [ - "-fno-omit-frame-pointer", - "-fexceptions", - ], - fbobjc_compiler_flags = get_apple_compiler_flags(), - soname = "libxplat_react_module_samplemodule.$(ext)", - visibility = [ - "PUBLIC", - ], - deps = [ - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//third-party/glog:glog", - ":module", - ], -) - -CXXREACT_PUBLIC_HEADERS = [ - "CxxNativeModule.h", - "Instance.h", - "JSBundleType.h", - "JSDeltaBundleClient.h", - "JSExecutor.h", - "JSIndexedRAMBundle.h", - "JSModulesUnbundle.h", - "MessageQueueThread.h", - "MethodCall.h", - "ModuleRegistry.h", - "NativeModule.h", - "NativeToJsBridge.h", - "RAMBundleRegistry.h", - "ReactMarker.h", - "RecoverableError.h", - "SharedProxyCxxModule.h", - "SystraceSection.h", -] - -rn_xplat_cxx_library( - name = "bridge", - srcs = glob( - ["*.cpp"], - exclude = [ - "JSBigString.cpp", - "SampleCxxModule.cpp", - ], - ), - headers = glob( - ["*.h"], - exclude = CXXREACT_PUBLIC_HEADERS, - ), - header_namespace = "", - exported_headers = dict([ - ( - "cxxreact/%s" % header, - header, - ) - for header in CXXREACT_PUBLIC_HEADERS - ]), - compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [ - "-fexceptions", - "-frtti", - ], - fbandroid_preprocessor_flags = get_android_inspector_flags(), - fbobjc_compiler_flags = get_apple_compiler_flags(), - fbobjc_force_static = True, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - macosx_tests_override = [], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - tests = [ - react_native_xplat_target("cxxreact/tests:tests"), - ], - visibility = ["PUBLIC"], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - ":jsbigstring", - ":module", - react_native_xplat_target("jsinspector:jsinspector"), - react_native_xplat_target("microprofiler:microprofiler"), - "xplat//folly:optional", - "xplat//third-party/glog:glog", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/CxxModule.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/CxxModule.h deleted file mode 100644 index 5a4d330e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/CxxModule.h +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include -#include - -#include - -using namespace std::placeholders; - -namespace facebook { -namespace react { - -class Instance; - -}} - -namespace facebook { -namespace xplat { -namespace module { - -/** - * Base class for Catalyst native modules whose implementations are - * written in C++. Native methods are represented by instances of the - * Method struct. Generally, a derived class will manage an instance - * which represents the data for the module, and non-Catalyst-specific - * methods can be wrapped in lambdas which convert between - * folly::dynamic and native C++ objects. The Callback arguments will - * pass through to js functions passed to the analogous javascript - * methods. At most two callbacks will be converted. Results should - * be passed to the first callback, and errors to the second callback. - * Exceptions thrown by a method will be converted to platform - * exceptions, and handled however they are handled on that platform. - * (TODO mhorowitz #7128529: this exception behavior is not yet - * implemented.) - * - * There are two sets of constructors here. The first set initializes - * a Method using a name and anything convertible to a std::function. - * This is most useful for registering a lambda as a RN method. There - * are overloads to support functions which take no arguments, - * arguments only, and zero, one, or two callbacks. - * - * The second set of methods is similar, but instead of taking a - * function, takes the method name, an object, and a pointer to a - * method on that object. - */ - -class CxxModule { - class AsyncTagType {}; - class SyncTagType {}; - -public: - typedef std::function()> Provider; - - typedef std::function)> Callback; - - constexpr static AsyncTagType AsyncTag = AsyncTagType(); - constexpr static SyncTagType SyncTag = SyncTagType(); - - struct Method { - std::string name; - - size_t callbacks; - bool isPromise; - std::function func; - - std::function syncFunc; - - const char *getType() { - assert(func || syncFunc); - return func ? (isPromise ? "promise" : "async") : "sync"; - } - - // std::function/lambda ctors - - Method(std::string aname, - std::function&& afunc) - : name(std::move(aname)) - , callbacks(0) - , isPromise(false) - , func(std::bind(std::move(afunc))) {} - - Method(std::string aname, - std::function&& afunc) - : name(std::move(aname)) - , callbacks(0) - , isPromise(false) - , func(std::bind(std::move(afunc), std::placeholders::_1)) {} - - Method(std::string aname, - std::function&& afunc) - : name(std::move(aname)) - , callbacks(1) - , isPromise(false) - , func(std::bind(std::move(afunc), std::placeholders::_1, std::placeholders::_2)) {} - - Method(std::string aname, - std::function&& afunc) - : name(std::move(aname)) - , callbacks(2) - , isPromise(true) - , func(std::move(afunc)) {} - - Method(std::string aname, - std::function&& afunc, - AsyncTagType) - : name(std::move(aname)) - , callbacks(2) - , isPromise(false) - , func(std::move(afunc)) {} - - // method pointer ctors - - template - Method(std::string aname, T* t, void (T::*method)()) - : name(std::move(aname)) - , callbacks(0) - , isPromise(false) - , func(std::bind(method, t)) {} - - template - Method(std::string aname, T* t, void (T::*method)(folly::dynamic)) - : name(std::move(aname)) - , callbacks(0) - , isPromise(false) - , func(std::bind(method, t, std::placeholders::_1)) {} - - template - Method(std::string aname, T* t, void (T::*method)(folly::dynamic, Callback)) - : name(std::move(aname)) - , callbacks(1) - , isPromise(false) - , func(std::bind(method, t, std::placeholders::_1, std::placeholders::_2)) {} - - template - Method(std::string aname, T* t, void (T::*method)(folly::dynamic, Callback, Callback)) - : name(std::move(aname)) - , callbacks(2) - , isPromise(true) - , func(std::bind(method, t, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)) {} - - template - Method(std::string aname, - T* t, - void (T::*method)(folly::dynamic, Callback, Callback), - AsyncTagType) - : name(std::move(aname)) - , callbacks(2) - , isPromise(false) - , func(std::bind(method, t, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)) {} - - // sync std::function/lambda ctors - - // Overloads for functions returning void give ambiguity errors. - // I am not sure if this is a runtime/compiler bug, or a - // limitation I do not understand. - - Method(std::string aname, - std::function&& afunc, - SyncTagType) - : name(std::move(aname)) - , callbacks(0) - , isPromise(false) - , syncFunc([afunc=std::move(afunc)] (const folly::dynamic&) - { return afunc(); }) - {} - - Method(std::string aname, - std::function&& afunc, - SyncTagType) - : name(std::move(aname)) - , callbacks(0) - , isPromise(false) - , syncFunc(std::move(afunc)) - {} - }; - - /** - * This may block, if necessary to complete cleanup before the - * object is destroyed. - */ - virtual ~CxxModule() {} - - /** - * @return the name of this module. This will be the name used to {@code require()} this module - * from javascript. - */ - virtual std::string getName() = 0; - - /** - * Each entry in the map will be exported as a property to JS. The - * key is the property name, and the value can be anything. - */ - virtual auto getConstants() -> std::map { return {}; }; - - /** - * @return a list of methods this module exports to JS. - */ - virtual auto getMethods() -> std::vector = 0; - - /** - * Called during the construction of CxxNativeModule. - */ - void setInstance(std::weak_ptr instance) { - instance_ = instance; - } - - /** - * @return a weak_ptr to the current instance of the bridge. - * When used with CxxNativeModule, this gives Cxx modules access to functions - * such as `callJSFunction`, allowing them to communicate back to JS outside - * of the regular callbacks. - */ - std::weak_ptr getInstance() { - return instance_; - } - -private: - std::weak_ptr instance_; -}; - -}}} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/CxxNativeModule.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/CxxNativeModule.cpp deleted file mode 100644 index 2b674c0c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/CxxNativeModule.cpp +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "CxxNativeModule.h" -#include "Instance.h" - -#include -#include -#include - -#include "JsArgumentHelpers.h" -#include "SystraceSection.h" -#include "MessageQueueThread.h" - -using facebook::xplat::module::CxxModule; -namespace facebook { -namespace react { - -std::function makeCallback( - std::weak_ptr instance, const folly::dynamic& callbackId) { - if (!callbackId.isNumber()) { - throw std::invalid_argument("Expected callback(s) as final argument"); - } - - auto id = callbackId.asInt(); - return [winstance = std::move(instance), id](folly::dynamic args) { - if (auto instance = winstance.lock()) { - instance->callJSCallback(id, std::move(args)); - } - }; -} - -namespace { - -/** - * CxxModule::Callback accepts a vector, makeCallback returns - * a callback that accepts a dynamic, adapt the second into the first. - * TODO: Callback types should be made equal (preferably - * function) to avoid the extra copy and indirect call. - */ -CxxModule::Callback convertCallback( - std::function callback) { - return [callback = std::move(callback)](std::vector args) { - callback(folly::dynamic(std::make_move_iterator(args.begin()), - std::make_move_iterator(args.end()))); - }; -} - -} - -std::string CxxNativeModule::getName() { - return name_; -} - -std::vector CxxNativeModule::getMethods() { - lazyInit(); - - std::vector descs; - for (auto& method : methods_) { - descs.emplace_back(method.name, method.getType()); - } - return descs; -} - -folly::dynamic CxxNativeModule::getConstants() { - lazyInit(); - - if (!module_) { - return nullptr; - } - - folly::dynamic constants = folly::dynamic::object(); - for (auto& pair : module_->getConstants()) { - constants.insert(std::move(pair.first), std::move(pair.second)); - } - return constants; -} - -void CxxNativeModule::invoke(unsigned int reactMethodId, folly::dynamic&& params, int callId) { - if (reactMethodId >= methods_.size()) { - throw std::invalid_argument(folly::to("methodId ", reactMethodId, - " out of range [0..", methods_.size(), "]")); - } - if (!params.isArray()) { - throw std::invalid_argument( - folly::to("method parameters should be array, but are ", params.typeName())); - } - - CxxModule::Callback first; - CxxModule::Callback second; - - const auto& method = methods_[reactMethodId]; - - if (!method.func) { - throw std::runtime_error(folly::to("Method ", method.name, - " is synchronous but invoked asynchronously")); - } - - if (params.size() < method.callbacks) { - throw std::invalid_argument(folly::to("Expected ", method.callbacks, - " callbacks, but only ", params.size(), " parameters provided")); - } - - if (method.callbacks == 1) { - first = convertCallback(makeCallback(instance_, params[params.size() - 1])); - } else if (method.callbacks == 2) { - first = convertCallback(makeCallback(instance_, params[params.size() - 2])); - second = convertCallback(makeCallback(instance_, params[params.size() - 1])); - } - - params.resize(params.size() - method.callbacks); - - // I've got a few flawed options here. I can let the C++ exception - // propagate, and the registry will log/convert them to java exceptions. - // This lets all the java and red box handling work ok, but the only info I - // can capture about the C++ exception is the what() string, not the stack. - // I can std::terminate() the app. This causes the full, accurate C++ - // stack trace to be added to logcat by debuggerd. The java state is lost, - // but in practice, the java stack is always the same in this case since - // the javascript stack is not visible, and the crash is unfriendly to js - // developers, but crucial to C++ developers. The what() value is also - // lost. Finally, I can catch, log the java stack, then rethrow the C++ - // exception. In this case I get java and C++ stack data, but the C++ - // stack is as of the rethrow, not the original throw, both the C++ and - // java stacks always look the same. - // - // I am going with option 2, since that seems like the most useful - // choice. It would be nice to be able to get what() and the C++ - // stack. I'm told that will be possible in the future. TODO - // mhorowitz #7128529: convert C++ exceptions to Java - - messageQueueThread_->runOnQueue([method, params=std::move(params), first, second, callId] () { - #ifdef WITH_FBSYSTRACE - if (callId != -1) { - fbsystrace_end_async_flow(TRACE_TAG_REACT_APPS, "native", callId); - } - #else - (void)(callId); - #endif - SystraceSection s(method.name.c_str()); - try { - method.func(std::move(params), first, second); - } catch (const facebook::xplat::JsArgumentException& ex) { - throw; - } catch (std::exception& e) { - LOG(ERROR) << "std::exception. Method call " << method.name.c_str() << " failed: " << e.what(); - std::terminate(); - } catch (std::string& error) { - LOG(ERROR) << "std::string. Method call " << method.name.c_str() << " failed: " << error.c_str(); - std::terminate(); - } catch (...) { - LOG(ERROR) << "Method call " << method.name.c_str() << " failed. unknown error"; - std::terminate(); - } - }); -} - -MethodCallResult CxxNativeModule::callSerializableNativeHook(unsigned int hookId, folly::dynamic&& args) { - if (hookId >= methods_.size()) { - throw std::invalid_argument( - folly::to("methodId ", hookId, " out of range [0..", methods_.size(), "]")); - } - - const auto& method = methods_[hookId]; - - if (!method.syncFunc) { - throw std::runtime_error( - folly::to("Method ", method.name, - " is asynchronous but invoked synchronously")); - } - - return method.syncFunc(std::move(args)); -} - -void CxxNativeModule::lazyInit() { - if (module_ || !provider_) { - return; - } - - // TODO 17216751: providers should never return null modules - module_ = provider_(); - provider_ = nullptr; - if (module_) { - methods_ = module_->getMethods(); - module_->setInstance(instance_); - } -} - -} -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/CxxNativeModule.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/CxxNativeModule.h deleted file mode 100644 index d28fac97..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/CxxNativeModule.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include - -#ifndef RN_EXPORT -#define RN_EXPORT __attribute__((visibility("default"))) -#endif - -namespace facebook { -namespace react { - -class Instance; -class MessageQueueThread; - -std::function makeCallback( - std::weak_ptr instance, const folly::dynamic& callbackId); - -class RN_EXPORT CxxNativeModule : public NativeModule { -public: - CxxNativeModule(std::weak_ptr instance, - std::string name, - xplat::module::CxxModule::Provider provider, - std::shared_ptr messageQueueThread) - : instance_(instance) - , name_(std::move(name)) - , provider_(provider) - , messageQueueThread_(messageQueueThread) {} - - std::string getName() override; - std::vector getMethods() override; - folly::dynamic getConstants() override; - void invoke(unsigned int reactMethodId, folly::dynamic&& params, int callId) override; - MethodCallResult callSerializableNativeHook(unsigned int hookId, folly::dynamic&& args) override; - -private: - void lazyInit(); - - std::weak_ptr instance_; - std::string name_; - xplat::module::CxxModule::Provider provider_; - std::shared_ptr messageQueueThread_; - std::unique_ptr module_; - std::vector methods_; -}; - -} -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/Instance.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/Instance.cpp deleted file mode 100644 index a9b6bd56..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/Instance.cpp +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "Instance.h" - -#include "JSBigString.h" -#include "JSBundleType.h" -#include "JSExecutor.h" -#include "MessageQueueThread.h" -#include "MethodCall.h" -#include "NativeToJsBridge.h" -#include "RAMBundleRegistry.h" -#include "RecoverableError.h" -#include "SystraceSection.h" - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -Instance::~Instance() { - if (nativeToJsBridge_) { - nativeToJsBridge_->destroy(); - } -} - -void Instance::initializeBridge( - std::unique_ptr callback, - std::shared_ptr jsef, - std::shared_ptr jsQueue, - std::shared_ptr moduleRegistry) { - callback_ = std::move(callback); - moduleRegistry_ = std::move(moduleRegistry); - jsQueue->runOnQueueSync([this, &jsef, jsQueue]() mutable { - nativeToJsBridge_ = folly::make_unique( - jsef.get(), moduleRegistry_, jsQueue, callback_); - - std::lock_guard lock(m_syncMutex); - m_syncReady = true; - m_syncCV.notify_all(); - }); - - CHECK(nativeToJsBridge_); -} - -void Instance::loadApplication(std::unique_ptr bundleRegistry, - std::unique_ptr string, - std::string sourceURL) { - callback_->incrementPendingJSCalls(); - SystraceSection s("Instance::loadApplication", "sourceURL", - sourceURL); - nativeToJsBridge_->loadApplication(std::move(bundleRegistry), std::move(string), - std::move(sourceURL)); -} - -void Instance::loadApplicationSync(std::unique_ptr bundleRegistry, - std::unique_ptr string, - std::string sourceURL) { - std::unique_lock lock(m_syncMutex); - m_syncCV.wait(lock, [this] { return m_syncReady; }); - - SystraceSection s("Instance::loadApplicationSync", "sourceURL", - sourceURL); - nativeToJsBridge_->loadApplicationSync(std::move(bundleRegistry), std::move(string), - std::move(sourceURL)); -} - -void Instance::setSourceURL(std::string sourceURL) { - callback_->incrementPendingJSCalls(); - SystraceSection s("Instance::setSourceURL", "sourceURL", sourceURL); - - nativeToJsBridge_->loadApplication(nullptr, nullptr, std::move(sourceURL)); -} - -void Instance::loadScriptFromString(std::unique_ptr string, - std::string sourceURL, - bool loadSynchronously) { - SystraceSection s("Instance::loadScriptFromString", "sourceURL", - sourceURL); - if (loadSynchronously) { - loadApplicationSync(nullptr, std::move(string), std::move(sourceURL)); - } else { - loadApplication(nullptr, std::move(string), std::move(sourceURL)); - } -} - -bool Instance::isIndexedRAMBundle(const char *sourcePath) { - std::ifstream bundle_stream(sourcePath, std::ios_base::in); - BundleHeader header; - - if (!bundle_stream || - !bundle_stream.read(reinterpret_cast(&header), sizeof(header))) { - return false; - } - - return parseTypeFromHeader(header) == ScriptTag::RAMBundle; -} - -void Instance::loadRAMBundleFromFile(const std::string& sourcePath, - const std::string& sourceURL, - bool loadSynchronously) { - auto bundle = folly::make_unique(sourcePath.c_str()); - auto startupScript = bundle->getStartupCode(); - auto registry = RAMBundleRegistry::multipleBundlesRegistry(std::move(bundle), JSIndexedRAMBundle::buildFactory()); - loadRAMBundle( - std::move(registry), - std::move(startupScript), - sourceURL, - loadSynchronously); -} - -void Instance::loadRAMBundle(std::unique_ptr bundleRegistry, - std::unique_ptr startupScript, - std::string startupScriptSourceURL, - bool loadSynchronously) { - if (loadSynchronously) { - loadApplicationSync(std::move(bundleRegistry), std::move(startupScript), - std::move(startupScriptSourceURL)); - } else { - loadApplication(std::move(bundleRegistry), std::move(startupScript), - std::move(startupScriptSourceURL)); - } -} - -void Instance::setGlobalVariable(std::string propName, - std::unique_ptr jsonValue) { - nativeToJsBridge_->setGlobalVariable(std::move(propName), - std::move(jsonValue)); -} - -void *Instance::getJavaScriptContext() { - return nativeToJsBridge_ ? nativeToJsBridge_->getJavaScriptContext() - : nullptr; -} - -bool Instance::isInspectable() { - return nativeToJsBridge_ ? nativeToJsBridge_->isInspectable() : false; -} - -bool Instance::isBatchActive() { - return nativeToJsBridge_ ? nativeToJsBridge_->isBatchActive() : false; -} - -void Instance::callJSFunction(std::string &&module, std::string &&method, - folly::dynamic &¶ms) { - callback_->incrementPendingJSCalls(); - nativeToJsBridge_->callFunction(std::move(module), std::move(method), - std::move(params)); -} - -void Instance::callJSCallback(uint64_t callbackId, folly::dynamic &¶ms) { - SystraceSection s("Instance::callJSCallback"); - callback_->incrementPendingJSCalls(); - nativeToJsBridge_->invokeCallback((double)callbackId, std::move(params)); -} - -void Instance::registerBundle(uint32_t bundleId, const std::string& bundlePath) { - nativeToJsBridge_->registerBundle(bundleId, bundlePath); -} - -const ModuleRegistry &Instance::getModuleRegistry() const { - return *moduleRegistry_; -} - -ModuleRegistry &Instance::getModuleRegistry() { return *moduleRegistry_; } - -void Instance::handleMemoryPressure(int pressureLevel) { - nativeToJsBridge_->handleMemoryPressure(pressureLevel); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/Instance.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/Instance.h deleted file mode 100644 index 72a5a7ee..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/Instance.h +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include - -#include - -#ifndef RN_EXPORT -#define RN_EXPORT __attribute__((visibility("default"))) -#endif - -namespace folly { -struct dynamic; -} - -namespace facebook { -namespace react { - -class JSBigString; -class JSExecutorFactory; -class MessageQueueThread; -class ModuleRegistry; -class RAMBundleRegistry; - -struct InstanceCallback { - virtual ~InstanceCallback() {} - virtual void onBatchComplete() {} - virtual void incrementPendingJSCalls() {} - virtual void decrementPendingJSCalls() {} -}; - -class RN_EXPORT Instance { -public: - ~Instance(); - void initializeBridge(std::unique_ptr callback, - std::shared_ptr jsef, - std::shared_ptr jsQueue, - std::shared_ptr moduleRegistry); - - void setSourceURL(std::string sourceURL); - - void loadScriptFromString(std::unique_ptr string, - std::string sourceURL, bool loadSynchronously); - static bool isIndexedRAMBundle(const char *sourcePath); - void loadRAMBundleFromFile(const std::string& sourcePath, - const std::string& sourceURL, - bool loadSynchronously); - void loadRAMBundle(std::unique_ptr bundleRegistry, - std::unique_ptr startupScript, - std::string startupScriptSourceURL, bool loadSynchronously); - bool supportsProfiling(); - void setGlobalVariable(std::string propName, - std::unique_ptr jsonValue); - void *getJavaScriptContext(); - bool isInspectable(); - bool isBatchActive(); - void callJSFunction(std::string &&module, std::string &&method, - folly::dynamic &¶ms); - void callJSCallback(uint64_t callbackId, folly::dynamic &¶ms); - - // This method is experimental, and may be modified or removed. - void registerBundle(uint32_t bundleId, const std::string& bundlePath); - - const ModuleRegistry &getModuleRegistry() const; - ModuleRegistry &getModuleRegistry(); - - void handleMemoryPressure(int pressureLevel); - -private: - void callNativeModules(folly::dynamic &&calls, bool isEndOfBatch); - void loadApplication(std::unique_ptr bundleRegistry, - std::unique_ptr startupScript, - std::string startupScriptSourceURL); - void loadApplicationSync(std::unique_ptr bundleRegistry, - std::unique_ptr startupScript, - std::string startupScriptSourceURL); - - std::shared_ptr callback_; - std::unique_ptr nativeToJsBridge_; - std::shared_ptr moduleRegistry_; - - std::mutex m_syncMutex; - std::condition_variable m_syncCV; - bool m_syncReady = false; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSBigString.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSBigString.cpp deleted file mode 100644 index e26a8100..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSBigString.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "JSBigString.h" - -#include -#include - -#include -#include -#include - -namespace facebook { -namespace react { - -JSBigFileString::JSBigFileString(int fd, size_t size, off_t offset /*= 0*/) - : m_fd { -1 } - , m_data { nullptr } { - folly::checkUnixError(m_fd = dup(fd), - "Could not duplicate file descriptor"); - - // Offsets given to mmap must be page aligend. We abstract away that - // restriction by sending a page aligned offset to mmap, and keeping track - // of the offset within the page that we must alter the mmap pointer by to - // get the final desired offset. - if (offset != 0) { - const static auto ps = getpagesize(); - auto d = lldiv(offset, ps); - - m_mapOff = d.quot; - m_pageOff = d.rem; - m_size = size + m_pageOff; - } else { - m_mapOff = 0; - m_pageOff = 0; - m_size = size; - } -} - -JSBigFileString::~JSBigFileString() { - if (m_data) { - munmap((void *)m_data, m_size); - } - close(m_fd); -} - - -const char *JSBigFileString::c_str() const { - if (!m_data) { - m_data = - (const char *) mmap(0, m_size, PROT_READ, MAP_SHARED, m_fd, m_mapOff); - CHECK(m_data != MAP_FAILED) - << " fd: " << m_fd - << " size: " << m_size - << " offset: " << m_mapOff - << " error: " << std::strerror(errno); - } - return m_data + m_pageOff; -} - -size_t JSBigFileString::size() const { - return m_size - m_pageOff; -} - -int JSBigFileString::fd() const { - return m_fd; -} - -std::unique_ptr JSBigFileString::fromPath(const std::string& sourceURL) { - int fd = ::open(sourceURL.c_str(), O_RDONLY); - folly::checkUnixError(fd, "Could not open file", sourceURL); - SCOPE_EXIT { CHECK(::close(fd) == 0); }; - - struct stat fileInfo; - folly::checkUnixError(::fstat(fd, &fileInfo), "fstat on bundle failed."); - - return folly::make_unique(fd, fileInfo.st_size); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSBigString.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSBigString.h deleted file mode 100644 index 497b9f7b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSBigString.h +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include - -#include - -#ifndef RN_EXPORT -# ifdef _MSC_VER -# define RN_EXPORT -# else -# define RN_EXPORT __attribute__((visibility("default"))) -# endif -#endif - -namespace facebook { -namespace react { - -// JSExecutor functions sometimes take large strings, on the order of -// megabytes. Copying these can be expensive. Introducing a -// move-only, non-CopyConstructible type will let the compiler ensure -// that no copies occur. folly::MoveWrapper should be used when a -// large string needs to be curried into a std::function<>, which must -// by CopyConstructible. - -class JSBigString { -public: - JSBigString() = default; - - // Not copyable - JSBigString(const JSBigString&) = delete; - JSBigString& operator=(const JSBigString&) = delete; - - virtual ~JSBigString() {} - - virtual bool isAscii() const = 0; - - // This needs to be a \0 terminated string - virtual const char* c_str() const = 0; - - // Length of the c_str without the NULL byte. - virtual size_t size() const = 0; -}; - -// Concrete JSBigString implementation which holds a std::string -// instance. -class JSBigStdString : public JSBigString { -public: - JSBigStdString(std::string str, bool isAscii=false) - : m_isAscii(isAscii) - , m_str(std::move(str)) {} - - bool isAscii() const override { - return m_isAscii; - } - - const char* c_str() const override { - return m_str.c_str(); - } - - size_t size() const override { - return m_str.size(); - } - -private: - bool m_isAscii; - std::string m_str; -}; - -// Concrete JSBigString implementation which holds a heap-allocated -// buffer, and provides an accessor for writing to it. This can be -// used to construct a JSBigString in place, such as by reading from a -// file. -class RN_EXPORT JSBigBufferString : public JSBigString { -public: - JSBigBufferString(size_t size) - : m_data(new char[size + 1]) - , m_size(size) { - // Guarantee nul-termination. The caller is responsible for - // filling in the rest of m_data. - m_data[m_size] = '\0'; - } - - ~JSBigBufferString() { - delete[] m_data; - } - - bool isAscii() const override { - return true; - } - - const char* c_str() const override { - return m_data; - } - - size_t size() const override { - return m_size; - } - - char* data() { - return m_data; - } - -private: - char* m_data; - size_t m_size; -}; - -// JSBigString interface implemented by a file-backed mmap region. -class RN_EXPORT JSBigFileString : public JSBigString { -public: - - JSBigFileString(int fd, size_t size, off_t offset = 0); - ~JSBigFileString(); - - bool isAscii() const override { - return true; - } - - const char *c_str() const override; - - size_t size() const override; - int fd() const; - - static std::unique_ptr fromPath(const std::string& sourceURL); - -private: - int m_fd; // The file descriptor being mmaped - size_t m_size; // The size of the mmaped region - size_t m_pageOff; // The offset in the mmaped region to the data. - off_t m_mapOff; // The offset in the file to the mmaped region. - mutable const char *m_data; // Pointer to the mmaped region. -}; - -} } diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSBundleType.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSBundleType.cpp deleted file mode 100644 index f2b7a519..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSBundleType.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "JSBundleType.h" - -#include - -namespace facebook { -namespace react { - -static uint32_t constexpr RAMBundleMagicNumber = 0xFB0BD1E5; -static uint32_t constexpr BCBundleMagicNumber = 0x6D657300; - -ScriptTag parseTypeFromHeader(const BundleHeader& header) { - switch (folly::Endian::little(header.magic)) { - case RAMBundleMagicNumber: - return ScriptTag::RAMBundle; - case BCBundleMagicNumber: - return ScriptTag::BCBundle; - default: - return ScriptTag::String; - } -} - -const char *stringForScriptTag(const ScriptTag& tag) { - switch (tag) { - case ScriptTag::String: - return "String"; - case ScriptTag::RAMBundle: - return "RAM Bundle"; - case ScriptTag::BCBundle: - return "BC Bundle"; - } - return ""; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSBundleType.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSBundleType.h deleted file mode 100644 index 0cd18948..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSBundleType.h +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include - -#ifndef RN_EXPORT -#define RN_EXPORT __attribute__((visibility("default"))) -#endif - -namespace facebook { -namespace react { - -/* - * ScriptTag - * - * Scripts given to the JS Executors to run could be in any of the following - * formats. They are tagged so the executor knows how to run them. - */ -enum struct ScriptTag { - String = 0, - RAMBundle, - BCBundle, -}; - -/** - * BundleHeader - * - * RAM bundles and BC bundles begin with headers. For RAM bundles this is - * 4 bytes, for BC bundles this is 12 bytes. This structure holds the first 12 - * bytes from a bundle in a way that gives access to that information. - */ -FOLLY_PACK_PUSH -struct FOLLY_PACK_ATTR BundleHeader { - BundleHeader() { - std::memset(this, 0, sizeof(BundleHeader)); - } - - uint32_t magic; - uint32_t reserved_; - uint32_t version; -}; -FOLLY_PACK_POP - -/** - * parseTypeFromHeader - * - * Takes the first 8 bytes of a bundle, and returns a tag describing the - * bundle's format. - */ -RN_EXPORT ScriptTag parseTypeFromHeader(const BundleHeader& header); - -/** - * stringForScriptTag - * - * Convert an `ScriptTag` enum into a string, useful for emitting in errors - * and diagnostic messages. - */ -RN_EXPORT const char* stringForScriptTag(const ScriptTag& tag); - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSDeltaBundleClient.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSDeltaBundleClient.cpp deleted file mode 100644 index 0c48785d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSDeltaBundleClient.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "JSDeltaBundleClient.h" - -#include - -#include - -namespace facebook { -namespace react { - -namespace { - std::string startupCode(const folly::dynamic *pre, const folly::dynamic *post) { - std::ostringstream startupCode; - - for (auto section : {pre, post}) { - if (section != nullptr) { - startupCode << section->getString() << '\n'; - } - } - - return startupCode.str(); - } -} // namespace - -void JSDeltaBundleClient::patchModules(const folly::dynamic *modules) { - for (const folly::dynamic pair : *modules) { - auto id = pair[0].getInt(); - auto module = pair[1]; - modules_[id] = std::move(module.getString()); - } -} - -void JSDeltaBundleClient::patch(const folly::dynamic& delta) { - auto const base = delta.get_ptr("base"); - - if (base != nullptr && base->asBool()) { - clear(); - - auto const pre = delta.get_ptr("pre"); - auto const post = delta.get_ptr("post"); - - startupCode_ = startupCode(pre, post); - - const folly::dynamic *modules = delta.get_ptr("modules"); - if (modules != nullptr) { - patchModules(modules); - } - } else { - const folly::dynamic *deleted = delta.get_ptr("deleted"); - if (deleted != nullptr) { - for (const folly::dynamic id : *deleted) { - modules_.erase(id.getInt()); - } - } - - // TODO T37123645 This is deprecated but necessary in order to support older - // versions of the Metro server. - const folly::dynamic *modules = delta.get_ptr("modules"); - if (modules != nullptr) { - patchModules(modules); - } - - const folly::dynamic *added = delta.get_ptr("added"); - if (added != nullptr) { - patchModules(added); - } - - const folly::dynamic *modified = delta.get_ptr("modified"); - if (modified != nullptr) { - patchModules(modified); - } - } - -} - -JSModulesUnbundle::Module JSDeltaBundleClient::getModule(uint32_t moduleId) const { - auto search = modules_.find(moduleId); - if (search != modules_.end()) { - return {folly::to(search->first, ".js"), search->second}; - } - - throw JSModulesUnbundle::ModuleNotFound(moduleId); -} - -std::unique_ptr JSDeltaBundleClient::getStartupCode() const { - return folly::make_unique(startupCode_); -} - -void JSDeltaBundleClient::clear() { - modules_.clear(); - startupCode_.clear(); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSDeltaBundleClient.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSDeltaBundleClient.h deleted file mode 100644 index 5ee2aba9..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSDeltaBundleClient.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include -#include - -#include -#include -#include - -namespace facebook { -namespace react { - -class JSDeltaBundleClient { -public: - void patch(const folly::dynamic& delta); - JSModulesUnbundle::Module getModule(uint32_t moduleId) const; - std::unique_ptr getStartupCode() const; - void clear(); - -private: - std::unordered_map modules_; - std::string startupCode_; - - void patchModules(const folly::dynamic *delta); -}; - -class JSDeltaBundleClientRAMBundle : public JSModulesUnbundle { -public: - JSDeltaBundleClientRAMBundle( - std::shared_ptr client) : client_(client) {} - - Module getModule(uint32_t moduleId) const override { - return client_->getModule(moduleId); - } -private: - const std::shared_ptr client_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSExecutor.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSExecutor.cpp deleted file mode 100644 index ca88df2e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSExecutor.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "JSExecutor.h" - -#include "RAMBundleRegistry.h" - -#include - -namespace facebook { -namespace react { - -std::string JSExecutor::getSyntheticBundlePath( - uint32_t bundleId, - const std::string& bundlePath) { - if (bundleId == RAMBundleRegistry::MAIN_BUNDLE_ID) { - return bundlePath; - } - return folly::to("seg-", bundleId, ".js"); -} - -} -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSExecutor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSExecutor.h deleted file mode 100644 index 4e8d682c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSExecutor.h +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include - -#include -#include - -#ifndef RN_EXPORT -#define RN_EXPORT __attribute__((visibility("default"))) -#endif - -namespace facebook { -namespace react { - -class JSBigString; -class JSExecutor; -class JSModulesUnbundle; -class MessageQueueThread; -class ModuleRegistry; -class RAMBundleRegistry; - -// This interface describes the delegate interface required by -// Executor implementations to call from JS into native code. -class ExecutorDelegate { - public: - virtual ~ExecutorDelegate() {} - - virtual std::shared_ptr getModuleRegistry() = 0; - - virtual void callNativeModules( - JSExecutor& executor, folly::dynamic&& calls, bool isEndOfBatch) = 0; - virtual MethodCallResult callSerializableNativeHook( - JSExecutor& executor, unsigned int moduleId, unsigned int methodId, folly::dynamic&& args) = 0; -}; - -using NativeExtensionsProvider = std::function; - -class JSExecutorFactory { -public: - virtual std::unique_ptr createJSExecutor( - std::shared_ptr delegate, - std::shared_ptr jsQueue) = 0; - virtual ~JSExecutorFactory() {} -}; - -class RN_EXPORT JSExecutor { -public: - /** - * Execute an application script bundle in the JS context. - */ - virtual void loadApplicationScript(std::unique_ptr script, - std::string sourceURL) = 0; - - /** - * Add an application "RAM" bundle registry - */ - virtual void setBundleRegistry(std::unique_ptr bundleRegistry) = 0; - - /** - * Register a file path for an additional "RAM" bundle - */ - virtual void registerBundle(uint32_t bundleId, const std::string& bundlePath) = 0; - - /** - * Executes BatchedBridge.callFunctionReturnFlushedQueue with the module ID, - * method ID and optional additional arguments in JS. The executor is responsible - * for using Bridge->callNativeModules to invoke any necessary native modules methods. - */ - virtual void callFunction(const std::string& moduleId, const std::string& methodId, const folly::dynamic& arguments) = 0; - - /** - * Executes BatchedBridge.invokeCallbackAndReturnFlushedQueue with the cbID, - * and optional additional arguments in JS and returns the next queue. The executor - * is responsible for using Bridge->callNativeModules to invoke any necessary - * native modules methods. - */ - virtual void invokeCallback(const double callbackId, const folly::dynamic& arguments) = 0; - - virtual void setGlobalVariable(std::string propName, std::unique_ptr jsonValue) = 0; - - virtual void* getJavaScriptContext() { - return nullptr; - } - - /** - * Returns whether or not the underlying executor supports debugging via the - * Chrome remote debugging protocol. - */ - virtual bool isInspectable() { - return false; - } - - /** - * The description is displayed in the dev menu, if there is one in - * this build. There is a default, but if this method returns a - * non-empty string, it will be used instead. - */ - virtual std::string getDescription() = 0; - - virtual void handleMemoryPressure(int pressureLevel) {} - - virtual void destroy() {} - virtual ~JSExecutor() {} - - static std::string getSyntheticBundlePath( - uint32_t bundleId, - const std::string& bundlePath); -}; - -} } diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSIndexedRAMBundle.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSIndexedRAMBundle.cpp deleted file mode 100644 index 237b9550..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSIndexedRAMBundle.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "JSIndexedRAMBundle.h" - -#include - -namespace facebook { -namespace react { - -std::function(std::string)> JSIndexedRAMBundle::buildFactory() { - return [](const std::string& bundlePath){ - return folly::make_unique(bundlePath.c_str()); - }; -} - -JSIndexedRAMBundle::JSIndexedRAMBundle(const char *sourcePath) : - m_bundle (sourcePath, std::ios_base::in) { - if (!m_bundle) { - throw std::ios_base::failure( - folly::to("Bundle ", sourcePath, - "cannot be opened: ", m_bundle.rdstate())); - } - - // read in magic header, number of entries, and length of the startup section - uint32_t header[3]; - static_assert( - sizeof(header) == 12, - "header size must exactly match the input file format"); - - readBundle(reinterpret_cast(header), sizeof(header)); - const size_t numTableEntries = folly::Endian::little(header[1]); - const size_t startupCodeSize = folly::Endian::little(header[2]); - - // allocate memory for meta data and lookup table. - m_table = ModuleTable(numTableEntries); - m_baseOffset = sizeof(header) + m_table.byteLength(); - - // read the lookup table from the file - readBundle( - reinterpret_cast(m_table.data.get()), m_table.byteLength()); - - // read the startup code - m_startupCode = std::unique_ptr(new JSBigBufferString{startupCodeSize - 1}); - - readBundle(m_startupCode->data(), startupCodeSize - 1); -} - -JSIndexedRAMBundle::Module JSIndexedRAMBundle::getModule(uint32_t moduleId) const { - Module ret; - ret.name = folly::to(moduleId, ".js"); - ret.code = getModuleCode(moduleId); - return ret; -} - -std::unique_ptr JSIndexedRAMBundle::getStartupCode() { - CHECK(m_startupCode) << "startup code for a RAM Bundle can only be retrieved once"; - return std::move(m_startupCode); -} - -std::string JSIndexedRAMBundle::getModuleCode(const uint32_t id) const { - const auto moduleData = id < m_table.numEntries ? &m_table.data[id] : nullptr; - - // entries without associated code have offset = 0 and length = 0 - const uint32_t length = moduleData ? folly::Endian::little(moduleData->length) : 0; - if (length == 0) { - throw std::ios_base::failure( - folly::to("Error loading module", id, "from RAM Bundle")); - } - - std::string ret(length - 1, '\0'); - readBundle(&ret.front(), length - 1, m_baseOffset + folly::Endian::little(moduleData->offset)); - return ret; -} - -void JSIndexedRAMBundle::readBundle(char *buffer, const std::streamsize bytes) const { - if (!m_bundle.read(buffer, bytes)) { - if (m_bundle.rdstate() & std::ios::eofbit) { - throw std::ios_base::failure("Unexpected end of RAM Bundle file"); - } - throw std::ios_base::failure( - folly::to("Error reading RAM Bundle: ", m_bundle.rdstate())); - } -} - -void JSIndexedRAMBundle::readBundle( - char *buffer, - const std::streamsize bytes, - const std::ifstream::pos_type position) const { - - if (!m_bundle.seekg(position)) { - throw std::ios_base::failure( - folly::to("Error reading RAM Bundle: ", m_bundle.rdstate())); - } - readBundle(buffer, bytes); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSIndexedRAMBundle.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSIndexedRAMBundle.h deleted file mode 100644 index be6b27f7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSIndexedRAMBundle.h +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include - -#include -#include - -#ifndef RN_EXPORT -#define RN_EXPORT __attribute__((visibility("default"))) -#endif - -namespace facebook { -namespace react { - -class RN_EXPORT JSIndexedRAMBundle : public JSModulesUnbundle { -public: - static std::function(std::string)> buildFactory(); - - // Throws std::runtime_error on failure. - JSIndexedRAMBundle(const char *sourceURL); - - // Throws std::runtime_error on failure. - std::unique_ptr getStartupCode(); - // Throws std::runtime_error on failure. - Module getModule(uint32_t moduleId) const override; - -private: - struct ModuleData { - uint32_t offset; - uint32_t length; - }; - static_assert( - sizeof(ModuleData) == 8, - "ModuleData must not have any padding and use sizes matching input files"); - - struct ModuleTable { - size_t numEntries; - std::unique_ptr data; - ModuleTable() : numEntries(0) {}; - ModuleTable(size_t entries) : - numEntries(entries), - data(std::unique_ptr(new ModuleData[numEntries])) {}; - size_t byteLength() const { - return numEntries * sizeof(ModuleData); - } - }; - - std::string getModuleCode(const uint32_t id) const; - void readBundle(char *buffer, const std::streamsize bytes) const; - void readBundle( - char *buffer, const - std::streamsize bytes, - const std::ifstream::pos_type position) const; - - mutable std::ifstream m_bundle; - ModuleTable m_table; - size_t m_baseOffset; - std::unique_ptr m_startupCode; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSModulesUnbundle.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSModulesUnbundle.h deleted file mode 100644 index c926a598..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JSModulesUnbundle.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include - -#include - -namespace facebook { -namespace react { - -class JSModulesUnbundle { - /** - * Represents the set of JavaScript modules that the application consists of. - * The source code of each module can be retrieved by module ID. - * - * The class is non-copyable because copying instances might involve copying - * several megabytes of memory. - */ -public: - class ModuleNotFound : public std::out_of_range { - public: - using std::out_of_range::out_of_range; - ModuleNotFound(uint32_t moduleId) : std::out_of_range::out_of_range( - folly::to("Module not found: ", moduleId)) {} - }; - struct Module { - std::string name; - std::string code; - }; - JSModulesUnbundle() {} - virtual ~JSModulesUnbundle() {} - virtual Module getModule(uint32_t moduleId) const = 0; - -private: - JSModulesUnbundle(const JSModulesUnbundle&) = delete; -}; - -} -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JsArgumentHelpers-inl.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JsArgumentHelpers-inl.h deleted file mode 100644 index eaea3d1a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JsArgumentHelpers-inl.h +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once -#include - -namespace facebook { -namespace xplat { - -namespace detail { - -template -R jsArg1(const folly::dynamic& arg, M asFoo, const T&... desc) { - try { - return (arg.*asFoo)(); - } catch (const folly::TypeError& ex) { - throw JsArgumentException( - folly::to( - "Error converting javascript arg ", desc..., " to C++: ", ex.what())); - } catch (const std::range_error& ex) { - throw JsArgumentException( - folly::to( - "Could not convert argument ", desc..., " to required type: ", ex.what())); - } -} - -} - -template -R jsArg(const folly::dynamic& arg, R (folly::dynamic::*asFoo)() const, const T&... desc) { - return detail::jsArg1(arg, asFoo, desc...); -} - -template -R jsArg(const folly::dynamic& arg, R (folly::dynamic::*asFoo)() const&, const T&... desc) { - return detail::jsArg1(arg, asFoo, desc...); -} - -template -typename detail::is_dynamic::type& jsArgAsDynamic(T&& args, size_t n) { - try { - return args[n]; - } catch (const std::out_of_range& ex) { - // Use 1-base counting for argument description. - throw JsArgumentException( - folly::to( - "JavaScript provided ", args.size(), - " arguments for C++ method which references at least ", n + 1, - " arguments: ", ex.what())); - } -} - -template -R jsArgN(const folly::dynamic& args, size_t n, R (folly::dynamic::*asFoo)() const) { - return jsArg(jsArgAsDynamic(args, n), asFoo, n); -} -template -R jsArgN(const folly::dynamic& args, size_t n, R (folly::dynamic::*asFoo)() const&) { - return jsArg(jsArgAsDynamic(args, n), asFoo, n); -} - -namespace detail { - -// This is a helper for jsArgAsArray and jsArgAsObject. - -template -typename detail::is_dynamic::type& jsArgAsType(T&& args, size_t n, const char* required, - bool (folly::dynamic::*isFoo)() const) { - T& ret = jsArgAsDynamic(args, n); - if ((ret.*isFoo)()) { - return ret; - } - - // Use 1-base counting for argument description. - throw JsArgumentException( - folly::to( - "Argument ", n + 1, " of type ", ret.typeName(), " is not required type ", required)); -} - -} // end namespace detail - -template -typename detail::is_dynamic::type& jsArgAsArray(T&& args, size_t n) { - return detail::jsArgAsType(args, n, "Array", &folly::dynamic::isArray); -} - -template -typename detail::is_dynamic::type& jsArgAsObject(T&& args, size_t n) { - return detail::jsArgAsType(args, n, "Object", &folly::dynamic::isObject); -} - -}} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JsArgumentHelpers.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JsArgumentHelpers.h deleted file mode 100644 index 9d256fa1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/JsArgumentHelpers.h +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include - -#include -#include - -// When building a cross-platform module for React Native, arguments passed -// from JS are represented as a folly::dynamic. This class provides helpers to -// extract arguments from the folly::dynamic to concrete types usable by -// cross-platform code, and converting exceptions to a JsArgumentException so -// they can be caught and reported to RN consistently. The goal is to make the -// jsArgAs... methods at the end simple to use should be most common, but any -// non-detail method can be used when needed. - -namespace facebook { -namespace xplat { - -class JsArgumentException : public std::logic_error { -public: - JsArgumentException(const std::string& msg) : std::logic_error(msg) {} -}; - -// This extracts a single argument by calling the given method pointer on it. -// If an exception is thrown, the additional arguments are passed to -// folly::to<> to be included in the exception string. This will be most -// commonly used when extracting values from non-scalar argument. The second -// overload accepts ref-qualified member functions. - -template -R jsArg(const folly::dynamic& arg, R (folly::dynamic::*asFoo)() const, const T&... desc); -template -R jsArg(const folly::dynamic& arg, R (folly::dynamic::*asFoo)() const&, const T&... desc); - -// This is like jsArg, but a operates on a dynamic representing an array of -// arguments. The argument n is used both to index the array and build the -// exception message, if any. It can be used directly, but will more often be -// used by the type-specific methods following. - -template -R jsArgN(const folly::dynamic& args, size_t n, R (folly::dynamic::*asFoo)() const); -template -R jsArgN(const folly::dynamic& args, size_t n, R (folly::dynamic::*asFoo)() const&); - -namespace detail { - -// This is a type helper to implement functions which should work on both const -// and non-const folly::dynamic arguments, and return a type with the same -// constness. Basically, it causes the templates which use it to be defined -// only for types compatible with folly::dynamic. -template -struct is_dynamic { - typedef typename std::enable_if::value, T>::type type; -}; - -} // end namespace detail - -// Easy to use conversion helpers are here: - -// Extract the n'th arg from the given dynamic, as a dynamic. Throws a -// JsArgumentException if there is no n'th arg in the input. -template -typename detail::is_dynamic::type& jsArgAsDynamic(T&& args, size_t n); - -// Extract the n'th arg from the given dynamic, as a dynamic Array. Throws a -// JsArgumentException if there is no n'th arg in the input, or it is not an -// Array. -template -typename detail::is_dynamic::type& jsArgAsArray(T&& args, size_t n); - -// Extract the n'th arg from the given dynamic, as a dynamic Object. Throws a -// JsArgumentException if there is no n'th arg in the input, or it is not an -// Object. -template -typename detail::is_dynamic::type& jsArgAsObject(T&& args, size_t n); - -// Extract the n'th arg from the given dynamic, as a bool. Throws a -// JsArgumentException if this fails for some reason. -inline bool jsArgAsBool(const folly::dynamic& args, size_t n) { - return jsArgN(args, n, &folly::dynamic::asBool); -} - -// Extract the n'th arg from the given dynamic, as an integer. Throws a -// JsArgumentException if this fails for some reason. -inline int64_t jsArgAsInt(const folly::dynamic& args, size_t n) { - return jsArgN(args, n, &folly::dynamic::asInt); -} - -// Extract the n'th arg from the given dynamic, as a double. Throws a -// JsArgumentException if this fails for some reason. -inline double jsArgAsDouble(const folly::dynamic& args, size_t n) { - return jsArgN(args, n, &folly::dynamic::asDouble); -} - -// Extract the n'th arg from the given dynamic, as a string. Throws a -// JsArgumentException if this fails for some reason. -inline std::string jsArgAsString(const folly::dynamic& args, size_t n) { - return jsArgN(args, n, &folly::dynamic::asString); -} - -}} - -#include diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/MessageQueueThread.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/MessageQueueThread.h deleted file mode 100644 index 4919273d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/MessageQueueThread.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class MessageQueueThread { - public: - virtual ~MessageQueueThread() {} - virtual void runOnQueue(std::function&&) = 0; - // runOnQueueSync and quitSynchronous are dangerous. They should only be - // used for initialization and cleanup. - virtual void runOnQueueSync(std::function&&) = 0; - // Once quitSynchronous() returns, no further work should run on the queue. - virtual void quitSynchronous() = 0; -}; - -}} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/MethodCall.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/MethodCall.cpp deleted file mode 100644 index 79c7f49a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/MethodCall.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "MethodCall.h" - -#include -#include - -namespace facebook { -namespace react { - -#define REQUEST_MODULE_IDS 0 -#define REQUEST_METHOD_IDS 1 -#define REQUEST_PARAMSS 2 -#define REQUEST_CALLID 3 - -static const char *errorPrefix = "Malformed calls from JS: "; - -std::vector parseMethodCalls(folly::dynamic&& jsonData) { - if (jsonData.isNull()) { - return {}; - } - - if (!jsonData.isArray()) { - throw std::invalid_argument( - folly::to(errorPrefix, "input isn't array but ", jsonData.typeName())); - } - - if (jsonData.size() < REQUEST_PARAMSS + 1) { - throw std::invalid_argument( - folly::to(errorPrefix, "size == ", jsonData.size())); - } - - auto& moduleIds = jsonData[REQUEST_MODULE_IDS]; - auto& methodIds = jsonData[REQUEST_METHOD_IDS]; - auto& params = jsonData[REQUEST_PARAMSS]; - int callId = -1; - - if (!moduleIds.isArray() || !methodIds.isArray() || !params.isArray()) { - throw std::invalid_argument( - folly::to(errorPrefix, "not all fields are arrays.\n\n", folly::toJson(jsonData))); - } - - if (moduleIds.size() != methodIds.size() || moduleIds.size() != params.size()) { - throw std::invalid_argument( - folly::to(errorPrefix, "field sizes are different.\n\n", folly::toJson(jsonData))); - } - - if (jsonData.size() > REQUEST_CALLID) { - if (!jsonData[REQUEST_CALLID].isNumber()) { - throw std::invalid_argument( - folly::to(errorPrefix, "invalid callId", jsonData[REQUEST_CALLID].typeName())); - } - callId = jsonData[REQUEST_CALLID].asInt(); - } - - std::vector methodCalls; - for (size_t i = 0; i < moduleIds.size(); i++) { - if (!params[i].isArray()) { - throw std::invalid_argument( - folly::to(errorPrefix, "method arguments isn't array but ", params[i].typeName())); - } - - methodCalls.emplace_back( - moduleIds[i].asInt(), - methodIds[i].asInt(), - std::move(params[i]), - callId); - - // only incremement callid if contains valid callid as callid is optional - callId += (callId != -1) ? 1 : 0; - } - - return methodCalls; -} - -}} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/MethodCall.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/MethodCall.h deleted file mode 100644 index be843b9a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/MethodCall.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include - -#include - -namespace facebook { -namespace react { - -struct MethodCall { - int moduleId; - int methodId; - folly::dynamic arguments; - int callId; - - MethodCall(int mod, int meth, folly::dynamic&& args, int cid) - : moduleId(mod) - , methodId(meth) - , arguments(std::move(args)) - , callId(cid) {} -}; - -/// \throws std::invalid_argument -std::vector parseMethodCalls(folly::dynamic&& calls); - -} } diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/ModuleRegistry.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/ModuleRegistry.cpp deleted file mode 100644 index 1d3ba722..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/ModuleRegistry.cpp +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "ModuleRegistry.h" - -#include - -#include "NativeModule.h" -#include "SystraceSection.h" - -namespace facebook { -namespace react { - -namespace { - -std::string normalizeName(std::string name) { - // TODO mhorowitz #10487027: This is super ugly. We should just - // change iOS to emit normalized names, drop the "RK..." from - // names hardcoded in Android, and then delete this and the - // similar hacks in js. - if (name.compare(0, 3, "RCT") == 0) { - return name.substr(3); - } else if (name.compare(0, 2, "RK") == 0) { - return name.substr(2); - } - return name; -} - -} - -ModuleRegistry::ModuleRegistry(std::vector> modules, ModuleNotFoundCallback callback) - : modules_{std::move(modules)}, moduleNotFoundCallback_{callback} {} - -void ModuleRegistry::updateModuleNamesFromIndex(size_t index) { - for (; index < modules_.size(); index++ ) { - std::string name = normalizeName(modules_[index]->getName()); - modulesByName_[name] = index; - } -} - -void ModuleRegistry::registerModules(std::vector> modules) { - SystraceSection s_("ModuleRegistry::registerModules"); - if (modules_.empty() && unknownModules_.empty()) { - modules_ = std::move(modules); - } else { - size_t modulesSize = modules_.size(); - size_t addModulesSize = modules.size(); - bool addToNames = !modulesByName_.empty(); - modules_.reserve(modulesSize + addModulesSize); - std::move(modules.begin(), modules.end(), std::back_inserter(modules_)); - if (!unknownModules_.empty()) { - for (size_t index = modulesSize; index < modulesSize + addModulesSize; index++) { - std::string name = normalizeName(modules_[index]->getName()); - auto it = unknownModules_.find(name); - if (it != unknownModules_.end()) { - throw std::runtime_error( - folly::to("module ", name, " was required without being registered and is now being registered.")); - } else if (addToNames) { - modulesByName_[name] = index; - } - } - } else if (addToNames) { - updateModuleNamesFromIndex(modulesSize); - } - } -} - -std::vector ModuleRegistry::moduleNames() { - SystraceSection s_("ModuleRegistry::moduleNames"); - std::vector names; - for (size_t i = 0; i < modules_.size(); i++) { - std::string name = normalizeName(modules_[i]->getName()); - modulesByName_[name] = i; - names.push_back(std::move(name)); - } - return names; -} - -folly::Optional ModuleRegistry::getConfig(const std::string& name) { - SystraceSection s("ModuleRegistry::getConfig", "module", name); - - // Initialize modulesByName_ - if (modulesByName_.empty() && !modules_.empty()) { - moduleNames(); - } - - auto it = modulesByName_.find(name); - - if (it == modulesByName_.end()) { - if (unknownModules_.find(name) != unknownModules_.end()) { - return folly::none; - } - if (!moduleNotFoundCallback_ || - !moduleNotFoundCallback_(name) || - (it = modulesByName_.find(name)) == modulesByName_.end()) { - unknownModules_.insert(name); - return folly::none; - } - } - size_t index = it->second; - - CHECK(index < modules_.size()); - NativeModule *module = modules_[index].get(); - - // string name, object constants, array methodNames (methodId is index), [array promiseMethodIds], [array syncMethodIds] - folly::dynamic config = folly::dynamic::array(name); - - { - SystraceSection s_("ModuleRegistry::getConstants", "module", name); - config.push_back(module->getConstants()); - } - - { - SystraceSection s_("ModuleRegistry::getMethods", "module", name); - std::vector methods = module->getMethods(); - - folly::dynamic methodNames = folly::dynamic::array; - folly::dynamic promiseMethodIds = folly::dynamic::array; - folly::dynamic syncMethodIds = folly::dynamic::array; - - for (auto& descriptor : methods) { - // TODO: #10487027 compare tags instead of doing string comparison? - methodNames.push_back(std::move(descriptor.name)); - if (descriptor.type == "promise") { - promiseMethodIds.push_back(methodNames.size() - 1); - } else if (descriptor.type == "sync") { - syncMethodIds.push_back(methodNames.size() - 1); - } - } - - if (!methodNames.empty()) { - config.push_back(std::move(methodNames)); - if (!promiseMethodIds.empty() || !syncMethodIds.empty()) { - config.push_back(std::move(promiseMethodIds)); - if (!syncMethodIds.empty()) { - config.push_back(std::move(syncMethodIds)); - } - } - } - } - - if (config.size() == 2 && config[1].empty()) { - // no constants or methods - return folly::none; - } else { - return ModuleConfig{index, config}; - } -} - -void ModuleRegistry::callNativeMethod(unsigned int moduleId, unsigned int methodId, folly::dynamic&& params, int callId) { - if (moduleId >= modules_.size()) { - throw std::runtime_error( - folly::to("moduleId ", moduleId, " out of range [0..", modules_.size(), ")")); - } - modules_[moduleId]->invoke(methodId, std::move(params), callId); -} - -MethodCallResult ModuleRegistry::callSerializableNativeHook(unsigned int moduleId, unsigned int methodId, folly::dynamic&& params) { - if (moduleId >= modules_.size()) { - throw std::runtime_error( - folly::to("moduleId ", moduleId, "out of range [0..", modules_.size(), ")")); - } - return modules_[moduleId]->callSerializableNativeHook(methodId, std::move(params)); -} - -}} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/ModuleRegistry.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/ModuleRegistry.h deleted file mode 100644 index 65d95315..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/ModuleRegistry.h +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include - -#include -#include -#include - -#ifndef RN_EXPORT -#define RN_EXPORT __attribute__((visibility("default"))) -#endif - -namespace facebook { -namespace react { - -class NativeModule; - -struct ModuleConfig { - size_t index; - folly::dynamic config; -}; - -class RN_EXPORT ModuleRegistry { - public: - // not implemented: - // onBatchComplete: see https://our.intern.facebook.com/intern/tasks/?t=5279396 - // getModule: only used by views - // getAllModules: only used for cleanup; use RAII instead - // notifyCatalystInstanceInitialized: this is really only used by view-related code - // notifyCatalystInstanceDestroy: use RAII instead - - using ModuleNotFoundCallback = std::function; - - ModuleRegistry(std::vector> modules, ModuleNotFoundCallback callback = nullptr); - void registerModules(std::vector> modules); - - std::vector moduleNames(); - - folly::Optional getConfig(const std::string& name); - - void callNativeMethod(unsigned int moduleId, unsigned int methodId, folly::dynamic&& params, int callId); - MethodCallResult callSerializableNativeHook(unsigned int moduleId, unsigned int methodId, folly::dynamic&& args); - - private: - // This is always populated - std::vector> modules_; - - // This is used to extend the population of modulesByName_ if registerModules is called after moduleNames - void updateModuleNamesFromIndex(size_t size); - - // This is only populated if moduleNames() is called. Values are indices into modules_. - std::unordered_map modulesByName_; - - // This is populated with modules that are requested via getConfig but are unknown. - // An error will be thrown if they are subsequently added to the registry. - std::unordered_set unknownModules_; - - // Function will be called if a module was requested but was not found. - // If the function returns true, ModuleRegistry will try to find the module again (assuming it's registered) - // If the functon returns false, ModuleRegistry will not try to find the module and return nullptr instead. - ModuleNotFoundCallback moduleNotFoundCallback_; -}; - -} -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/NativeModule.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/NativeModule.h deleted file mode 100644 index e01756b5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/NativeModule.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include - -#include -#include - -namespace facebook { -namespace react { - -struct MethodDescriptor { - std::string name; - // type is one of js MessageQueue.MethodTypes - std::string type; - - MethodDescriptor(std::string n, std::string t) - : name(std::move(n)) - , type(std::move(t)) {} -}; - - using MethodCallResult = folly::Optional; - -class NativeModule { - public: - virtual ~NativeModule() {} - virtual std::string getName() = 0; - virtual std::vector getMethods() = 0; - virtual folly::dynamic getConstants() = 0; - virtual void invoke(unsigned int reactMethodId, folly::dynamic&& params, int callId) = 0; - virtual MethodCallResult callSerializableNativeHook(unsigned int reactMethodId, folly::dynamic&& args) = 0; -}; - -} -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/NativeToJsBridge.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/NativeToJsBridge.cpp deleted file mode 100644 index b5401267..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/NativeToJsBridge.cpp +++ /dev/null @@ -1,272 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "NativeToJsBridge.h" - -#include -#include -#include -#include - -#include "Instance.h" -#include "JSBigString.h" -#include "SystraceSection.h" -#include "MethodCall.h" -#include "MessageQueueThread.h" -#include "ModuleRegistry.h" -#include "RAMBundleRegistry.h" - -#ifdef WITH_FBSYSTRACE -#include -using fbsystrace::FbSystraceAsyncFlow; -#endif - -namespace facebook { -namespace react { - -// This class manages calls from JS to native code. -class JsToNativeBridge : public react::ExecutorDelegate { -public: - JsToNativeBridge(std::shared_ptr registry, - std::shared_ptr callback) - : m_registry(registry) - , m_callback(callback) {} - - std::shared_ptr getModuleRegistry() override { - return m_registry; - } - - bool isBatchActive() { - return m_batchHadNativeModuleCalls; - } - - void callNativeModules( - JSExecutor& executor, folly::dynamic&& calls, bool isEndOfBatch) override { - - CHECK(m_registry || calls.empty()) << - "native module calls cannot be completed with no native modules"; - m_batchHadNativeModuleCalls = m_batchHadNativeModuleCalls || !calls.empty(); - - // An exception anywhere in here stops processing of the batch. This - // was the behavior of the Android bridge, and since exception handling - // terminates the whole bridge, there's not much point in continuing. - for (auto& call : parseMethodCalls(std::move(calls))) { - m_registry->callNativeMethod(call.moduleId, call.methodId, std::move(call.arguments), call.callId); - } - if (isEndOfBatch) { - // onBatchComplete will be called on the native (module) queue, but - // decrementPendingJSCalls will be called sync. Be aware that the bridge may still - // be processing native calls when the birdge idle signaler fires. - if (m_batchHadNativeModuleCalls) { - m_callback->onBatchComplete(); - m_batchHadNativeModuleCalls = false; - } - m_callback->decrementPendingJSCalls(); - } - } - - MethodCallResult callSerializableNativeHook( - JSExecutor& executor, unsigned int moduleId, unsigned int methodId, - folly::dynamic&& args) override { - return m_registry->callSerializableNativeHook(moduleId, methodId, std::move(args)); - } - -private: - - // These methods are always invoked from an Executor. The NativeToJsBridge - // keeps a reference to the executor, and when destroy() is called, the - // executor is destroyed synchronously on its queue. - std::shared_ptr m_registry; - std::shared_ptr m_callback; - bool m_batchHadNativeModuleCalls = false; -}; - -NativeToJsBridge::NativeToJsBridge( - JSExecutorFactory* jsExecutorFactory, - std::shared_ptr registry, - std::shared_ptr jsQueue, - std::shared_ptr callback) - : m_destroyed(std::make_shared(false)) - , m_delegate(std::make_shared(registry, callback)) - , m_executor(jsExecutorFactory->createJSExecutor(m_delegate, jsQueue)) - , m_executorMessageQueueThread(std::move(jsQueue)) {} - -// This must be called on the same thread on which the constructor was called. -NativeToJsBridge::~NativeToJsBridge() { - CHECK(*m_destroyed) << - "NativeToJsBridge::destroy() must be called before deallocating the NativeToJsBridge!"; -} - -void NativeToJsBridge::loadApplication( - std::unique_ptr bundleRegistry, - std::unique_ptr startupScript, - std::string startupScriptSourceURL) { - - runOnExecutorQueue( - [this, - bundleRegistryWrap=folly::makeMoveWrapper(std::move(bundleRegistry)), - startupScript=folly::makeMoveWrapper(std::move(startupScript)), - startupScriptSourceURL=std::move(startupScriptSourceURL)] - (JSExecutor* executor) mutable { - auto bundleRegistry = bundleRegistryWrap.move(); - if (bundleRegistry) { - executor->setBundleRegistry(std::move(bundleRegistry)); - } - try { - executor->loadApplicationScript(std::move(*startupScript), - std::move(startupScriptSourceURL)); - } catch (...) { - m_applicationScriptHasFailure = true; - throw; - } - }); -} - -void NativeToJsBridge::loadApplicationSync( - std::unique_ptr bundleRegistry, - std::unique_ptr startupScript, - std::string startupScriptSourceURL) { - if (bundleRegistry) { - m_executor->setBundleRegistry(std::move(bundleRegistry)); - } - try { - m_executor->loadApplicationScript(std::move(startupScript), - std::move(startupScriptSourceURL)); - } catch (...) { - m_applicationScriptHasFailure = true; - throw; - } -} - -void NativeToJsBridge::callFunction( - std::string&& module, - std::string&& method, - folly::dynamic&& arguments) { - int systraceCookie = -1; - #ifdef WITH_FBSYSTRACE - systraceCookie = m_systraceCookie++; - FbSystraceAsyncFlow::begin( - TRACE_TAG_REACT_CXX_BRIDGE, - "JSCall", - systraceCookie); - #endif - - runOnExecutorQueue([this, module = std::move(module), method = std::move(method), arguments = std::move(arguments), systraceCookie] - (JSExecutor* executor) { - if (m_applicationScriptHasFailure) { - LOG(ERROR) << "Attempting to call JS function on a bad application bundle: " << module.c_str() << "." << method.c_str() << "()"; - throw std::runtime_error("Attempting to call JS function on a bad application bundle: " + module + "." + method + "()"); - } - - #ifdef WITH_FBSYSTRACE - FbSystraceAsyncFlow::end( - TRACE_TAG_REACT_CXX_BRIDGE, - "JSCall", - systraceCookie); - SystraceSection s("NativeToJsBridge::callFunction", "module", module, "method", method); - #else - (void)(systraceCookie); - #endif - // This is safe because we are running on the executor's thread: it won't - // destruct until after it's been unregistered (which we check above) and - // that will happen on this thread - executor->callFunction(module, method, arguments); - }); -} - -void NativeToJsBridge::invokeCallback(double callbackId, folly::dynamic&& arguments) { - int systraceCookie = -1; - #ifdef WITH_FBSYSTRACE - systraceCookie = m_systraceCookie++; - FbSystraceAsyncFlow::begin( - TRACE_TAG_REACT_CXX_BRIDGE, - "", - systraceCookie); - #endif - - runOnExecutorQueue([this, callbackId, arguments = std::move(arguments), systraceCookie] - (JSExecutor* executor) { - if (m_applicationScriptHasFailure) { - LOG(ERROR) << "Attempting to call JS callback on a bad application bundle: " << callbackId; - throw std::runtime_error("Attempting to invoke JS callback on a bad application bundle."); - } - #ifdef WITH_FBSYSTRACE - FbSystraceAsyncFlow::end( - TRACE_TAG_REACT_CXX_BRIDGE, - "", - systraceCookie); - SystraceSection s("NativeToJsBridge::invokeCallback"); - #else - (void)(systraceCookie); - #endif - executor->invokeCallback(callbackId, arguments); - }); -} - -void NativeToJsBridge::registerBundle(uint32_t bundleId, const std::string& bundlePath) { - runOnExecutorQueue([bundleId, bundlePath] (JSExecutor* executor) { - executor->registerBundle(bundleId, bundlePath); - }); -} - -void NativeToJsBridge::setGlobalVariable(std::string propName, - std::unique_ptr jsonValue) { - runOnExecutorQueue([propName=std::move(propName), jsonValue=folly::makeMoveWrapper(std::move(jsonValue))] - (JSExecutor* executor) mutable { - executor->setGlobalVariable(propName, jsonValue.move()); - }); -} - -void* NativeToJsBridge::getJavaScriptContext() { - // TODO(cjhopman): this seems unsafe unless we require that it is only called on the main js queue. - return m_executor->getJavaScriptContext(); -} - -bool NativeToJsBridge::isInspectable() { - return m_executor->isInspectable(); -} - -bool NativeToJsBridge::isBatchActive() { - return m_delegate->isBatchActive(); -} - -void NativeToJsBridge::handleMemoryPressure(int pressureLevel) { - runOnExecutorQueue([=] (JSExecutor* executor) { - executor->handleMemoryPressure(pressureLevel); - }); -} - -void NativeToJsBridge::destroy() { - // All calls made through runOnExecutorQueue have an early exit if - // m_destroyed is true. Setting this before the runOnQueueSync will cause - // pending work to be cancelled and we won't have to wait for it. - *m_destroyed = true; - m_executorMessageQueueThread->runOnQueueSync([this] { - m_executor->destroy(); - m_executorMessageQueueThread->quitSynchronous(); - m_executor = nullptr; - }); -} - -void NativeToJsBridge::runOnExecutorQueue(std::function task) { - if (*m_destroyed) { - return; - } - - std::shared_ptr isDestroyed = m_destroyed; - m_executorMessageQueueThread->runOnQueue([this, isDestroyed, task=std::move(task)] { - if (*isDestroyed) { - return; - } - - // The executor is guaranteed to be valid for the duration of the task because: - // 1. the executor is only destroyed after it is unregistered - // 2. the executor is unregistered on this queue - // 3. we just confirmed that the executor hasn't been unregistered above - task(m_executor.get()); - }); -} - -} } diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/NativeToJsBridge.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/NativeToJsBridge.h deleted file mode 100644 index cc30054a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/NativeToJsBridge.h +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include -#include - -#include - -namespace folly { -struct dynamic; -} - -namespace facebook { -namespace react { - -struct InstanceCallback; -class JsToNativeBridge; -class MessageQueueThread; -class ModuleRegistry; -class RAMBundleRegistry; - -// This class manages calls from native code to JS. It also manages -// executors and their threads. All functions here can be called from -// any thread. -// -// Except for loadApplicationScriptSync(), all void methods will queue -// work to run on the jsQueue passed to the ctor, and return -// immediately. -class NativeToJsBridge { -public: - friend class JsToNativeBridge; - - /** - * This must be called on the main JS thread. - */ - NativeToJsBridge( - JSExecutorFactory* jsExecutorFactory, - std::shared_ptr registry, - std::shared_ptr jsQueue, - std::shared_ptr callback); - virtual ~NativeToJsBridge(); - - /** - * Executes a function with the module ID and method ID and any additional - * arguments in JS. - */ - void callFunction(std::string&& module, std::string&& method, folly::dynamic&& args); - - /** - * Invokes a callback with the cbID, and optional additional arguments in JS. - */ - void invokeCallback(double callbackId, folly::dynamic&& args); - - /** - * Starts the JS application. If bundleRegistry is non-null, then it is - * used to fetch JavaScript modules as individual scripts. - * Otherwise, the script is assumed to include all the modules. - */ - void loadApplication( - std::unique_ptr bundleRegistry, - std::unique_ptr startupCode, - std::string sourceURL); - void loadApplicationSync( - std::unique_ptr bundleRegistry, - std::unique_ptr startupCode, - std::string sourceURL); - - void registerBundle(uint32_t bundleId, const std::string& bundlePath); - void setGlobalVariable(std::string propName, std::unique_ptr jsonValue); - void* getJavaScriptContext(); - bool isInspectable(); - bool isBatchActive(); - - void handleMemoryPressure(int pressureLevel); - - /** - * Synchronously tears down the bridge and the main executor. - */ - void destroy(); -private: - void runOnExecutorQueue(std::function task); - - // This is used to avoid a race condition where a proxyCallback gets queued - // after ~NativeToJsBridge(), on the same thread. In that case, the callback - // will try to run the task on m_callback which will have been destroyed - // within ~NativeToJsBridge(), thus causing a SIGSEGV. - std::shared_ptr m_destroyed; - std::shared_ptr m_delegate; - std::unique_ptr m_executor; - std::shared_ptr m_executorMessageQueueThread; - - // Keep track of whether the JS bundle containing the application logic causes - // exception when evaluated initially. If so, more calls to JS will very - // likely fail as well, so this flag can help prevent them. - bool m_applicationScriptHasFailure = false; - - #ifdef WITH_FBSYSTRACE - std::atomic_uint_least32_t m_systraceCookie = ATOMIC_VAR_INIT(); - #endif -}; - -} } diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/RAMBundleRegistry.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/RAMBundleRegistry.cpp deleted file mode 100644 index f53370d3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/RAMBundleRegistry.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "RAMBundleRegistry.h" - -#include -#include - -namespace facebook { -namespace react { - -constexpr uint32_t RAMBundleRegistry::MAIN_BUNDLE_ID; - -std::unique_ptr RAMBundleRegistry::singleBundleRegistry( - std::unique_ptr mainBundle) { - return folly::make_unique(std::move(mainBundle)); -} - -std::unique_ptr RAMBundleRegistry::multipleBundlesRegistry( - std::unique_ptr mainBundle, - std::function(std::string)> factory) { - return folly::make_unique( - std::move(mainBundle), std::move(factory)); -} - -RAMBundleRegistry::RAMBundleRegistry( - std::unique_ptr mainBundle, - std::function(std::string)> factory): - m_factory(std::move(factory)) { - m_bundles.emplace(MAIN_BUNDLE_ID, std::move(mainBundle)); -} - -void RAMBundleRegistry::registerBundle( - uint32_t bundleId, std::string bundlePath) { - m_bundlePaths.emplace(bundleId, std::move(bundlePath)); -} - -JSModulesUnbundle::Module RAMBundleRegistry::getModule( - uint32_t bundleId, uint32_t moduleId) { - if (m_bundles.find(bundleId) == m_bundles.end()) { - if (!m_factory) { - throw std::runtime_error( - "You need to register factory function in order to " - "support multiple RAM bundles." - ); - } - - auto bundlePath = m_bundlePaths.find(bundleId); - if (bundlePath == m_bundlePaths.end()) { - throw std::runtime_error( - "In order to fetch RAM bundle from the registry, its file " - "path needs to be registered first." - ); - } - m_bundles.emplace(bundleId, m_factory(bundlePath->second)); - } - - auto module = getBundle(bundleId)->getModule(moduleId); - if (bundleId == MAIN_BUNDLE_ID) { - return module; - } - return { - folly::to("seg-", bundleId, '_', std::move(module.name)), - std::move(module.code), - }; -} - -JSModulesUnbundle* RAMBundleRegistry::getBundle(uint32_t bundleId) const { - return m_bundles.at(bundleId).get(); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/RAMBundleRegistry.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/RAMBundleRegistry.h deleted file mode 100644 index 224e1541..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/RAMBundleRegistry.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include -#include -#include - -#include - -#ifndef RN_EXPORT -#define RN_EXPORT __attribute__((visibility("default"))) -#endif - -namespace facebook { -namespace react { - -class RN_EXPORT RAMBundleRegistry { -public: - constexpr static uint32_t MAIN_BUNDLE_ID = 0; - - static std::unique_ptr singleBundleRegistry( - std::unique_ptr mainBundle); - static std::unique_ptr multipleBundlesRegistry( - std::unique_ptr mainBundle, - std::function(std::string)> factory); - - explicit RAMBundleRegistry( - std::unique_ptr mainBundle, - std::function< - std::unique_ptr(std::string)> factory = nullptr); - - RAMBundleRegistry(RAMBundleRegistry&&) = default; - RAMBundleRegistry& operator=(RAMBundleRegistry&&) = default; - - void registerBundle(uint32_t bundleId, std::string bundlePath); - JSModulesUnbundle::Module getModule(uint32_t bundleId, uint32_t moduleId); - virtual ~RAMBundleRegistry() {}; -private: - JSModulesUnbundle* getBundle(uint32_t bundleId) const; - - std::function(std::string)> m_factory; - std::unordered_map m_bundlePaths; - std::unordered_map> m_bundles; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/ReactMarker.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/ReactMarker.cpp deleted file mode 100644 index 075fd8ff..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/ReactMarker.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "ReactMarker.h" - -namespace facebook { -namespace react { -namespace ReactMarker { - -#if __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wglobal-constructors" -#endif - -LogTaggedMarker logTaggedMarker = nullptr; - -#if __clang__ -#pragma clang diagnostic pop -#endif - -void logMarker(const ReactMarkerId markerId) { - logTaggedMarker(markerId, nullptr); -} - -} -} -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/ReactMarker.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/ReactMarker.h deleted file mode 100644 index 21d5deb0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/ReactMarker.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#ifdef __APPLE__ -#include -#endif - -namespace facebook { -namespace react { -namespace ReactMarker { - -enum ReactMarkerId { - NATIVE_REQUIRE_START, - NATIVE_REQUIRE_STOP, - RUN_JS_BUNDLE_START, - RUN_JS_BUNDLE_STOP, - CREATE_REACT_CONTEXT_STOP, - JS_BUNDLE_STRING_CONVERT_START, - JS_BUNDLE_STRING_CONVERT_STOP, - NATIVE_MODULE_SETUP_START, - NATIVE_MODULE_SETUP_STOP, - REGISTER_JS_SEGMENT_START, - REGISTER_JS_SEGMENT_STOP -}; - -#ifdef __APPLE__ -using LogTaggedMarker = std::function; -#else -typedef void(*LogTaggedMarker)(const ReactMarkerId, const char* tag); -#endif - -#ifndef RN_EXPORT -#define RN_EXPORT __attribute__((visibility("default"))) -#endif - -extern RN_EXPORT LogTaggedMarker logTaggedMarker; - -extern RN_EXPORT void logMarker(const ReactMarkerId markerId); - -} -} -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/RecoverableError.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/RecoverableError.h deleted file mode 100644 index 2ecc64bf..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/RecoverableError.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -/** - * RecoverableError - * - * An exception that it is expected we should be able to recover from. - */ -struct RecoverableError : public std::exception { - - explicit RecoverableError(const std::string &what_) - : m_what { "facebook::react::Recoverable: " + what_ } - {} - - virtual const char* what() const noexcept override { return m_what.c_str(); } - - /** - * runRethrowingAsRecoverable - * - * Helper function that converts any exception of type `E`, thrown within the - * `act` routine into a recoverable error with the same message. - */ - template - inline static void runRethrowingAsRecoverable(std::function act) { - try { - act(); - } catch(const E &err) { - throw RecoverableError(err.what()); - } - } - -private: - std::string m_what; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/SampleCxxModule.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/SampleCxxModule.cpp deleted file mode 100644 index 1862c0f0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/SampleCxxModule.cpp +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "SampleCxxModule.h" -#include - -#include -#include - -#include - -using namespace folly; - -namespace facebook { namespace xplat { namespace samples { - -std::string Sample::hello() { - LOG(WARNING) << "glog: hello, world"; - return "hello"; -} - -double Sample::add(double a, double b) { - return a + b; -} - -std::string Sample::concat(const std::string& a, const std::string& b) { - return a + b; -} - -std::string Sample::repeat(int count, const std::string& str) { - std::string ret; - for (int i = 0; i < count; i++) { - ret += str; - } - - return ret; -} - -void Sample::save(std::map dict) -{ - state_ = std::move(dict); -} - -std::map Sample::load() { - return state_; -} - -void Sample::except() { -// TODO mhorowitz #7128529: There's no way to automatically test this -// right now. - // throw std::runtime_error("oops"); -} - -void Sample::call_later(int msec, std::function f) { - std::thread t([=] { - std::this_thread::sleep_for(std::chrono::milliseconds(msec)); - f(); - }); - t.detach(); -} - -double Sample::twice(double n) { - return n * 2; -} - -SampleCxxModule::SampleCxxModule(std::unique_ptr sample) - : sample_(std::move(sample)) {} - -std::string SampleCxxModule::getName() { - return "Sample"; -} - -auto SampleCxxModule::getConstants() -> std::map { - return { - { "one", 1 }, - { "two", 2 }, - { "animal", "fox" }, - }; -} - -auto SampleCxxModule::getMethods() -> std::vector { - return { - Method("hello", [this] { - sample_->hello(); - }), - Method("add", [this](dynamic args, Callback cb) { - LOG(WARNING) << "Sample: add => " - << sample_->add(jsArgAsDouble(args, 0), jsArgAsDouble(args, 1)); - cb({sample_->add(jsArgAsDouble(args, 0), jsArgAsDouble(args, 1))}); - }), - Method("concat", [this](dynamic args, Callback cb) { - cb({sample_->concat(jsArgAsString(args, 0), - jsArgAsString(args, 1))}); - }), - Method("repeat", [this](dynamic args, Callback cb) { - cb({sample_->repeat(jsArgAsInt(args, 0), - jsArgAsString(args, 1))}); - }), - Method("save", this, &SampleCxxModule::save), - Method("load", this, &SampleCxxModule::load), - Method("call_later", [this](dynamic args, Callback cb) { - sample_->call_later(jsArgAsInt(args, 0), [cb] { - cb({}); - }); - }), - Method("except", [this] { - sample_->except(); - }), - Method("twice", [this](dynamic args) -> dynamic { - return sample_->twice(jsArgAsDouble(args, 0)); - }, SyncTag), - Method("syncHello", [this]() -> dynamic { - sample_->hello(); - return nullptr; - }, SyncTag), - Method("addIfPositiveAsPromise", [](dynamic args, Callback cb, Callback cbError) { - auto a = jsArgAsDouble(args, 0); - auto b = jsArgAsDouble(args, 1); - if (a < 0 || b < 0) { - cbError({"Negative number!"}); - } else { - cb({a + b}); - } - }), - Method("addIfPositiveAsAsync", [](dynamic args, Callback cb, Callback cbError) { - auto a = jsArgAsDouble(args, 0); - auto b = jsArgAsDouble(args, 1); - if (a < 0 || b < 0) { - cbError({"Negative number!"}); - } else { - cb({a + b}); - } - }, AsyncTag), - - }; -} - -void SampleCxxModule::save(folly::dynamic args) { - std::map m; - for (const auto& p : jsArgN(args, 0, &dynamic::items)) { - m.emplace(jsArg(p.first, &dynamic::asString, "map key"), - jsArg(p.second, &dynamic::asString, "map value")); - } - sample_->save(std::move(m)); -} - -void SampleCxxModule::load(folly::dynamic args, Callback cb) { - dynamic d = dynamic::object; - for (const auto& p : sample_->load()) { - d.insert(p.first, p.second); - } - cb({d}); -} - -}}} - -// By convention, the function name should be the same as the class name. -facebook::xplat::module::CxxModule *SampleCxxModule() { - return new facebook::xplat::samples::SampleCxxModule( - folly::make_unique()); -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/SampleCxxModule.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/SampleCxxModule.h deleted file mode 100644 index d7fa1193..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/SampleCxxModule.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include - -#include - -namespace facebook { namespace xplat { namespace samples { - -// In a less contrived example, Sample would be part of a traditional -// C++ library. - -class Sample { -public: - std::string hello(); - double add(double a, double b); - std::string concat(const std::string& a, const std::string& b); - std::string repeat(int count, const std::string& str); - void save(std::map dict); - std::map load(); - void call_later(int msec, std::function f); - void except(); - double twice(double n); - -private: - std::map state_; -}; - -class SampleCxxModule : public module::CxxModule { -public: - SampleCxxModule(std::unique_ptr sample); - - std::string getName(); - - virtual auto getConstants() -> std::map; - - virtual auto getMethods() -> std::vector; - -private: - void save(folly::dynamic args); - void load(folly::dynamic args, Callback cb); - - std::unique_ptr sample_; -}; - -}}} - -extern "C" facebook::xplat::module::CxxModule *SampleCxxModule(); diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/SharedProxyCxxModule.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/SharedProxyCxxModule.h deleted file mode 100644 index 2e0d731d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/SharedProxyCxxModule.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include - -#include - -namespace facebook { namespace xplat { namespace module { - -// Allows a Cxx-module to be shared or reused across multiple React instances -// Caveat: the setInstance call is not forwarded, so usages of getInstance inside your -// module (e.g. dispatching events) will always be nullptr. -class SharedProxyCxxModule : public CxxModule { -public: - explicit SharedProxyCxxModule(std::shared_ptr shared) - : shared_(shared) {} - - std::string getName() override { - return shared_->getName(); - } - - auto getConstants() -> std::map override { - return shared_->getConstants(); - } - - auto getMethods() -> std::vector override { - return shared_->getMethods(); - } - -private: - std::shared_ptr shared_; -}; - -} -} -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/SystraceSection.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/SystraceSection.h deleted file mode 100644 index 381d099c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/SystraceSection.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#ifdef WITH_FBSYSTRACE -#include -#endif - -namespace facebook { -namespace react { - -/** - * This is a convenience class to avoid lots of verbose profiling - * #ifdefs. If WITH_FBSYSTRACE is not defined, the optimizer will - * remove this completely. If it is defined, it will behave as - * FbSystraceSection, with the right tag provided. Use two separate classes to - * to ensure that the ODR rule isn't violated, that is, if WITH_FBSYSTRACE has - * different values in different files, there is no inconsistency in the sizes - * of defined symbols. - */ -#ifdef WITH_FBSYSTRACE -struct ConcreteSystraceSection { -public: - template - explicit - ConcreteSystraceSection(const char* name, ConvertsToStringPiece&&... args) - : m_section(TRACE_TAG_REACT_CXX_BRIDGE, name, args...) - {} - -private: - fbsystrace::FbSystraceSection m_section; -}; -using SystraceSection = ConcreteSystraceSection; -#else -struct DummySystraceSection { -public: - template - explicit - DummySystraceSection(const char* name, ConvertsToStringPiece&&... args) - {} -}; -using SystraceSection = DummySystraceSection; -#endif - -}} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/tests/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/tests/BUCK deleted file mode 100644 index e25870d3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/tests/BUCK +++ /dev/null @@ -1,57 +0,0 @@ -load( - "//tools/build_defs/oss:rn_defs.bzl", - "APPLE", - "fb_xplat_cxx_test", - "jni_instrumentation_test_lib", - "react_native_xplat_target", -) - -TEST_SRCS = [ - "RecoverableErrorTest.cpp", - "JSDeltaBundleClientTest.cpp", - "jsarg_helpers.cpp", - "jsbigstring.cpp", - "methodcall.cpp", -] - -jni_instrumentation_test_lib( - name = "tests", - srcs = TEST_SRCS, - class_under_test = "com/facebook/react/XplatBridgeTest", - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - ], - soname = "libxplat-bridge.so", - visibility = [ - "fbandroid//instrumentation_tests/...", - ], - deps = [ - "xplat//folly:dynamic", - "xplat//third-party/gmock:gtest", - "xplat//third-party/linker_lib:android", - "xplat//third-party/linker_lib:atomic", - react_native_xplat_target("cxxreact:bridge"), - react_native_xplat_target("cxxreact:jsbigstring"), - ], -) - -fb_xplat_cxx_test( - name = "tests", - srcs = TEST_SRCS, - compiler_flags = [ - "-fexceptions", - "-frtti", - ], - platforms = APPLE, - visibility = [ - react_native_xplat_target("cxxreact/..."), - ], - deps = [ - "xplat//folly:molly", - "xplat//third-party/gmock:gtest", - react_native_xplat_target("cxxreact:bridge"), - react_native_xplat_target("cxxreact:jsbigstring"), - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/tests/JSDeltaBundleClientTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/tests/JSDeltaBundleClientTest.cpp deleted file mode 100644 index c3a70ab2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/tests/JSDeltaBundleClientTest.cpp +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include - -#include -#include -#include - -#include -#include -#include - -using namespace facebook::react; - -TEST(JSDeltaBundleClient, PatchStartupCode) { - JSDeltaBundleClient client; - - folly::dynamic delta1 = folly::parseJson(R"({ - "base": true, - "revisionId": "rev0", - "pre": "pre", - "post": "post", - "modules": [ - [0, "0"], - [1, "1"] - ] - })"); - - client.patch(delta1); - - EXPECT_STREQ(client.getStartupCode()->c_str(), "pre\npost\n"); - - folly::dynamic delta2 = folly::parseJson(R"({ - "base": true, - "revisionId": "rev1", - "pre": "pre2", - "post": "post2", - "modules": [] - })"); - - client.patch(delta2); - - EXPECT_STREQ(client.getStartupCode()->c_str(), "pre2\npost2\n"); -} - -TEST(JSDeltaBundleClient, PatchModule) { - JSDeltaBundleClient client; - - folly::dynamic delta1 = folly::parseJson(R"({ - "base": true, - "revisionId": "rev0", - "pre": "pre", - "post": "post", - "modules": [ - [0, "0"], - [1, "1"] - ] - })"); - - client.patch(delta1); - - EXPECT_EQ(client.getModule(0).code, "0"); - EXPECT_EQ(client.getModule(1).code, "1"); - - ASSERT_THROW(client.getModule(2), JSModulesUnbundle::ModuleNotFound); - - folly::dynamic delta2 = folly::parseJson(R"({ - "base": false, - "revisionId": "rev1", - "added": [ - [2, "2"] - ], - "modified": [ - [0, "0.1"] - ], - "deleted": [1] - })"); - - client.patch(delta2); - - EXPECT_EQ(client.getModule(0).code, "0.1"); - EXPECT_EQ(client.getModule(2).code, "2"); - ASSERT_THROW(client.getModule(1), JSModulesUnbundle::ModuleNotFound); - - folly::dynamic delta3 = folly::parseJson(R"({ - "base": true, - "revisionId": "rev2", - "pre": "pre", - "post": "post", - "modules": [ - [3, "3"], - [4, "4"] - ] - })"); - - client.patch(delta3); - - ASSERT_THROW(client.getModule(0), JSModulesUnbundle::ModuleNotFound); - ASSERT_THROW(client.getModule(1), JSModulesUnbundle::ModuleNotFound); - ASSERT_THROW(client.getModule(2), JSModulesUnbundle::ModuleNotFound); - - EXPECT_EQ(client.getModule(3).code, "3"); - EXPECT_EQ(client.getModule(4).code, "4"); -} - -TEST(JSDeltaBundleClient, Clear) { - JSDeltaBundleClient client; - - folly::dynamic delta1 = folly::parseJson(R"({ - "base": true, - "revisionId": "rev0", - "pre": "pre", - "post": "post", - "modules": [ - [0, "0"], - [1, "1"] - ] - })"); - - client.patch(delta1); - - client.clear(); - - ASSERT_THROW(client.getModule(0), JSModulesUnbundle::ModuleNotFound); - ASSERT_THROW(client.getModule(1), JSModulesUnbundle::ModuleNotFound); - - EXPECT_STREQ(client.getStartupCode()->c_str(), ""); -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/tests/RecoverableErrorTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/tests/RecoverableErrorTest.cpp deleted file mode 100644 index ea84601c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/tests/RecoverableErrorTest.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include - -#include -#include - -#include - -using namespace facebook::react; - -TEST(RecoverableError, RunRethrowingAsRecoverableRecoverTest) { - try { - RecoverableError::runRethrowingAsRecoverable([]() { - throw std::runtime_error("catch me"); - }); - FAIL() << "Unthrown exception"; - } catch (const RecoverableError &err) { - ASSERT_STREQ(err.what(), "facebook::react::Recoverable: catch me"); - } catch (...) { - FAIL() << "Uncaught exception"; - } -} - -TEST(RecoverableError, RunRethrowingAsRecoverableFallthroughTest) { - try { - RecoverableError::runRethrowingAsRecoverable([]() { - throw std::logic_error("catch me"); - }); - FAIL() << "Unthrown exception"; - } catch (const RecoverableError &err) { - FAIL() << "Recovered exception that should have fallen through"; - } catch (const std::exception &err) { - ASSERT_STREQ(err.what(), "catch me"); - } -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/tests/jsarg_helpers.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/tests/jsarg_helpers.cpp deleted file mode 100644 index 2c52c1d8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/tests/jsarg_helpers.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include - -#include - -#include -#include - -using namespace std; -using namespace folly; -using namespace facebook::xplat; - -#define EXPECT_JSAE(statement, exstr) do { \ - try { \ - statement; \ - FAIL() << "Expected JsArgumentException(" << (exstr) << ") not thrown"; \ - } catch (const JsArgumentException& ex) { \ - EXPECT_EQ(ex.what(), std::string(exstr)); \ - } \ - } while(0) // let any other exception escape, gtest will deal. - -TEST(JsArgumentHelpersTest, args) { - const bool aBool = true; - const int64_t anInt = 17; - const double aDouble = 3.14; - const string aString = "word"; - const dynamic anArray = dynamic::array("a", "b", "c"); - const dynamic anObject = dynamic::object("k1", "v1")("k2", "v2"); - const string aNumericString = to(anInt); - - folly::dynamic args = dynamic::array(aBool, anInt, aDouble, aString, anArray, anObject, aNumericString); - - EXPECT_EQ(jsArgAsBool(args, 0), aBool); - EXPECT_EQ(jsArgAsInt(args, 1), anInt); - EXPECT_EQ(jsArgAsDouble(args, 2), aDouble); - EXPECT_EQ(jsArgAsString(args, 3), aString); - EXPECT_EQ(jsArgAsArray(args, 4), anArray); - EXPECT_EQ(jsArgAsObject(args, 5), anObject); - - // const args - const folly::dynamic& cargs = args; - const folly::dynamic& a4 = jsArgAsArray(cargs, 4); - EXPECT_EQ(a4, anArray); - EXPECT_EQ(jsArgAsObject(cargs, 5), anObject); - - // helpers returning dynamic should return same object without copying - EXPECT_EQ(&jsArgAsArray(args, 4), &(args[4])); - EXPECT_EQ(&jsArgAsArray(cargs, 4), &(args[4])); - - // dynamics returned for mutable args should be mutable. The test is that - // this compiles. - jsArgAsArray(args, 4)[2] = "d"; - jsArgAsArray(args, 4)[2] = "c"; - // These fail to compile due to constness. - // jsArgAsArray(cargs, 4)[2] = "d"; - // jsArgAsArray(cargs, 4)[2] = "c"; - - // ref-qualified member function tests - EXPECT_EQ(jsArgN(args, 3, &folly::dynamic::getString), aString); - EXPECT_EQ(jsArg(args[3], &folly::dynamic::getString), aString); - - // conversions - EXPECT_EQ(jsArgAsDouble(args, 1), anInt * 1.0); - EXPECT_EQ(jsArgAsString(args, 1), aNumericString); - EXPECT_EQ(jsArgAsInt(args, 6), anInt); - - // Test exception messages. - - // out_of_range - EXPECT_JSAE(jsArgAsBool(args, 7), - "JavaScript provided 7 arguments for C++ method which references at least " - "8 arguments: out of range in dynamic array"); - // Conv range_error (invalid value conversion) - const std::string exhead = "Could not convert argument 3 to required type: "; - const std::string extail = ": Invalid leading character: \"word\""; - try { - jsArgAsInt(args, 3); - FAIL() << "Expected JsArgumentException(" << exhead << "..." << extail << ") not thrown"; - } catch (const JsArgumentException& ex) { - const std::string exwhat = ex.what(); - - EXPECT_GT(exwhat.size(), exhead.size()); - EXPECT_GT(exwhat.size(), extail.size()); - - EXPECT_TRUE(std::equal(exhead.cbegin(), exhead.cend(), exwhat.cbegin())) - << "JsArgumentException('" << exwhat << "') does not begin with '" << exhead << "'"; - EXPECT_TRUE(std::equal(extail.crbegin(), extail.crend(), exwhat.crbegin())) - << "JsArgumentException('" << exwhat << "') does not end with '" << extail << "'"; - } - // inconvertible types - EXPECT_JSAE(jsArgAsArray(args, 2), - "Argument 3 of type double is not required type Array"); - EXPECT_JSAE(jsArgAsInt(args, 4), - "Error converting javascript arg 4 to C++: " - "TypeError: expected dynamic type `int/double/bool/string', but had type `array'"); - // type predicate failure - EXPECT_JSAE(jsArgAsObject(args, 4), - "Argument 5 of type array is not required type Object"); -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/tests/jsbigstring.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/tests/jsbigstring.cpp deleted file mode 100644 index 69e265c9..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/tests/jsbigstring.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. -#include -#include - -#include -#include -#include - -using namespace facebook; -using namespace facebook::react; - -namespace { -int tempFileFromString(std::string contents) -{ - std::string tmp {getenv("TMPDIR")}; - tmp += "/temp.XXXXXX"; - - std::vector tmpBuf {tmp.begin(), tmp.end()}; - tmpBuf.push_back('\0'); - - const int fd = mkstemp(tmpBuf.data()); - write(fd, contents.c_str(), contents.size() + 1); - - return fd; -} -}; - -TEST(JSBigFileString, MapWholeFileTest) { - std::string data {"Hello, world"}; - const auto size = data.length() + 1; - - // Initialise Big String - int fd = tempFileFromString("Hello, world"); - JSBigFileString bigStr {fd, size}; - - // Test - ASSERT_STREQ(data.c_str(), bigStr.c_str()); -} - -TEST(JSBigFileString, MapPartTest) { - std::string data {"Hello, world"}; - - // Sub-string to actually map - std::string needle {"or"}; - off_t offset = data.find(needle); - - // Initialise Big String - int fd = tempFileFromString(data); - JSBigFileString bigStr {fd, needle.size(), offset}; - - // Test - ASSERT_EQ(needle.length(), bigStr.size()); - for (unsigned int i = 0; i < needle.length(); ++i) { - ASSERT_EQ(needle[i], bigStr.c_str()[i]); - } -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/tests/methodcall.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/tests/methodcall.cpp deleted file mode 100644 index 15e47e0a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/cxxreact/tests/methodcall.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include - -#include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-compare" -#include -#pragma GCC diagnostic pop - -using namespace facebook; -using namespace facebook::react; -using namespace folly; - -TEST(parseMethodCalls, SingleReturnCallNoArgs) { - auto jsText = "[[7],[3],[[]]]"; - auto returnedCalls = parseMethodCalls(folly::parseJson(jsText)); - ASSERT_EQ(1, returnedCalls.size()); - auto returnedCall = returnedCalls[0]; - ASSERT_EQ(0, returnedCall.arguments.size()); - ASSERT_EQ(7, returnedCall.moduleId); - ASSERT_EQ(3, returnedCall.methodId); -} - -TEST(parseMethodCalls, InvalidReturnFormat) { - try { - auto input = dynamic::object("foo", 1); - parseMethodCalls(std::move(input)); - ADD_FAILURE(); - } catch (const std::invalid_argument&) { - // ignored - } - try { - auto input = dynamic::array(dynamic::object("foo", 1)); - parseMethodCalls(std::move(input)); - ADD_FAILURE(); - } catch (const std::invalid_argument&) { - // ignored - } - try { - auto input = dynamic::array(1, 4, dynamic::object("foo", 2)); - parseMethodCalls(std::move(input)); - ADD_FAILURE(); - } catch (const std::invalid_argument&) { - // ignored - } - try { - auto input = dynamic::array(dynamic::array(1), - dynamic::array(4), - dynamic::object("foo", 2)); - parseMethodCalls(std::move(input)); - ADD_FAILURE(); - } catch (const std::invalid_argument&) { - // ignored - } - try { - auto input = dynamic::array(dynamic::array(1), - dynamic::array(4), - dynamic::array()); - parseMethodCalls(std::move(input)); - ADD_FAILURE(); - } catch (const std::invalid_argument&) { - // ignored - } -} - -TEST(parseMethodCalls, NumberReturn) { - auto jsText = "[[0],[0],[[\"foobar\"]]]"; - auto returnedCalls = parseMethodCalls(folly::parseJson(jsText)); - ASSERT_EQ(1, returnedCalls.size()); - auto returnedCall = returnedCalls[0]; - ASSERT_EQ(1, returnedCall.arguments.size()); - ASSERT_EQ(folly::dynamic::STRING, returnedCall.arguments[0].type()); - ASSERT_EQ("foobar", returnedCall.arguments[0].asString()); -} - -TEST(parseMethodCalls, StringReturn) { - auto jsText = "[[0],[0],[[42.16]]]"; - auto returnedCalls = parseMethodCalls(folly::parseJson(jsText)); - ASSERT_EQ(1, returnedCalls.size()); - auto returnedCall = returnedCalls[0]; - ASSERT_EQ(1, returnedCall.arguments.size()); - ASSERT_EQ(folly::dynamic::DOUBLE, returnedCall.arguments[0].type()); - ASSERT_EQ(42.16, returnedCall.arguments[0].asDouble()); -} - -TEST(parseMethodCalls, BooleanReturn) { - auto jsText = "[[0],[0],[[false]]]"; - auto returnedCalls = parseMethodCalls(folly::parseJson(jsText)); - ASSERT_EQ(1, returnedCalls.size()); - auto returnedCall = returnedCalls[0]; - ASSERT_EQ(1, returnedCall.arguments.size()); - ASSERT_EQ(folly::dynamic::BOOL, returnedCall.arguments[0].type()); - ASSERT_FALSE(returnedCall.arguments[0].asBool()); -} - -TEST(parseMethodCalls, NullReturn) { - auto jsText = "[[0],[0],[[null]]]"; - auto returnedCalls = parseMethodCalls(folly::parseJson(jsText)); - ASSERT_EQ(1, returnedCalls.size()); - auto returnedCall = returnedCalls[0]; - ASSERT_EQ(1, returnedCall.arguments.size()); - ASSERT_EQ(folly::dynamic::NULLT, returnedCall.arguments[0].type()); -} - -TEST(parseMethodCalls, MapReturn) { - auto jsText = "[[0],[0],[[{\"foo\": \"hello\", \"bar\": 4.0, \"baz\": true}]]]"; - auto returnedCalls = parseMethodCalls(folly::parseJson(jsText)); - ASSERT_EQ(1, returnedCalls.size()); - auto returnedCall = returnedCalls[0]; - ASSERT_EQ(1, returnedCall.arguments.size()); - ASSERT_EQ(folly::dynamic::OBJECT, returnedCall.arguments[0].type()); - auto& returnedMap = returnedCall.arguments[0]; - auto foo = returnedMap.at("foo"); - EXPECT_EQ(folly::dynamic("hello"), foo); - auto bar = returnedMap.at("bar"); - EXPECT_EQ(folly::dynamic(4.0), bar); - auto baz = returnedMap.at("baz"); - EXPECT_EQ(folly::dynamic(true), baz); -} - -TEST(parseMethodCalls, ArrayReturn) { - auto jsText = "[[0],[0],[[[\"foo\", 42.0, false]]]]"; - auto returnedCalls = parseMethodCalls(folly::parseJson(jsText)); - ASSERT_EQ(1, returnedCalls.size()); - auto returnedCall = returnedCalls[0]; - ASSERT_EQ(1, returnedCall.arguments.size()); - ASSERT_EQ(folly::dynamic::ARRAY, returnedCall.arguments[0].type()); - auto& returnedArray = returnedCall.arguments[0]; - ASSERT_EQ(3, returnedArray.size()); - ASSERT_EQ(folly::dynamic("foo"), returnedArray[0]); - ASSERT_EQ(folly::dynamic(42.0), returnedArray[1]); - ASSERT_EQ(folly::dynamic(false), returnedArray[2]); -} - -TEST(parseMethodCalls, ReturnMultipleParams) { - auto jsText = "[[0],[0],[[\"foo\", 14, null, false]]]"; - auto returnedCalls = parseMethodCalls(folly::parseJson(jsText)); - ASSERT_EQ(1, returnedCalls.size()); - auto returnedCall = returnedCalls[0]; - ASSERT_EQ(4, returnedCall.arguments.size()); - ASSERT_EQ(folly::dynamic::STRING, returnedCall.arguments[0].type()); - ASSERT_EQ(folly::dynamic::INT64, returnedCall.arguments[1].type()); - ASSERT_EQ(folly::dynamic::NULLT, returnedCall.arguments[2].type()); - ASSERT_EQ(folly::dynamic::BOOL, returnedCall.arguments[3].type()); -} - -TEST(parseMethodCalls, ParseTwoCalls) { - auto jsText = "[[0,0],[1,1],[[],[]]]"; - auto returnedCalls = parseMethodCalls(folly::parseJson(jsText)); - ASSERT_EQ(2, returnedCalls.size()); -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/AttributedString.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/AttributedString.cpp deleted file mode 100644 index 5a85cb28..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/AttributedString.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "AttributedString.h" - -#include - -namespace facebook { -namespace react { - -using Fragment = AttributedString::Fragment; -using Fragments = AttributedString::Fragments; - -#pragma mark - Fragment - -bool Fragment::operator==(const Fragment &rhs) const { - return std::tie(string, textAttributes, shadowView, parentShadowView) == - std::tie( - rhs.string, - rhs.textAttributes, - rhs.shadowView, - rhs.parentShadowView); -} - -bool Fragment::operator!=(const Fragment &rhs) const { - return !(*this == rhs); -} - -#pragma mark - AttributedString - -void AttributedString::appendFragment(const Fragment &fragment) { - ensureUnsealed(); - fragments_.push_back(fragment); -} - -void AttributedString::prependFragment(const Fragment &fragment) { - ensureUnsealed(); - fragments_.insert(fragments_.begin(), fragment); -} - -void AttributedString::appendAttributedString( - const AttributedString &attributedString) { - ensureUnsealed(); - fragments_.insert( - fragments_.end(), - attributedString.fragments_.begin(), - attributedString.fragments_.end()); -} - -void AttributedString::prependAttributedString( - const AttributedString &attributedString) { - ensureUnsealed(); - fragments_.insert( - fragments_.begin(), - attributedString.fragments_.begin(), - attributedString.fragments_.end()); -} - -const std::vector &AttributedString::getFragments() const { - return fragments_; -} - -std::string AttributedString::getString() const { - auto string = std::string{}; - for (const auto &fragment : fragments_) { - string += fragment.string; - } - return string; -} - -bool AttributedString::operator==(const AttributedString &rhs) const { - return fragments_ == rhs.fragments_; -} - -bool AttributedString::operator!=(const AttributedString &rhs) const { - return !(*this == rhs); -} - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE -SharedDebugStringConvertibleList AttributedString::getDebugChildren() const { - auto list = SharedDebugStringConvertibleList{}; - - for (auto &&fragment : fragments_) { - auto propsList = - fragment.textAttributes.DebugStringConvertible::getDebugProps(); - - list.push_back(std::make_shared( - "Fragment", - fragment.string, - SharedDebugStringConvertibleList(), - propsList)); - } - - return list; -} -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/AttributedString.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/AttributedString.h deleted file mode 100644 index 2178e62f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/AttributedString.h +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class AttributedString; - -using SharedAttributedString = std::shared_ptr; - -/* - * Simple, cross-platfrom, React-specific implementation of attributed string - * (aka spanned string). - * `AttributedString` is basically a list of `Fragments` which have `string` and - * `textAttributes` + `shadowNode` associated with the `string`. - */ -class AttributedString : public Sealable, public DebugStringConvertible { - public: - class Fragment { - public: - std::string string; - TextAttributes textAttributes; - ShadowView shadowView; - ShadowView parentShadowView; - - bool operator==(const Fragment &rhs) const; - bool operator!=(const Fragment &rhs) const; - }; - - using Fragments = std::vector; - - /* - * Appends and prepends a `fragment` to the string. - */ - void appendFragment(const Fragment &fragment); - void prependFragment(const Fragment &fragment); - - /* - * Appends and prepends an `attributedString` (all its fragments) to - * the string. - */ - void appendAttributedString(const AttributedString &attributedString); - void prependAttributedString(const AttributedString &attributedString); - - /* - * Returns read-only reference to a list of fragments. - */ - const Fragments &getFragments() const; - - /* - * Returns a string constructed from all strings in all fragments. - */ - std::string getString() const; - - bool operator==(const AttributedString &rhs) const; - bool operator!=(const AttributedString &rhs) const; - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE - SharedDebugStringConvertibleList getDebugChildren() const override; -#endif - - private: - Fragments fragments_; -}; - -} // namespace react -} // namespace facebook - -namespace std { -template <> -struct hash { - size_t operator()( - const facebook::react::AttributedString::Fragment &fragment) const { - auto seed = size_t{0}; - folly::hash::hash_combine( - seed, - fragment.string, - fragment.textAttributes, - fragment.shadowView, - fragment.parentShadowView); - return seed; - } -}; - -template <> -struct hash { - size_t operator()( - const facebook::react::AttributedString &attributedString) const { - auto seed = size_t{0}; - - for (const auto &fragment : attributedString.getFragments()) { - folly::hash::hash_combine(seed, fragment); - } - - return seed; - } -}; -} // namespace std diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/BUCK deleted file mode 100644 index d48685ee..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/BUCK +++ /dev/null @@ -1,81 +0,0 @@ -load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load( - "//tools/build_defs/oss:rn_defs.bzl", - "ANDROID", - "APPLE", - "fb_xplat_cxx_test", - "get_apple_compiler_flags", - "get_apple_inspector_flags", - "react_native_xplat_target", - "rn_xplat_cxx_library", - "subdir_glob", -) - -APPLE_COMPILER_FLAGS = get_apple_compiler_flags() - -rn_xplat_cxx_library( - name = "attributedstring", - srcs = glob( - ["**/*.cpp"], - exclude = glob(["tests/**/*.cpp"]), - ), - headers = glob( - ["**/*.h"], - exclude = glob(["tests/**/*.h"]), - ), - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "*.h"), - ], - prefix = "react/attributedstring", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - force_static = True, - macosx_tests_override = [], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - tests = [":tests"], - visibility = ["PUBLIC"], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//third-party/glog:glog", - react_native_xplat_target("utils:utils"), - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/mounting:mounting"), - ], -) - -fb_xplat_cxx_test( - name = "tests", - srcs = glob(["tests/**/*.cpp"]), - headers = glob(["tests/**/*.h"]), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - contacts = ["oncall+react_native@xmail.facebook.com"], - platforms = (ANDROID, APPLE), - deps = [ - "xplat//folly:molly", - "xplat//third-party/gmock:gtest", - ":attributedstring", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/ParagraphAttributes.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/ParagraphAttributes.cpp deleted file mode 100644 index e4910077..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/ParagraphAttributes.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ParagraphAttributes.h" - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -bool ParagraphAttributes::operator==(const ParagraphAttributes &rhs) const { - return std::tie(maximumNumberOfLines, ellipsizeMode, adjustsFontSizeToFit) == - std::tie( - rhs.maximumNumberOfLines, - rhs.ellipsizeMode, - rhs.adjustsFontSizeToFit) && - floatEquality(minimumFontSize, rhs.minimumFontSize) && - floatEquality(maximumFontSize, rhs.maximumFontSize); -} - -bool ParagraphAttributes::operator!=(const ParagraphAttributes &rhs) const { - return !(*this == rhs); -} - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE -SharedDebugStringConvertibleList ParagraphAttributes::getDebugProps() const { - return { - debugStringConvertibleItem("maximumNumberOfLines", maximumNumberOfLines), - debugStringConvertibleItem("ellipsizeMode", ellipsizeMode), - debugStringConvertibleItem("adjustsFontSizeToFit", adjustsFontSizeToFit), - debugStringConvertibleItem("minimumFontSize", minimumFontSize), - debugStringConvertibleItem("maximumFontSize", maximumFontSize)}; -} -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/ParagraphAttributes.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/ParagraphAttributes.h deleted file mode 100644 index 6f0738d6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/ParagraphAttributes.h +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class ParagraphAttributes; - -using SharedParagraphAttributes = std::shared_ptr; - -/* - * Represents all visual attributes of a paragraph of text. - * Two data structures, ParagraphAttributes and AttributedText, should be - * enough to define visual representation of a piece of text on the screen. - */ -class ParagraphAttributes : public DebugStringConvertible { - public: -#pragma mark - Fields - - /* - * Maximum number of lines which paragraph can take. - * Zero value represents "no limit". - */ - int maximumNumberOfLines{}; - - /* - * In case if a text cannot fit given boundaries, defines a place where - * an ellipsize should be placed. - */ - EllipsizeMode ellipsizeMode{}; - - /* - * Enables font size adjustment to fit constrained boundaries. - */ - bool adjustsFontSizeToFit{}; - - /* - * In case of font size adjustment enabled, defines minimum and maximum - * font sizes. - */ - Float minimumFontSize{std::numeric_limits::quiet_NaN()}; - Float maximumFontSize{std::numeric_limits::quiet_NaN()}; - - bool operator==(const ParagraphAttributes &) const; - bool operator!=(const ParagraphAttributes &) const; - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE - SharedDebugStringConvertibleList getDebugProps() const override; -#endif -}; - -} // namespace react -} // namespace facebook - -namespace std { - -template <> -struct hash { - size_t operator()( - const facebook::react::ParagraphAttributes &attributes) const { - auto seed = size_t{0}; - folly::hash::hash_combine( - seed, - attributes.maximumNumberOfLines, - attributes.ellipsizeMode, - attributes.adjustsFontSizeToFit, - attributes.minimumFontSize, - attributes.maximumFontSize); - return seed; - } -}; -} // namespace std diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/TextAttributes.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/TextAttributes.cpp deleted file mode 100644 index 5016c9ce..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/TextAttributes.cpp +++ /dev/null @@ -1,209 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "TextAttributes.h" - -#include -#include -#include -#include -#include - -#include - -namespace facebook { -namespace react { - -void TextAttributes::apply(TextAttributes textAttributes) { - // Color - foregroundColor = textAttributes.foregroundColor - ? textAttributes.foregroundColor - : foregroundColor; - backgroundColor = textAttributes.backgroundColor - ? textAttributes.backgroundColor - : backgroundColor; - opacity = - !std::isnan(textAttributes.opacity) ? textAttributes.opacity : opacity; - - // Font - fontFamily = !textAttributes.fontFamily.empty() ? textAttributes.fontFamily - : fontFamily; - fontSize = - !std::isnan(textAttributes.fontSize) ? textAttributes.fontSize : fontSize; - fontSizeMultiplier = !std::isnan(textAttributes.fontSizeMultiplier) - ? textAttributes.fontSizeMultiplier - : fontSizeMultiplier; - fontWeight = textAttributes.fontWeight.hasValue() ? textAttributes.fontWeight - : fontWeight; - fontStyle = textAttributes.fontStyle.hasValue() ? textAttributes.fontStyle - : fontStyle; - fontVariant = textAttributes.fontVariant.hasValue() - ? textAttributes.fontVariant - : fontVariant; - allowFontScaling = textAttributes.allowFontScaling.hasValue() - ? textAttributes.allowFontScaling - : allowFontScaling; - letterSpacing = !std::isnan(textAttributes.letterSpacing) - ? textAttributes.letterSpacing - : letterSpacing; - - // Paragraph Styles - lineHeight = !std::isnan(textAttributes.lineHeight) - ? textAttributes.lineHeight - : lineHeight; - alignment = textAttributes.alignment.hasValue() ? textAttributes.alignment - : alignment; - baseWritingDirection = textAttributes.baseWritingDirection.hasValue() - ? textAttributes.baseWritingDirection - : baseWritingDirection; - - // Decoration - textDecorationColor = textAttributes.textDecorationColor - ? textAttributes.textDecorationColor - : textDecorationColor; - textDecorationLineType = textAttributes.textDecorationLineType.hasValue() - ? textAttributes.textDecorationLineType - : textDecorationLineType; - textDecorationLineStyle = textAttributes.textDecorationLineStyle.hasValue() - ? textAttributes.textDecorationLineStyle - : textDecorationLineStyle; - textDecorationLinePattern = - textAttributes.textDecorationLinePattern.hasValue() - ? textAttributes.textDecorationLinePattern - : textDecorationLinePattern; - - // Shadow - textShadowOffset = textAttributes.textShadowOffset.hasValue() - ? textAttributes.textShadowOffset.value() - : textShadowOffset; - textShadowRadius = !std::isnan(textAttributes.textShadowRadius) - ? textAttributes.textShadowRadius - : textShadowRadius; - textShadowColor = textAttributes.textShadowColor - ? textAttributes.textShadowColor - : textShadowColor; - - // Special - isHighlighted = textAttributes.isHighlighted.hasValue() - ? textAttributes.isHighlighted - : isHighlighted; - layoutDirection = textAttributes.layoutDirection.hasValue() - ? textAttributes.layoutDirection - : layoutDirection; -} - -#pragma mark - Operators - -bool TextAttributes::operator==(const TextAttributes &rhs) const { - return std::tie( - foregroundColor, - backgroundColor, - fontFamily, - fontWeight, - fontStyle, - fontVariant, - allowFontScaling, - alignment, - baseWritingDirection, - textDecorationColor, - textDecorationLineType, - textDecorationLineStyle, - textDecorationLinePattern, - textShadowOffset, - textShadowColor, - isHighlighted, - layoutDirection) == - std::tie( - rhs.foregroundColor, - rhs.backgroundColor, - rhs.fontFamily, - rhs.fontWeight, - rhs.fontStyle, - rhs.fontVariant, - rhs.allowFontScaling, - rhs.alignment, - rhs.baseWritingDirection, - rhs.textDecorationColor, - rhs.textDecorationLineType, - rhs.textDecorationLineStyle, - rhs.textDecorationLinePattern, - rhs.textShadowOffset, - rhs.textShadowColor, - rhs.isHighlighted, - rhs.layoutDirection) && - floatEquality(opacity, rhs.opacity) && - floatEquality(fontSize, rhs.fontSize) && - floatEquality(fontSizeMultiplier, rhs.fontSizeMultiplier) && - floatEquality(letterSpacing, rhs.letterSpacing) && - floatEquality(lineHeight, rhs.lineHeight) && - floatEquality(textShadowRadius, rhs.textShadowRadius); -} - -bool TextAttributes::operator!=(const TextAttributes &rhs) const { - return !(*this == rhs); -} - -TextAttributes TextAttributes::defaultTextAttributes() { - static auto textAttributes = [] { - auto textAttributes = TextAttributes{}; - // Non-obvious (can be different among platforms) default text attributes. - textAttributes.foregroundColor = blackColor(); - textAttributes.backgroundColor = clearColor(); - textAttributes.fontSize = 14.0; - return textAttributes; - }(); - return textAttributes; -} - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE -SharedDebugStringConvertibleList TextAttributes::getDebugProps() const { - return { - // Color - debugStringConvertibleItem("backgroundColor", backgroundColor), - debugStringConvertibleItem("foregroundColor", foregroundColor), - debugStringConvertibleItem("opacity", opacity), - - // Font - debugStringConvertibleItem("fontFamily", fontFamily), - debugStringConvertibleItem("fontSize", fontSize), - debugStringConvertibleItem("fontSizeMultiplier", fontSizeMultiplier), - debugStringConvertibleItem("fontWeight", fontWeight), - debugStringConvertibleItem("fontStyle", fontStyle), - debugStringConvertibleItem("fontVariant", fontVariant), - debugStringConvertibleItem("allowFontScaling", allowFontScaling), - debugStringConvertibleItem("letterSpacing", letterSpacing), - - // Paragraph Styles - debugStringConvertibleItem("lineHeight", lineHeight), - debugStringConvertibleItem("alignment", alignment), - debugStringConvertibleItem("baseWritingDirection", baseWritingDirection), - - // Decoration - debugStringConvertibleItem("textDecorationColor", textDecorationColor), - debugStringConvertibleItem( - "textDecorationLineType", textDecorationLineType), - debugStringConvertibleItem( - "textDecorationLineStyle", textDecorationLineStyle), - debugStringConvertibleItem( - "textDecorationLinePattern", textDecorationLinePattern), - - // Shadow - debugStringConvertibleItem("textShadowOffset", textShadowOffset), - debugStringConvertibleItem("textShadowRadius", textShadowRadius), - debugStringConvertibleItem("textShadowColor", textShadowColor), - - // Special - debugStringConvertibleItem("isHighlighted", isHighlighted), - debugStringConvertibleItem("layoutDirection", layoutDirection), - }; -} -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/TextAttributes.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/TextAttributes.h deleted file mode 100644 index feb1c1e7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/TextAttributes.h +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class TextAttributes; - -using SharedTextAttributes = std::shared_ptr; - -class TextAttributes : public DebugStringConvertible { - public: - /* - * Returns TextAttribute object which has actual default attribute values - * (e.g. `foregroundColor = black`), in oppose to TextAttribute's default - * constructor which creates an object with nulled attributes. - */ - static TextAttributes defaultTextAttributes(); - -#pragma mark - Fields - - // Color - SharedColor foregroundColor{}; - SharedColor backgroundColor{}; - Float opacity{std::numeric_limits::quiet_NaN()}; - - // Font - std::string fontFamily{""}; - Float fontSize{std::numeric_limits::quiet_NaN()}; - Float fontSizeMultiplier{std::numeric_limits::quiet_NaN()}; - folly::Optional fontWeight{}; - folly::Optional fontStyle{}; - folly::Optional fontVariant{}; - folly::Optional allowFontScaling{}; - Float letterSpacing{std::numeric_limits::quiet_NaN()}; - - // Paragraph Styles - Float lineHeight{std::numeric_limits::quiet_NaN()}; - folly::Optional alignment{}; - folly::Optional baseWritingDirection{}; - - // Decoration - SharedColor textDecorationColor{}; - folly::Optional textDecorationLineType{}; - folly::Optional textDecorationLineStyle{}; - folly::Optional textDecorationLinePattern{}; - - // Shadow - // TODO: Use `Point` type instead of `Size` for `textShadowOffset` attribute. - folly::Optional textShadowOffset{}; - Float textShadowRadius{std::numeric_limits::quiet_NaN()}; - SharedColor textShadowColor{}; - - // Special - folly::Optional isHighlighted{}; - folly::Optional layoutDirection{}; - -#pragma mark - Operations - - void apply(TextAttributes textAttributes); - -#pragma mark - Operators - - bool operator==(const TextAttributes &rhs) const; - bool operator!=(const TextAttributes &rhs) const; - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE - SharedDebugStringConvertibleList getDebugProps() const override; -#endif -}; - -} // namespace react -} // namespace facebook - -namespace std { - -template <> -struct hash { - size_t operator()( - const facebook::react::TextAttributes &textAttributes) const { - auto seed = size_t{0}; - folly::hash::hash_combine( - seed, - textAttributes.foregroundColor, - textAttributes.backgroundColor, - textAttributes.opacity, - textAttributes.fontFamily, - textAttributes.fontSize, - textAttributes.fontSizeMultiplier, - textAttributes.fontWeight, - textAttributes.fontStyle, - textAttributes.fontVariant, - textAttributes.allowFontScaling, - textAttributes.letterSpacing, - textAttributes.lineHeight, - textAttributes.alignment, - textAttributes.baseWritingDirection, - textAttributes.textDecorationColor, - textAttributes.textDecorationLineType, - textAttributes.textDecorationLineStyle, - textAttributes.textDecorationLinePattern, - textAttributes.textShadowOffset, - textAttributes.textShadowRadius, - textAttributes.textShadowColor, - textAttributes.isHighlighted, - textAttributes.layoutDirection); - return seed; - } -}; -} // namespace std diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/conversions.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/conversions.h deleted file mode 100644 index 2dfea377..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/conversions.h +++ /dev/null @@ -1,498 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -inline std::string toString(const EllipsizeMode &ellipsisMode) { - switch (ellipsisMode) { - case EllipsizeMode::Clip: - return "clip"; - case EllipsizeMode::Head: - return "head"; - case EllipsizeMode::Tail: - return "tail"; - case EllipsizeMode::Middle: - return "middle"; - } -} - -inline void fromRawValue(const RawValue &value, EllipsizeMode &result) { - auto string = (std::string)value; - if (string == "clip") { - result = EllipsizeMode::Clip; - return; - } - if (string == "head") { - result = EllipsizeMode::Head; - return; - } - if (string == "tail") { - result = EllipsizeMode::Tail; - return; - } - if (string == "middle") { - result = EllipsizeMode::Middle; - return; - } - abort(); -} - -inline void fromRawValue(const RawValue &value, FontWeight &result) { - auto string = (std::string)value; - if (string == "normal") { - result = FontWeight::Regular; - return; - } - if (string == "regular") { - result = FontWeight::Regular; - return; - } - if (string == "bold") { - result = FontWeight::Bold; - return; - } - if (string == "100") { - result = FontWeight::Weight100; - return; - } - if (string == "200") { - result = FontWeight::Weight200; - return; - } - if (string == "300") { - result = FontWeight::Weight300; - return; - } - if (string == "400") { - result = FontWeight::Weight400; - return; - } - if (string == "500") { - result = FontWeight::Weight500; - return; - } - if (string == "600") { - result = FontWeight::Weight600; - return; - } - if (string == "700") { - result = FontWeight::Weight700; - return; - } - if (string == "800") { - result = FontWeight::Weight800; - return; - } - if (string == "900") { - result = FontWeight::Weight900; - return; - } - abort(); -} - -inline std::string toString(const FontWeight &fontWeight) { - return folly::to((int)fontWeight); -} - -inline void fromRawValue(const RawValue &value, FontStyle &result) { - auto string = (std::string)value; - if (string == "normal") { - result = FontStyle::Normal; - return; - } - if (string == "italic") { - result = FontStyle::Italic; - return; - } - if (string == "oblique") { - result = FontStyle::Oblique; - return; - } - abort(); -} - -inline std::string toString(const FontStyle &fontStyle) { - switch (fontStyle) { - case FontStyle::Normal: - return "normal"; - case FontStyle::Italic: - return "italic"; - case FontStyle::Oblique: - return "oblique"; - } -} - -inline void fromRawValue(const RawValue &value, FontVariant &result) { - assert(value.hasType>()); - result = FontVariant::Default; - auto items = std::vector{value}; - for (const auto &item : items) { - if (item == "small-caps") { - result = (FontVariant)((int)result | (int)FontVariant::SmallCaps); - continue; - } - if (item == "oldstyle-nums") { - result = (FontVariant)((int)result | (int)FontVariant::OldstyleNums); - continue; - } - if (item == "lining-nums") { - result = (FontVariant)((int)result | (int)FontVariant::LiningNums); - continue; - } - if (item == "tabular-nums") { - result = (FontVariant)((int)result | (int)FontVariant::TabularNums); - continue; - } - if (item == "proportional-nums") { - result = (FontVariant)((int)result | (int)FontVariant::ProportionalNums); - continue; - } - } -} - -inline std::string toString(const FontVariant &fontVariant) { - auto result = std::string{}; - auto separator = std::string{", "}; - if ((int)fontVariant & (int)FontVariant::SmallCaps) { - result += "small-caps" + separator; - } - if ((int)fontVariant & (int)FontVariant::OldstyleNums) { - result += "oldstyle-nums" + separator; - } - if ((int)fontVariant & (int)FontVariant::LiningNums) { - result += "lining-nums" + separator; - } - if ((int)fontVariant & (int)FontVariant::TabularNums) { - result += "tabular-nums" + separator; - } - if ((int)fontVariant & (int)FontVariant::ProportionalNums) { - result += "proportional-nums" + separator; - } - - if (!result.empty()) { - result.erase(result.length() - separator.length()); - } - - return result; -} - -inline void fromRawValue(const RawValue &value, TextAlignment &result) { - auto string = (std::string)value; - if (string == "natural") { - result = TextAlignment::Natural; - return; - } - if (string == "left") { - result = TextAlignment::Left; - return; - } - if (string == "center") { - result = TextAlignment::Center; - return; - } - if (string == "right") { - result = TextAlignment::Right; - return; - } - if (string == "justified") { - result = TextAlignment::Justified; - return; - } - abort(); -} - -inline std::string toString(const TextAlignment &textAlignment) { - switch (textAlignment) { - case TextAlignment::Natural: - return "natural"; - case TextAlignment::Left: - return "left"; - case TextAlignment::Center: - return "center"; - case TextAlignment::Right: - return "right"; - case TextAlignment::Justified: - return "justified"; - } -} - -inline void fromRawValue(const RawValue &value, WritingDirection &result) { - auto string = (std::string)value; - if (string == "natural") { - result = WritingDirection::Natural; - return; - } - if (string == "ltr") { - result = WritingDirection::LeftToRight; - return; - } - if (string == "rtl") { - result = WritingDirection::RightToLeft; - return; - } - abort(); -} - -inline std::string toString(const WritingDirection &writingDirection) { - switch (writingDirection) { - case WritingDirection::Natural: - return "natural"; - case WritingDirection::LeftToRight: - return "ltr"; - case WritingDirection::RightToLeft: - return "rtl"; - } -} - -inline void fromRawValue( - const RawValue &value, - TextDecorationLineType &result) { - auto string = (std::string)value; - if (string == "none") { - result = TextDecorationLineType::None; - return; - } - if (string == "underline") { - result = TextDecorationLineType::Underline; - return; - } - if (string == "strikethrough") { - result = TextDecorationLineType::Strikethrough; - return; - } - if (string == "underline-strikethrough") { - result = TextDecorationLineType::UnderlineStrikethrough; - return; - } - abort(); -} - -inline std::string toString( - const TextDecorationLineType &textDecorationLineType) { - switch (textDecorationLineType) { - case TextDecorationLineType::None: - return "none"; - case TextDecorationLineType::Underline: - return "underline"; - case TextDecorationLineType::Strikethrough: - return "strikethrough"; - case TextDecorationLineType::UnderlineStrikethrough: - return "underline-strikethrough"; - } -} - -inline void fromRawValue( - const RawValue &value, - TextDecorationLineStyle &result) { - auto string = (std::string)value; - if (string == "single") { - result = TextDecorationLineStyle::Single; - return; - } - if (string == "thick") { - result = TextDecorationLineStyle::Thick; - return; - } - if (string == "double") { - result = TextDecorationLineStyle::Double; - return; - } - abort(); -} - -inline std::string toString( - const TextDecorationLineStyle &textDecorationLineStyle) { - switch (textDecorationLineStyle) { - case TextDecorationLineStyle::Single: - return "single"; - case TextDecorationLineStyle::Thick: - return "thick"; - case TextDecorationLineStyle::Double: - return "double"; - } -} - -inline void fromRawValue( - const RawValue &value, - TextDecorationLinePattern &result) { - auto string = (std::string)value; - if (string == "solid") { - result = TextDecorationLinePattern::Solid; - return; - } - if (string == "dot") { - result = TextDecorationLinePattern::Dot; - return; - } - if (string == "dash") { - result = TextDecorationLinePattern::Dash; - return; - } - if (string == "dash-dot") { - result = TextDecorationLinePattern::DashDot; - return; - } - if (string == "dash-dot-dot") { - result = TextDecorationLinePattern::DashDotDot; - return; - } - abort(); -} - -inline std::string toString( - const TextDecorationLinePattern &textDecorationLinePattern) { - switch (textDecorationLinePattern) { - case TextDecorationLinePattern::Solid: - return "solid"; - case TextDecorationLinePattern::Dot: - return "dot"; - case TextDecorationLinePattern::Dash: - return "dash"; - case TextDecorationLinePattern::DashDot: - return "dash-dot"; - case TextDecorationLinePattern::DashDotDot: - return "dash-dot-dot"; - } -} - -#ifdef ANDROID - -inline folly::dynamic toDynamic( - const ParagraphAttributes ¶graphAttributes) { - auto values = folly::dynamic::object(); - values("maximumNumberOfLines", paragraphAttributes.maximumNumberOfLines); - values("ellipsizeMode", toString(paragraphAttributes.ellipsizeMode)); - values("adjustsFontSizeToFit", paragraphAttributes.adjustsFontSizeToFit); - return values; -} - -inline folly::dynamic toDynamic(const TextAttributes &textAttributes) { - auto _textAttributes = folly::dynamic::object(); - if (textAttributes.foregroundColor) { - _textAttributes( - "foregroundColor", toDynamic(textAttributes.foregroundColor)); - } - if (textAttributes.backgroundColor) { - _textAttributes( - "backgroundColor", toDynamic(textAttributes.backgroundColor)); - } - if (!std::isnan(textAttributes.opacity)) { - _textAttributes("opacity", textAttributes.opacity); - } - if (!textAttributes.fontFamily.empty()) { - _textAttributes("fontFamily", textAttributes.fontFamily); - } - if (!std::isnan(textAttributes.fontSize)) { - _textAttributes("fontSize", textAttributes.fontSize); - } - if (!std::isnan(textAttributes.fontSizeMultiplier)) { - _textAttributes("fontSizeMultiplier", textAttributes.fontSizeMultiplier); - } - if (textAttributes.fontWeight.has_value()) { - _textAttributes("fontWeight", toString(*textAttributes.fontWeight)); - } - if (textAttributes.fontStyle.has_value()) { - _textAttributes("fontStyle", toString(*textAttributes.fontStyle)); - } - if (textAttributes.fontVariant.has_value()) { - _textAttributes("fontVariant", toString(*textAttributes.fontVariant)); - } - if (textAttributes.allowFontScaling.has_value()) { - _textAttributes("allowFontScaling", *textAttributes.allowFontScaling); - } - if (!std::isnan(textAttributes.letterSpacing)) { - _textAttributes("letterSpacing", textAttributes.letterSpacing); - } - if (!std::isnan(textAttributes.lineHeight)) { - _textAttributes("lineHeight", textAttributes.lineHeight); - } - if (textAttributes.alignment.has_value()) { - _textAttributes("alignment", toString(*textAttributes.alignment)); - } - if (textAttributes.baseWritingDirection.has_value()) { - _textAttributes( - "baseWritingDirection", toString(*textAttributes.baseWritingDirection)); - } - // Decoration - if (textAttributes.textDecorationColor) { - _textAttributes( - "textDecorationColor", toDynamic(textAttributes.textDecorationColor)); - } - if (textAttributes.textDecorationLineType.has_value()) { - _textAttributes( - "textDecorationLine", toString(*textAttributes.textDecorationLineType)); - } - if (textAttributes.textDecorationLineStyle.has_value()) { - _textAttributes( - "textDecorationLineStyle", - toString(*textAttributes.textDecorationLineStyle)); - } - if (textAttributes.textDecorationLinePattern.has_value()) { - _textAttributes( - "textDecorationLinePattern", - toString(*textAttributes.textDecorationLinePattern)); - } - // Shadow - // textShadowOffset = textAttributes.textShadowOffset.has_value() ? - // textAttributes.textShadowOffset.value() : textShadowOffset; - if (!std::isnan(textAttributes.textShadowRadius)) { - _textAttributes("textShadowRadius", textAttributes.textShadowRadius); - } - if (textAttributes.textShadowColor) { - _textAttributes( - "textShadowColor", toDynamic(textAttributes.textShadowColor)); - } - // Special - if (textAttributes.isHighlighted.has_value()) { - _textAttributes("isHighlighted", *textAttributes.isHighlighted); - } - if (textAttributes.layoutDirection.has_value()) { - _textAttributes( - "layoutDirection", toString(*textAttributes.layoutDirection)); - } - return _textAttributes; -} - -inline folly::dynamic toDynamic(const AttributedString &attributedString) { - auto value = folly::dynamic::object(); - auto fragments = folly::dynamic::array(); - for (auto fragment : attributedString.getFragments()) { - folly::dynamic dynamicFragment = folly::dynamic::object(); - dynamicFragment["string"] = fragment.string; - if (fragment.parentShadowView.componentHandle) { - dynamicFragment["reactTag"] = fragment.parentShadowView.tag; - } - dynamicFragment["textAttributes"] = toDynamic(fragment.textAttributes); - fragments.push_back(dynamicFragment); - } - value("fragments", fragments); - value( - "hash", std::hash{}(attributedString)); - value("string", attributedString.getString()); - return value; -} - -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/primitives.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/primitives.h deleted file mode 100644 index d849258a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/primitives.h +++ /dev/null @@ -1,154 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -enum class FontStyle { Normal, Italic, Oblique }; - -enum class FontWeight : int { - Weight100 = 100, - UltraLight = 100, - Weight200 = 200, - Thin = 200, - Weight300 = 300, - Light = 300, - Weight400 = 400, - Regular = 400, - Weight500 = 500, - Medium = 500, - Weight600 = 600, - Semibold = 600, - Demibold = 600, - Weight700 = 700, - Bold = 700, - Weight800 = 800, - Heavy = 800, - Weight900 = 900, - Black = 900 -}; - -enum class FontVariant : int { - Default = 0, - SmallCaps = 1 << 1, - OldstyleNums = 1 << 2, - LiningNums = 1 << 3, - TabularNums = 1 << 4, - ProportionalNums = 1 << 5 -}; - -enum class EllipsizeMode { - Clip, // Do not add ellipsize, simply clip. - Head, // Truncate at head of line: "...wxyz". - Tail, // Truncate at tail of line: "abcd...". - Middle // Truncate middle of line: "ab...yz". -}; - -enum class TextAlignment { - Natural, // Indicates the default alignment for script. - Left, // Visually left aligned. - Center, // Visually centered. - Right, // Visually right aligned. - Justified // Fully-justified. The last line in a paragraph is natural-aligned. -}; - -enum class WritingDirection { - Natural, // Determines direction using the Unicode Bidi Algorithm rules P2 and - // P3. - LeftToRight, // Left to right writing direction. - RightToLeft // Right to left writing direction. -}; - -enum class TextDecorationLineType { - None, - Underline, - Strikethrough, - UnderlineStrikethrough -}; - -enum class TextDecorationLineStyle { Single, Thick, Double }; - -enum class TextDecorationLinePattern { - Solid, - Dot, - Dash, - DashDot, - DashDotDot, -}; - -} // namespace react -} // namespace facebook - -namespace std { -template <> -struct hash { - size_t operator()(const facebook::react::FontVariant &v) const { - return hash()(static_cast(v)); - } -}; - -template <> -struct hash { - size_t operator()(const facebook::react::TextAlignment &v) const { - return hash()(static_cast(v)); - } -}; - -template <> -struct hash { - size_t operator()(const facebook::react::FontStyle &v) const { - return hash()(static_cast(v)); - } -}; - -template <> -struct hash { - size_t operator()(const facebook::react::TextDecorationLineType &v) const { - return hash()(static_cast(v)); - } -}; - -template <> -struct hash { - size_t operator()(const facebook::react::WritingDirection &v) const { - return hash()(static_cast(v)); - } -}; - -template <> -struct hash { - size_t operator()(const facebook::react::TextDecorationLinePattern &v) const { - return hash()(static_cast(v)); - } -}; - -template <> -struct hash { - size_t operator()(const facebook::react::TextDecorationLineStyle &v) const { - return hash()(static_cast(v)); - } -}; - -template <> -struct hash { - size_t operator()(const facebook::react::FontWeight &v) const { - return hash()(static_cast(v)); - } -}; - -template <> -struct hash { - size_t operator()(const facebook::react::EllipsizeMode &v) const { - return hash()(static_cast(v)); - } -}; -} // namespace std diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/tests/AttributedStringTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/tests/AttributedStringTest.cpp deleted file mode 100644 index 3560d616..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/tests/AttributedStringTest.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -#ifdef ANDROID - -TEST(AttributedStringTest, testToDynamic) { - auto attString = new AttributedString(); - auto fragment = new AttributedString::Fragment(); - fragment->string = "test"; - - auto text = new TextAttributes(); - text->foregroundColor = { - colorFromComponents({100 / 255.0, 153 / 255.0, 200 / 255.0, 1.0})}; - text->opacity = 0.5; - text->fontStyle = FontStyle::Italic; - text->fontWeight = FontWeight::Thin; - text->fontVariant = FontVariant::TabularNums; - fragment->textAttributes = *text; - - attString->prependFragment(*fragment); - - auto result = toDynamic(*attString); - assert(result["string"] == fragment->string); - auto textAttribute = result["fragments"][0]["textAttributes"]; - assert(textAttribute["foregroundColor"] == toDynamic(text->foregroundColor)); - assert(textAttribute["opacity"] == text->opacity); - assert(textAttribute["fontStyle"] == toString(*text->fontStyle)); - assert(textAttribute["fontWeight"] == toString(*text->fontWeight)); -} - -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/tests/ParagraphAttributesTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/tests/ParagraphAttributesTest.cpp deleted file mode 100644 index fb3e1c34..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/tests/ParagraphAttributesTest.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -#ifdef ANDROID - -TEST(ParagraphAttributesTest, testToDynamic) { - auto paragraphAttributes = ParagraphAttributes(); - paragraphAttributes.maximumNumberOfLines = 2; - paragraphAttributes.adjustsFontSizeToFit = false; - paragraphAttributes.ellipsizeMode = EllipsizeMode::Middle; - - auto result = toDynamic(paragraphAttributes); - assert( - result["maximumNumberOfLines"] == - paragraphAttributes.maximumNumberOfLines); - assert( - result["adjustsFontSizeToFit"] == - paragraphAttributes.adjustsFontSizeToFit); - assert( - result["ellipsizeMode"] == toString(paragraphAttributes.ellipsizeMode)); -} - -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/tests/TextAttributesTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/tests/TextAttributesTest.cpp deleted file mode 100644 index 5b559230..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/attributedstring/tests/TextAttributesTest.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -#ifdef ANDROID - -TEST(TextAttributesTest, testToDynamic) { - auto text = TextAttributes(); - text.foregroundColor = { - colorFromComponents({200 / 255.0, 153 / 255.0, 100 / 255.0, 1.0})}; - text.opacity = 0.5; - text.fontStyle = FontStyle::Italic; - text.fontWeight = FontWeight::Thin; - text.fontVariant = FontVariant::TabularNums; - - auto result = toDynamic(text); - assert(result["foregroundColor"] == toDynamic(text.foregroundColor)); - assert(result["opacity"] == text.opacity); - assert(result["fontStyle"] == toString(*text.fontStyle)); - assert(result["fontWeight"] == toString(*text.fontWeight)); -} - -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/ActivityIndicatorViewComponentDescriptor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/ActivityIndicatorViewComponentDescriptor.h deleted file mode 100644 index 7dbe4253..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/ActivityIndicatorViewComponentDescriptor.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using ActivityIndicatorViewComponentDescriptor = - ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/ActivityIndicatorViewProps.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/ActivityIndicatorViewProps.cpp deleted file mode 100644 index 6ff45aef..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/ActivityIndicatorViewProps.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -ActivityIndicatorViewProps::ActivityIndicatorViewProps( - const ActivityIndicatorViewProps &sourceProps, - const RawProps &rawProps) - : ViewProps(sourceProps, rawProps), - animating(convertRawProp(rawProps, "animating", sourceProps.animating)), - color(convertRawProp(rawProps, "color", sourceProps.color)), - hidesWhenStopped(convertRawProp( - rawProps, - "hidesWhenStopped", - sourceProps.hidesWhenStopped)), - size(convertRawProp(rawProps, "size", sourceProps.size)) {} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/ActivityIndicatorViewProps.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/ActivityIndicatorViewProps.h deleted file mode 100644 index 8a8f7395..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/ActivityIndicatorViewProps.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -// TODO (T28334063): Consider for codegen. -class ActivityIndicatorViewProps final : public ViewProps { - public: - ActivityIndicatorViewProps() = default; - ActivityIndicatorViewProps( - const ActivityIndicatorViewProps &sourceProps, - const RawProps &rawProps); - -#pragma mark - Props - - const bool animating{true}; - const SharedColor color{colorFromComponents( - {153 / 255.0, 153 / 255.0, 153 / 255.0, 1.0})}; // #999999 - const bool hidesWhenStopped{true}; - const ActivityIndicatorViewSize size{ActivityIndicatorViewSize::Small}; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/ActivityIndicatorViewShadowNode.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/ActivityIndicatorViewShadowNode.cpp deleted file mode 100644 index 09bb4700..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/ActivityIndicatorViewShadowNode.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ActivityIndicatorViewShadowNode.h" - -namespace facebook { -namespace react { - -const char ActivityIndicatorViewComponentName[] = "ActivityIndicatorView"; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/ActivityIndicatorViewShadowNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/ActivityIndicatorViewShadowNode.h deleted file mode 100644 index ac768dd6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/ActivityIndicatorViewShadowNode.h +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -extern const char ActivityIndicatorViewComponentName[]; - -/* - * `ShadowNode` for component. - */ -using ActivityIndicatorViewShadowNode = ConcreteViewShadowNode< - ActivityIndicatorViewComponentName, - ActivityIndicatorViewProps>; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/BUCK deleted file mode 100644 index 45074f25..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/BUCK +++ /dev/null @@ -1,66 +0,0 @@ -load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "APPLE", "fb_xplat_cxx_test", "get_apple_compiler_flags", "get_apple_inspector_flags", "react_native_xplat_target", "rn_xplat_cxx_library", "subdir_glob") - -APPLE_COMPILER_FLAGS = get_apple_compiler_flags() - -rn_xplat_cxx_library( - name = "activityindicator", - srcs = glob( - ["**/*.cpp"], - exclude = glob(["tests/**/*.cpp"]), - ), - headers = [], - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "*.h"), - ], - prefix = "react/components/activityindicator", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - macosx_tests_override = [], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - tests = [":tests"], - visibility = ["PUBLIC"], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//third-party/glog:glog", - "xplat//yoga:yoga", - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/components/view:view"), - ], -) - -fb_xplat_cxx_test( - name = "tests", - srcs = glob(["tests/**/*.cpp"]), - headers = glob(["tests/**/*.h"]), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - platforms = (ANDROID, APPLE), - deps = [ - "xplat//folly:molly", - "xplat//third-party/gmock:gtest", - ":activityindicator", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/conversions.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/conversions.h deleted file mode 100644 index d84b7a75..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/conversions.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -inline void fromRawValue( - const RawValue &value, - ActivityIndicatorViewSize &result) { - auto string = (std::string)value; - if (string == "large") { - result = ActivityIndicatorViewSize::Large; - return; - } - if (string == "small") { - result = ActivityIndicatorViewSize::Small; - return; - } - abort(); -} - -inline std::string toString(const ActivityIndicatorViewSize &value) { - switch (value) { - case ActivityIndicatorViewSize::Large: - return "large"; - case ActivityIndicatorViewSize::Small: - return "small"; - } -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/primitives.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/primitives.h deleted file mode 100644 index ba9b2606..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/primitives.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -namespace facebook { -namespace react { - -enum class ActivityIndicatorViewSize { - Large, - Small, -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/tests/ActivityIndicatorViewTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/tests/ActivityIndicatorViewTest.cpp deleted file mode 100644 index 05b6e147..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/activityindicator/tests/ActivityIndicatorViewTest.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include - -TEST(ActivityIndicatorViewTest, testSomething) { - // TODO -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/BUCK deleted file mode 100644 index 2ce6f3db..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/BUCK +++ /dev/null @@ -1,79 +0,0 @@ -load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load( - "//tools/build_defs/oss:rn_defs.bzl", - "ANDROID", - "APPLE", - "fb_xplat_cxx_test", - "get_apple_compiler_flags", - "get_apple_inspector_flags", - "react_native_xplat_target", - "rn_xplat_cxx_library", - "subdir_glob", -) - -APPLE_COMPILER_FLAGS = get_apple_compiler_flags() - -rn_xplat_cxx_library( - name = "image", - srcs = glob( - ["**/*.cpp"], - exclude = glob(["tests/**/*.cpp"]), - ), - headers = [], - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "*.h"), - ], - prefix = "react/components/image", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - macosx_tests_override = [], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - tests = [":tests"], - visibility = ["PUBLIC"], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:futures", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//third-party/glog:glog", - "xplat//yoga:yoga", - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/imagemanager:imagemanager"), - react_native_xplat_target("fabric/components/view:view"), - ], -) - -fb_xplat_cxx_test( - name = "tests", - srcs = glob(["tests/**/*.cpp"]), - headers = glob(["tests/**/*.h"]), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - contacts = ["oncall+react_native@xmail.facebook.com"], - platforms = (ANDROID, APPLE), - deps = [ - "xplat//folly:molly", - "xplat//third-party/gmock:gtest", - ":image", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageComponentDescriptor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageComponentDescriptor.h deleted file mode 100644 index f7168dcd..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageComponentDescriptor.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * Descriptor for component. - */ -class ImageComponentDescriptor final - : public ConcreteComponentDescriptor { - public: - ImageComponentDescriptor( - SharedEventDispatcher eventDispatcher, - const SharedContextContainer &contextContainer) - : ConcreteComponentDescriptor(eventDispatcher), - imageManager_( - contextContainer - ? contextContainer->getInstance( - "ImageManager") - : nullptr) {} - - void adopt(UnsharedShadowNode shadowNode) const override { - ConcreteComponentDescriptor::adopt(shadowNode); - - assert(std::dynamic_pointer_cast(shadowNode)); - auto imageShadowNode = - std::static_pointer_cast(shadowNode); - - // `ImageShadowNode` uses `ImageManager` to initiate image loading and - // communicate the loading state and results to mounting layer. - imageShadowNode->setImageManager(imageManager_); - } - - private: - const SharedImageManager imageManager_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageEventEmitter.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageEventEmitter.cpp deleted file mode 100644 index 1d70b79c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageEventEmitter.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ImageEventEmitter.h" - -namespace facebook { -namespace react { - -void ImageEventEmitter::onLoadStart() const { - dispatchEvent("loadStart"); -} - -void ImageEventEmitter::onLoad() const { - dispatchEvent("load"); -} - -void ImageEventEmitter::onLoadEnd() const { - dispatchEvent("loadEnd"); -} - -void ImageEventEmitter::onProgress(double progress) const { - dispatchEvent("progress", [=](jsi::Runtime &runtime) { - auto payload = jsi::Object(runtime); - payload.setProperty(runtime, "progress", progress); - return payload; - }); -} - -void ImageEventEmitter::onError() const { - dispatchEvent("error"); -} - -void ImageEventEmitter::onPartialLoad() const { - dispatchEvent("partialLoad"); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageEventEmitter.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageEventEmitter.h deleted file mode 100644 index 2c19024a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageEventEmitter.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -#pragma once - -#include - -namespace facebook { -namespace react { - -class ImageEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - void onLoadStart() const; - void onLoad() const; - void onLoadEnd() const; - void onProgress(double) const; - void onError() const; - void onPartialLoad() const; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageLocalData.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageLocalData.cpp deleted file mode 100644 index 3fa237c1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageLocalData.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ImageLocalData.h" - -#include -#include - -namespace facebook { -namespace react { - -ImageSource ImageLocalData::getImageSource() const { - return imageSource_; -} - -const ImageRequest &ImageLocalData::getImageRequest() const { - return imageRequest_; -} - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE -std::string ImageLocalData::getDebugName() const { - return "ImageLocalData"; -} - -SharedDebugStringConvertibleList ImageLocalData::getDebugProps() const { - return {debugStringConvertibleItem("imageSource", imageSource_)}; -} -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageLocalData.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageLocalData.h deleted file mode 100644 index d87e45a7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageLocalData.h +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class ImageLocalData; - -using SharedImageLocalData = std::shared_ptr; - -/* - * LocalData for component. - * Represents the image request state and (possible) retrieved image bitmap. - */ -class ImageLocalData : public LocalData { - public: - ImageLocalData(const ImageSource &imageSource, ImageRequest imageRequest) - : imageSource_(imageSource), imageRequest_(std::move(imageRequest)){}; - - /* - * Returns stored ImageSource object. - */ - ImageSource getImageSource() const; - - /* - * Exposes for reading stored `ImageRequest` object. - * `ImageRequest` object cannot be copied or moved from `ImageLocalData`. - */ - const ImageRequest &getImageRequest() const; - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE - std::string getDebugName() const override; - SharedDebugStringConvertibleList getDebugProps() const override; -#endif - - private: - ImageSource imageSource_; - ImageRequest imageRequest_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageProps.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageProps.cpp deleted file mode 100644 index 5eca2429..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageProps.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -ImageProps::ImageProps(const ImageProps &sourceProps, const RawProps &rawProps) - : ViewProps(sourceProps, rawProps), - sources(convertRawProp(rawProps, "source", sourceProps.sources)), - defaultSources(convertRawProp( - rawProps, - "defaultSource", - sourceProps.defaultSources)), - resizeMode(convertRawProp( - rawProps, - "resizeMode", - sourceProps.resizeMode, - ImageResizeMode::Stretch)), - blurRadius( - convertRawProp(rawProps, "blurRadius", sourceProps.blurRadius)), - capInsets(convertRawProp(rawProps, "capInsets", sourceProps.capInsets)), - tintColor(convertRawProp(rawProps, "tintColor", sourceProps.tintColor)) {} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageProps.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageProps.h deleted file mode 100644 index d0c1369a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageProps.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -// TODO (T28334063): Consider for codegen. -class ImageProps final : public ViewProps { - public: - ImageProps() = default; - ImageProps(const ImageProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - const ImageSources sources{}; - const ImageSources defaultSources{}; - const ImageResizeMode resizeMode{ImageResizeMode::Stretch}; - const Float blurRadius{}; - const EdgeInsets capInsets{}; - const SharedColor tintColor{}; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageShadowNode.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageShadowNode.cpp deleted file mode 100644 index 5421515f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageShadowNode.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include -#include -#include - -namespace facebook { -namespace react { - -const char ImageComponentName[] = "Image"; - -void ImageShadowNode::setImageManager(const SharedImageManager &imageManager) { - ensureUnsealed(); - imageManager_ = imageManager; -} - -void ImageShadowNode::updateLocalData() { - const auto &imageSource = getImageSource(); - const auto ¤tLocalData = getLocalData(); - if (currentLocalData) { - assert(std::dynamic_pointer_cast(currentLocalData)); - auto currentImageLocalData = - std::static_pointer_cast(currentLocalData); - if (currentImageLocalData->getImageSource() == imageSource) { - // Same `imageSource` is already in `localData`, - // no need to (re)request an image resource. - return; - } - } - - // Now we are about to mutate the Shadow Node. - ensureUnsealed(); - - auto imageRequest = imageManager_->requestImage(imageSource); - auto imageLocalData = - std::make_shared(imageSource, std::move(imageRequest)); - setLocalData(imageLocalData); -} - -ImageSource ImageShadowNode::getImageSource() const { - auto sources = getProps()->sources; - - if (sources.size() == 0) { - return {.type = ImageSource::Type::Invalid}; - } - - if (sources.size() == 1) { - return sources[0]; - } - - auto layoutMetrics = getLayoutMetrics(); - auto size = layoutMetrics.getContentFrame().size; - auto scale = layoutMetrics.pointScaleFactor; - auto targetImageArea = size.width * size.height * scale * scale; - auto bestFit = kFloatMax; - - auto bestSource = ImageSource{}; - - for (const auto &source : sources) { - auto sourceSize = source.size; - auto sourceScale = source.scale == 0 ? scale : source.scale; - auto sourceArea = - sourceSize.width * sourceSize.height * sourceScale * sourceScale; - - auto fit = std::abs(1 - (sourceArea / targetImageArea)); - - if (fit < bestFit) { - bestFit = fit; - bestSource = source; - } - } - - return bestSource; -} - -#pragma mark - LayoutableShadowNode - -void ImageShadowNode::layout(LayoutContext layoutContext) { - updateLocalData(); - ConcreteViewShadowNode::layout(layoutContext); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageShadowNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageShadowNode.h deleted file mode 100644 index e1a811fd..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/ImageShadowNode.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -extern const char ImageComponentName[]; - -/* - * `ShadowNode` for component. - */ -class ImageShadowNode final : public ConcreteViewShadowNode< - ImageComponentName, - ImageProps, - ImageEventEmitter> { - public: - using ConcreteViewShadowNode::ConcreteViewShadowNode; - - /* - * Associates a shared `ImageManager` with the node. - */ - void setImageManager(const SharedImageManager &imageManager); - -#pragma mark - LayoutableShadowNode - - void layout(LayoutContext layoutContext) override; - - private: - /* - * (Re)Creates a `LocalData` object (with `ImageRequest`) if needed. - */ - void updateLocalData(); - - ImageSource getImageSource() const; - - SharedImageManager imageManager_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/conversions.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/conversions.h deleted file mode 100644 index 015c8f01..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/conversions.h +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -inline void fromRawValue(const RawValue &value, ImageSource &result) { - if (value.hasType()) { - result = {.type = ImageSource::Type::Remote, .uri = (std::string)value}; - return; - } - - if (value.hasType>()) { - auto items = (std::unordered_map)value; - result = {}; - - result.type = ImageSource::Type::Remote; - - if (items.find("__packager_asset") != items.end()) { - result.type = ImageSource::Type::Local; - } - - if (items.find("width") != items.end() && - items.find("height") != items.end()) { - result.size = {(Float)items.at("width"), (Float)items.at("height")}; - } - - if (items.find("scale") != items.end()) { - result.scale = (Float)items.at("scale"); - } else { - result.scale = items.find("deprecated") != items.end() ? 0.0 : 1.0; - } - - if (items.find("url") != items.end()) { - result.uri = (std::string)items.at("url"); - } - - if (items.find("uri") != items.end()) { - result.uri = (std::string)items.at("uri"); - } - - if (items.find("bundle") != items.end()) { - result.bundle = (std::string)items.at("bundle"); - result.type = ImageSource::Type::Local; - } - - return; - } - - abort(); -} - -inline std::string toString(const ImageSource &value) { - return "{uri: " + value.uri + "}"; -} - -inline void fromRawValue(const RawValue &value, ImageResizeMode &result) { - assert(value.hasType()); - auto stringValue = (std::string)value; - if (stringValue == "cover") { - result = ImageResizeMode::Cover; - return; - } - if (stringValue == "contain") { - result = ImageResizeMode::Contain; - return; - } - if (stringValue == "stretch") { - result = ImageResizeMode::Stretch; - return; - } - if (stringValue == "center") { - result = ImageResizeMode::Center; - return; - } - if (stringValue == "repeat") { - result = ImageResizeMode::Repeat; - return; - } - abort(); -} - -inline std::string toString(const ImageResizeMode &value) { - switch (value) { - case ImageResizeMode::Cover: - return "cover"; - case ImageResizeMode::Contain: - return "contain"; - case ImageResizeMode::Stretch: - return "stretch"; - case ImageResizeMode::Center: - return "center"; - case ImageResizeMode::Repeat: - return "repeat"; - } -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/tests/ImageTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/tests/ImageTest.cpp deleted file mode 100644 index 876af0aa..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/image/tests/ImageTest.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include - -TEST(ImageTest, testSomething) { - // TODO -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/root/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/root/BUCK deleted file mode 100644 index 9ce084c7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/root/BUCK +++ /dev/null @@ -1,78 +0,0 @@ -load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load( - "//tools/build_defs/oss:rn_defs.bzl", - "ANDROID", - "APPLE", - "fb_xplat_cxx_test", - "get_apple_compiler_flags", - "get_apple_inspector_flags", - "react_native_xplat_target", - "rn_xplat_cxx_library", - "subdir_glob", -) - -APPLE_COMPILER_FLAGS = get_apple_compiler_flags() - -rn_xplat_cxx_library( - name = "root", - srcs = glob( - ["**/*.cpp"], - exclude = glob(["tests/**/*.cpp"]), - ), - headers = [], - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "*.h"), - ], - prefix = "react/components/root", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - macosx_tests_override = [], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - # Systraces are temporary disabled. - # "-DWITH_FBSYSTRACE=1", - ], - tests = [":tests"], - visibility = ["PUBLIC"], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//third-party/glog:glog", - "xplat//yoga:yoga", - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/components/view:view"), - ], -) - -fb_xplat_cxx_test( - name = "tests", - srcs = glob(["tests/**/*.cpp"]), - headers = glob(["tests/**/*.h"]), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - contacts = ["oncall+react_native@xmail.facebook.com"], - platforms = (ANDROID, APPLE), - deps = [ - "xplat//folly:molly", - "xplat//third-party/gmock:gtest", - ":root", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/root/RootProps.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/root/RootProps.cpp deleted file mode 100644 index d0efb194..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/root/RootProps.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "RootProps.h" - -#include -#include - -namespace facebook { -namespace react { - -static YGStyle yogaStyleFromLayoutConstraints( - const LayoutConstraints &layoutConstraints) { - auto yogaStyle = YGStyle{}; - yogaStyle.minDimensions[YGDimensionWidth] = - yogaStyleValueFromFloat(layoutConstraints.minimumSize.width); - yogaStyle.minDimensions[YGDimensionHeight] = - yogaStyleValueFromFloat(layoutConstraints.minimumSize.height); - - yogaStyle.maxDimensions[YGDimensionWidth] = - yogaStyleValueFromFloat(layoutConstraints.maximumSize.width); - yogaStyle.maxDimensions[YGDimensionHeight] = - yogaStyleValueFromFloat(layoutConstraints.maximumSize.height); - - yogaStyle.direction = - yogaDirectionFromLayoutDirection(layoutConstraints.layoutDirection); - - return yogaStyle; -} - -RootProps::RootProps( - const RootProps &sourceProps, - const LayoutConstraints &layoutConstraints, - const LayoutContext &layoutContext) - : ViewProps(yogaStyleFromLayoutConstraints(layoutConstraints)), - layoutConstraints(layoutConstraints), - layoutContext(layoutContext){}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/root/RootProps.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/root/RootProps.h deleted file mode 100644 index 1ef3068e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/root/RootProps.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include -#include -#include - -namespace facebook { -namespace react { - -class RootProps; - -using SharedRootProps = std::shared_ptr; - -class RootProps final : public ViewProps { - public: - RootProps() = default; - RootProps( - const RootProps &sourceProps, - const LayoutConstraints &layoutConstraints, - const LayoutContext &layoutContext); - -#pragma mark - Props - - const LayoutConstraints layoutConstraints{}; - const LayoutContext layoutContext{}; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/root/RootShadowNode.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/root/RootShadowNode.cpp deleted file mode 100644 index 30d817bc..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/root/RootShadowNode.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "RootShadowNode.h" - -#include -#include - -namespace facebook { -namespace react { - -const char RootComponentName[] = "RootView"; - -void RootShadowNode::layout() { - SystraceSection s("RootShadowNode::layout"); - ensureUnsealed(); - layout(getProps()->layoutContext); - - // This is the rare place where shadow node must layout (set `layoutMetrics`) - // itself because there is no a parent node which usually should do it. - setLayoutMetrics(layoutMetricsFromYogaNode(yogaNode_)); -} - -UnsharedRootShadowNode RootShadowNode::clone( - const LayoutConstraints &layoutConstraints, - const LayoutContext &layoutContext) const { - auto props = std::make_shared( - *getProps(), layoutConstraints, layoutContext); - auto newRootShadowNode = std::make_shared( - *this, ShadowNodeFragment{.props = props}); - return newRootShadowNode; -} - -UnsharedRootShadowNode RootShadowNode::clone( - const SharedShadowNode &oldShadowNode, - const SharedShadowNode &newShadowNode) const { - std::vector> ancestors; - oldShadowNode->constructAncestorPath(*this, ancestors); - - if (ancestors.size() == 0) { - return UnsharedRootShadowNode{nullptr}; - } - - auto oldChild = oldShadowNode; - auto newChild = newShadowNode; - - SharedShadowNodeUnsharedList sharedChildren; - - for (const auto &ancestor : ancestors) { - auto children = ancestor.get().getChildren(); - std::replace(children.begin(), children.end(), oldChild, newChild); - - sharedChildren = std::make_shared(children); - - oldChild = ancestor.get().shared_from_this(); - newChild = oldChild->clone(ShadowNodeFragment{.children = sharedChildren}); - } - - return std::make_shared( - *this, ShadowNodeFragment{.children = sharedChildren}); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/root/RootShadowNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/root/RootShadowNode.h deleted file mode 100644 index cc0596d0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/root/RootShadowNode.h +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include -#include -#include - -namespace facebook { -namespace react { - -class RootShadowNode; - -using SharedRootShadowNode = std::shared_ptr; -using UnsharedRootShadowNode = std::shared_ptr; - -extern const char RootComponentName[]; - -/* - * `ShadowNode` for the root component. - * Besides all functionality of the `View` component, `RootShadowNode` contains - * props which represent external layout constraints and context of the - * shadow tree. - */ -class RootShadowNode final - : public ConcreteViewShadowNode { - public: - using ConcreteViewShadowNode::ConcreteViewShadowNode; - - /* - * Layouts the shadow tree. - */ - void layout(); - - /* - * Clones the node with given `layoutConstraints` and `layoutContext`. - */ - UnsharedRootShadowNode clone( - const LayoutConstraints &layoutConstraints, - const LayoutContext &layoutContext) const; - - /* - * Clones the node replacing a given old shadow node with a new one in the - * tree by cloning all nodes on the path to the root node and then complete - * the tree. Returns `nullptr` if the operation cannot be finished - * successfully. - */ - UnsharedRootShadowNode clone( - const SharedShadowNode &oldShadowNode, - const SharedShadowNode &newShadowNode) const; - - private: - using YogaLayoutableShadowNode::layout; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/root/tests/RootShadowNodeTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/root/tests/RootShadowNodeTest.cpp deleted file mode 100644 index 5ebd60a9..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/root/tests/RootShadowNodeTest.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include - -TEST(RootShadowNodeTest, testSomething) { - // TODO -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/BUCK deleted file mode 100644 index 2e712459..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/BUCK +++ /dev/null @@ -1,81 +0,0 @@ -load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load( - "//tools/build_defs/oss:rn_defs.bzl", - "ANDROID", - "APPLE", - "fb_xplat_cxx_test", - "get_apple_compiler_flags", - "get_apple_inspector_flags", - "react_native_xplat_target", - "rn_xplat_cxx_library", - "subdir_glob", -) - -APPLE_COMPILER_FLAGS = get_apple_compiler_flags() - -rn_xplat_cxx_library( - name = "scrollview", - srcs = glob( - ["**/*.cpp"], - exclude = glob(["tests/**/*.cpp"]), - ), - headers = glob( - ["**/*.h"], - exclude = glob(["tests/**/*.h"]), - ), - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "*.h"), - ], - prefix = "react/components/scrollview", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - force_static = True, - macosx_tests_override = [], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - tests = [":tests"], - visibility = ["PUBLIC"], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//third-party/glog:glog", - "xplat//yoga:yoga", - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/components/view:view"), - ], -) - -fb_xplat_cxx_test( - name = "tests", - srcs = glob(["tests/**/*.cpp"]), - headers = glob(["tests/**/*.h"]), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - contacts = ["oncall+react_native@xmail.facebook.com"], - platforms = (ANDROID, APPLE), - deps = [ - "xplat//folly:molly", - "xplat//third-party/gmock:gtest", - ":scrollview", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewComponentDescriptor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewComponentDescriptor.h deleted file mode 100644 index 74ccf924..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewComponentDescriptor.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using ScrollViewComponentDescriptor = - ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewEventEmitter.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewEventEmitter.cpp deleted file mode 100644 index ee800491..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewEventEmitter.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ScrollViewEventEmitter.h" - -namespace facebook { -namespace react { - -static jsi::Value scrollViewMetricsPayload( - jsi::Runtime &runtime, - const ScrollViewMetrics &scrollViewMetrics) { - auto payload = jsi::Object(runtime); - - { - auto contentOffset = jsi::Object(runtime); - contentOffset.setProperty(runtime, "x", scrollViewMetrics.contentOffset.x); - contentOffset.setProperty(runtime, "y", scrollViewMetrics.contentOffset.y); - payload.setProperty(runtime, "contentOffset", contentOffset); - } - - { - auto contentInset = jsi::Object(runtime); - contentInset.setProperty( - runtime, "top", scrollViewMetrics.contentInset.top); - contentInset.setProperty( - runtime, "left", scrollViewMetrics.contentInset.left); - contentInset.setProperty( - runtime, "bottom", scrollViewMetrics.contentInset.bottom); - contentInset.setProperty( - runtime, "right", scrollViewMetrics.contentInset.right); - payload.setProperty(runtime, "contentInset", contentInset); - } - - { - auto contentSize = jsi::Object(runtime); - contentSize.setProperty( - runtime, "width", scrollViewMetrics.contentSize.width); - contentSize.setProperty( - runtime, "height", scrollViewMetrics.contentSize.height); - payload.setProperty(runtime, "contentSize", contentSize); - } - - { - auto containerSize = jsi::Object(runtime); - containerSize.setProperty( - runtime, "width", scrollViewMetrics.containerSize.width); - containerSize.setProperty( - runtime, "height", scrollViewMetrics.containerSize.height); - payload.setProperty(runtime, "layoutMeasurement", containerSize); - } - - payload.setProperty(runtime, "zoomScale", scrollViewMetrics.zoomScale); - - return payload; -} - -void ScrollViewEventEmitter::onScroll( - const ScrollViewMetrics &scrollViewMetrics) const { - dispatchScrollViewEvent("scroll", scrollViewMetrics); -} - -void ScrollViewEventEmitter::onScrollBeginDrag( - const ScrollViewMetrics &scrollViewMetrics) const { - dispatchScrollViewEvent("scrollBeginDrag", scrollViewMetrics); -} - -void ScrollViewEventEmitter::onScrollEndDrag( - const ScrollViewMetrics &scrollViewMetrics) const { - dispatchScrollViewEvent("scrollEndDrag", scrollViewMetrics); -} - -void ScrollViewEventEmitter::onMomentumScrollBegin( - const ScrollViewMetrics &scrollViewMetrics) const { - dispatchScrollViewEvent("momentumScrollBegin", scrollViewMetrics); -} - -void ScrollViewEventEmitter::onMomentumScrollEnd( - const ScrollViewMetrics &scrollViewMetrics) const { - dispatchScrollViewEvent("momentumScrollEnd", scrollViewMetrics); -} - -void ScrollViewEventEmitter::dispatchScrollViewEvent( - const std::string &name, - const ScrollViewMetrics &scrollViewMetrics, - EventPriority priority) const { - dispatchEvent( - name, - [scrollViewMetrics](jsi::Runtime &runtime) { - return scrollViewMetricsPayload(runtime, scrollViewMetrics); - }, - priority); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewEventEmitter.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewEventEmitter.h deleted file mode 100644 index 91d419a0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewEventEmitter.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -#pragma once - -#include - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class ScrollViewMetrics { - public: - Size contentSize; - Point contentOffset; - EdgeInsets contentInset; - Size containerSize; - Float zoomScale; -}; - -class ScrollViewEventEmitter; - -using SharedScrollViewEventEmitter = - std::shared_ptr; - -class ScrollViewEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - void onScroll(const ScrollViewMetrics &scrollViewMetrics) const; - void onScrollBeginDrag(const ScrollViewMetrics &scrollViewMetrics) const; - void onScrollEndDrag(const ScrollViewMetrics &scrollViewMetrics) const; - void onMomentumScrollBegin(const ScrollViewMetrics &scrollViewMetrics) const; - void onMomentumScrollEnd(const ScrollViewMetrics &scrollViewMetrics) const; - - private: - void dispatchScrollViewEvent( - const std::string &name, - const ScrollViewMetrics &scrollViewMetrics, - EventPriority priority = EventPriority::AsynchronousBatched) const; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewLocalData.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewLocalData.cpp deleted file mode 100644 index f3e1cd1f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewLocalData.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ScrollViewLocalData.h" - -#include -#include - -namespace facebook { -namespace react { - -ScrollViewLocalData::ScrollViewLocalData(Rect contentBoundingRect) - : contentBoundingRect(contentBoundingRect) {} - -Size ScrollViewLocalData::getContentSize() const { - return Size{contentBoundingRect.getMaxX(), contentBoundingRect.getMaxY()}; -} - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE -std::string ScrollViewLocalData::getDebugName() const { - return "ScrollViewLocalData"; -} - -SharedDebugStringConvertibleList ScrollViewLocalData::getDebugProps() const { - return { - debugStringConvertibleItem("contentBoundingRect", contentBoundingRect)}; -} -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewLocalData.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewLocalData.h deleted file mode 100644 index f54778fe..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewLocalData.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -class ScrollViewLocalData; - -using SharedScrollViewLocalData = std::shared_ptr; - -/* - * LocalData for component. - */ -class ScrollViewLocalData : public LocalData { - public: - ScrollViewLocalData(Rect contentBoundingRect); - - /* - * Compound size of all nested (first level only) components; - * is used for computing `contentSize`. - */ - const Rect contentBoundingRect; - -#pragma mark - Getters - - Size getContentSize() const; - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE - std::string getDebugName() const override; - SharedDebugStringConvertibleList getDebugProps() const override; -#endif -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewProps.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewProps.cpp deleted file mode 100644 index 4b2184b1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewProps.cpp +++ /dev/null @@ -1,232 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ScrollViewProps.h" - -#include -#include -#include - -#include - -namespace facebook { -namespace react { - -ScrollViewProps::ScrollViewProps( - const ScrollViewProps &sourceProps, - const RawProps &rawProps) - : ViewProps(sourceProps, rawProps), - alwaysBounceHorizontal(convertRawProp( - rawProps, - "alwaysBounceHorizontal", - sourceProps.alwaysBounceHorizontal)), - alwaysBounceVertical(convertRawProp( - rawProps, - "alwaysBounceVertical", - sourceProps.alwaysBounceVertical)), - bounces(convertRawProp(rawProps, "bounces", sourceProps.bounces, true)), - bouncesZoom(convertRawProp( - rawProps, - "bouncesZoom", - sourceProps.bouncesZoom, - true)), - canCancelContentTouches(convertRawProp( - rawProps, - "canCancelContentTouches", - sourceProps.canCancelContentTouches)), - centerContent( - convertRawProp(rawProps, "centerContent", sourceProps.centerContent)), - automaticallyAdjustContentInsets(convertRawProp( - rawProps, - "automaticallyAdjustContentInsets", - sourceProps.automaticallyAdjustContentInsets)), - decelerationRate(convertRawProp( - rawProps, - "decelerationRate", - sourceProps.decelerationRate, - (Float)0.998)), - directionalLockEnabled(convertRawProp( - rawProps, - "directionalLockEnabled", - sourceProps.directionalLockEnabled)), - indicatorStyle(convertRawProp( - rawProps, - "indicatorStyle", - sourceProps.indicatorStyle)), - keyboardDismissMode(convertRawProp( - rawProps, - "keyboardDismissMode", - sourceProps.keyboardDismissMode)), - maximumZoomScale(convertRawProp( - rawProps, - "maximumZoomScale", - sourceProps.maximumZoomScale, - (Float)1.0)), - minimumZoomScale(convertRawProp( - rawProps, - "minimumZoomScale", - sourceProps.minimumZoomScale, - (Float)1.0)), - scrollEnabled(convertRawProp( - rawProps, - "scrollEnabled", - sourceProps.scrollEnabled, - true)), - pagingEnabled( - convertRawProp(rawProps, "pagingEnabled", sourceProps.pagingEnabled)), - pinchGestureEnabled(convertRawProp( - rawProps, - "pinchGestureEnabled", - sourceProps.pinchGestureEnabled, - true)), - scrollsToTop(convertRawProp( - rawProps, - "scrollsToTop", - sourceProps.scrollsToTop, - true)), - showsHorizontalScrollIndicator(convertRawProp( - rawProps, - "showsHorizontalScrollIndicator", - sourceProps.showsHorizontalScrollIndicator, - true)), - showsVerticalScrollIndicator(convertRawProp( - rawProps, - "showsVerticalScrollIndicator", - sourceProps.showsVerticalScrollIndicator, - true)), - scrollEventThrottle(convertRawProp( - rawProps, - "scrollEventThrottle", - sourceProps.scrollEventThrottle)), - zoomScale(convertRawProp( - rawProps, - "zoomScale", - sourceProps.zoomScale, - (Float)1.0)), - contentInset( - convertRawProp(rawProps, "contentInset", sourceProps.contentInset)), - scrollIndicatorInsets(convertRawProp( - rawProps, - "scrollIndicatorInsets", - sourceProps.scrollIndicatorInsets)), - snapToInterval(convertRawProp( - rawProps, - "snapToInterval", - sourceProps.snapToInterval)), - snapToAlignment(convertRawProp( - rawProps, - "snapToAlignment", - sourceProps.snapToAlignment)) {} - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE -SharedDebugStringConvertibleList ScrollViewProps::getDebugProps() const { - auto defaultScrollViewProps = ScrollViewProps{}; - - return ViewProps::getDebugProps() + - SharedDebugStringConvertibleList{ - debugStringConvertibleItem( - "alwaysBounceHorizontal", - alwaysBounceHorizontal, - defaultScrollViewProps.alwaysBounceHorizontal), - debugStringConvertibleItem( - "alwaysBounceVertical", - alwaysBounceVertical, - defaultScrollViewProps.alwaysBounceVertical), - debugStringConvertibleItem( - "bounces", bounces, defaultScrollViewProps.bounces), - debugStringConvertibleItem( - "bouncesZoom", bouncesZoom, defaultScrollViewProps.bouncesZoom), - debugStringConvertibleItem( - "canCancelContentTouches", - canCancelContentTouches, - defaultScrollViewProps.canCancelContentTouches), - debugStringConvertibleItem( - "centerContent", - centerContent, - defaultScrollViewProps.centerContent), - debugStringConvertibleItem( - "automaticallyAdjustContentInsets", - automaticallyAdjustContentInsets, - defaultScrollViewProps.automaticallyAdjustContentInsets), - debugStringConvertibleItem( - "decelerationRate", - decelerationRate, - defaultScrollViewProps.decelerationRate), - debugStringConvertibleItem( - "directionalLockEnabled", - directionalLockEnabled, - defaultScrollViewProps.directionalLockEnabled), - debugStringConvertibleItem( - "indicatorStyle", - indicatorStyle, - defaultScrollViewProps.indicatorStyle), - debugStringConvertibleItem( - "keyboardDismissMode", - keyboardDismissMode, - defaultScrollViewProps.keyboardDismissMode), - debugStringConvertibleItem( - "maximumZoomScale", - maximumZoomScale, - defaultScrollViewProps.maximumZoomScale), - debugStringConvertibleItem( - "minimumZoomScale", - minimumZoomScale, - defaultScrollViewProps.minimumZoomScale), - debugStringConvertibleItem( - "scrollEnabled", - scrollEnabled, - defaultScrollViewProps.scrollEnabled), - debugStringConvertibleItem( - "pagingEnabled", - pagingEnabled, - defaultScrollViewProps.pagingEnabled), - debugStringConvertibleItem( - "pinchGestureEnabled", - pinchGestureEnabled, - defaultScrollViewProps.pinchGestureEnabled), - debugStringConvertibleItem( - "scrollsToTop", - scrollsToTop, - defaultScrollViewProps.scrollsToTop), - debugStringConvertibleItem( - "showsHorizontalScrollIndicator", - showsHorizontalScrollIndicator, - defaultScrollViewProps.showsHorizontalScrollIndicator), - debugStringConvertibleItem( - "showsVerticalScrollIndicator", - showsVerticalScrollIndicator, - defaultScrollViewProps.showsVerticalScrollIndicator), - debugStringConvertibleItem( - "scrollEventThrottle", - scrollEventThrottle, - defaultScrollViewProps.scrollEventThrottle), - debugStringConvertibleItem( - "zoomScale", zoomScale, defaultScrollViewProps.zoomScale), - debugStringConvertibleItem( - "contentInset", - contentInset, - defaultScrollViewProps.contentInset), - debugStringConvertibleItem( - "scrollIndicatorInsets", - scrollIndicatorInsets, - defaultScrollViewProps.scrollIndicatorInsets), - debugStringConvertibleItem( - "snapToInterval", - snapToInterval, - defaultScrollViewProps.snapToInterval), - debugStringConvertibleItem( - "snapToAlignment", - snapToAlignment, - defaultScrollViewProps.snapToAlignment), - }; -} -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewProps.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewProps.h deleted file mode 100644 index 4dc57b79..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewProps.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -// TODO (T28334063): Consider for codegen. -class ScrollViewProps final : public ViewProps { - public: - ScrollViewProps() = default; - ScrollViewProps(const ScrollViewProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - const bool alwaysBounceHorizontal{}; - const bool alwaysBounceVertical{}; - const bool bounces{true}; - const bool bouncesZoom{true}; - const bool canCancelContentTouches{true}; - const bool centerContent{}; - const bool automaticallyAdjustContentInsets{}; - const Float decelerationRate{0.998}; - const bool directionalLockEnabled{}; - const ScrollViewIndicatorStyle indicatorStyle{}; - const ScrollViewKeyboardDismissMode keyboardDismissMode{}; - const Float maximumZoomScale{1.0}; - const Float minimumZoomScale{1.0}; - const bool scrollEnabled{true}; - const bool pagingEnabled{}; - const bool pinchGestureEnabled{true}; - const bool scrollsToTop{true}; - const bool showsHorizontalScrollIndicator{true}; - const bool showsVerticalScrollIndicator{true}; - const Float scrollEventThrottle{}; - const Float zoomScale{1.0}; - const EdgeInsets contentInset{}; - const EdgeInsets scrollIndicatorInsets{}; - const int snapToInterval{}; - const ScrollViewSnapToAlignment snapToAlignment{}; - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE - SharedDebugStringConvertibleList getDebugProps() const override; -#endif -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewShadowNode.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewShadowNode.cpp deleted file mode 100644 index 4eb4bdec..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewShadowNode.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ScrollViewShadowNode.h" - -#include - -#include "ScrollViewLocalData.h" - -namespace facebook { -namespace react { - -const char ScrollViewComponentName[] = "ScrollView"; - -void ScrollViewShadowNode::updateLocalData() { - ensureUnsealed(); - - auto contentBoundingRect = Rect{}; - for (const auto &childNode : getLayoutableChildNodes()) { - contentBoundingRect.unionInPlace(childNode->getLayoutMetrics().frame); - } - - const auto &localData = - std::make_shared(contentBoundingRect); - setLocalData(localData); -} - -#pragma mark - LayoutableShadowNode - -void ScrollViewShadowNode::layout(LayoutContext layoutContext) { - ConcreteViewShadowNode::layout(layoutContext); - updateLocalData(); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewShadowNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewShadowNode.h deleted file mode 100644 index fabc946a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/ScrollViewShadowNode.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -extern const char ScrollViewComponentName[]; - -/* - * `ShadowNode` for component. - */ -class ScrollViewShadowNode final : public ConcreteViewShadowNode< - ScrollViewComponentName, - ScrollViewProps, - ScrollViewEventEmitter> { - public: - using ConcreteViewShadowNode::ConcreteViewShadowNode; - -#pragma mark - LayoutableShadowNode - - void layout(LayoutContext layoutContext) override; - - private: - void updateLocalData(); -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/conversions.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/conversions.h deleted file mode 100644 index bcbcaaac..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/conversions.h +++ /dev/null @@ -1,107 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -inline void fromRawValue( - const RawValue &value, - ScrollViewSnapToAlignment &result) { - auto string = (std::string)value; - if (string == "start") { - result = ScrollViewSnapToAlignment::Start; - return; - } - if (string == "center") { - result = ScrollViewSnapToAlignment::Center; - return; - } - if (string == "end") { - result = ScrollViewSnapToAlignment::End; - return; - } - abort(); -} - -inline void fromRawValue( - const RawValue &value, - ScrollViewIndicatorStyle &result) { - auto string = (std::string)value; - if (string == "default") { - result = ScrollViewIndicatorStyle::Default; - return; - } - if (string == "black") { - result = ScrollViewIndicatorStyle::Black; - return; - } - if (string == "white") { - result = ScrollViewIndicatorStyle::White; - return; - } - abort(); -} - -inline void fromRawValue( - const RawValue &value, - ScrollViewKeyboardDismissMode &result) { - auto string = (std::string)value; - if (string == "none") { - result = ScrollViewKeyboardDismissMode::None; - return; - } - if (string == "on-drag") { - result = ScrollViewKeyboardDismissMode::OnDrag; - return; - } - if (string == "interactive") { - result = ScrollViewKeyboardDismissMode::Interactive; - return; - } - abort(); -} - -inline std::string toString(const ScrollViewSnapToAlignment &value) { - switch (value) { - case ScrollViewSnapToAlignment::Start: - return "start"; - case ScrollViewSnapToAlignment::Center: - return "center"; - case ScrollViewSnapToAlignment::End: - return "end"; - } -} - -inline std::string toString(const ScrollViewIndicatorStyle &value) { - switch (value) { - case ScrollViewIndicatorStyle::Default: - return "default"; - case ScrollViewIndicatorStyle::Black: - return "black"; - case ScrollViewIndicatorStyle::White: - return "white"; - } -} - -inline std::string toString(const ScrollViewKeyboardDismissMode &value) { - switch (value) { - case ScrollViewKeyboardDismissMode::None: - return "none"; - case ScrollViewKeyboardDismissMode::OnDrag: - return "on-drag"; - case ScrollViewKeyboardDismissMode::Interactive: - return "interactive"; - } -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/primitives.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/primitives.h deleted file mode 100644 index 81ceb0de..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/primitives.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -namespace facebook { -namespace react { - -enum class ScrollViewSnapToAlignment { Start, Center, End }; - -enum class ScrollViewIndicatorStyle { Default, Black, White }; - -enum class ScrollViewKeyboardDismissMode { None, OnDrag, Interactive }; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/tests/ScrollViewTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/tests/ScrollViewTest.cpp deleted file mode 100644 index c95dea07..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/scrollview/tests/ScrollViewTest.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include - -TEST(ScrollViewTest, testSomething) { - // TODO -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/BUCK deleted file mode 100644 index c82cd512..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/BUCK +++ /dev/null @@ -1,79 +0,0 @@ -load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load( - "//tools/build_defs/oss:rn_defs.bzl", - "ANDROID", - "APPLE", - "fb_xplat_cxx_test", - "get_apple_compiler_flags", - "get_apple_inspector_flags", - "react_native_xplat_target", - "rn_xplat_cxx_library", - "subdir_glob", -) - -APPLE_COMPILER_FLAGS = get_apple_compiler_flags() - -rn_xplat_cxx_library( - name = "slider", - srcs = glob( - ["**/*.cpp"], - exclude = glob(["tests/**/*.cpp"]), - ), - headers = [], - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "*.h"), - ], - prefix = "react/components/slider", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - macosx_tests_override = [], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - tests = [":tests"], - visibility = ["PUBLIC"], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//third-party/glog:glog", - "xplat//yoga:yoga", - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/components/image:image"), - react_native_xplat_target("fabric/components/view:view"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/imagemanager:imagemanager"), - ], -) - -fb_xplat_cxx_test( - name = "tests", - srcs = glob(["tests/**/*.cpp"]), - headers = glob(["tests/**/*.h"]), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - contacts = ["oncall+react_native@xmail.facebook.com"], - platforms = (ANDROID, APPLE), - deps = [ - "xplat//folly:molly", - "xplat//third-party/gmock:gtest", - ":slider", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderComponentDescriptor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderComponentDescriptor.h deleted file mode 100644 index c692d14e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderComponentDescriptor.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -/* - * Descriptor for component. - */ -class SliderComponentDescriptor final - : public ConcreteComponentDescriptor { - public: - SliderComponentDescriptor( - SharedEventDispatcher eventDispatcher, - const SharedContextContainer &contextContainer) - : ConcreteComponentDescriptor(eventDispatcher), - imageManager_( - contextContainer - ? contextContainer->getInstance( - "ImageManager") - : nullptr) {} - - void adopt(UnsharedShadowNode shadowNode) const override { - ConcreteComponentDescriptor::adopt(shadowNode); - - assert(std::dynamic_pointer_cast(shadowNode)); - auto sliderShadowNode = - std::static_pointer_cast(shadowNode); - - // `SliderShadowNode` uses `ImageManager` to initiate image loading and - // communicate the loading state and results to mounting layer. - sliderShadowNode->setImageManager(imageManager_); - } - - private: - const SharedImageManager imageManager_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderEventEmitter.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderEventEmitter.cpp deleted file mode 100644 index 8d03b6a2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderEventEmitter.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "SliderEventEmitter.h" - -namespace facebook { -namespace react { - -void SliderEventEmitter::onValueChange(float value) const { - dispatchEvent("valueChange", [value](jsi::Runtime &runtime) { - auto payload = jsi::Object(runtime); - payload.setProperty(runtime, "value", value); - return payload; - }); -} - -void SliderEventEmitter::onSlidingComplete(float value) const { - dispatchEvent("slidingComplete", [value](jsi::Runtime &runtime) { - auto payload = jsi::Object(runtime); - payload.setProperty(runtime, "value", value); - return payload; - }); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderEventEmitter.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderEventEmitter.h deleted file mode 100644 index 9394df7f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderEventEmitter.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -#pragma once - -#include - -namespace facebook { -namespace react { - -class SliderEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - void onValueChange(float value) const; - void onSlidingComplete(float value) const; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderLocalData.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderLocalData.cpp deleted file mode 100644 index f73d9be6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderLocalData.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "SliderLocalData.h" - -#include -#include - -namespace facebook { -namespace react { - -ImageSource SliderLocalData::getTrackImageSource() const { - return trackImageSource_; -} - -const ImageRequest &SliderLocalData::getTrackImageRequest() const { - return trackImageRequest_; -} - -ImageSource SliderLocalData::getMinimumTrackImageSource() const { - return minimumTrackImageSource_; -} - -const ImageRequest &SliderLocalData::getMinimumTrackImageRequest() const { - return minimumTrackImageRequest_; -} - -ImageSource SliderLocalData::getMaximumTrackImageSource() const { - return maximumTrackImageSource_; -} - -const ImageRequest &SliderLocalData::getMaximumTrackImageRequest() const { - return maximumTrackImageRequest_; -} - -ImageSource SliderLocalData::getThumbImageSource() const { - return thumbImageSource_; -} - -const ImageRequest &SliderLocalData::getThumbImageRequest() const { - return thumbImageRequest_; -} - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE -std::string SliderLocalData::getDebugName() const { - return "SliderLocalData"; -} - -SharedDebugStringConvertibleList SliderLocalData::getDebugProps() const { - return { - debugStringConvertibleItem("trackImageSource", trackImageSource_), - debugStringConvertibleItem( - "minimumTrackImageSource", minimumTrackImageSource_), - debugStringConvertibleItem( - "maximumTrackImageSource", maximumTrackImageSource_), - debugStringConvertibleItem("thumbImageSource", thumbImageSource_), - }; -} -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderLocalData.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderLocalData.h deleted file mode 100644 index 93d8ef21..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderLocalData.h +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class SliderLocalData; - -using SharedSliderLocalData = std::shared_ptr; - -/* - * LocalData for component. - * Represents the image request state and (possible) retrieved image bitmap. - */ -class SliderLocalData : public LocalData { - public: - SliderLocalData( - const ImageSource &trackImageSource, - ImageRequest trackImageRequest, - const ImageSource &minimumTrackImageSource, - ImageRequest minimumTrackImageRequest, - const ImageSource &maximumTrackImageSource, - ImageRequest maximumTrackImageRequest, - const ImageSource &thumbImageSource, - ImageRequest thumbImageRequest) - : trackImageSource_(trackImageSource), - trackImageRequest_(std::move(trackImageRequest)), - minimumTrackImageSource_(minimumTrackImageSource), - minimumTrackImageRequest_(std::move(minimumTrackImageRequest)), - maximumTrackImageSource_(maximumTrackImageSource), - maximumTrackImageRequest_(std::move(maximumTrackImageRequest)), - thumbImageSource_(thumbImageSource), - thumbImageRequest_(std::move(thumbImageRequest)){}; - - /* - * Returns stored ImageSource object. - */ - ImageSource getTrackImageSource() const; - - /* - * Exposes for reading stored `ImageRequest` object. - * `ImageRequest` object cannot be copied or moved from `ImageLocalData`. - */ - const ImageRequest &getTrackImageRequest() const; - - /* - * Returns stored ImageSource object. - */ - ImageSource getMinimumTrackImageSource() const; - - /* - * Exposes for reading stored `ImageRequest` object. - * `ImageRequest` object cannot be copied or moved from `ImageLocalData`. - */ - const ImageRequest &getMinimumTrackImageRequest() const; - - /* - * Returns stored ImageSource object. - */ - ImageSource getMaximumTrackImageSource() const; - - /* - * Exposes for reading stored `ImageRequest` object. - * `ImageRequest` object cannot be copied or moved from `ImageLocalData`. - */ - const ImageRequest &getMaximumTrackImageRequest() const; - - /* - * Returns stored ImageSource object. - */ - ImageSource getThumbImageSource() const; - - /* - * Exposes for reading stored `ImageRequest` object. - * `ImageRequest` object cannot be copied or moved from `ImageLocalData`. - */ - const ImageRequest &getThumbImageRequest() const; - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE - std::string getDebugName() const override; - SharedDebugStringConvertibleList getDebugProps() const override; -#endif - - private: - ImageSource trackImageSource_; - ImageRequest trackImageRequest_; - ImageSource minimumTrackImageSource_; - ImageRequest minimumTrackImageRequest_; - ImageSource maximumTrackImageSource_; - ImageRequest maximumTrackImageRequest_; - ImageSource thumbImageSource_; - ImageRequest thumbImageRequest_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderProps.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderProps.cpp deleted file mode 100644 index cbdb029f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderProps.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -SliderProps::SliderProps( - const SliderProps &sourceProps, - const RawProps &rawProps) - : ViewProps(sourceProps, rawProps), - value(convertRawProp(rawProps, "value", sourceProps.value, value)), - minimumValue(convertRawProp( - rawProps, - "minimumValue", - sourceProps.minimumValue, - minimumValue)), - maximumValue(convertRawProp( - rawProps, - "maximumValue", - sourceProps.maximumValue, - maximumValue)), - step(convertRawProp(rawProps, "step", sourceProps.step, step)), - disabled( - convertRawProp(rawProps, "disabled", sourceProps.disabled, disabled)), - minimumTrackTintColor(convertRawProp( - rawProps, - "minimumTrackTintColor", - sourceProps.minimumTrackTintColor, - minimumTrackTintColor)), - maximumTrackTintColor(convertRawProp( - rawProps, - "maximumTrackTintColor", - sourceProps.maximumTrackTintColor, - maximumTrackTintColor)), - thumbTintColor(convertRawProp( - rawProps, - "thumbTintColor", - sourceProps.thumbTintColor, - thumbTintColor)), - trackImage(convertRawProp( - rawProps, - "trackImage", - sourceProps.trackImage, - trackImage)), - minimumTrackImage(convertRawProp( - rawProps, - "minimumTrackImage", - sourceProps.minimumTrackImage, - minimumTrackImage)), - maximumTrackImage(convertRawProp( - rawProps, - "maximumTrackImage", - sourceProps.maximumTrackImage, - maximumTrackImage)), - thumbImage(convertRawProp( - rawProps, - "thumbImage", - sourceProps.thumbImage, - thumbImage)) {} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderProps.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderProps.h deleted file mode 100644 index 8ddee4b6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderProps.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -// TODO (T28334063): Consider for codegen. -class SliderProps final : public ViewProps { - public: - SliderProps() = default; - SliderProps(const SliderProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - const float value{0}; - const float minimumValue{0}; - const float maximumValue{1}; - const float step{0}; - const bool disabled{false}; - const SharedColor minimumTrackTintColor{}; - const SharedColor maximumTrackTintColor{}; - - // Android only - const SharedColor thumbTintColor; - - // iOS only - const ImageSource trackImage{}; - const ImageSource minimumTrackImage{}; - const ImageSource maximumTrackImage{}; - const ImageSource thumbImage{}; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderShadowNode.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderShadowNode.cpp deleted file mode 100644 index 5726bc2f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderShadowNode.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "SliderShadowNode.h" - -#include -#include -#include - -namespace facebook { -namespace react { - -extern const char SliderComponentName[] = "Slider"; - -void SliderShadowNode::setImageManager(const SharedImageManager &imageManager) { - ensureUnsealed(); - imageManager_ = imageManager; -} - -void SliderShadowNode::updateLocalData() { - const auto &newTrackImageSource = getTrackImageSource(); - const auto &newMinimumTrackImageSource = getMinimumTrackImageSource(); - const auto &newMaximumTrackImageSource = getMaximumTrackImageSource(); - const auto &newThumbImageSource = getThumbImageSource(); - - const auto &localData = getLocalData(); - if (localData) { - assert(std::dynamic_pointer_cast(localData)); - auto currentLocalData = - std::static_pointer_cast(localData); - - auto trackImageSource = currentLocalData->getTrackImageSource(); - auto minimumTrackImageSource = - currentLocalData->getMinimumTrackImageSource(); - auto maximumTrackImageSource = - currentLocalData->getMaximumTrackImageSource(); - auto thumbImageSource = currentLocalData->getThumbImageSource(); - - bool anyChanged = newTrackImageSource != trackImageSource || - newMinimumTrackImageSource != minimumTrackImageSource || - newMaximumTrackImageSource != maximumTrackImageSource || - newThumbImageSource != thumbImageSource; - - if (!anyChanged) { - return; - } - } - - // Now we are about to mutate the Shadow Node. - ensureUnsealed(); - - // It is not possible to copy or move image requests from SliderLocalData, - // so instead we recreate any image requests (that may already be in-flight?) - // TODO: check if multiple requests are cached or if it's a net loss - const auto &newLocalData = std::make_shared( - newTrackImageSource, - imageManager_->requestImage(newTrackImageSource), - newMinimumTrackImageSource, - imageManager_->requestImage(newMinimumTrackImageSource), - newMaximumTrackImageSource, - imageManager_->requestImage(newMaximumTrackImageSource), - newThumbImageSource, - imageManager_->requestImage(newThumbImageSource)); - setLocalData(newLocalData); -} - -ImageSource SliderShadowNode::getTrackImageSource() const { - return getProps()->trackImage; -} - -ImageSource SliderShadowNode::getMinimumTrackImageSource() const { - return getProps()->minimumTrackImage; -} - -ImageSource SliderShadowNode::getMaximumTrackImageSource() const { - return getProps()->maximumTrackImage; -} - -ImageSource SliderShadowNode::getThumbImageSource() const { - return getProps()->thumbImage; -} - -#pragma mark - LayoutableShadowNode - -void SliderShadowNode::layout(LayoutContext layoutContext) { - updateLocalData(); - ConcreteViewShadowNode::layout(layoutContext); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderShadowNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderShadowNode.h deleted file mode 100644 index 27ffdb04..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/SliderShadowNode.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -extern const char SliderComponentName[]; - -/* - * `ShadowNode` for component. - */ -class SliderShadowNode final : public ConcreteViewShadowNode< - SliderComponentName, - SliderProps, - SliderEventEmitter> { - public: - using ConcreteViewShadowNode::ConcreteViewShadowNode; - - // Associates a shared `ImageManager` with the node. - void setImageManager(const SharedImageManager &imageManager); - -#pragma mark - LayoutableShadowNode - - void layout(LayoutContext layoutContext) override; - - private: - // (Re)Creates a `LocalData` object (with `ImageRequest`) if needed. - void updateLocalData(); - - ImageSource getTrackImageSource() const; - ImageSource getMinimumTrackImageSource() const; - ImageSource getMaximumTrackImageSource() const; - ImageSource getThumbImageSource() const; - - SharedImageManager imageManager_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/tests/SliderTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/tests/SliderTest.cpp deleted file mode 100644 index 233aebde..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/slider/tests/SliderTest.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include - -TEST(SliderTest, testSomething) { - // TODO -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/BUCK deleted file mode 100644 index bceff95d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/BUCK +++ /dev/null @@ -1,90 +0,0 @@ -load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load( - "//tools/build_defs/oss:rn_defs.bzl", - "ANDROID", - "APPLE", - "fb_xplat_cxx_test", - "get_apple_compiler_flags", - "get_apple_inspector_flags", - "react_native_xplat_target", - "rn_xplat_cxx_library", - "subdir_glob", -) - -APPLE_COMPILER_FLAGS = get_apple_compiler_flags() - -rn_xplat_cxx_library( - name = "text", - srcs = glob( - ["**/*.cpp"], - exclude = glob(["tests/**/*.cpp"]), - ), - headers = glob( - ["**/*.h"], - exclude = glob(["tests/**/*.h"]), - ), - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "*.h"), - ("basetext", "*.h"), - ("paragraph", "*.h"), - ("text", "*.h"), - ("rawtext", "*.h"), - ], - prefix = "react/components/text", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - force_static = True, - macosx_tests_override = [], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - tests = [":tests"], - visibility = ["PUBLIC"], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:evicting_cache_map", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//third-party/glog:glog", - "xplat//yoga:yoga", - react_native_xplat_target("utils:utils"), - react_native_xplat_target("fabric/attributedstring:attributedstring"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/textlayoutmanager:textlayoutmanager"), - react_native_xplat_target("fabric/components/view:view"), - react_native_xplat_target("fabric/uimanager:uimanager"), - ], -) - -fb_xplat_cxx_test( - name = "tests", - srcs = glob(["tests/**/*.cpp"]), - headers = glob(["tests/**/*.h"]), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - contacts = ["oncall+react_native@xmail.facebook.com"], - platforms = (ANDROID, APPLE), - deps = [ - "xplat//folly:molly", - "xplat//third-party/gmock:gtest", - ":text", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/basetext/BaseTextProps.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/basetext/BaseTextProps.cpp deleted file mode 100644 index d25d9f71..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/basetext/BaseTextProps.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "BaseTextProps.h" - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -static TextAttributes convertRawProp( - const RawProps &rawProps, - const TextAttributes defaultTextAttributes) { - auto textAttributes = TextAttributes{}; - - // Color - textAttributes.foregroundColor = - convertRawProp(rawProps, "color", defaultTextAttributes.foregroundColor); - textAttributes.backgroundColor = convertRawProp( - rawProps, "backgroundColor", defaultTextAttributes.backgroundColor); - textAttributes.opacity = - convertRawProp(rawProps, "opacity", defaultTextAttributes.opacity); - - // Font - textAttributes.fontFamily = - convertRawProp(rawProps, "fontFamily", defaultTextAttributes.fontFamily); - textAttributes.fontSize = - convertRawProp(rawProps, "fontSize", defaultTextAttributes.fontSize); - textAttributes.fontSizeMultiplier = convertRawProp( - rawProps, "fontSizeMultiplier", defaultTextAttributes.fontSizeMultiplier); - textAttributes.fontWeight = - convertRawProp(rawProps, "fontWeight", defaultTextAttributes.fontWeight); - textAttributes.fontStyle = - convertRawProp(rawProps, "fontStyle", defaultTextAttributes.fontStyle); - textAttributes.fontVariant = convertRawProp( - rawProps, "fontVariant", defaultTextAttributes.fontVariant); - textAttributes.allowFontScaling = convertRawProp( - rawProps, "allowFontScaling", defaultTextAttributes.allowFontScaling); - textAttributes.letterSpacing = convertRawProp( - rawProps, "letterSpacing", defaultTextAttributes.letterSpacing); - - // Paragraph - textAttributes.lineHeight = - convertRawProp(rawProps, "lineHeight", defaultTextAttributes.lineHeight); - textAttributes.alignment = - convertRawProp(rawProps, "alignment", defaultTextAttributes.alignment); - textAttributes.baseWritingDirection = convertRawProp( - rawProps, - "baseWritingDirection", - defaultTextAttributes.baseWritingDirection); - - // Decoration - textAttributes.textDecorationColor = convertRawProp( - rawProps, - "textDecorationColor", - defaultTextAttributes.textDecorationColor); - textAttributes.textDecorationLineType = convertRawProp( - rawProps, - "textDecorationLine", - defaultTextAttributes.textDecorationLineType); - textAttributes.textDecorationLineStyle = convertRawProp( - rawProps, - "textDecorationLineStyle", - defaultTextAttributes.textDecorationLineStyle); - textAttributes.textDecorationLinePattern = convertRawProp( - rawProps, - "textDecorationLinePattern", - defaultTextAttributes.textDecorationLinePattern); - - // Shadow - textAttributes.textShadowOffset = convertRawProp( - rawProps, "textShadowOffset", defaultTextAttributes.textShadowOffset); - textAttributes.textShadowRadius = convertRawProp( - rawProps, "textShadowRadius", defaultTextAttributes.textShadowRadius); - textAttributes.textShadowColor = convertRawProp( - rawProps, "textShadowColor", defaultTextAttributes.textShadowColor); - - // Special - textAttributes.isHighlighted = convertRawProp( - rawProps, "isHighlighted", defaultTextAttributes.isHighlighted); - - return textAttributes; -} - -BaseTextProps::BaseTextProps( - const BaseTextProps &sourceProps, - const RawProps &rawProps) - : textAttributes(convertRawProp(rawProps, sourceProps.textAttributes)){}; - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE -SharedDebugStringConvertibleList BaseTextProps::getDebugProps() const { - return textAttributes.getDebugProps(); -} -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/basetext/BaseTextProps.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/basetext/BaseTextProps.h deleted file mode 100644 index 25968c20..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/basetext/BaseTextProps.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * `Props`-like class which is used as a base class for all Props classes - * that can have text attributes (such as Text and Paragraph). - */ -class BaseTextProps { - public: - BaseTextProps() = default; - BaseTextProps(const BaseTextProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - const TextAttributes textAttributes{}; - -#pragma mark - DebugStringConvertible (partially) - -#if RN_DEBUG_STRING_CONVERTIBLE - SharedDebugStringConvertibleList getDebugProps() const; -#endif -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/basetext/BaseTextShadowNode.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/basetext/BaseTextShadowNode.cpp deleted file mode 100644 index c7443aea..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/basetext/BaseTextShadowNode.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "BaseTextShadowNode.h" - -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -AttributedString BaseTextShadowNode::getAttributedString( - const TextAttributes &textAttributes, - const SharedShadowNode &parentNode) const { - auto attributedString = AttributedString{}; - - for (const auto &childNode : parentNode->getChildren()) { - // RawShadowNode - auto rawTextShadowNode = - std::dynamic_pointer_cast(childNode); - if (rawTextShadowNode) { - auto fragment = AttributedString::Fragment{}; - fragment.string = rawTextShadowNode->getProps()->text; - fragment.textAttributes = textAttributes; - - // Storing a retaining pointer to `ParagraphShadowNode` inside - // `attributedString` causes a retain cycle (besides that fact that we - // don't need it at all). Storing a `ShadowView` instance instead of - // `ShadowNode` should properly fix this problem. - fragment.parentShadowView = ShadowView(*parentNode); - attributedString.appendFragment(fragment); - continue; - } - - // TextShadowNode - auto textShadowNode = - std::dynamic_pointer_cast(childNode); - if (textShadowNode) { - auto localTextAttributes = textAttributes; - localTextAttributes.apply(textShadowNode->getProps()->textAttributes); - attributedString.appendAttributedString( - textShadowNode->getAttributedString( - localTextAttributes, textShadowNode)); - continue; - } - - // Any other kind of ShadowNode - auto fragment = AttributedString::Fragment{}; - fragment.shadowView = ShadowView(*childNode); - fragment.textAttributes = textAttributes; - attributedString.appendFragment(fragment); - } - - return attributedString; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/basetext/BaseTextShadowNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/basetext/BaseTextShadowNode.h deleted file mode 100644 index 7da11864..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/basetext/BaseTextShadowNode.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -/* - * Base class (one of) for shadow nodes that represents attributed text, - * such as Text and Paragraph (but not RawText). - */ -class BaseTextShadowNode { - public: - /* - * Returns a `AttributedString` which represents text content of the node. - */ - AttributedString getAttributedString( - const TextAttributes &baseTextAttributes, - const SharedShadowNode &parentNode) const; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphComponentDescriptor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphComponentDescriptor.h deleted file mode 100644 index f87fffda..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphComponentDescriptor.h +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include "ParagraphMeasurementCache.h" -#include "ParagraphShadowNode.h" - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * Descriptor for component. - */ -class ParagraphComponentDescriptor final - : public ConcreteComponentDescriptor { - public: - ParagraphComponentDescriptor( - SharedEventDispatcher eventDispatcher, - const SharedContextContainer &contextContainer) - : ConcreteComponentDescriptor(eventDispatcher) { - // Every single `ParagraphShadowNode` will have a reference to - // a shared `TextLayoutManager`. - textLayoutManager_ = std::make_shared(contextContainer); - // Every single `ParagraphShadowNode` will have a reference to - // a shared `EvictingCacheMap`, a simple LRU cache for Paragraph - // measurements. -#ifdef ANDROID - auto paramName = "react_fabric:enabled_paragraph_measure_cache_android"; -#else - auto paramName = "react_fabric:enabled_paragraph_measure_cache_ios"; -#endif - // TODO: T39927960 - get rid of this if statement - bool enableCache = - (contextContainer != nullptr - ? contextContainer - ->getInstance>( - "ReactNativeConfig") - ->getBool(paramName) - : false); - if (enableCache) { - measureCache_ = std::make_unique(); - } else { - measureCache_ = nullptr; - } - } - - void adopt(UnsharedShadowNode shadowNode) const override { - ConcreteComponentDescriptor::adopt(shadowNode); - - assert(std::dynamic_pointer_cast(shadowNode)); - auto paragraphShadowNode = - std::static_pointer_cast(shadowNode); - - // `ParagraphShadowNode` uses `TextLayoutManager` to measure text content - // and communicate text rendering metrics to mounting layer. - paragraphShadowNode->setTextLayoutManager(textLayoutManager_); - - // `ParagraphShadowNode` uses this to cache the results of text rendering - // measurements. - paragraphShadowNode->setMeasureCache( - measureCache_ ? measureCache_.get() : nullptr); - - // All `ParagraphShadowNode`s must have leaf Yoga nodes with properly - // setup measure function. - paragraphShadowNode->enableMeasurement(); - } - - private: - SharedTextLayoutManager textLayoutManager_; - std::unique_ptr measureCache_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.cpp deleted file mode 100644 index fb9426da..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ParagraphLocalData.h" - -#include -#include - -namespace facebook { -namespace react { - -AttributedString ParagraphLocalData::getAttributedString() const { - return attributedString_; -} - -void ParagraphLocalData::setAttributedString( - AttributedString attributedString) { - ensureUnsealed(); - attributedString_ = attributedString; -} - -SharedTextLayoutManager ParagraphLocalData::getTextLayoutManager() const { - return textLayoutManager_; -} - -void ParagraphLocalData::setTextLayoutManager( - SharedTextLayoutManager textLayoutManager) { - ensureUnsealed(); - textLayoutManager_ = textLayoutManager; -} - -#ifdef ANDROID - -folly::dynamic ParagraphLocalData::getDynamic() const { - return toDynamic(*this); -} - -#endif - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE -std::string ParagraphLocalData::getDebugName() const { - return "ParagraphLocalData"; -} - -SharedDebugStringConvertibleList ParagraphLocalData::getDebugProps() const { - return { - debugStringConvertibleItem("attributedString", attributedString_, "")}; -} -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.h deleted file mode 100644 index 15e37057..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class ParagraphLocalData; - -using SharedParagraphLocalData = std::shared_ptr; - -/* - * LocalData for component. - * Represents what to render and how to render. - */ -class ParagraphLocalData : public LocalData { - public: - /* - * All content of component represented as an `AttributedString`. - */ - AttributedString getAttributedString() const; - void setAttributedString(AttributedString attributedString); - - /* - * `TextLayoutManager` provides a connection to platform-specific - * text rendering infrastructure which is capable to render the - * `AttributedString`. - */ - SharedTextLayoutManager getTextLayoutManager() const; - void setTextLayoutManager(SharedTextLayoutManager textLayoutManager); - -#ifdef ANDROID - folly::dynamic getDynamic() const override; -#endif - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE - std::string getDebugName() const override; - SharedDebugStringConvertibleList getDebugProps() const override; -#endif - - private: - AttributedString attributedString_; - SharedTextLayoutManager textLayoutManager_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphMeasurementCache.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphMeasurementCache.h deleted file mode 100644 index 6c4f2a89..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphMeasurementCache.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include -#include -#include - -namespace facebook { -namespace react { -using ParagraphMeasurementCacheKey = - std::tuple; -using ParagraphMeasurementCacheValue = Size; - -class ParagraphMeasurementCache { - public: - ParagraphMeasurementCache() : cache_{256} {} - - bool exists(const ParagraphMeasurementCacheKey &key) const { - std::lock_guard lock(mutex_); - return cache_.exists(key); - } - - ParagraphMeasurementCacheValue get( - const ParagraphMeasurementCacheKey &key) const { - std::lock_guard lock(mutex_); - return cache_.get(key); - } - - void set( - const ParagraphMeasurementCacheKey &key, - const ParagraphMeasurementCacheValue &value) const { - std::lock_guard lock(mutex_); - cache_.set(key, value); - } - - private: - mutable folly::EvictingCacheMap< - ParagraphMeasurementCacheKey, - ParagraphMeasurementCacheValue> - cache_; - mutable std::mutex mutex_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphProps.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphProps.cpp deleted file mode 100644 index d8135cd8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphProps.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ParagraphProps.h" - -#include -#include -#include - -namespace facebook { -namespace react { - -static ParagraphAttributes convertRawProp( - const RawProps &rawProps, - const ParagraphAttributes &defaultParagraphAttributes) { - auto paragraphAttributes = ParagraphAttributes{}; - - paragraphAttributes.maximumNumberOfLines = convertRawProp( - rawProps, - "numberOfLines", - defaultParagraphAttributes.maximumNumberOfLines); - paragraphAttributes.ellipsizeMode = convertRawProp( - rawProps, "ellipsizeMode", defaultParagraphAttributes.ellipsizeMode); - paragraphAttributes.adjustsFontSizeToFit = convertRawProp( - rawProps, - "adjustsFontSizeToFit", - defaultParagraphAttributes.adjustsFontSizeToFit); - paragraphAttributes.minimumFontSize = convertRawProp( - rawProps, - "minimumFontSize", - defaultParagraphAttributes.minimumFontSize, - std::numeric_limits::quiet_NaN()); - paragraphAttributes.maximumFontSize = convertRawProp( - rawProps, - "maximumFontSize", - defaultParagraphAttributes.maximumFontSize, - std::numeric_limits::quiet_NaN()); - - return paragraphAttributes; -} - -ParagraphProps::ParagraphProps( - const ParagraphProps &sourceProps, - const RawProps &rawProps) - : ViewProps(sourceProps, rawProps), - BaseTextProps(sourceProps, rawProps), - paragraphAttributes( - convertRawProp(rawProps, sourceProps.paragraphAttributes)), - isSelectable( - convertRawProp(rawProps, "selectable", sourceProps.isSelectable)){}; - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE -SharedDebugStringConvertibleList ParagraphProps::getDebugProps() const { - return ViewProps::getDebugProps() + BaseTextProps::getDebugProps() + - paragraphAttributes.getDebugProps() + - SharedDebugStringConvertibleList{ - debugStringConvertibleItem("isSelectable", isSelectable)}; -} -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphProps.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphProps.h deleted file mode 100644 index 1e1ca67e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphProps.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * Props of component. - * Most of the props are directly stored in composed `ParagraphAttributes` - * object. - */ -class ParagraphProps : public ViewProps, public BaseTextProps { - public: - ParagraphProps() = default; - ParagraphProps(const ParagraphProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - /* - * Contains all prop values that affect visual representation of the - * paragraph. - */ - const ParagraphAttributes paragraphAttributes{}; - - /* - * Defines can the text be selected (and copied) or not. - */ - const bool isSelectable{}; - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE - SharedDebugStringConvertibleList getDebugProps() const override; -#endif -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphShadowNode.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphShadowNode.cpp deleted file mode 100644 index 68def552..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphShadowNode.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ParagraphShadowNode.h" -#include "ParagraphLocalData.h" -#include "ParagraphMeasurementCache.h" - -namespace facebook { -namespace react { - -const char ParagraphComponentName[] = "Paragraph"; - -AttributedString ParagraphShadowNode::getAttributedString() const { - if (!cachedAttributedString_.has_value()) { - auto textAttributes = TextAttributes::defaultTextAttributes(); - textAttributes.apply(getProps()->textAttributes); - - cachedAttributedString_ = BaseTextShadowNode::getAttributedString( - textAttributes, shared_from_this()); - } - - return cachedAttributedString_.value(); -} - -void ParagraphShadowNode::setTextLayoutManager( - SharedTextLayoutManager textLayoutManager) { - ensureUnsealed(); - textLayoutManager_ = textLayoutManager; -} - -void ParagraphShadowNode::setMeasureCache( - const ParagraphMeasurementCache *cache) { - ensureUnsealed(); - measureCache_ = cache; -} - -void ParagraphShadowNode::updateLocalDataIfNeeded() { - ensureUnsealed(); - - auto attributedString = getAttributedString(); - auto currentLocalData = - std::static_pointer_cast(getLocalData()); - if (currentLocalData && - currentLocalData->getAttributedString() == attributedString) { - return; - } - - auto localData = std::make_shared(); - localData->setAttributedString(std::move(attributedString)); - localData->setTextLayoutManager(textLayoutManager_); - setLocalData(localData); -} - -#pragma mark - LayoutableShadowNode - -Size ParagraphShadowNode::measure(LayoutConstraints layoutConstraints) const { - AttributedString attributedString = getAttributedString(); - const ParagraphAttributes attributes = getProps()->paragraphAttributes; - - auto makeMeasurements = [&] { - return textLayoutManager_->measure( - attributedString, getProps()->paragraphAttributes, layoutConstraints); - }; - - // Cache results of this function so we don't need to call measure() - // repeatedly - if (measureCache_ != nullptr) { - ParagraphMeasurementCacheKey cacheKey = - std::make_tuple(attributedString, attributes, layoutConstraints); - if (measureCache_->exists(cacheKey)) { - return measureCache_->get(cacheKey); - } - - auto measuredSize = makeMeasurements(); - measureCache_->set(cacheKey, measuredSize); - - return measuredSize; - } - - return makeMeasurements(); -} - -void ParagraphShadowNode::layout(LayoutContext layoutContext) { - updateLocalDataIfNeeded(); - ConcreteViewShadowNode::layout(layoutContext); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphShadowNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphShadowNode.h deleted file mode 100644 index 9d03af4a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/ParagraphShadowNode.h +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -extern const char ParagraphComponentName[]; - -using ParagraphEventEmitter = ViewEventEmitter; - -/* - * `ShadowNode` for component, represents -like component - * containing and displaying text. Text content is represented as nested - * and components. - */ -class ParagraphShadowNode : public ConcreteViewShadowNode< - ParagraphComponentName, - ParagraphProps, - ParagraphEventEmitter>, - public BaseTextShadowNode { - public: - using ConcreteViewShadowNode::ConcreteViewShadowNode; - - /* - * Returns a `AttributedString` which represents text content of the node. - */ - AttributedString getAttributedString() const; - - /* - * Associates a shared TextLayoutManager with the node. - * `ParagraphShadowNode` uses the manager to measure text content - * and construct `ParagraphLocalData` objects. - */ - void setTextLayoutManager(SharedTextLayoutManager textLayoutManager); - - /* - * Associates a shared LRU cache with the node. - * `ParagraphShadowNode` uses this to cache the results of - * text rendering measurements. - * By design, the ParagraphComponentDescriptor outlives all - * shadow nodes, so it's safe for this to be a raw pointer. - */ - void setMeasureCache(const ParagraphMeasurementCache *cache); - -#pragma mark - LayoutableShadowNode - - void layout(LayoutContext layoutContext) override; - Size measure(LayoutConstraints layoutConstraints) const override; - - private: - /* - * Creates a `LocalData` object (with `AttributedText` and - * `TextLayoutManager`) if needed. - */ - void updateLocalDataIfNeeded(); - - SharedTextLayoutManager textLayoutManager_; - const ParagraphMeasurementCache *measureCache_; - - /* - * Cached attributed string that represents the content of the subtree started - * from the node. - */ - mutable folly::Optional cachedAttributedString_{}; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/conversions.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/conversions.h deleted file mode 100644 index dd507cef..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/paragraph/conversions.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include -#include -#include - -namespace facebook { -namespace react { - -#ifdef ANDROID - -inline folly::dynamic toDynamic(const ParagraphLocalData ¶graphLocalData) { - folly::dynamic newLocalData = folly::dynamic::object(); - newLocalData["attributedString"] = - toDynamic(paragraphLocalData.getAttributedString()); - newLocalData["hash"] = newLocalData["attributedString"]["hash"]; - return newLocalData; -} - -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/rawtext/RawTextComponentDescriptor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/rawtext/RawTextComponentDescriptor.h deleted file mode 100644 index 8ee9418e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/rawtext/RawTextComponentDescriptor.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using RawTextComponentDescriptor = - ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/rawtext/RawTextProps.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/rawtext/RawTextProps.cpp deleted file mode 100644 index 92a485ab..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/rawtext/RawTextProps.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "RawTextProps.h" - -#include -#include - -namespace facebook { -namespace react { - -RawTextProps::RawTextProps( - const RawTextProps &sourceProps, - const RawProps &rawProps) - : Props(sourceProps, rawProps), - text(convertRawProp(rawProps, "text", sourceProps.text)){}; - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE -SharedDebugStringConvertibleList RawTextProps::getDebugProps() const { - return {debugStringConvertibleItem("text", text)}; -} -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/rawtext/RawTextProps.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/rawtext/RawTextProps.h deleted file mode 100644 index 4b774ca4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/rawtext/RawTextProps.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include -#include - -namespace facebook { -namespace react { - -class RawTextProps; - -using SharedRawTextProps = std::shared_ptr; - -class RawTextProps : public Props { - public: - RawTextProps() = default; - RawTextProps(const RawTextProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - const std::string text{}; - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE - SharedDebugStringConvertibleList getDebugProps() const override; -#endif -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/rawtext/RawTextShadowNode.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/rawtext/RawTextShadowNode.cpp deleted file mode 100644 index 61de150a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/rawtext/RawTextShadowNode.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "RawTextShadowNode.h" - -namespace facebook { -namespace react { - -extern const char RawTextComponentName[] = "RawText"; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/rawtext/RawTextShadowNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/rawtext/RawTextShadowNode.h deleted file mode 100644 index 6613289a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/rawtext/RawTextShadowNode.h +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -extern const char RawTextComponentName[]; - -/* - * `ShadowNode` for component, represents a purely regular string - * object in React. In a code fragment `Hello!`, "Hello!" part - * is represented as ``. - * component must not have any children. - */ -using RawTextShadowNode = - ConcreteShadowNode; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/tests/ParagraphLocalDataTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/tests/ParagraphLocalDataTest.cpp deleted file mode 100644 index accf32c0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/tests/ParagraphLocalDataTest.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -#ifdef ANDROID - -TEST(ParagraphLocalDataTest, testSomething) { - auto attString = AttributedString(); - auto fragment = AttributedString::Fragment(); - fragment.string = "test"; - - auto text = TextAttributes(); - text.foregroundColor = { - colorFromComponents({100 / 255.0, 153 / 255.0, 253 / 255.0, 1.0})}; - text.opacity = 0.5; - text.fontStyle = FontStyle::Italic; - text.fontWeight = FontWeight::Thin; - text.fontVariant = FontVariant::TabularNums; - fragment.textAttributes = text; - attString.prependFragment(fragment); - - auto paragraphLocalData = ParagraphLocalData(); - paragraphLocalData.setAttributedString(attString); - - auto result = toDynamic(paragraphLocalData)["attributedString"]; - - assert(result["string"] == fragment.string); - auto textAttribute = result["fragments"][0]["textAttributes"]; - assert(textAttribute["foregroundColor"] == toDynamic(text.foregroundColor)); - assert(textAttribute["opacity"] == text.opacity); - assert(textAttribute["fontStyle"] == toString(*text.fontStyle)); - assert(textAttribute["fontWeight"] == toString(*text.fontWeight)); -} - -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/tests/TextTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/tests/TextTest.cpp deleted file mode 100644 index 1be2d441..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/tests/TextTest.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include - -TEST(TextTest, testSomething) { - // TODO: -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/text/TextComponentDescriptor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/text/TextComponentDescriptor.h deleted file mode 100644 index 13946369..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/text/TextComponentDescriptor.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using TextComponentDescriptor = ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/text/TextProps.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/text/TextProps.cpp deleted file mode 100644 index 6a24fa8b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/text/TextProps.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "TextProps.h" - -namespace facebook { -namespace react { - -TextProps::TextProps(const TextProps &sourceProps, const RawProps &rawProps) - : BaseTextProps::BaseTextProps(sourceProps, rawProps){}; - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE -SharedDebugStringConvertibleList TextProps::getDebugProps() const { - return BaseTextProps::getDebugProps(); -} -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/text/TextProps.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/text/TextProps.h deleted file mode 100644 index 83680db4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/text/TextProps.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class TextProps : public Props, public BaseTextProps { - public: - TextProps() = default; - TextProps(const TextProps &sourceProps, const RawProps &rawProps); - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE - SharedDebugStringConvertibleList getDebugProps() const override; -#endif -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/text/TextShadowNode.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/text/TextShadowNode.cpp deleted file mode 100644 index 60e0445a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/text/TextShadowNode.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "TextShadowNode.h" - -namespace facebook { -namespace react { - -extern const char TextComponentName[] = "Text"; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/text/TextShadowNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/text/TextShadowNode.h deleted file mode 100644 index 52ed70e9..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/text/text/TextShadowNode.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -extern const char TextComponentName[]; - -using TextEventEmitter = TouchEventEmitter; - -class TextShadowNode - : public ConcreteShadowNode, - public BaseTextShadowNode { - public: - using ConcreteShadowNode::ConcreteShadowNode; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/BUCK deleted file mode 100644 index 5ea07711..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/BUCK +++ /dev/null @@ -1,84 +0,0 @@ -load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load( - "//tools/build_defs/oss:rn_defs.bzl", - "ANDROID", - "APPLE", - "fb_xplat_cxx_test", - "get_apple_compiler_flags", - "get_apple_inspector_flags", - "react_native_xplat_target", - "rn_xplat_cxx_library", - "subdir_glob", -) - -APPLE_COMPILER_FLAGS = get_apple_compiler_flags() - -rn_xplat_cxx_library( - name = "view", - srcs = glob( - ["**/*.cpp"], - exclude = glob(["tests/**/*.cpp"]), - ), - headers = glob( - ["**/*.h"], - exclude = glob(["tests/**/*.h"]), - ), - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "*.h"), - ("accessibility", "*.h"), - ("root", "*.h"), - ("yoga", "*.h"), - ], - prefix = "react/components/view", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - force_static = True, - macosx_tests_override = [], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - # Systraces are temporary disabled. - # "-DWITH_FBSYSTRACE=1", - ], - tests = [":tests"], - visibility = ["PUBLIC"], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//third-party/glog:glog", - "xplat//yoga:yoga", - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/graphics:graphics"), - ], -) - -fb_xplat_cxx_test( - name = "tests", - srcs = glob(["tests/**/*.cpp"]), - headers = glob(["tests/**/*.h"]), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - contacts = ["oncall+react_native@xmail.facebook.com"], - platforms = (ANDROID, APPLE), - deps = [ - "xplat//folly:molly", - "xplat//third-party/gmock:gtest", - ":view", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ConcreteViewShadowNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ConcreteViewShadowNode.h deleted file mode 100644 index 584afe8e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ConcreteViewShadowNode.h +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * Template for all -like classes (classes which have all same props - * as and similar basic behaviour). - * For example: , , but not , . - */ -template < - const char *concreteComponentName, - typename ViewPropsT = ViewProps, - typename ViewEventEmitterT = ViewEventEmitter> -class ConcreteViewShadowNode : public ConcreteShadowNode< - concreteComponentName, - ViewPropsT, - ViewEventEmitterT>, - public AccessibleShadowNode, - public YogaLayoutableShadowNode { - static_assert( - std::is_base_of::value, - "ViewPropsT must be a descendant of ViewProps"); - static_assert( - std::is_base_of::value, - "ViewPropsT must be a descendant of YogaStylableProps"); - static_assert( - std::is_base_of::value, - "ViewPropsT must be a descendant of AccessibilityProps"); - - public: - using BaseShadowNode = - ConcreteShadowNode; - using ConcreteViewProps = ViewPropsT; - - ConcreteViewShadowNode( - const ShadowNodeFragment &fragment, - const ShadowNodeCloneFunction &cloneFunction) - : BaseShadowNode(fragment, cloneFunction), - AccessibleShadowNode( - std::static_pointer_cast(fragment.props)), - YogaLayoutableShadowNode() { - YogaLayoutableShadowNode::setProps( - *std::static_pointer_cast(fragment.props)); - YogaLayoutableShadowNode::setChildren( - BaseShadowNode::template getChildrenSlice()); - }; - - ConcreteViewShadowNode( - const ShadowNode &sourceShadowNode, - const ShadowNodeFragment &fragment) - : BaseShadowNode(sourceShadowNode, fragment), - AccessibleShadowNode( - static_cast(sourceShadowNode), - std::static_pointer_cast(fragment.props)), - YogaLayoutableShadowNode( - static_cast(sourceShadowNode)) { - if (fragment.props) { - YogaLayoutableShadowNode::setProps( - *std::static_pointer_cast(fragment.props)); - } - - if (fragment.children) { - YogaLayoutableShadowNode::setChildren( - BaseShadowNode::template getChildrenSlice< - YogaLayoutableShadowNode>()); - } - }; - - void appendChild(const SharedShadowNode &child) { - ensureUnsealed(); - - ShadowNode::appendChild(child); - - auto nonConstChild = const_cast(child.get()); - auto yogaLayoutableChild = - dynamic_cast(nonConstChild); - if (yogaLayoutableChild) { - YogaLayoutableShadowNode::appendChild(yogaLayoutableChild); - } - } - - LayoutableShadowNode *cloneAndReplaceChild( - LayoutableShadowNode *child, - int suggestedIndex = -1) override { - ensureUnsealed(); - auto childShadowNode = static_cast(child); - auto clonedChildShadowNode = - std::static_pointer_cast( - childShadowNode->clone({})); - ShadowNode::replaceChild( - childShadowNode->shared_from_this(), - clonedChildShadowNode, - suggestedIndex); - return clonedChildShadowNode.get(); - } - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE - SharedDebugStringConvertibleList getDebugProps() const override { - auto list = SharedDebugStringConvertibleList{}; - - auto basePropsList = ShadowNode::getDebugProps(); - std::move( - basePropsList.begin(), basePropsList.end(), std::back_inserter(list)); - - list.push_back(std::make_shared( - "layout", "", LayoutableShadowNode::getDebugProps())); - - return list; - } -#endif -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/TouchEventEmitter.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/TouchEventEmitter.cpp deleted file mode 100644 index ddf69aa4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/TouchEventEmitter.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "TouchEventEmitter.h" - -namespace facebook { -namespace react { - -#pragma mark - Touches - -static jsi::Value touchPayload(jsi::Runtime &runtime, const Touch &touch) { - auto object = jsi::Object(runtime); - object.setProperty(runtime, "locationX", touch.offsetPoint.x); - object.setProperty(runtime, "locationY", touch.offsetPoint.y); - object.setProperty(runtime, "pageX", touch.pagePoint.x); - object.setProperty(runtime, "pageY", touch.pagePoint.y); - object.setProperty(runtime, "screenX", touch.screenPoint.x); - object.setProperty(runtime, "screenY", touch.screenPoint.y); - object.setProperty(runtime, "identifier", touch.identifier); - object.setProperty(runtime, "target", touch.target); - object.setProperty(runtime, "timestamp", touch.timestamp * 1000); - object.setProperty(runtime, "force", touch.force); - return object; -} - -static jsi::Value touchesPayload( - jsi::Runtime &runtime, - const Touches &touches) { - auto array = jsi::Array(runtime, touches.size()); - int i = 0; - for (const auto &touch : touches) { - array.setValueAtIndex(runtime, i++, touchPayload(runtime, touch)); - } - return array; -} - -static jsi::Value touchEventPayload( - jsi::Runtime &runtime, - const TouchEvent &event) { - auto object = jsi::Object(runtime); - object.setProperty( - runtime, "touches", touchesPayload(runtime, event.touches)); - object.setProperty( - runtime, "changedTouches", touchesPayload(runtime, event.changedTouches)); - object.setProperty( - runtime, "targetTouches", touchesPayload(runtime, event.targetTouches)); - return object; -} - -void TouchEventEmitter::dispatchTouchEvent( - const std::string &type, - const TouchEvent &event, - const EventPriority &priority) const { - dispatchEvent( - type, - [event](jsi::Runtime &runtime) { - return touchEventPayload(runtime, event); - }, - priority); -} - -void TouchEventEmitter::onTouchStart(const TouchEvent &event) const { - dispatchTouchEvent("touchStart", event, EventPriority::SynchronousUnbatched); -} - -void TouchEventEmitter::onTouchMove(const TouchEvent &event) const { - dispatchTouchEvent("touchMove", event, EventPriority::SynchronousBatched); -} - -void TouchEventEmitter::onTouchEnd(const TouchEvent &event) const { - dispatchTouchEvent("touchEnd", event, EventPriority::SynchronousBatched); -} - -void TouchEventEmitter::onTouchCancel(const TouchEvent &event) const { - dispatchTouchEvent("touchCancel", event, EventPriority::SynchronousBatched); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/TouchEventEmitter.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/TouchEventEmitter.h deleted file mode 100644 index 3bf5e50f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/TouchEventEmitter.h +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * Describes an individual touch point for a touch event. - * See https://www.w3.org/TR/touch-events/ for more details. - */ -struct Touch { - /* - * The coordinate of point relative to the root component in points. - */ - Point pagePoint; - - /* - * The coordinate of point relative to the target component in points. - */ - Point offsetPoint; - - /* - * The coordinate of point relative to the screen component in points. - */ - Point screenPoint; - - /* - * An identification number for each touch point. - */ - int identifier; - - /* - * The tag of a component on which the touch point started when it was first - * placed on the surface, even if the touch point has since moved outside the - * interactive area of that element. - */ - Tag target; - - /* - * The force of the touch. - */ - Float force; - - /* - * The time in seconds when the touch occurred or when it was last mutated. - */ - Float timestamp; - - /* - * The particular implementation of `Hasher` and (especially) `Comparator` - * make sense only when `Touch` object is used as a *key* in indexed - * collections. Because of that they are expressed as separate classes. - */ - struct Hasher { - size_t operator()(const Touch &touch) const { - return std::hash()(touch.identifier); - } - }; - - struct Comparator { - bool operator()(const Touch &lhs, const Touch &rhs) const { - return lhs.identifier == rhs.identifier; - } - }; -}; - -using Touches = std::unordered_set; - -/* - * Defines the `touchstart`, `touchend`, `touchmove`, and `touchcancel` event - * types. - */ -struct TouchEvent { - /* - * A list of Touches for every point of contact currently touching the - * surface. - */ - Touches touches; - - /* - * A list of Touches for every point of contact which contributed to the - * event. - */ - Touches changedTouches; - - /* - * A list of Touches for every point of contact that is touching the surface - * and started on the element that is the target of the current event. - */ - Touches targetTouches; -}; - -class TouchEventEmitter; -using SharedTouchEventEmitter = std::shared_ptr; - -class TouchEventEmitter : public EventEmitter { - public: - using EventEmitter::EventEmitter; - - void onTouchStart(const TouchEvent &event) const; - void onTouchMove(const TouchEvent &event) const; - void onTouchEnd(const TouchEvent &event) const; - void onTouchCancel(const TouchEvent &event) const; - - private: - void dispatchTouchEvent( - const std::string &type, - const TouchEvent &event, - const EventPriority &priority) const; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewComponentDescriptor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewComponentDescriptor.h deleted file mode 100644 index dfa98ac1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewComponentDescriptor.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using ViewComponentDescriptor = ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewEventEmitter.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewEventEmitter.cpp deleted file mode 100644 index 4ab1f900..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewEventEmitter.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ViewEventEmitter.h" - -namespace facebook { -namespace react { - -#pragma mark - Accessibility - -void ViewEventEmitter::onAccessibilityAction(const std::string &name) const { - dispatchEvent("accessibilityAction", [name](jsi::Runtime &runtime) { - auto payload = jsi::Object(runtime); - payload.setProperty(runtime, "action", name); - return payload; - }); -} - -void ViewEventEmitter::onAccessibilityTap() const { - dispatchEvent("accessibilityTap"); -} - -void ViewEventEmitter::onAccessibilityMagicTap() const { - dispatchEvent("magicTap"); -} - -void ViewEventEmitter::onAccessibilityEscape() const { - dispatchEvent("accessibilityEscape"); -} - -#pragma mark - Layout - -void ViewEventEmitter::onLayout(const LayoutMetrics &layoutMetrics) const { - dispatchEvent("layout", [frame = layoutMetrics.frame](jsi::Runtime &runtime) { - auto layout = jsi::Object(runtime); - layout.setProperty(runtime, "x", frame.origin.x); - layout.setProperty(runtime, "y", frame.origin.y); - layout.setProperty(runtime, "width", frame.size.width); - layout.setProperty(runtime, "height", frame.size.height); - auto payload = jsi::Object(runtime); - payload.setProperty(runtime, "layout", std::move(layout)); - return payload; - }); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewEventEmitter.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewEventEmitter.h deleted file mode 100644 index e16b4f98..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewEventEmitter.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -#pragma once - -#include - -#include -#include -#include "TouchEventEmitter.h" - -namespace facebook { -namespace react { - -class ViewEventEmitter; - -using SharedViewEventEmitter = std::shared_ptr; - -class ViewEventEmitter : public TouchEventEmitter { - public: - using TouchEventEmitter::TouchEventEmitter; - -#pragma mark - Accessibility - - void onAccessibilityAction(const std::string &name) const; - void onAccessibilityTap() const; - void onAccessibilityMagicTap() const; - void onAccessibilityEscape() const; - -#pragma mark - Layout - - void onLayout(const LayoutMetrics &layoutMetrics) const; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewProps.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewProps.cpp deleted file mode 100644 index db11821b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewProps.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ViewProps.h" - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -ViewProps::ViewProps(const YGStyle &yogaStyle) : YogaStylableProps(yogaStyle) {} - -ViewProps::ViewProps(const ViewProps &sourceProps, const RawProps &rawProps) - : Props(sourceProps, rawProps), - YogaStylableProps(sourceProps, rawProps), - AccessibilityProps(sourceProps, rawProps), - opacity( - convertRawProp(rawProps, "opacity", sourceProps.opacity, (Float)1.0)), - foregroundColor(convertRawProp( - rawProps, - "foregroundColor", - sourceProps.foregroundColor)), - backgroundColor(convertRawProp( - rawProps, - "backgroundColor", - sourceProps.backgroundColor)), - borderRadii(convertRawProp( - rawProps, - "border", - "Radius", - sourceProps.borderRadii)), - borderColors(convertRawProp( - rawProps, - "border", - "Color", - sourceProps.borderColors)), - borderStyles(convertRawProp( - rawProps, - "border", - "Style", - sourceProps.borderStyles)), - shadowColor( - convertRawProp(rawProps, "shadowColor", sourceProps.shadowColor)), - shadowOffset( - convertRawProp(rawProps, "shadowOffset", sourceProps.shadowOffset)), - shadowOpacity( - convertRawProp(rawProps, "shadowOpacity", sourceProps.shadowOpacity)), - shadowRadius( - convertRawProp(rawProps, "shadowRadius", sourceProps.shadowRadius)), - transform(convertRawProp(rawProps, "transform", sourceProps.transform)), - backfaceVisibility(convertRawProp( - rawProps, - "backfaceVisibility", - sourceProps.backfaceVisibility)), - shouldRasterize(convertRawProp( - rawProps, - "shouldRasterize", - sourceProps.shouldRasterize)), - zIndex(convertRawProp(rawProps, "zIndex", sourceProps.zIndex)), - pointerEvents( - convertRawProp(rawProps, "pointerEvents", sourceProps.pointerEvents)), - hitSlop(convertRawProp(rawProps, "hitSlop", sourceProps.hitSlop)), - onLayout(convertRawProp(rawProps, "onLayout", sourceProps.onLayout)), - collapsable(convertRawProp( - rawProps, - "collapsable", - sourceProps.collapsable, - true)){}; - -#pragma mark - Convenience Methods - -BorderMetrics ViewProps::resolveBorderMetrics(bool isRTL) const { - auto borderWidths = CascadedBorderWidths{ - .left = optionalFloatFromYogaValue(yogaStyle.border[YGEdgeLeft]), - .top = optionalFloatFromYogaValue(yogaStyle.border[YGEdgeTop]), - .right = optionalFloatFromYogaValue(yogaStyle.border[YGEdgeRight]), - .bottom = optionalFloatFromYogaValue(yogaStyle.border[YGEdgeBottom]), - .start = optionalFloatFromYogaValue(yogaStyle.border[YGEdgeStart]), - .end = optionalFloatFromYogaValue(yogaStyle.border[YGEdgeEnd]), - .horizontal = - optionalFloatFromYogaValue(yogaStyle.border[YGEdgeHorizontal]), - .vertical = optionalFloatFromYogaValue(yogaStyle.border[YGEdgeVertical]), - .all = optionalFloatFromYogaValue(yogaStyle.border[YGEdgeAll])}; - - return {.borderColors = borderColors.resolve(isRTL, {}), - .borderWidths = borderWidths.resolve(isRTL, 0), - .borderRadii = borderRadii.resolve(isRTL, 0), - .borderStyles = borderStyles.resolve(isRTL, BorderStyle::Solid)}; -} - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE -SharedDebugStringConvertibleList ViewProps::getDebugProps() const { - const auto &defaultViewProps = ViewProps(); - - return AccessibilityProps::getDebugProps() + - YogaStylableProps::getDebugProps() + - SharedDebugStringConvertibleList{ - debugStringConvertibleItem("zIndex", zIndex, defaultViewProps.zIndex), - debugStringConvertibleItem( - "opacity", opacity, defaultViewProps.opacity), - debugStringConvertibleItem( - "foregroundColor", - foregroundColor, - defaultViewProps.foregroundColor), - debugStringConvertibleItem( - "backgroundColor", - backgroundColor, - defaultViewProps.backgroundColor), - }; -} -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewProps.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewProps.h deleted file mode 100644 index 5259a85f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewProps.h +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class ViewProps; - -using SharedViewProps = std::shared_ptr; - -class ViewProps : public Props, - public YogaStylableProps, - public AccessibilityProps { - public: - ViewProps() = default; - ViewProps(const YGStyle &yogaStyle); - ViewProps(const ViewProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - // Color - const Float opacity{1.0}; - const SharedColor foregroundColor{}; - const SharedColor backgroundColor{}; - - // Borders - const CascadedBorderRadii borderRadii{}; - const CascadedBorderColors borderColors{}; - const CascadedBorderStyles borderStyles{}; - - // Shadow - const SharedColor shadowColor{}; - const Size shadowOffset{}; - const Float shadowOpacity{}; - const Float shadowRadius{}; - - // Transform - const Transform transform{}; - const bool backfaceVisibility{}; - const bool shouldRasterize{}; - const int zIndex{}; - - // Events - const PointerEventsMode pointerEvents{}; - const EdgeInsets hitSlop{}; - const bool onLayout{}; - - const bool collapsable{true}; - -#pragma mark - Convenience Methods - - BorderMetrics resolveBorderMetrics(bool isRTL) const; - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE - SharedDebugStringConvertibleList getDebugProps() const override; -#endif -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewShadowNode.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewShadowNode.cpp deleted file mode 100644 index edc68a74..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewShadowNode.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ViewShadowNode.h" - -namespace facebook { -namespace react { - -const char ViewComponentName[] = "View"; - -bool ViewShadowNode::isLayoutOnly() const { - const auto &viewProps = *std::static_pointer_cast(props_); - - return viewProps.collapsable && - // Event listeners - !viewProps.onLayout && - // Generic Props - viewProps.nativeId.empty() && - // Accessibility Props - !viewProps.accessible && - // Style Props - viewProps.yogaStyle.overflow == YGOverflowVisible && - viewProps.opacity == 1.0 && !viewProps.backgroundColor && - !viewProps.foregroundColor && !viewProps.shadowColor && - viewProps.transform == Transform{} && viewProps.zIndex == 0 && - // Layout Metrics - getLayoutMetrics().borderWidth == EdgeInsets{}; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewShadowNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewShadowNode.h deleted file mode 100644 index 4111f939..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/ViewShadowNode.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -extern const char ViewComponentName[]; - -/* - * `ShadowNode` for component. - */ -class ViewShadowNode final : public ConcreteViewShadowNode< - ViewComponentName, - ViewProps, - ViewEventEmitter> { - public: - using ConcreteViewShadowNode::ConcreteViewShadowNode; - - bool isLayoutOnly() const; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/accessibility/AccessibilityPrimitives.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/accessibility/AccessibilityPrimitives.h deleted file mode 100644 index 36d4c221..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/accessibility/AccessibilityPrimitives.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -namespace facebook { -namespace react { - -enum class AccessibilityTraits : uint32_t { - None = 0, - Button = (1 << 0), - Link = (1 << 1), - Image = (1 << 2), - Selected = (1 << 3), - PlaysSound = (1 << 4), - KeyboardKey = (1 << 5), - StaticText = (1 << 6), - SummaryElement = (1 << 7), - NotEnabled = (1 << 8), - UpdatesFrequently = (1 << 9), - SearchField = (1 << 10), - StartsMediaSession = (1 << 11), - Adjustable = (1 << 12), - AllowsDirectInteraction = (1 << 13), - CausesPageTurn = (1 << 14), - Header = (1 << 15), -}; - -constexpr enum AccessibilityTraits operator|( - const enum AccessibilityTraits lhs, - const enum AccessibilityTraits rhs) { - return (enum AccessibilityTraits)((uint32_t)lhs | (uint32_t)rhs); -} - -constexpr enum AccessibilityTraits operator&( - const enum AccessibilityTraits lhs, - const enum AccessibilityTraits rhs) { - return (enum AccessibilityTraits)((uint32_t)lhs & (uint32_t)rhs); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/accessibility/AccessibilityProps.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/accessibility/AccessibilityProps.cpp deleted file mode 100644 index f8ba55d9..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/accessibility/AccessibilityProps.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "AccessibilityProps.h" - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -AccessibilityProps::AccessibilityProps( - const AccessibilityProps &sourceProps, - const RawProps &rawProps) - : accessible( - convertRawProp(rawProps, "accessible", sourceProps.accessible)), - accessibilityTraits(convertRawProp( - rawProps, - "accessibilityTraits", - sourceProps.accessibilityTraits)), - accessibilityLabel(convertRawProp( - rawProps, - "accessibilityLabel", - sourceProps.accessibilityLabel)), - accessibilityHint(convertRawProp( - rawProps, - "accessibilityHint", - sourceProps.accessibilityHint)), - accessibilityActions(convertRawProp( - rawProps, - "accessibilityActions", - sourceProps.accessibilityActions)), - accessibilityViewIsModal(convertRawProp( - rawProps, - "accessibilityViewIsModal", - sourceProps.accessibilityViewIsModal)), - accessibilityElementsHidden(convertRawProp( - rawProps, - "accessibilityElementsHidden", - sourceProps.accessibilityElementsHidden)), - accessibilityIgnoresInvertColors(convertRawProp( - rawProps, - "accessibilityIgnoresInvertColors", - sourceProps.accessibilityIgnoresInvertColors)), - testId(convertRawProp(rawProps, "testId", sourceProps.testId)) {} - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE -SharedDebugStringConvertibleList AccessibilityProps::getDebugProps() const { - const auto &defaultProps = AccessibilityProps(); - LOG(INFO) << "Call AccessibilityProps::getDebugProps with testId " << testId; - return SharedDebugStringConvertibleList{ - debugStringConvertibleItem("testId", testId, defaultProps.testId), - }; -} -#endif // RN_DEBUG_STRING_CONVERTIBLE - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/accessibility/AccessibilityProps.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/accessibility/AccessibilityProps.h deleted file mode 100644 index 1253fc30..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/accessibility/AccessibilityProps.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class AccessibilityProps; - -typedef std::shared_ptr SharedAccessibilityProps; - -class AccessibilityProps : public virtual DebugStringConvertible { - public: - AccessibilityProps() = default; - AccessibilityProps( - const AccessibilityProps &sourceProps, - const RawProps &rawProps); - -#pragma mark - Props - - const bool accessible{false}; - const AccessibilityTraits accessibilityTraits{AccessibilityTraits::None}; - const std::string accessibilityLabel{""}; - const std::string accessibilityHint{""}; - const std::vector accessibilityActions{}; - const bool accessibilityViewIsModal{false}; - const bool accessibilityElementsHidden{false}; - const bool accessibilityIgnoresInvertColors{false}; - const std::string testId{""}; - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE - SharedDebugStringConvertibleList getDebugProps() const override; -#endif -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/accessibility/AccessibleShadowNode.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/accessibility/AccessibleShadowNode.cpp deleted file mode 100644 index 627f1c2f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/accessibility/AccessibleShadowNode.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "AccessibleShadowNode.h" - -#include - -namespace facebook { -namespace react { - -AccessibleShadowNode::AccessibleShadowNode( - const SharedAccessibilityProps &props) { - assert(props); -} - -AccessibleShadowNode::AccessibleShadowNode( - const AccessibleShadowNode &shadowNode, - const SharedAccessibilityProps &props) {} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/accessibility/AccessibleShadowNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/accessibility/AccessibleShadowNode.h deleted file mode 100644 index db22cca4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/accessibility/AccessibleShadowNode.h +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include -#include - -namespace facebook { -namespace react { - -class AccessibleShadowNode; - -using SharedAccessibleShadowNode = std::shared_ptr; - -class AccessibleShadowNode { - public: -#pragma mark - Constructors - - AccessibleShadowNode() = default; - - AccessibleShadowNode(const SharedAccessibilityProps &props); - - AccessibleShadowNode( - const AccessibleShadowNode &shadowNode, - const SharedAccessibilityProps &props = nullptr); -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/accessibility/accessibilityPropsConversions.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/accessibility/accessibilityPropsConversions.h deleted file mode 100644 index 4125f383..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/accessibility/accessibilityPropsConversions.h +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -inline void fromString(const std::string &string, AccessibilityTraits &result) { - if (string == "none") { - result = AccessibilityTraits::None; - return; - } - if (string == "button") { - result = AccessibilityTraits::Button; - return; - } - if (string == "link") { - result = AccessibilityTraits::Link; - return; - } - if (string == "image") { - result = AccessibilityTraits::Image; - return; - } - if (string == "selected") { - result = AccessibilityTraits::Selected; - return; - } - if (string == "plays") { - result = AccessibilityTraits::PlaysSound; - return; - } - if (string == "keyboardkey") { - result = AccessibilityTraits::KeyboardKey; - return; - } - if (string == "text") { - result = AccessibilityTraits::StaticText; - return; - } - if (string == "disabled") { - result = AccessibilityTraits::NotEnabled; - return; - } - if (string == "frequentUpdates") { - result = AccessibilityTraits::UpdatesFrequently; - return; - } - if (string == "search") { - result = AccessibilityTraits::SearchField; - return; - } - if (string == "startsMedia") { - result = AccessibilityTraits::StartsMediaSession; - return; - } - if (string == "adjustable") { - result = AccessibilityTraits::Adjustable; - return; - } - if (string == "allowsDirectInteraction") { - result = AccessibilityTraits::AllowsDirectInteraction; - return; - } - if (string == "pageTurn") { - result = AccessibilityTraits::CausesPageTurn; - return; - } - if (string == "header") { - result = AccessibilityTraits::Header; - return; - } - abort(); -} - -inline void fromRawValue(const RawValue &value, AccessibilityTraits &result) { - if (value.hasType()) { - fromString((std::string)value, result); - return; - } - - if (value.hasType>()) { - result = {}; - auto items = (std::vector)value; - for (auto &item : items) { - AccessibilityTraits itemAccessibilityTraits; - fromString(item, itemAccessibilityTraits); - result = result | itemAccessibilityTraits; - } - } - - abort(); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/conversions.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/conversions.h deleted file mode 100644 index 957b4ab4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/conversions.h +++ /dev/null @@ -1,623 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -inline Float floatFromYogaFloat(float value) { - if (value == YGUndefined) { - return kFloatUndefined; - } - - return (Float)value; -} - -inline float yogaFloatFromFloat(Float value) { - if (value == kFloatUndefined) { - return YGUndefined; - } - - return (float)value; -} - -inline Float floatFromYogaOptionalFloat(YGFloatOptional value) { - if (value.isUndefined()) { - return kFloatUndefined; - } - - return floatFromYogaFloat(value.unwrap()); -} - -inline YGFloatOptional yogaOptionalFloatFromFloat(Float value) { - if (value == kFloatUndefined) { - return YGFloatOptional(); - } - - return YGFloatOptional(yogaFloatFromFloat(value)); -} - -inline YGValue yogaStyleValueFromFloat(const Float &value) { - if (std::isnan(value) || value == kFloatUndefined) { - return YGValueUndefined; - } - - return {(float)value, YGUnitPoint}; -} - -inline folly::Optional optionalFloatFromYogaValue( - const YGValue value, - folly::Optional base = {}) { - switch (value.unit) { - case YGUnitUndefined: - return {}; - case YGUnitPoint: - return floatFromYogaFloat(value.value); - case YGUnitPercent: - return base.has_value() - ? folly::Optional( - base.value() * floatFromYogaFloat(value.value)) - : folly::Optional(); - case YGUnitAuto: - return {}; - } -} - -inline LayoutMetrics layoutMetricsFromYogaNode(YGNode &yogaNode) { - auto layoutMetrics = LayoutMetrics{}; - - layoutMetrics.frame = - Rect{Point{floatFromYogaFloat(YGNodeLayoutGetLeft(&yogaNode)), - floatFromYogaFloat(YGNodeLayoutGetTop(&yogaNode))}, - Size{floatFromYogaFloat(YGNodeLayoutGetWidth(&yogaNode)), - floatFromYogaFloat(YGNodeLayoutGetHeight(&yogaNode))}}; - - layoutMetrics.borderWidth = EdgeInsets{ - floatFromYogaFloat(YGNodeLayoutGetBorder(&yogaNode, YGEdgeLeft)), - floatFromYogaFloat(YGNodeLayoutGetBorder(&yogaNode, YGEdgeTop)), - floatFromYogaFloat(YGNodeLayoutGetBorder(&yogaNode, YGEdgeRight)), - floatFromYogaFloat(YGNodeLayoutGetBorder(&yogaNode, YGEdgeBottom))}; - - layoutMetrics.contentInsets = EdgeInsets{ - layoutMetrics.borderWidth.left + - floatFromYogaFloat(YGNodeLayoutGetPadding(&yogaNode, YGEdgeLeft)), - layoutMetrics.borderWidth.top + - floatFromYogaFloat(YGNodeLayoutGetPadding(&yogaNode, YGEdgeTop)), - layoutMetrics.borderWidth.right + - floatFromYogaFloat(YGNodeLayoutGetPadding(&yogaNode, YGEdgeRight)), - layoutMetrics.borderWidth.bottom + - floatFromYogaFloat(YGNodeLayoutGetPadding(&yogaNode, YGEdgeBottom))}; - - layoutMetrics.displayType = yogaNode.getStyle().display == YGDisplayNone - ? DisplayType::None - : DisplayType::Flex; - - layoutMetrics.layoutDirection = - YGNodeLayoutGetDirection(&yogaNode) == YGDirectionRTL - ? LayoutDirection::RightToLeft - : LayoutDirection::LeftToRight; - - return layoutMetrics; -} - -inline YGDirection yogaDirectionFromLayoutDirection(LayoutDirection direction) { - switch (direction) { - case LayoutDirection::Undefined: - return YGDirectionInherit; - case LayoutDirection::LeftToRight: - return YGDirectionLTR; - case LayoutDirection::RightToLeft: - return YGDirectionRTL; - } -} - -inline void fromRawValue(const RawValue &value, YGDirection &result) { - assert(value.hasType()); - auto stringValue = (std::string)value; - if (stringValue == "inherit") { - result = YGDirectionInherit; - return; - } - if (stringValue == "ltr") { - result = YGDirectionLTR; - return; - } - if (stringValue == "rtl") { - result = YGDirectionRTL; - return; - } - abort(); -} - -inline void fromRawValue(const RawValue &value, YGFlexDirection &result) { - assert(value.hasType()); - auto stringValue = (std::string)value; - if (stringValue == "column") { - result = YGFlexDirectionColumn; - return; - } - if (stringValue == "column-reverse") { - result = YGFlexDirectionColumnReverse; - return; - } - if (stringValue == "row") { - result = YGFlexDirectionRow; - return; - } - if (stringValue == "row-reverse") { - result = YGFlexDirectionRowReverse; - return; - } - abort(); -} - -inline void fromRawValue(const RawValue &value, YGJustify &result) { - assert(value.hasType()); - auto stringValue = (std::string)value; - if (stringValue == "flex-start") { - result = YGJustifyFlexStart; - return; - } - if (stringValue == "center") { - result = YGJustifyCenter; - return; - } - if (stringValue == "flex-end") { - result = YGJustifyFlexEnd; - return; - } - if (stringValue == "space-between") { - result = YGJustifySpaceBetween; - return; - } - if (stringValue == "space-around") { - result = YGJustifySpaceAround; - return; - } - if (stringValue == "space-evenly") { - result = YGJustifySpaceEvenly; - return; - } - abort(); -} - -inline void fromRawValue(const RawValue &value, YGAlign &result) { - assert(value.hasType()); - auto stringValue = (std::string)value; - if (stringValue == "auto") { - result = YGAlignAuto; - return; - } - if (stringValue == "flex-start") { - result = YGAlignFlexStart; - return; - } - if (stringValue == "center") { - result = YGAlignCenter; - return; - } - if (stringValue == "flex-end") { - result = YGAlignFlexEnd; - return; - } - if (stringValue == "stretch") { - result = YGAlignStretch; - return; - } - if (stringValue == "baseline") { - result = YGAlignBaseline; - return; - } - if (stringValue == "between") { - result = YGAlignSpaceBetween; - return; - } - if (stringValue == "space-around") { - result = YGAlignSpaceAround; - return; - } - abort(); -} - -inline void fromRawValue(const RawValue &value, YGPositionType &result) { - assert(value.hasType()); - auto stringValue = (std::string)value; - if (stringValue == "relative") { - result = YGPositionTypeRelative; - return; - } - if (stringValue == "absolute") { - result = YGPositionTypeAbsolute; - return; - } - abort(); -} - -inline void fromRawValue(const RawValue &value, YGWrap &result) { - assert(value.hasType()); - auto stringValue = (std::string)value; - if (stringValue == "no-wrap") { - result = YGWrapNoWrap; - return; - } - if (stringValue == "wrap") { - result = YGWrapWrap; - return; - } - if (stringValue == "wrap-reverse") { - result = YGWrapWrapReverse; - return; - } - abort(); -} - -inline void fromRawValue(const RawValue &value, YGOverflow &result) { - assert(value.hasType()); - auto stringValue = (std::string)value; - if (stringValue == "visible") { - result = YGOverflowVisible; - return; - } - if (stringValue == "hidden") { - result = YGOverflowHidden; - return; - } - if (stringValue == "scroll") { - result = YGOverflowScroll; - return; - } - abort(); -} - -inline void fromRawValue(const RawValue &value, YGDisplay &result) { - assert(value.hasType()); - auto stringValue = (std::string)value; - if (stringValue == "flex") { - result = YGDisplayFlex; - return; - } - if (stringValue == "none") { - result = YGDisplayNone; - return; - } - abort(); -} - -inline void fromRawValue( - const RawValue &value, - decltype(YGStyle{}.margin[0]) /* type is subject to change */ &result) { - if (value.hasType()) { - result = yogaStyleValueFromFloat((Float)value); - return; - } else if (value.hasType()) { - const auto stringValue = (std::string)value; - if (stringValue == "auto") { - result = YGValueUndefined; - return; - } else { - if (stringValue.back() == '%') { - result = YGValue{ - folly::to(stringValue.substr(0, stringValue.length() - 1)), - YGUnitPercent}; - return; - } else { - result = YGValue{folly::to(stringValue), YGUnitPoint}; - return; - } - } - } - result = YGValueUndefined; -} - -inline void fromRawValue(const RawValue &value, YGFloatOptional &result) { - if (value.hasType()) { - result = YGFloatOptional((float)value); - return; - } else if (value.hasType()) { - const auto stringValue = (std::string)value; - if (stringValue == "auto") { - result = YGFloatOptional(); - return; - } - } - abort(); -} - -inline void fromRawValue(const RawValue &value, Transform &result) { - assert(value.hasType>()); - auto transformMatrix = Transform{}; - auto configurations = (std::vector)value; - - for (const auto &configuration : configurations) { - auto configurationPair = - (std::unordered_map)configuration; - auto pair = configurationPair.begin(); - auto operation = pair->first; - auto ¶meters = pair->second; - - if (operation == "matrix") { - assert(parameters.hasType>()); - auto numbers = (std::vector)parameters; - assert(numbers.size() == transformMatrix.matrix.size()); - auto i = 0; - for (auto number : numbers) { - transformMatrix.matrix[i++] = number; - } - } else if (operation == "perspective") { - transformMatrix = - transformMatrix * Transform::Perspective((Float)parameters); - } else if (operation == "rotateX") { - transformMatrix = - transformMatrix * Transform::Rotate((Float)parameters, 0, 0); - } else if (operation == "rotateY") { - transformMatrix = - transformMatrix * Transform::Rotate(0, (Float)parameters, 0); - } else if (operation == "rotateZ") { - transformMatrix = - transformMatrix * Transform::Rotate(0, 0, (Float)parameters); - } else if (operation == "scale") { - auto number = (Float)parameters; - transformMatrix = - transformMatrix * Transform::Scale(number, number, number); - } else if (operation == "scaleX") { - transformMatrix = - transformMatrix * Transform::Scale((Float)parameters, 0, 0); - } else if (operation == "scaleY") { - transformMatrix = - transformMatrix * Transform::Scale(0, (Float)parameters, 0); - } else if (operation == "scaleZ") { - transformMatrix = - transformMatrix * Transform::Scale(0, 0, (Float)parameters); - } else if (operation == "translate") { - auto numbers = (std::vector)parameters; - transformMatrix = transformMatrix * - Transform::Translate(numbers.at(0), numbers.at(1), 0); - } else if (operation == "translateX") { - transformMatrix = - transformMatrix * Transform::Translate((Float)parameters, 0, 0); - } else if (operation == "translateY") { - transformMatrix = - transformMatrix * Transform::Translate(0, (Float)parameters, 0); - } else if (operation == "skewX") { - transformMatrix = transformMatrix * Transform::Skew((Float)parameters, 0); - } else if (operation == "skewY") { - transformMatrix = transformMatrix * Transform::Skew(0, (Float)parameters); - } - } - - result = transformMatrix; -} - -inline void fromRawValue(const RawValue &value, PointerEventsMode &result) { - assert(value.hasType()); - auto stringValue = (std::string)value; - if (stringValue == "auto") { - result = PointerEventsMode::Auto; - return; - } - if (stringValue == "none") { - result = PointerEventsMode::None; - return; - } - if (stringValue == "box-none") { - result = PointerEventsMode::BoxNone; - return; - } - if (stringValue == "box-only") { - result = PointerEventsMode::BoxOnly; - return; - } - abort(); -} - -inline void fromRawValue(const RawValue &value, BorderStyle &result) { - assert(value.hasType()); - auto stringValue = (std::string)value; - if (stringValue == "solid") { - result = BorderStyle::Solid; - return; - } - if (stringValue == "dotted") { - result = BorderStyle::Dotted; - return; - } - if (stringValue == "dashed") { - result = BorderStyle::Dashed; - return; - } - abort(); -} - -inline std::string toString( - const std::array()> &dimensions) { - return "{" + folly::to(dimensions[0]) + ", " + - folly::to(dimensions[1]) + "}"; -} - -inline std::string toString(const std::array &position) { - return "{" + folly::to(position[0]) + ", " + - folly::to(position[1]) + "}"; -} - -inline std::string toString( - const std::array()> &edges) { - return "{" + folly::to(edges[0]) + ", " + - folly::to(edges[1]) + ", " + - folly::to(edges[2]) + ", " + - folly::to(edges[3]) + "}"; -} - -inline std::string toString(const YGDirection &value) { - switch (value) { - case YGDirectionInherit: - return "inherit"; - case YGDirectionLTR: - return "ltr"; - case YGDirectionRTL: - return "rtl"; - } -} - -inline std::string toString(const YGFlexDirection &value) { - switch (value) { - case YGFlexDirectionColumn: - return "column"; - case YGFlexDirectionColumnReverse: - return "column-reverse"; - case YGFlexDirectionRow: - return "row"; - case YGFlexDirectionRowReverse: - return "row-reverse"; - } -} - -inline std::string toString(const YGJustify &value) { - switch (value) { - case YGJustifyFlexStart: - return "flex-start"; - case YGJustifyCenter: - return "center"; - case YGJustifyFlexEnd: - return "flex-end"; - case YGJustifySpaceBetween: - return "space-between"; - case YGJustifySpaceAround: - return "space-around"; - case YGJustifySpaceEvenly: - return "space-evenly"; - } -} - -inline std::string toString(const YGAlign &value) { - switch (value) { - case YGAlignAuto: - return "auto"; - case YGAlignFlexStart: - return "flex-start"; - case YGAlignCenter: - return "center"; - case YGAlignFlexEnd: - return "flex-end"; - case YGAlignStretch: - return "stretch"; - case YGAlignBaseline: - return "baseline"; - case YGAlignSpaceBetween: - return "space-between"; - case YGAlignSpaceAround: - return "space-around"; - } -} - -inline std::string toString(const YGPositionType &value) { - switch (value) { - case YGPositionTypeRelative: - return "relative"; - case YGPositionTypeAbsolute: - return "absolute"; - } -} - -inline std::string toString(const YGWrap &value) { - switch (value) { - case YGWrapNoWrap: - return "no-wrap"; - case YGWrapWrap: - return "wrap"; - case YGWrapWrapReverse: - return "wrap-reverse"; - } -} - -inline std::string toString(const YGOverflow &value) { - switch (value) { - case YGOverflowVisible: - return "visible"; - case YGOverflowScroll: - return "scroll"; - case YGOverflowHidden: - return "hidden"; - } -} - -inline std::string toString(const YGDisplay &value) { - switch (value) { - case YGDisplayFlex: - return "flex"; - case YGDisplayNone: - return "none"; - } -} - -inline std::string toString(const YGValue &value) { - switch (value.unit) { - case YGUnitUndefined: - return "undefined"; - case YGUnitPoint: - return folly::to(value.value); - case YGUnitPercent: - return folly::to(value.value) + "%"; - case YGUnitAuto: - return "auto"; - } -} - -inline std::string toString(const YGFloatOptional &value) { - if (value.isUndefined()) { - return "undefined"; - } - - return folly::to(floatFromYogaFloat(value.unwrap())); -} - -inline std::string toString(const YGStyle::Dimensions &value) { - return "{" + toString(value[0]) + ", " + toString(value[1]) + "}"; -} - -inline std::string toString(const YGStyle::Edges &value) { - static std::array()> names = { - {"left", - "top", - "right", - "bottom", - "start", - "end", - "horizontal", - "vertical", - "all"}}; - - auto result = std::string{}; - auto separator = std::string{", "}; - - for (auto i = 0; i < yoga::enums::count(); i++) { - YGValue v = value[i]; - if (v.unit == YGUnitUndefined) { - continue; - } - result += names[i] + ": " + toString(v) + separator; - } - - if (!result.empty()) { - result.erase(result.length() - separator.length()); - } - - return "{" + result + "}"; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/primitives.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/primitives.h deleted file mode 100644 index 04967251..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/primitives.h +++ /dev/null @@ -1,337 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -struct Transform { - std::array matrix{ - {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}}; - - static Transform Identity() { - return {}; - } - - static Transform Perspective(const Float &perspective) { - auto transform = Transform{}; - transform.matrix[11] = -1.0 / perspective; - return transform; - } - - static Transform - Scale(const Float &factorX, const Float &factorY, const Float &factorZ) { - auto transform = Transform{}; - transform.matrix[0] = factorX; - transform.matrix[5] = factorY; - transform.matrix[10] = factorZ; - return transform; - } - - static Transform Translate(const Float &x, const Float &y, const Float &z) { - auto transform = Transform{}; - transform.matrix[12] = x; - transform.matrix[13] = y; - transform.matrix[14] = z; - return transform; - } - - static Transform Skew(const Float &x, const Float &y) { - auto transform = Transform{}; - transform.matrix[4] = std::tan(x); - transform.matrix[1] = std::tan(y); - return transform; - } - - static Transform RotateX(const Float &radians) { - auto transform = Transform{}; - transform.matrix[5] = std::cos(radians); - transform.matrix[6] = std::sin(radians); - transform.matrix[9] = -std::sin(radians); - transform.matrix[10] = std::cos(radians); - return transform; - } - - static Transform RotateY(const Float &radians) { - auto transform = Transform{}; - transform.matrix[0] = std::cos(radians); - transform.matrix[2] = -std::sin(radians); - transform.matrix[8] = std::sin(radians); - transform.matrix[10] = std::cos(radians); - return transform; - } - - static Transform RotateZ(const Float &radians) { - auto transform = Transform{}; - transform.matrix[0] = std::cos(radians); - transform.matrix[1] = std::sin(radians); - transform.matrix[4] = -std::sin(radians); - transform.matrix[5] = std::cos(radians); - return transform; - } - - static Transform Rotate(const Float &x, const Float &y, const Float &z) { - auto transform = Transform{}; - if (x != 0) { - transform = transform * Transform::RotateX(x); - } - if (y != 0) { - transform = transform * Transform::RotateY(y); - } - if (z != 0) { - transform = transform * Transform::RotateZ(z); - } - return transform; - } - - bool operator==(const Transform &rhs) const { - for (auto i = 0; i < 16; i++) { - if (matrix[i] != rhs.matrix[i]) { - return false; - } - } - return true; - } - - bool operator!=(const Transform &rhs) const { - return !(*this == rhs); - } - - Transform operator*(const Transform &rhs) const { - if (*this == Transform::Identity()) { - return rhs; - } - - const auto &lhs = *this; - auto result = Transform{}; - - auto lhs00 = lhs.matrix[0], lhs01 = lhs.matrix[1], lhs02 = lhs.matrix[2], - lhs03 = lhs.matrix[3], lhs10 = lhs.matrix[4], lhs11 = lhs.matrix[5], - lhs12 = lhs.matrix[6], lhs13 = lhs.matrix[7], lhs20 = lhs.matrix[8], - lhs21 = lhs.matrix[9], lhs22 = lhs.matrix[10], lhs23 = lhs.matrix[11], - lhs30 = lhs.matrix[12], lhs31 = lhs.matrix[13], lhs32 = lhs.matrix[14], - lhs33 = lhs.matrix[15]; - - auto rhs0 = rhs.matrix[0], rhs1 = rhs.matrix[1], rhs2 = rhs.matrix[2], - rhs3 = rhs.matrix[3]; - result.matrix[0] = - rhs0 * lhs00 + rhs1 * lhs10 + rhs2 * lhs20 + rhs3 * lhs30; - result.matrix[1] = - rhs0 * lhs01 + rhs1 * lhs11 + rhs2 * lhs21 + rhs3 * lhs31; - result.matrix[2] = - rhs0 * lhs02 + rhs1 * lhs12 + rhs2 * lhs22 + rhs3 * lhs32; - result.matrix[3] = - rhs0 * lhs03 + rhs1 * lhs13 + rhs2 * lhs23 + rhs3 * lhs33; - - rhs0 = rhs.matrix[4]; - rhs1 = rhs.matrix[5]; - rhs2 = rhs.matrix[6]; - rhs3 = rhs.matrix[7]; - result.matrix[4] = - rhs0 * lhs00 + rhs1 * lhs10 + rhs2 * lhs20 + rhs3 * lhs30; - result.matrix[5] = - rhs0 * lhs01 + rhs1 * lhs11 + rhs2 * lhs21 + rhs3 * lhs31; - result.matrix[6] = - rhs0 * lhs02 + rhs1 * lhs12 + rhs2 * lhs22 + rhs3 * lhs32; - result.matrix[7] = - rhs0 * lhs03 + rhs1 * lhs13 + rhs2 * lhs23 + rhs3 * lhs33; - - rhs0 = rhs.matrix[8]; - rhs1 = rhs.matrix[9]; - rhs2 = rhs.matrix[10]; - rhs3 = rhs.matrix[11]; - result.matrix[8] = - rhs0 * lhs00 + rhs1 * lhs10 + rhs2 * lhs20 + rhs3 * lhs30; - result.matrix[9] = - rhs0 * lhs01 + rhs1 * lhs11 + rhs2 * lhs21 + rhs3 * lhs31; - result.matrix[10] = - rhs0 * lhs02 + rhs1 * lhs12 + rhs2 * lhs22 + rhs3 * lhs32; - result.matrix[11] = - rhs0 * lhs03 + rhs1 * lhs13 + rhs2 * lhs23 + rhs3 * lhs33; - - rhs0 = rhs.matrix[12]; - rhs1 = rhs.matrix[13]; - rhs2 = rhs.matrix[14]; - rhs3 = rhs.matrix[15]; - result.matrix[12] = - rhs0 * lhs00 + rhs1 * lhs10 + rhs2 * lhs20 + rhs3 * lhs30; - result.matrix[13] = - rhs0 * lhs01 + rhs1 * lhs11 + rhs2 * lhs21 + rhs3 * lhs31; - result.matrix[14] = - rhs0 * lhs02 + rhs1 * lhs12 + rhs2 * lhs22 + rhs3 * lhs32; - result.matrix[15] = - rhs0 * lhs03 + rhs1 * lhs13 + rhs2 * lhs23 + rhs3 * lhs33; - - return result; - } -}; - -enum class PointerEventsMode { Auto, None, BoxNone, BoxOnly }; - -enum class BorderStyle { Solid, Dotted, Dashed }; - -template -struct CascadedRectangleEdges { - using Counterpart = RectangleEdges; - using OptionalT = folly::Optional; - - OptionalT left{}; - OptionalT top{}; - OptionalT right{}; - OptionalT bottom{}; - OptionalT start{}; - OptionalT end{}; - OptionalT horizontal{}; - OptionalT vertical{}; - OptionalT all{}; - - Counterpart resolve(bool isRTL, T defaults) const { - const auto leading = isRTL ? end : start; - const auto trailing = isRTL ? start : end; - const auto horizontalOrAllOrDefault = - horizontal.value_or(all.value_or(defaults)); - const auto verticalOrAllOrDefault = - vertical.value_or(all.value_or(defaults)); - - return Counterpart{ - .left = left.value_or(leading.value_or(horizontalOrAllOrDefault)), - .right = right.value_or(trailing.value_or(horizontalOrAllOrDefault)), - .top = top.value_or(verticalOrAllOrDefault), - .bottom = bottom.value_or(verticalOrAllOrDefault)}; - } - - bool operator==(const CascadedRectangleEdges &rhs) const { - return std::tie( - this->left, - this->top, - this->right, - this->bottom, - this->start, - this->end, - this->horizontal, - this->vertical, - this->all) == - std::tie( - rhs.left, - rhs.top, - rhs.right, - rhs.bottom, - rhs.start, - rhs.end, - rhs.horizontal, - rhs.vertical, - rhs.all); - } - - bool operator!=(const CascadedRectangleEdges &rhs) const { - return !(*this == rhs); - } -}; - -template -struct CascadedRectangleCorners { - using Counterpart = RectangleCorners; - using OptionalT = folly::Optional; - - OptionalT topLeft{}; - OptionalT topRight{}; - OptionalT bottomLeft{}; - OptionalT bottomRight{}; - OptionalT topStart{}; - OptionalT topEnd{}; - OptionalT bottomStart{}; - OptionalT bottomEnd{}; - OptionalT all{}; - - Counterpart resolve(bool isRTL, T defaults) const { - const auto topLeading = isRTL ? topEnd : topStart; - const auto topTrailing = isRTL ? topStart : topEnd; - const auto bottomLeading = isRTL ? bottomEnd : bottomStart; - const auto bottomTrailing = isRTL ? bottomStart : bottomEnd; - - return Counterpart{ - .topLeft = - topLeft.value_or(topLeading.value_or(all.value_or(defaults))), - .topRight = - topRight.value_or(topTrailing.value_or(all.value_or(defaults))), - .bottomLeft = - bottomLeft.value_or(topLeading.value_or(all.value_or(defaults))), - .bottomRight = - bottomRight.value_or(topTrailing.value_or(all.value_or(defaults)))}; - } - - bool operator==(const CascadedRectangleCorners &rhs) const { - return std::tie( - this->topLeft, - this->topRight, - this->bottomLeft, - this->bottomRight, - this->topStart, - this->topEnd, - this->bottomStart, - this->bottomEnd, - this->all) == - std::tie( - rhs.topLeft, - rhs.topRight, - rhs.bottomLeft, - rhs.bottomRight, - rhs.topStart, - rhs.topEnd, - rhs.bottomStart, - rhs.bottomEnd, - rhs.all); - } - - bool operator!=(const CascadedRectangleCorners &rhs) const { - return !(*this == rhs); - } -}; - -using BorderWidths = RectangleEdges; -using BorderStyles = RectangleEdges; -using BorderColors = RectangleEdges; -using BorderRadii = RectangleCorners; - -using CascadedBorderWidths = CascadedRectangleEdges; -using CascadedBorderStyles = CascadedRectangleEdges; -using CascadedBorderColors = CascadedRectangleEdges; -using CascadedBorderRadii = CascadedRectangleCorners; - -struct BorderMetrics { - BorderColors borderColors{}; - BorderWidths borderWidths{}; - BorderRadii borderRadii{}; - BorderStyles borderStyles{}; - - bool operator==(const BorderMetrics &rhs) const { - return std::tie( - this->borderColors, - this->borderWidths, - this->borderRadii, - this->borderStyles) == - std::tie( - rhs.borderColors, - rhs.borderWidths, - rhs.borderRadii, - rhs.borderStyles); - } - - bool operator!=(const BorderMetrics &rhs) const { - return !(*this == rhs); - } -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/propsConversions.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/propsConversions.h deleted file mode 100644 index d52e4316..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/propsConversions.h +++ /dev/null @@ -1,249 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -static inline YGStyle::Dimensions convertRawProp( - const RawProps &rawProps, - const std::string &widthName, - const std::string &heightName, - const YGStyle::Dimensions &sourceValue, - const YGStyle::Dimensions &defaultValue) { - auto dimensions = defaultValue; - dimensions[YGDimensionWidth] = convertRawProp( - rawProps, - widthName, - sourceValue[YGDimensionWidth], - defaultValue[YGDimensionWidth]); - dimensions[YGDimensionHeight] = convertRawProp( - rawProps, - heightName, - sourceValue[YGDimensionHeight], - defaultValue[YGDimensionWidth]); - return dimensions; -} - -static inline YGStyle::Edges convertRawProp( - const RawProps &rawProps, - const std::string &prefix, - const std::string &suffix, - const YGStyle::Edges &sourceValue, - const YGStyle::Edges &defaultValue) { - auto result = defaultValue; - result[YGEdgeLeft] = convertRawProp( - rawProps, - prefix + "Left" + suffix, - sourceValue[YGEdgeLeft], - defaultValue[YGEdgeLeft]); - result[YGEdgeTop] = convertRawProp( - rawProps, - prefix + "Top" + suffix, - sourceValue[YGEdgeTop], - defaultValue[YGEdgeTop]); - result[YGEdgeRight] = convertRawProp( - rawProps, - prefix + "Right" + suffix, - sourceValue[YGEdgeRight], - defaultValue[YGEdgeRight]); - result[YGEdgeBottom] = convertRawProp( - rawProps, - prefix + "Bottom" + suffix, - sourceValue[YGEdgeBottom], - defaultValue[YGEdgeBottom]); - result[YGEdgeStart] = convertRawProp( - rawProps, - prefix + "Start" + suffix, - sourceValue[YGEdgeStart], - defaultValue[YGEdgeStart]); - result[YGEdgeEnd] = convertRawProp( - rawProps, - prefix + "End" + suffix, - sourceValue[YGEdgeEnd], - defaultValue[YGEdgeEnd]); - result[YGEdgeHorizontal] = convertRawProp( - rawProps, - prefix + "Horizontal" + suffix, - sourceValue[YGEdgeHorizontal], - defaultValue[YGEdgeHorizontal]); - result[YGEdgeVertical] = convertRawProp( - rawProps, - prefix + "Vertical" + suffix, - sourceValue[YGEdgeVertical], - defaultValue[YGEdgeVertical]); - result[YGEdgeAll] = convertRawProp( - rawProps, - prefix + suffix, - sourceValue[YGEdgeAll], - defaultValue[YGEdgeAll]); - return result; -} - -static inline YGStyle::Edges convertRawProp( - const RawProps &rawProps, - const YGStyle::Edges &sourceValue, - const YGStyle::Edges &defaultValue) { - auto result = defaultValue; - result[YGEdgeLeft] = convertRawProp( - rawProps, "left", sourceValue[YGEdgeLeft], defaultValue[YGEdgeLeft]); - result[YGEdgeTop] = convertRawProp( - rawProps, "top", sourceValue[YGEdgeTop], defaultValue[YGEdgeTop]); - result[YGEdgeRight] = convertRawProp( - rawProps, "right", sourceValue[YGEdgeRight], defaultValue[YGEdgeRight]); - result[YGEdgeBottom] = convertRawProp( - rawProps, - "bottom", - sourceValue[YGEdgeBottom], - defaultValue[YGEdgeBottom]); - result[YGEdgeStart] = convertRawProp( - rawProps, "start", sourceValue[YGEdgeStart], defaultValue[YGEdgeStart]); - result[YGEdgeEnd] = convertRawProp( - rawProps, "end", sourceValue[YGEdgeEnd], defaultValue[YGEdgeEnd]); - return result; -} - -static inline YGStyle convertRawProp( - const RawProps &rawProps, - const YGStyle &sourceValue) { - auto yogaStyle = YGStyle{}; - yogaStyle.direction = convertRawProp( - rawProps, "direction", sourceValue.direction, yogaStyle.direction); - yogaStyle.flexDirection = convertRawProp( - rawProps, - "flexDirection", - sourceValue.flexDirection, - yogaStyle.flexDirection); - yogaStyle.justifyContent = convertRawProp( - rawProps, - "justifyContent", - sourceValue.justifyContent, - yogaStyle.justifyContent); - yogaStyle.alignContent = convertRawProp( - rawProps, - "alignContent", - sourceValue.alignContent, - yogaStyle.alignContent); - yogaStyle.alignItems = convertRawProp( - rawProps, "alignItems", sourceValue.alignItems, yogaStyle.alignItems); - yogaStyle.alignSelf = convertRawProp( - rawProps, "alignSelf", sourceValue.alignSelf, yogaStyle.alignSelf); - yogaStyle.positionType = convertRawProp( - rawProps, "position", sourceValue.positionType, yogaStyle.positionType); - yogaStyle.flexWrap = convertRawProp( - rawProps, "flexWrap", sourceValue.flexWrap, yogaStyle.flexWrap); - yogaStyle.overflow = convertRawProp( - rawProps, "overflow", sourceValue.overflow, yogaStyle.overflow); - yogaStyle.display = convertRawProp( - rawProps, "display", sourceValue.display, yogaStyle.display); - yogaStyle.flex = - convertRawProp(rawProps, "flex", sourceValue.flex, yogaStyle.flex); - yogaStyle.flexGrow = convertRawProp( - rawProps, "flexGrow", sourceValue.flexGrow, yogaStyle.flexGrow); - yogaStyle.flexShrink = convertRawProp( - rawProps, "flexShrink", sourceValue.flexShrink, yogaStyle.flexShrink); - yogaStyle.flexBasis = convertRawProp( - rawProps, "flexBasis", sourceValue.flexBasis, yogaStyle.flexBasis); - yogaStyle.margin = convertRawProp( - rawProps, "margin", "", sourceValue.margin, yogaStyle.margin); - yogaStyle.position = - convertRawProp(rawProps, sourceValue.position, yogaStyle.position); - yogaStyle.padding = convertRawProp( - rawProps, "padding", "", sourceValue.padding, yogaStyle.padding); - yogaStyle.border = convertRawProp( - rawProps, "border", "Width", sourceValue.border, yogaStyle.border); - yogaStyle.dimensions = convertRawProp( - rawProps, - "width", - "height", - sourceValue.dimensions, - yogaStyle.dimensions); - yogaStyle.minDimensions = convertRawProp( - rawProps, - "minWidth", - "minHeight", - sourceValue.minDimensions, - yogaStyle.minDimensions); - yogaStyle.maxDimensions = convertRawProp( - rawProps, - "maxWidth", - "maxHeight", - sourceValue.maxDimensions, - yogaStyle.maxDimensions); - yogaStyle.aspectRatio = convertRawProp( - rawProps, "aspectRatio", sourceValue.aspectRatio, yogaStyle.aspectRatio); - return yogaStyle; -} - -template -static inline CascadedRectangleCorners convertRawProp( - const RawProps &rawProps, - const std::string &prefix, - const std::string &suffix, - const CascadedRectangleCorners &sourceValue) { - CascadedRectangleCorners result; - - result.topLeft = convertRawProp( - rawProps, prefix + "TopLeft" + suffix, sourceValue.topLeft); - result.topRight = convertRawProp( - rawProps, prefix + "TopRight" + suffix, sourceValue.topRight); - result.bottomLeft = convertRawProp( - rawProps, prefix + "BottomLeft" + suffix, sourceValue.bottomLeft); - result.bottomRight = convertRawProp( - rawProps, prefix + "BottomRight" + suffix, sourceValue.bottomRight); - - result.topStart = convertRawProp( - rawProps, prefix + "TopStart" + suffix, sourceValue.topStart); - result.topEnd = - convertRawProp(rawProps, prefix + "TopEnd" + suffix, sourceValue.topEnd); - result.bottomStart = convertRawProp( - rawProps, prefix + "BottomStart" + suffix, sourceValue.bottomStart); - result.bottomEnd = convertRawProp( - rawProps, prefix + "BottomEnd" + suffix, sourceValue.bottomEnd); - - result.all = convertRawProp(rawProps, prefix + suffix, sourceValue.all); - - return result; -} - -template -static inline CascadedRectangleEdges convertRawProp( - const RawProps &rawProps, - const std::string &prefix, - const std::string &suffix, - const CascadedRectangleEdges &sourceValue) { - CascadedRectangleEdges result; - - result.left = - convertRawProp(rawProps, prefix + "Left" + suffix, sourceValue.left); - result.right = - convertRawProp(rawProps, prefix + "Right" + suffix, sourceValue.right); - result.top = - convertRawProp(rawProps, prefix + "Top" + suffix, sourceValue.top); - result.bottom = - convertRawProp(rawProps, prefix + "Bottom" + suffix, sourceValue.bottom); - - result.start = - convertRawProp(rawProps, prefix + "Start" + suffix, sourceValue.start); - result.end = - convertRawProp(rawProps, prefix + "End" + suffix, sourceValue.end); - result.horizontal = convertRawProp( - rawProps, prefix + "Horizontal" + suffix, sourceValue.horizontal); - result.vertical = convertRawProp( - rawProps, prefix + "Vertical" + suffix, sourceValue.vertical); - - result.all = convertRawProp(rawProps, prefix + suffix, sourceValue.all); - - return result; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/tests/ViewTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/tests/ViewTest.cpp deleted file mode 100644 index acef5fdf..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/tests/ViewTest.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include -#include - -using namespace facebook::react; - -TEST(ViewTest, testSomething) { - // TODO -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp deleted file mode 100644 index 30d49d86..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "YogaLayoutableShadowNode.h" - -#include -#include - -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -YogaLayoutableShadowNode::YogaLayoutableShadowNode() - : yogaNode_({}), yogaConfig_(nullptr) { - initializeYogaConfig(yogaConfig_); - - yogaNode_.setConfig(&yogaConfig_); - yogaNode_.setContext(this); - yogaNode_.setDirty(true); -} - -YogaLayoutableShadowNode::YogaLayoutableShadowNode( - const YogaLayoutableShadowNode &layoutableShadowNode) - : yogaNode_(layoutableShadowNode.yogaNode_), yogaConfig_(nullptr) { - initializeYogaConfig(yogaConfig_); - - yogaNode_.setConfig(&yogaConfig_); - yogaNode_.setContext(this); - yogaNode_.setOwner(nullptr); - yogaNode_.setDirty(true); -} - -void YogaLayoutableShadowNode::cleanLayout() { - yogaNode_.setDirty(false); -} - -void YogaLayoutableShadowNode::dirtyLayout() { - yogaNode_.markDirtyAndPropogate(); -} - -bool YogaLayoutableShadowNode::getIsLayoutClean() const { - return !yogaNode_.isDirty(); -} - -bool YogaLayoutableShadowNode::getHasNewLayout() const { - return yogaNode_.getHasNewLayout(); -} - -void YogaLayoutableShadowNode::setHasNewLayout(bool hasNewLayout) { - yogaNode_.setHasNewLayout(hasNewLayout); -} - -#pragma mark - Mutating Methods - -void YogaLayoutableShadowNode::enableMeasurement() { - ensureUnsealed(); - - yogaNode_.setMeasureFunc( - YogaLayoutableShadowNode::yogaNodeMeasureCallbackConnector); -} - -void YogaLayoutableShadowNode::appendChild(YogaLayoutableShadowNode *child) { - ensureUnsealed(); - - auto yogaNodeRawPtr = &yogaNode_; - auto childYogaNodeRawPtr = &child->yogaNode_; - - if (childYogaNodeRawPtr->getOwner() != nullptr) { - child = static_cast( - cloneAndReplaceChild(child, yogaNode_.getChildren().size())); - childYogaNodeRawPtr = &child->yogaNode_; - assert(childYogaNodeRawPtr->getOwner() == nullptr); - } - - child->ensureUnsealed(); - childYogaNodeRawPtr->setOwner(yogaNodeRawPtr); - - yogaNodeRawPtr->insertChild( - childYogaNodeRawPtr, yogaNodeRawPtr->getChildren().size()); -} - -void YogaLayoutableShadowNode::setChildren( - std::vector children) { - yogaNode_.setChildren({}); - for (const auto &child : children) { - appendChild(child); - } -} - -void YogaLayoutableShadowNode::setProps(const YogaStylableProps &props) { - yogaNode_.setStyle(props.yogaStyle); -} - -void YogaLayoutableShadowNode::layout(LayoutContext layoutContext) { - if (!getIsLayoutClean()) { - ensureUnsealed(); - - /* - * In Yoga, every single Yoga Node has to have a (non-null) pointer to - * Yoga Config (this config can be shared between many nodes), - * so every node can be individually configured. This does *not* mean - * however that Yoga consults with every single Yoga Node Config for every - * config parameter. Especially in case of `pointScaleFactor`, - * the only value in the config of the root node is taken into account - * (and this is by design). - */ - yogaConfig_.pointScaleFactor = layoutContext.pointScaleFactor; - - { - SystraceSection s("YogaLayoutableShadowNode::YGNodeCalculateLayout"); - - YGNodeCalculateLayout( - &yogaNode_, YGUndefined, YGUndefined, YGDirectionInherit); - } - } - - LayoutableShadowNode::layout(layoutContext); -} - -void YogaLayoutableShadowNode::layoutChildren(LayoutContext layoutContext) { - for (const auto &childYogaNode : yogaNode_.getChildren()) { - auto childNode = - static_cast(childYogaNode->getContext()); - - LayoutMetrics childLayoutMetrics = - layoutMetricsFromYogaNode(childNode->yogaNode_); - childLayoutMetrics.pointScaleFactor = layoutContext.pointScaleFactor; - childNode->setLayoutMetrics(childLayoutMetrics); - } -} - -std::vector -YogaLayoutableShadowNode::getLayoutableChildNodes() const { - std::vector yogaLayoutableChildNodes; - yogaLayoutableChildNodes.reserve(yogaNode_.getChildren().size()); - - for (const auto &childYogaNode : yogaNode_.getChildren()) { - auto childNode = - static_cast(childYogaNode->getContext()); - yogaLayoutableChildNodes.push_back(childNode); - } - - return yogaLayoutableChildNodes; -} - -#pragma mark - Yoga Connectors - -YGNode *YogaLayoutableShadowNode::yogaNodeCloneCallbackConnector( - YGNode *oldYogaNode, - YGNode *parentYogaNode, - int childIndex) { - SystraceSection s("YogaLayoutableShadowNode::yogaNodeCloneCallbackConnector"); - - // At this point it is garanteed that all shadow nodes associated with yoga - // nodes are `YogaLayoutableShadowNode` subclasses. - auto parentNode = - static_cast(parentYogaNode->getContext()); - auto oldNode = - static_cast(oldYogaNode->getContext()); - auto clonedNode = static_cast( - parentNode->cloneAndReplaceChild(oldNode, childIndex)); - return &clonedNode->yogaNode_; -} - -YGSize YogaLayoutableShadowNode::yogaNodeMeasureCallbackConnector( - YGNode *yogaNode, - float width, - YGMeasureMode widthMode, - float height, - YGMeasureMode heightMode) { - SystraceSection s( - "YogaLayoutableShadowNode::yogaNodeMeasureCallbackConnector"); - - auto shadowNodeRawPtr = - static_cast(yogaNode->getContext()); - - auto minimumSize = Size{0, 0}; - auto maximumSize = Size{kFloatMax, kFloatMax}; - - switch (widthMode) { - case YGMeasureModeUndefined: - break; - case YGMeasureModeExactly: - minimumSize.width = floatFromYogaFloat(width); - maximumSize.width = floatFromYogaFloat(width); - break; - case YGMeasureModeAtMost: - maximumSize.width = floatFromYogaFloat(width); - break; - } - - switch (heightMode) { - case YGMeasureModeUndefined: - break; - case YGMeasureModeExactly: - minimumSize.height = floatFromYogaFloat(height); - maximumSize.height = floatFromYogaFloat(height); - break; - case YGMeasureModeAtMost: - maximumSize.height = floatFromYogaFloat(height); - break; - } - - auto size = shadowNodeRawPtr->measure({minimumSize, maximumSize}); - - return YGSize{yogaFloatFromFloat(size.width), - yogaFloatFromFloat(size.height)}; -} - -void YogaLayoutableShadowNode::initializeYogaConfig(YGConfig &config) { - config.cloneNodeCallback = - YogaLayoutableShadowNode::yogaNodeCloneCallbackConnector; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.h deleted file mode 100644 index 8386937a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.h +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -#include - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class YogaLayoutableShadowNode : public LayoutableShadowNode, - public virtual DebugStringConvertible, - public virtual Sealable { - public: -#pragma mark - Constructors - - YogaLayoutableShadowNode(); - - YogaLayoutableShadowNode( - const YogaLayoutableShadowNode &layoutableShadowNode); - -#pragma mark - Mutating Methods - - /* - * Connects `measureFunc` function of Yoga node with - * `LayoutableShadowNode::measure()` method. - */ - void enableMeasurement(); - - /* - * Appends `child`'s Yoga node to the own Yoga node. - * Complements `ShadowNode::appendChild(...)` functionality from Yoga - * perspective. - */ - void appendChild(YogaLayoutableShadowNode *child); - - /* - * Sets Yoga children based on collection of `YogaLayoutableShadowNode` - * instances. Complements `ShadowNode::setChildren(...)` functionality from - * Yoga perspective. - */ - void setChildren(std::vector children); - - /* - * Sets Yoga styles based on given `YogaStylableProps`. - */ - void setProps(const YogaStylableProps &props); - -#pragma mark - LayoutableShadowNode - - void cleanLayout() override; - void dirtyLayout() override; - bool getIsLayoutClean() const override; - - void setHasNewLayout(bool hasNewLayout) override; - bool getHasNewLayout() const override; - - /* - * Computes layout using Yoga layout engine. - * See `LayoutableShadowNode` for more details. - */ - void layout(LayoutContext layoutContext) override; - - void layoutChildren(LayoutContext layoutContext) override; - - std::vector getLayoutableChildNodes() const override; - - protected: - /* - * All Yoga functions only accept non-const arguments, so we have to mark - * Yoga node as `mutable` here to avoid `static_cast`ing the pointer to this - * all the time. - */ - mutable YGNode yogaNode_; - - /* - * Yoga config associated (only) with this particular node. - */ - YGConfig yogaConfig_; - - private: - static void initializeYogaConfig(YGConfig &config); - static YGNode *yogaNodeCloneCallbackConnector( - YGNode *oldYogaNode, - YGNode *parentYogaNode, - int childIndex); - static YGSize yogaNodeMeasureCallbackConnector( - YGNode *yogaNode, - float width, - YGMeasureMode widthMode, - float height, - YGMeasureMode heightMode); -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/yoga/YogaStylableProps.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/yoga/YogaStylableProps.cpp deleted file mode 100644 index 74391cf2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/yoga/YogaStylableProps.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "YogaStylableProps.h" - -#include -#include -#include -#include -#include -#include - -#include "conversions.h" - -namespace facebook { -namespace react { - -YogaStylableProps::YogaStylableProps(const YGStyle &yogaStyle) - : yogaStyle(yogaStyle) {} - -YogaStylableProps::YogaStylableProps( - const YogaStylableProps &sourceProps, - const RawProps &rawProps) - : yogaStyle(convertRawProp(rawProps, sourceProps.yogaStyle)){}; - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE -SharedDebugStringConvertibleList YogaStylableProps::getDebugProps() const { - auto defaultYogaStyle = YGStyle{}; - return { - debugStringConvertibleItem( - "direction", yogaStyle.direction, defaultYogaStyle.direction), - debugStringConvertibleItem( - "flexDirection", - yogaStyle.flexDirection, - defaultYogaStyle.flexDirection), - debugStringConvertibleItem( - "justifyContent", - yogaStyle.justifyContent, - defaultYogaStyle.justifyContent), - debugStringConvertibleItem( - "alignContent", - yogaStyle.alignContent, - defaultYogaStyle.alignContent), - debugStringConvertibleItem( - "alignItems", yogaStyle.alignItems, defaultYogaStyle.alignItems), - debugStringConvertibleItem( - "alignSelf", yogaStyle.alignSelf, defaultYogaStyle.alignSelf), - debugStringConvertibleItem( - "positionType", - yogaStyle.positionType, - defaultYogaStyle.positionType), - debugStringConvertibleItem( - "flexWrap", yogaStyle.flexWrap, defaultYogaStyle.flexWrap), - debugStringConvertibleItem( - "overflow", yogaStyle.overflow, defaultYogaStyle.overflow), - debugStringConvertibleItem( - "display", yogaStyle.display, defaultYogaStyle.display), - debugStringConvertibleItem("flex", yogaStyle.flex, defaultYogaStyle.flex), - debugStringConvertibleItem( - "flexGrow", yogaStyle.flexGrow, defaultYogaStyle.flexGrow), - debugStringConvertibleItem( - "flexShrink", yogaStyle.flexShrink, defaultYogaStyle.flexShrink), - debugStringConvertibleItem( - "flexBasis", yogaStyle.flexBasis, defaultYogaStyle.flexBasis), - debugStringConvertibleItem( - "margin", yogaStyle.margin, defaultYogaStyle.margin), - debugStringConvertibleItem( - "position", yogaStyle.position, defaultYogaStyle.position), - debugStringConvertibleItem( - "padding", yogaStyle.padding, defaultYogaStyle.padding), - debugStringConvertibleItem( - "border", yogaStyle.border, defaultYogaStyle.border), - debugStringConvertibleItem( - "dimensions", yogaStyle.dimensions, defaultYogaStyle.dimensions), - debugStringConvertibleItem( - "minDimensions", - yogaStyle.minDimensions, - defaultYogaStyle.minDimensions), - debugStringConvertibleItem( - "maxDimensions", - yogaStyle.maxDimensions, - defaultYogaStyle.maxDimensions), - debugStringConvertibleItem( - "aspectRatio", yogaStyle.aspectRatio, defaultYogaStyle.aspectRatio), - }; -} -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/yoga/YogaStylableProps.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/yoga/YogaStylableProps.h deleted file mode 100644 index 470a064c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/components/view/yoga/YogaStylableProps.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include -#include - -namespace facebook { -namespace react { - -class YogaStylableProps; - -typedef std::shared_ptr SharedYogaStylableProps; - -class YogaStylableProps { - public: - YogaStylableProps() = default; - YogaStylableProps(const YGStyle &yogaStyle); - YogaStylableProps( - const YogaStylableProps &sourceProps, - const RawProps &rawProps); - -#pragma mark - Props - - const YGStyle yogaStyle{}; - -#pragma mark - DebugStringConvertible (Partial) - -#if RN_DEBUG_STRING_CONVERTIBLE - SharedDebugStringConvertibleList getDebugProps() const; -#endif -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/BUCK deleted file mode 100644 index 4abae9d0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/BUCK +++ /dev/null @@ -1,75 +0,0 @@ -load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "APPLE", "fb_xplat_cxx_test", "get_apple_compiler_flags", "get_apple_inspector_flags", "react_native_xplat_target", "rn_xplat_cxx_library", "subdir_glob") - -APPLE_COMPILER_FLAGS = get_apple_compiler_flags() - -rn_xplat_cxx_library( - name = "core", - srcs = glob( - ["**/*.cpp"], - exclude = glob(["tests/**/*.cpp"]), - ), - headers = glob( - ["**/*.h"], - exclude = glob(["tests/**/*.h"]), - ), - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "*.h"), - ("events", "*.h"), - ("primitives", "*.h"), - ("componentdescriptor", "*.h"), - ("layout", "*.h"), - ("shadownode", "*.h"), - ], - prefix = "react/core", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - force_static = True, - macosx_tests_override = [], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - tests = [":tests"], - visibility = ["PUBLIC"], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//third-party/glog:glog", - react_native_xplat_target("utils:utils"), - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/events:events"), - react_native_xplat_target("fabric/graphics:graphics"), - ], -) - -fb_xplat_cxx_test( - name = "tests", - srcs = glob(["tests/**/*.cpp"]), - headers = glob(["tests/**/*.h"]), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - contacts = ["oncall+react_native@xmail.facebook.com"], - platforms = (ANDROID, APPLE), - deps = [ - "xplat//folly:molly", - "xplat//third-party/gmock:gtest", - ":core", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/componentdescriptor/ComponentDescriptor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/componentdescriptor/ComponentDescriptor.h deleted file mode 100644 index 6eb19fba..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/componentdescriptor/ComponentDescriptor.h +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -class ComponentDescriptor; - -using SharedComponentDescriptor = std::shared_ptr; - -/* - * Abstract class defining an interface of `ComponentDescriptor`. - * `ComponentDescriptor` represents particular `ShadowNode` type and - * defines (customizes) basic operations with particular kind of - * `ShadowNode`s (such as creating, cloning, props and children managing). - */ -class ComponentDescriptor { - public: - virtual ~ComponentDescriptor() = default; - - /* - * Returns `componentHandle` associated with particular kind of components. - * All `ShadowNode`s of this type must return same `componentHandle`. - */ - virtual ComponentHandle getComponentHandle() const = 0; - - /* - * Returns component's name. - * React uses a `name` to refer to particular kind of components in - * `create` requests. - */ - virtual ComponentName getComponentName() const = 0; - - /* - * Creates a new `ShadowNode` of a particular type. - */ - virtual SharedShadowNode createShadowNode( - const ShadowNodeFragment &fragment) const = 0; - - /* - * Clones a `ShadowNode` with optionally new `props` and/or `children`. - */ - virtual UnsharedShadowNode cloneShadowNode( - const ShadowNode &sourceShadowNode, - const ShadowNodeFragment &fragment) const = 0; - - /* - * Appends (by mutating) a given `childShadowNode` to `parentShadowNode`. - */ - virtual void appendChild( - const SharedShadowNode &parentShadowNode, - const SharedShadowNode &childShadowNode) const = 0; - - /* - * Creates a new `Props` of a particular type with all values copied from - * `props` and `rawProps` applied on top of this. - * If `props` is `nullptr`, a default `Props` object (with default values) - * will be used. - */ - virtual SharedProps cloneProps( - const SharedProps &props, - const RawProps &rawProps) const = 0; - - /* - * Creates a new `EventEmitter` object compatible with particular type of - * shadow nodes. - */ - virtual SharedEventEmitter createEventEmitter( - SharedEventTarget eventTarget, - const Tag &tag) const = 0; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/componentdescriptor/ConcreteComponentDescriptor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/componentdescriptor/ConcreteComponentDescriptor.h deleted file mode 100644 index 7a52cb2d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/componentdescriptor/ConcreteComponentDescriptor.h +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * Default template-based implementation of ComponentDescriptor. - * Use your `ShadowNode` type as a template argument and override any methods - * if necessary. - */ -template -class ConcreteComponentDescriptor : public ComponentDescriptor { - static_assert( - std::is_base_of::value, - "ShadowNodeT must be a descendant of ShadowNode"); - - using SharedShadowNodeT = std::shared_ptr; - using ConcreteProps = typename ShadowNodeT::ConcreteProps; - using SharedConcreteProps = typename ShadowNodeT::SharedConcreteProps; - using ConcreteEventEmitter = typename ShadowNodeT::ConcreteEventEmitter; - using SharedConcreteEventEmitter = - typename ShadowNodeT::SharedConcreteEventEmitter; - - public: - ConcreteComponentDescriptor(SharedEventDispatcher eventDispatcher) - : eventDispatcher_(eventDispatcher) {} - - ComponentHandle getComponentHandle() const override { - return ShadowNodeT::Handle(); - } - - ComponentName getComponentName() const override { - return ShadowNodeT::Name(); - } - - SharedShadowNode createShadowNode( - const ShadowNodeFragment &fragment) const override { - assert(std::dynamic_pointer_cast(fragment.props)); - assert(std::dynamic_pointer_cast( - fragment.eventEmitter)); - - auto shadowNode = - std::make_shared(fragment, getCloneFunction()); - - adopt(shadowNode); - - return shadowNode; - } - - UnsharedShadowNode cloneShadowNode( - const ShadowNode &sourceShadowNode, - const ShadowNodeFragment &fragment) const override { - auto shadowNode = std::make_shared(sourceShadowNode, fragment); - - adopt(shadowNode); - return shadowNode; - } - - void appendChild( - const SharedShadowNode &parentShadowNode, - const SharedShadowNode &childShadowNode) const override { - auto concreteParentShadowNode = - std::static_pointer_cast(parentShadowNode); - auto concreteNonConstParentShadowNode = - std::const_pointer_cast(concreteParentShadowNode); - concreteNonConstParentShadowNode->appendChild(childShadowNode); - } - - virtual SharedProps cloneProps( - const SharedProps &props, - const RawProps &rawProps) const override { - return ShadowNodeT::Props(rawProps, props); - }; - - virtual SharedEventEmitter createEventEmitter( - SharedEventTarget eventTarget, - const Tag &tag) const override { - return std::make_shared( - std::move(eventTarget), tag, eventDispatcher_); - } - - protected: - virtual void adopt(UnsharedShadowNode shadowNode) const { - // Default implementation does nothing. - assert(shadowNode->getComponentHandle() == getComponentHandle()); - } - - private: - mutable SharedEventDispatcher eventDispatcher_{nullptr}; - - mutable ShadowNodeCloneFunction cloneFunction_; - - ShadowNodeCloneFunction getCloneFunction() const { - if (!cloneFunction_) { - cloneFunction_ = [this]( - const ShadowNode &shadowNode, - const ShadowNodeFragment &fragment) { - return this->cloneShadowNode(shadowNode, fragment); - }; - } - - return cloneFunction_; - } -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/conversions.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/conversions.h deleted file mode 100644 index d9066d8a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/conversions.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -namespace facebook { -namespace react { - -inline std::string toString(const LayoutDirection &layoutDirection) { - switch (layoutDirection) { - case LayoutDirection::Undefined: - return "undefined"; - case LayoutDirection::LeftToRight: - return "ltr"; - case LayoutDirection::RightToLeft: - return "rtl"; - } -} - -inline std::string toString(const DisplayType &displayType) { - switch (displayType) { - case DisplayType::None: - return "none"; - case DisplayType::Flex: - return "flex"; - case DisplayType::Inline: - return "inline"; - } -} - -inline Size yogaMeassureToSize(int64_t value) { - static_assert( - sizeof(value) == 8, - "Expected measureResult to be 8 bytes, or two 32 bit ints"); - - int32_t wBits = 0xFFFFFFFF & (value >> 32); - int32_t hBits = 0xFFFFFFFF & value; - - float *measuredWidth = reinterpret_cast(&wBits); - float *measuredHeight = reinterpret_cast(&hBits); - - return {*measuredWidth, *measuredHeight}; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/layout/LayoutConstraints.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/layout/LayoutConstraints.h deleted file mode 100644 index d4f79bf5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/layout/LayoutConstraints.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * Unified layout constraints for measuring. - */ -struct LayoutConstraints { - Size minimumSize{0, 0}; - Size maximumSize{kFloatUndefined, kFloatUndefined}; - LayoutDirection layoutDirection{LayoutDirection::Undefined}; -}; - -inline bool operator==( - const LayoutConstraints &lhs, - const LayoutConstraints &rhs) { - return std::tie(lhs.minimumSize, lhs.maximumSize, lhs.layoutDirection) == - std::tie(rhs.minimumSize, rhs.maximumSize, rhs.layoutDirection); -} - -} // namespace react -} // namespace facebook - -namespace std { -template <> -struct hash { - size_t operator()( - const facebook::react::LayoutConstraints &constraints) const { - auto seed = size_t{0}; - folly::hash::hash_combine( - seed, - constraints.minimumSize, - constraints.maximumSize, - constraints.layoutDirection); - return seed; - } -}; -} // namespace std diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/layout/LayoutContext.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/layout/LayoutContext.h deleted file mode 100644 index 184d44f1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/layout/LayoutContext.h +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -namespace facebook { -namespace react { - -/* - * LayoutContext: Additional contextual information useful for particular - * layout approaches. - */ -struct LayoutContext { - /* - * Compound absolute position of the node relative to the root node. - */ - Point absolutePosition{0, 0}; - - /* - * Reflects the scale factor needed to convert from the logical coordinate - * space into the device coordinate space of the physical screen. - * Some layout systems *might* use this to round layout metric values - * to `pixel value`. - */ - Float pointScaleFactor = {1.0}; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/layout/LayoutMetrics.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/layout/LayoutMetrics.h deleted file mode 100644 index b7ee04a4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/layout/LayoutMetrics.h +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -/* - * Describes results of layout process for partucular shadow node. - */ -struct LayoutMetrics { - Rect frame; - EdgeInsets contentInsets{0}; - EdgeInsets borderWidth{0}; - DisplayType displayType{DisplayType::Flex}; - LayoutDirection layoutDirection{LayoutDirection::Undefined}; - Float pointScaleFactor{1.0}; - - Rect getContentFrame() const { - return Rect{ - Point{contentInsets.left, contentInsets.top}, - Size{frame.size.width - contentInsets.left - contentInsets.right, - frame.size.height - contentInsets.top - contentInsets.bottom}}; - } - - bool operator==(const LayoutMetrics &rhs) const { - return std::tie( - this->frame, - this->contentInsets, - this->borderWidth, - this->displayType, - this->layoutDirection, - this->pointScaleFactor) == - std::tie( - rhs.frame, - rhs.contentInsets, - rhs.borderWidth, - rhs.displayType, - rhs.layoutDirection, - this->pointScaleFactor); - } - - bool operator!=(const LayoutMetrics &rhs) const { - return !(*this == rhs); - } -}; - -/* - * Represents some undefined, not-yet-computed or meaningless value of - * `LayoutMetrics` type. - */ -static const LayoutMetrics EmptyLayoutMetrics = {.frame = {.size = {-1, -1}}}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/layout/LayoutPrimitives.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/layout/LayoutPrimitives.h deleted file mode 100644 index 6c6f524a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/layout/LayoutPrimitives.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -/* - * Defines visibility of the shadow node and partucular layout - * engine which should be used for laying out the node. - */ -enum class DisplayType { - None, - Flex, - Inline, -}; - -/* - * User interface layout direction. - */ -enum class LayoutDirection { - Undefined, - LeftToRight, - RightToLeft, -}; - -} // namespace react -} // namespace facebook - -namespace std { -template <> -struct hash { - size_t operator()(const facebook::react::LayoutDirection &v) const { - return hash()(static_cast(v)); - } -}; -} // namespace std diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp deleted file mode 100644 index f502fd4d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "LayoutableShadowNode.h" - -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -LayoutMetrics LayoutableShadowNode::getLayoutMetrics() const { - return layoutMetrics_; -} - -bool LayoutableShadowNode::setLayoutMetrics(LayoutMetrics layoutMetrics) { - if (layoutMetrics_ == layoutMetrics) { - return false; - } - - ensureUnsealed(); - - layoutMetrics_ = layoutMetrics; - return true; -} - -bool LayoutableShadowNode::LayoutableShadowNode::isLayoutOnly() const { - return false; -} - -LayoutMetrics LayoutableShadowNode::getRelativeLayoutMetrics( - const LayoutableShadowNode &ancestorLayoutableShadowNode) const { - std::vector> ancestors; - - auto &ancestorShadowNode = - dynamic_cast(ancestorLayoutableShadowNode); - auto &shadowNode = dynamic_cast(*this); - - if (!shadowNode.constructAncestorPath(ancestorShadowNode, ancestors)) { - return EmptyLayoutMetrics; - } - - auto layoutMetrics = getLayoutMetrics(); - - for (const auto ¤tShadowNode : ancestors) { - auto layoutableCurrentShadowNode = - dynamic_cast(¤tShadowNode.get()); - - if (!layoutableCurrentShadowNode) { - return EmptyLayoutMetrics; - } - - layoutMetrics.frame.origin += - layoutableCurrentShadowNode->getLayoutMetrics().frame.origin; - } - - return layoutMetrics; -} - -void LayoutableShadowNode::cleanLayout() { - isLayoutClean_ = true; -} - -void LayoutableShadowNode::dirtyLayout() { - isLayoutClean_ = false; -} - -bool LayoutableShadowNode::getIsLayoutClean() const { - return isLayoutClean_; -} - -bool LayoutableShadowNode::getHasNewLayout() const { - return hasNewLayout_; -}; - -void LayoutableShadowNode::setHasNewLayout(bool hasNewLayout) { - hasNewLayout_ = hasNewLayout; -} - -Size LayoutableShadowNode::measure(LayoutConstraints layoutConstraints) const { - return Size(); -} - -Float LayoutableShadowNode::firstBaseline(Size size) const { - return 0; -} - -Float LayoutableShadowNode::lastBaseline(Size size) const { - return 0; -} - -void LayoutableShadowNode::layout(LayoutContext layoutContext) { - layoutChildren(layoutContext); - - for (auto child : getLayoutableChildNodes()) { - if (!child->getHasNewLayout()) { - continue; - } - - child->ensureUnsealed(); - child->setHasNewLayout(false); - - const auto childLayoutMetrics = child->getLayoutMetrics(); - if (childLayoutMetrics.displayType == DisplayType::None) { - continue; - } - - auto childLayoutContext = LayoutContext(layoutContext); - childLayoutContext.absolutePosition += childLayoutMetrics.frame.origin; - - child->layout(layoutContext); - } -} - -void LayoutableShadowNode::layoutChildren(LayoutContext layoutContext) { - // Default implementation does nothing. -} - -#if RN_DEBUG_STRING_CONVERTIBLE -SharedDebugStringConvertibleList LayoutableShadowNode::getDebugProps() const { - auto list = SharedDebugStringConvertibleList{}; - - if (getHasNewLayout()) { - list.push_back( - std::make_shared("hasNewLayout")); - } - - if (!getIsLayoutClean()) { - list.push_back(std::make_shared("dirty")); - } - - auto layoutMetrics = getLayoutMetrics(); - auto defaultLayoutMetrics = LayoutMetrics(); - - list.push_back(std::make_shared( - "frame", toString(layoutMetrics.frame))); - - if (layoutMetrics.borderWidth != defaultLayoutMetrics.borderWidth) { - list.push_back(std::make_shared( - "borderWidth", toString(layoutMetrics.borderWidth))); - } - - if (layoutMetrics.contentInsets != defaultLayoutMetrics.contentInsets) { - list.push_back(std::make_shared( - "contentInsets", toString(layoutMetrics.contentInsets))); - } - - if (layoutMetrics.displayType == DisplayType::None) { - list.push_back(std::make_shared("hidden")); - } - - if (layoutMetrics.layoutDirection == LayoutDirection::RightToLeft) { - list.push_back(std::make_shared("rtl")); - } - - return list; -} -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/layout/LayoutableShadowNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/layout/LayoutableShadowNode.h deleted file mode 100644 index 58b76744..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/layout/LayoutableShadowNode.h +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include - -#include -#include -#include - -namespace facebook { -namespace react { - -struct LayoutConstraints; -struct LayoutContext; - -/* - * Describes all sufficient layout API (in approach-agnostic way) - * which makes a concurrent layout possible. - */ -class LayoutableShadowNode : public virtual Sealable { - public: - virtual ~LayoutableShadowNode() noexcept = default; - - /* - * Measures the node (and node content, propbably recursivly) with - * given constrains and relying on possible layout. - * Default implementation returns zero size. - */ - virtual Size measure(LayoutConstraints layoutConstraints) const; - - /* - * Computes layout recusively. - * Additional environmental constraints might be provided via `layoutContext` - * argument. - * Default implementation basically calls `layoutChildren()` and then - * `layout()` (recursively), and provides some obvious performance - * optimization. - */ - virtual void layout(LayoutContext layoutContext); - - /* - * Returns layout metrics computed during previous layout pass. - */ - virtual LayoutMetrics getLayoutMetrics() const; - - /* - * Returns `true` if the node represents only information necessary for - * layout computation and can be safely removed from view hierarchy. - * Default implementation returns `false`. - */ - virtual bool isLayoutOnly() const; - - /* - * Returns layout metrics relatively to the given ancestor node. - */ - LayoutMetrics getRelativeLayoutMetrics( - const LayoutableShadowNode &ancestorLayoutableShadowNode) const; - - protected: - /* - * Clean or Dirty layout state: - * Indicates whether all nodes (and possibly their subtrees) along the path - * to the root node should be re-layouted. - */ - virtual void cleanLayout(); - virtual void dirtyLayout(); - virtual bool getIsLayoutClean() const; - - /* - * Indicates does the shadow node (or any descendand node of the node) - * get a new layout metrics during a previous layout pass. - */ - virtual void setHasNewLayout(bool hasNewLayout); - virtual bool getHasNewLayout() const; - - /* - * Applies layout for all children; - * does not call anything in recusive manner *by desing*. - */ - virtual void layoutChildren(LayoutContext layoutContext); - - /* - * Unifed methods to access text layout metrics. - */ - virtual Float firstBaseline(Size size) const; - virtual Float lastBaseline(Size size) const; - - /* - * Returns layoutable children to interate on. - */ - virtual std::vector getLayoutableChildNodes() - const = 0; - - /* - * In case layout algorithm needs to mutate this (probably sealed) node, - * it has to clone and replace it in the hierarchy before to do so. - */ - virtual LayoutableShadowNode *cloneAndReplaceChild( - LayoutableShadowNode *child, - int suggestedIndex = -1) = 0; - - /* - * Sets layout metrics for the shadow node. - * Returns true if the metrics are different from previous ones. - */ - virtual bool setLayoutMetrics(LayoutMetrics layoutMetrics); - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE - SharedDebugStringConvertibleList getDebugProps() const; -#endif - - private: - LayoutMetrics layoutMetrics_{}; - bool hasNewLayout_{false}; - bool isLayoutClean_{false}; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/RawProps.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/RawProps.cpp deleted file mode 100644 index a647a379..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/RawProps.cpp +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "RawProps.h" diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/RawProps.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/RawProps.h deleted file mode 100644 index 6feed6af..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/RawProps.h +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * `RawProps` represents an untyped map of props comes from JavaScript side. - * `RawProps` stores JSI (or `folly::dynamic`) primitives inside and abstract - * them as `RawValue` objects. - * `RawProps` is NOT a thread-safe type nor long-living type. - * The caller must not store values of this type. - * The class is practically a wrapper around a `jsi::Value and `jsi::Runtime` - * pair (or folly::dynamic) preventing direct access to it and inefficient - * misuse. Not copyable, not moveable. - */ -class RawProps { - public: - /* - * Creates an object with given `runtime` and `value`. - */ - RawProps(jsi::Runtime &runtime, const jsi::Value &value) noexcept - : RawProps( - value.isNull() ? folly::dynamic::object() - : jsi::dynamicFromValue(runtime, value)) {} - - /* - * Creates an object with given `folly::dynamic` object. - * Deprecated. - * We need this temporary, only because we have a callsite that does not have - * a `jsi::Runtime` behind the data. - */ - RawProps(const folly::dynamic &dynamic) noexcept - : -#ifdef ANDROID - dynamic_(dynamic), -#endif - map_((std::unordered_map)RawValue(dynamic)) { - } - - /* - * Not moveable. - */ - RawProps(RawProps &&other) noexcept = delete; - RawProps &operator=(RawProps &&other) noexcept = delete; - - /* - * Not copyable. - */ - RawProps(const RawProps &other) noexcept = delete; - RawProps &operator=(const RawProps &other) noexcept = delete; - -#ifdef ANDROID - /* - * Deprecated. Do not use. - * The support for explicit conversion to `folly::dynamic` is deprecated and - * will be removed as soon Android implementation does not need it. - */ - explicit operator folly::dynamic() const noexcept { - return dynamic_; - } -#endif - - /* - * Returns a const unowning pointer to `RawValue` of a prop with a given name. - * Returns `nullptr`, it a prop with the given name does not exist. - */ - const RawValue *at(const std::string &name) const noexcept { - auto iterator = map_.find(name); - if (iterator == map_.end()) { - return nullptr; - } - - return &iterator->second; - } - - private: -#ifdef ANDROID - const folly::dynamic dynamic_; -#endif - - const std::unordered_map map_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/RawValue.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/RawValue.cpp deleted file mode 100644 index 9457cc76..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/RawValue.cpp +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "RawValue.h" diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/RawValue.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/RawValue.h deleted file mode 100644 index c7acfa9b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/RawValue.h +++ /dev/null @@ -1,266 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class RawProps; - -/* - * `RawValue` abstracts some arbitrary complex data structure similar to JSON. - * `RawValue` supports explicit conversion to: `bool`, `int`, `int64_t`, - * `float`, `double`, `string`, and `vector` & `map` of those types and itself. - * - * The main intention of the class is to abstract React props parsing infra from - * JSI, to enable support for any non-JSI-based data sources. The particular - * implementation of the interface is a very slim abstraction around - * `folly::dynamic` though. - * In the near future, this class will hold a `jsi::Runtime` and `jsi::Value` - * pair instead of `folly::dynamic`. - * - * How `RawValue` is different from `JSI::Value`: - * * `RawValue` provides much more scoped API without any references to - * JavaScript specifics. - * * The API is much more C++-idiomatic and easy to use from C++ code. - * * The API prevents access to JSI/JavaScript internals from prop-parsing - * code. - * * The `RawValue` is not copyable nor thread-safe, which prevent - * misuse and accidental performance problems. - * - * How `RawValue` is different from `folly::dynamic`: - * * `RawValue` is a lazy data structure, it does not copy all content inside, - * it provides efficient SAX-like access to the data. - * * `RawValue` has more static and C++-idiomatic API. - * * The `RawValue` is not copyable nor thread-safe, which prevent - * misuse and accidental performance problems. - */ -class RawValue { - public: - /* - * Constructors. - */ - RawValue() noexcept : dynamic_(nullptr){}; - - RawValue(RawValue &&other) noexcept : dynamic_(std::move(other.dynamic_)) {} - - RawValue &operator=(RawValue &&other) noexcept { - if (this != &other) { - dynamic_ = std::move(other.dynamic_); - } - return *this; - } - - private: - friend RawProps; - - /* - * Arbitrary constructors are private only for RawProps and internal usage. - */ - RawValue(const folly::dynamic &dynamic) noexcept : dynamic_(dynamic){}; - - RawValue(folly::dynamic &&dynamic) noexcept : dynamic_(std::move(dynamic)){}; - - /* - * Copy constructor and copy assignment operator are private and only for - * internal use. Basically, it's implementation details. Other particular - * implementations of the `RawValue` interface may not have them. - */ - RawValue(RawValue const &other) noexcept : dynamic_(other.dynamic_) {} - - RawValue &operator=(const RawValue &other) noexcept { - if (this != &other) { - dynamic_ = other.dynamic_; - } - return *this; - } - - public: - /* - * Casts the value to a specified type. - */ - template - explicit operator T() const noexcept { - return castValue(dynamic_, (T *)nullptr); - } - - inline explicit operator folly::dynamic() const { - return dynamic_; - } - - /* - * Checks if the stored value has specified type. - */ - template - bool hasType() const noexcept { - return checkValueType(dynamic_, (T *)nullptr); - }; - - /* - * Checks if the stored value is *not* `null`. - */ - bool hasValue() const noexcept { - return !dynamic_.isNull(); - } - - private: - folly::dynamic dynamic_; - - static bool checkValueType( - const folly::dynamic &dynamic, - RawValue *type) noexcept { - return true; - } - - static bool checkValueType( - const folly::dynamic &dynamic, - bool *type) noexcept { - return dynamic.isBool(); - } - - static bool checkValueType( - const folly::dynamic &dynamic, - int *type) noexcept { - return dynamic.isNumber(); - } - - static bool checkValueType( - const folly::dynamic &dynamic, - int64_t *type) noexcept { - return dynamic.isNumber(); - } - - static bool checkValueType( - const folly::dynamic &dynamic, - float *type) noexcept { - return dynamic.isNumber(); - } - - static bool checkValueType( - const folly::dynamic &dynamic, - double *type) noexcept { - return dynamic.isNumber(); - } - - static bool checkValueType( - const folly::dynamic &dynamic, - std::string *type) noexcept { - return dynamic.isString(); - } - - template - static bool checkValueType( - const folly::dynamic &dynamic, - std::vector *type) noexcept { - if (!dynamic.isArray()) { - return false; - } - - for (const auto &item : dynamic) { - if (!checkValueType(item, (T *)nullptr)) { - return false; - } - - // Note: We test only one element. - break; - } - - return true; - } - - template - static bool checkValueType( - const folly::dynamic &dynamic, - std::unordered_map *type) noexcept { - if (!dynamic.isObject()) { - return false; - } - - for (const auto &item : dynamic.items()) { - assert(item.first.isString()); - if (!checkValueType(item.second, (T *)nullptr)) { - return false; - } - - // Note: We test only one element. - break; - } - - return true; - } - - // Casts - static RawValue castValue( - const folly::dynamic &dynamic, - RawValue *type) noexcept { - return RawValue(dynamic); - } - - static bool castValue(const folly::dynamic &dynamic, bool *type) noexcept { - return dynamic.getBool(); - } - - static int castValue(const folly::dynamic &dynamic, int *type) noexcept { - return dynamic.asInt(); - } - - static int64_t castValue( - const folly::dynamic &dynamic, - int64_t *type) noexcept { - return dynamic.asInt(); - } - - static float castValue(const folly::dynamic &dynamic, float *type) noexcept { - return dynamic.asDouble(); - } - - static double castValue( - const folly::dynamic &dynamic, - double *type) noexcept { - return dynamic.asDouble(); - } - - static std::string castValue( - const folly::dynamic &dynamic, - std::string *type) noexcept { - return dynamic.getString(); - } - - template - static std::vector castValue( - const folly::dynamic &dynamic, - std::vector *type) noexcept { - assert(dynamic.isArray()); - auto result = std::vector{}; - result.reserve(dynamic.size()); - for (const auto &item : dynamic) { - result.push_back(castValue(item, (T *)nullptr)); - } - return result; - } - - template - static std::unordered_map castValue( - const folly::dynamic &dynamic, - std::unordered_map *type) noexcept { - assert(dynamic.isObject()); - auto result = std::unordered_map{}; - for (const auto &item : dynamic.items()) { - assert(item.first.isString()); - result[item.first.getString()] = castValue(item.second, (T *)nullptr); - } - return result; - } -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/ReactPrimitives.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/ReactPrimitives.h deleted file mode 100644 index 54ca67d9..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/ReactPrimitives.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * `Tag` and `InstanceHandle` are used to address React Native components. - */ -using Tag = int32_t; -using InstanceHandle = struct InstanceHandleDummyStruct { -} *; - -/* - * An id of a running Surface instance that is used to refer to the instance. - */ -using SurfaceId = int32_t; - -/* - * Universal component handle which allows to refer to `ComponentDescriptor`s - * in maps efficiently. - * Practically, it's something that concrete ShadowNode and concrete - * ComponentDescriptor have in common. - */ -using ComponentHandle = int64_t; - -/* - * String identifier for components used for addressing them from - * JavaScript side. - */ -using ComponentName = std::string; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/Sealable.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/Sealable.cpp deleted file mode 100644 index cd1c2b02..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/Sealable.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "Sealable.h" - -#include - -namespace facebook { -namespace react { - -/* - * Note: - * We must explictly implement all *the rule of five* methods because: - * 1. Using `std::atomic` behind `sealed_` implicitly deletes default - * constructors; - * 2. We have to establish behaviour where any new cloned or moved instances - * of the object lose `sealed` flag. - * - * See more about the rule of three/five/zero: - * http://en.cppreference.com/w/cpp/language/rule_of_three - */ - -#ifndef NDEBUG - -Sealable::Sealable() : sealed_(false) {} - -Sealable::Sealable(const Sealable &other) : sealed_(false){}; - -Sealable::Sealable(Sealable &&other) noexcept : sealed_(false){}; - -Sealable::~Sealable() noexcept {}; - -Sealable &Sealable::operator=(const Sealable &other) { - ensureUnsealed(); - return *this; -} - -Sealable &Sealable::operator=(Sealable &&other) noexcept { - ensureUnsealed(); - return *this; -} - -void Sealable::seal() const { - sealed_ = true; -} - -bool Sealable::getSealed() const { - return sealed_; -} - -void Sealable::ensureUnsealed() const { - if (sealed_) { - throw std::runtime_error("Attempt to mutate a sealed object."); - } -} - -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/Sealable.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/Sealable.h deleted file mode 100644 index b11afecb..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/primitives/Sealable.h +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -namespace facebook { -namespace react { - -/* - * Represents an object which can be *sealed* (imperatively marked as - * immutable). - * - * The `sealed` flag is tight to a particular instance of the class and resets - * to `false` for all newly created (by copy-constructor, assignment operator - * and so on) derivative objects. - * - * Why do we need this? In Fabric, some objects are semi-immutable - * even if they are explicitly marked as `const`. It means that in some special - * cases those objects can be const-casted-away and then mutated. That comes - * from the fact that we share some object's life-cycle responsibilities with - * React and the immutability is guaranteed by some logic splitted between - * native and JavaScript worlds (which makes it impossible to fully use - * immutability enforcement at a language level). To detect possible errors as - * early as possible we additionally mark objects as *sealed* after some stages - * and then enforce this at run-time. - * - * How to use: - * 1. Inherit your class from `Sealable`. - * 2. Call `ensureUnsealed()` in all cases where the object might be mutated: - * a. At the beginning of all *always* mutating `non-const` methods; - * b. Right before the place where actual mutation happens in all - * *possible* mutating `non-const` methods; c. Right after performing - * `const_cast`. (Optionally. This is not strictly necessary but might help - * detect problems earlier.) - * 3. Call `seal()` at some point from which any modifications - * must be prevented. - */ - -#ifdef NDEBUG - -class Sealable { - public: - inline void seal() const {} - inline bool getSealed() const { - return true; - } - inline void ensureUnsealed() const {} -}; - -#else - -class Sealable { - public: - Sealable(); - Sealable(const Sealable &other); - Sealable(Sealable &&other) noexcept; - ~Sealable() noexcept; - Sealable &operator=(const Sealable &other); - Sealable &operator=(Sealable &&other) noexcept; - - /* - * Seals the object. This operation is irreversible; - * the object cannot be "unsealed" after being sealing. - */ - void seal() const; - - /* - * Returns if the object already sealed or not. - */ - bool getSealed() const; - - /* - * Throws an exception if the object is sealed. - * Call this from all non-`const` methods. - */ - void ensureUnsealed() const; - - private: - mutable std::atomic sealed_{false}; -}; - -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/propsConversions.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/propsConversions.h deleted file mode 100644 index 003d9ab6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/propsConversions.h +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -template -void fromRawValue(const RawValue &rawValue, T &result) { - result = (T)rawValue; -} - -template -void fromRawValue(const RawValue &rawValue, std::vector &result) { - if (rawValue.hasType>()) { - auto items = (std::vector)rawValue; - auto length = items.size(); - result.clear(); - result.reserve(length); - for (int i = 0; i < length; i++) { - T itemResult; - fromRawValue(items.at(i), itemResult); - result.push_back(itemResult); - } - return; - } - - // The case where `value` is not an array. - result.clear(); - result.reserve(1); - T itemResult; - fromRawValue(rawValue, itemResult); - result.push_back(itemResult); -} - -template -T convertRawProp( - const RawProps &rawProps, - const std::string &name, - const T &sourceValue, - const T &defaultValue = T()) { - const auto rawValue = rawProps.at(name); - - if (!rawValue) { - return sourceValue; - } - - // Special case: `null` always means `the prop was removed, use default - // value`. - if (!rawValue->hasValue()) { - return defaultValue; - } - - T result; - fromRawValue(*rawValue, result); - return result; -} - -template -static folly::Optional convertRawProp( - const RawProps &rawProps, - const std::string &name, - const folly::Optional &sourceValue, - const folly::Optional &defaultValue = {}) { - const auto rawValue = rawProps.at(name); - - if (!rawValue) { - return sourceValue; - } - - // Special case: `null` always means `the prop was removed, use default - // value`. - if (!rawValue->hasValue()) { - return defaultValue; - } - - T result; - fromRawValue(*rawValue, result); - return folly::Optional{result}; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/ConcreteShadowNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/ConcreteShadowNode.h deleted file mode 100644 index c85abc74..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/ConcreteShadowNode.h +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -/* - * Base templace class for all `ShadowNode`s which connects exact `ShadowNode` - * type with exact `Props` type. - * `ConcreteShadowNode` is a default implementation of `ShadowNode` interface - * with many handy features. - */ -template < - const char *concreteComponentName, - typename PropsT, - typename EventEmitterT = EventEmitter> -class ConcreteShadowNode : public ShadowNode { - static_assert( - std::is_base_of::value, - "PropsT must be a descendant of Props"); - - public: - using ShadowNode::ShadowNode; - - using ConcreteProps = PropsT; - using SharedConcreteProps = std::shared_ptr; - using ConcreteEventEmitter = EventEmitterT; - using SharedConcreteEventEmitter = std::shared_ptr; - using SharedConcreteShadowNode = std::shared_ptr; - - static ComponentName Name() { - return ComponentName(concreteComponentName); - } - - static ComponentHandle Handle() { - return ComponentHandle(concreteComponentName); - } - - static SharedConcreteProps Props( - const RawProps &rawProps, - const SharedProps &baseProps = nullptr) { - return std::make_shared( - baseProps ? *std::static_pointer_cast(baseProps) - : PropsT(), - rawProps); - } - - static SharedConcreteProps defaultSharedProps() { - static const SharedConcreteProps defaultSharedProps = - std::make_shared(); - return defaultSharedProps; - } - - ComponentName getComponentName() const override { - return ComponentName(concreteComponentName); - } - - ComponentHandle getComponentHandle() const override { - return reinterpret_cast(concreteComponentName); - } - - const SharedConcreteProps getProps() const { - assert(std::dynamic_pointer_cast(props_)); - return std::static_pointer_cast(props_); - } - - /* - * Returns subset of children that are inherited from `SpecificShadowNodeT`. - */ - template - std::vector getChildrenSlice() const { - std::vector children; - for (const auto &childShadowNode : getChildren()) { - auto specificChildShadowNode = - dynamic_cast(childShadowNode.get()); - if (specificChildShadowNode) { - children.push_back( - const_cast(specificChildShadowNode)); - } - } - return children; - } -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/LocalData.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/LocalData.h deleted file mode 100644 index d62b3d29..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/LocalData.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class LocalData; - -using SharedLocalData = std::shared_ptr; - -/* - * Abstract class for any kind of concrete pieces of local data specific for - * some kinds of `ShadowNode`s. - * LocalData might be used to communicate some infomation between `ShadowNode`s - * and native component views. - * All `LocalData` objects *must* be immutable (sealed) when they became - * a part of the shadow tree. - */ -class LocalData : public Sealable, public DebugStringConvertible { - public: - virtual ~LocalData() = default; - - virtual folly::dynamic getDynamic() const { - return folly::dynamic::object(); - } -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/Props.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/Props.cpp deleted file mode 100644 index d56726f7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/Props.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "Props.h" - -#include -#include - -namespace facebook { -namespace react { - -Props::Props(const Props &sourceProps, const RawProps &rawProps) - : nativeId(convertRawProp(rawProps, "nativeID", sourceProps.nativeId)) -#ifdef ANDROID - , - rawProps((folly::dynamic)rawProps) -#endif - {}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/Props.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/Props.h deleted file mode 100644 index 840ef84a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/Props.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include -#include -#include - -namespace facebook { -namespace react { - -class Props; - -using SharedProps = std::shared_ptr; - -/* - * Represents the most generic props object. - */ -class Props : public virtual Sealable, public virtual DebugStringConvertible { - public: - Props() = default; - Props(const Props &sourceProps, const RawProps &rawProps); - virtual ~Props() = default; - - const std::string nativeId; - -#ifdef ANDROID - const folly::dynamic rawProps = folly::dynamic::object(); -#endif -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/ShadowNode.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/ShadowNode.cpp deleted file mode 100644 index 07c5b9dd..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/ShadowNode.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ShadowNode.h" - -#include - -#include -#include -#include - -namespace facebook { -namespace react { - -SharedShadowNodeSharedList ShadowNode::emptySharedShadowNodeSharedList() { - static const auto emptySharedShadowNodeSharedList = - std::make_shared(); - return emptySharedShadowNodeSharedList; -} - -#pragma mark - Constructors - -ShadowNode::ShadowNode( - const ShadowNodeFragment &fragment, - const ShadowNodeCloneFunction &cloneFunction) - : tag_(fragment.tag), - rootTag_(fragment.rootTag), - props_(fragment.props), - eventEmitter_(fragment.eventEmitter), - children_(fragment.children ?: emptySharedShadowNodeSharedList()), - cloneFunction_(cloneFunction), - childrenAreShared_(true), - revision_(1) { - assert(props_); - assert(children_); -} - -ShadowNode::ShadowNode( - const ShadowNode &sourceShadowNode, - const ShadowNodeFragment &fragment) - : tag_(fragment.tag ?: sourceShadowNode.tag_), - rootTag_(fragment.rootTag ?: sourceShadowNode.rootTag_), - props_(fragment.props ?: sourceShadowNode.props_), - eventEmitter_(fragment.eventEmitter ?: sourceShadowNode.eventEmitter_), - children_(fragment.children ?: sourceShadowNode.children_), - localData_(fragment.localData ?: sourceShadowNode.localData_), - cloneFunction_(sourceShadowNode.cloneFunction_), - childrenAreShared_(true), - revision_(sourceShadowNode.revision_ + 1) { - assert(props_); - assert(children_); -} - -UnsharedShadowNode ShadowNode::clone(const ShadowNodeFragment &fragment) const { - assert(cloneFunction_); - return cloneFunction_(*this, fragment); -} - -#pragma mark - Getters - -const SharedShadowNodeList &ShadowNode::getChildren() const { - return *children_; -} - -SharedProps ShadowNode::getProps() const { - return props_; -} - -SharedEventEmitter ShadowNode::getEventEmitter() const { - return eventEmitter_; -} - -Tag ShadowNode::getTag() const { - return tag_; -} - -Tag ShadowNode::getRootTag() const { - return rootTag_; -} - -SharedLocalData ShadowNode::getLocalData() const { - return localData_; -} - -void ShadowNode::sealRecursive() const { - if (getSealed()) { - return; - } - - seal(); - - props_->seal(); - - for (auto child : *children_) { - child->sealRecursive(); - } -} - -#pragma mark - Mutating Methods - -void ShadowNode::appendChild(const SharedShadowNode &child) { - ensureUnsealed(); - - cloneChildrenIfShared(); - auto nonConstChildren = - std::const_pointer_cast(children_); - nonConstChildren->push_back(child); -} - -void ShadowNode::replaceChild( - const SharedShadowNode &oldChild, - const SharedShadowNode &newChild, - int suggestedIndex) { - ensureUnsealed(); - - cloneChildrenIfShared(); - - auto nonConstChildren = - std::const_pointer_cast(children_); - - if (suggestedIndex != -1 && suggestedIndex < nonConstChildren->size()) { - if (nonConstChildren->at(suggestedIndex) == oldChild) { - (*nonConstChildren)[suggestedIndex] = newChild; - return; - } - } - - std::replace( - nonConstChildren->begin(), nonConstChildren->end(), oldChild, newChild); -} - -void ShadowNode::setLocalData(const SharedLocalData &localData) { - ensureUnsealed(); - localData_ = localData; -} - -void ShadowNode::cloneChildrenIfShared() { - if (!childrenAreShared_) { - return; - } - childrenAreShared_ = false; - children_ = std::make_shared(*children_); -} - -void ShadowNode::setMounted(bool mounted) const { - eventEmitter_->setEnabled(mounted); -} - -bool ShadowNode::constructAncestorPath( - const ShadowNode &ancestorShadowNode, - std::vector> &ancestors) const { - // Note: We have a decent idea of how to make it reasonable performant. - // This is not implemented yet though. See T36620537 for more details. - if (this == &ancestorShadowNode) { - return true; - } - - for (const auto &childShadowNode : *ancestorShadowNode.children_) { - if (constructAncestorPath(*childShadowNode, ancestors)) { - ancestors.push_back(std::ref(ancestorShadowNode)); - return true; - } - } - - return false; -} - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE -std::string ShadowNode::getDebugName() const { - return getComponentName(); -} - -std::string ShadowNode::getDebugValue() const { - return "r" + folly::to(revision_) + - (getSealed() ? "/sealed" : ""); -} - -SharedDebugStringConvertibleList ShadowNode::getDebugChildren() const { - auto debugChildren = SharedDebugStringConvertibleList{}; - - for (auto child : *children_) { - auto debugChild = - std::dynamic_pointer_cast(child); - if (debugChild) { - debugChildren.push_back(debugChild); - } - } - - return debugChildren; -} - -SharedDebugStringConvertibleList ShadowNode::getDebugProps() const { - return props_->getDebugProps() + - SharedDebugStringConvertibleList{ - debugStringConvertibleItem("tag", folly::to(tag_))}; -} -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/ShadowNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/ShadowNode.h deleted file mode 100644 index ea12b5f7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/ShadowNode.h +++ /dev/null @@ -1,171 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -struct ShadowNodeFragment; - -class ShadowNode; - -using SharedShadowNode = std::shared_ptr; -using UnsharedShadowNode = std::shared_ptr; -using SharedShadowNodeList = std::vector; -using SharedShadowNodeSharedList = std::shared_ptr; -using SharedShadowNodeUnsharedList = std::shared_ptr; - -using ShadowNodeCloneFunction = std::function; - -class ShadowNode : public virtual Sealable, - public virtual DebugStringConvertible, - public std::enable_shared_from_this { - public: - static SharedShadowNodeSharedList emptySharedShadowNodeSharedList(); - -#pragma mark - Constructors - - /* - * Creates a Shadow Node based on fields specified in a `fragment`. - */ - ShadowNode( - const ShadowNodeFragment &fragment, - const ShadowNodeCloneFunction &cloneFunction); - - /* - * Creates a Shadow Node via cloning given `sourceShadowNode` and - * applying fields from given `fragment`. - */ - ShadowNode( - const ShadowNode &sourceShadowNode, - const ShadowNodeFragment &fragment); - - virtual ~ShadowNode() = default; - - /* - * Clones the shadow node using stored `cloneFunction`. - */ - UnsharedShadowNode clone(const ShadowNodeFragment &fragment) const; - -#pragma mark - Getters - - virtual ComponentHandle getComponentHandle() const = 0; - virtual ComponentName getComponentName() const = 0; - - const SharedShadowNodeList &getChildren() const; - SharedProps getProps() const; - SharedEventEmitter getEventEmitter() const; - Tag getTag() const; - Tag getRootTag() const; - - /* - * Returns a local data associated with the node. - * `LocalData` object might be used for data exchange between native view and - * shadow node instances. - * Concrete type of the object depends on concrete type of the `ShadowNode`. - */ - SharedLocalData getLocalData() const; - - void sealRecursive() const; - -#pragma mark - Mutating Methods - - void appendChild(const SharedShadowNode &child); - void replaceChild( - const SharedShadowNode &oldChild, - const SharedShadowNode &newChild, - int suggestedIndex = -1); - void clearSourceNode(); - - /* - * Sets local data assosiated with the node. - * The node must be unsealed at this point. - */ - void setLocalData(const SharedLocalData &localData); - - /* - * Performs all side effects associated with mounting/unmounting in one place. - * This is not `virtual` on purpose, do not override this. - * `EventEmitter::DispatchMutex()` must be acquired before calling. - */ - void setMounted(bool mounted) const; - - /* - * Forms a list of all ancestors of the node relative to the given ancestor. - * The list starts from the parent node and ends with the given ancestor node. - * Returns `true` if successful, `false` otherwise. - * Thread-safe if the subtree is immutable. - * The theoretical complexity of this algorithm is `O(n)`. Use it wisely. - * The particular implementation can use some tricks to mitigate the - * complexity problem up to `0(ln(n))` but this is not guaranteed. - * Particular consumers should use appropriate cache techniques based on - * `childIndex` and `nodeId` tracking. - */ - bool constructAncestorPath( - const ShadowNode &rootShadowNode, - std::vector> &ancestors) const; - -#pragma mark - DebugStringConvertible - -#if RN_DEBUG_STRING_CONVERTIBLE - std::string getDebugName() const override; - std::string getDebugValue() const override; - SharedDebugStringConvertibleList getDebugChildren() const override; - SharedDebugStringConvertibleList getDebugProps() const override; -#endif - - protected: - Tag tag_; - Tag rootTag_; - SharedProps props_; - SharedEventEmitter eventEmitter_; - SharedShadowNodeSharedList children_; - SharedLocalData localData_; - - private: - /* - * Clones the list of children (and creates a new `shared_ptr` to it) if - * `childrenAreShared_` flag is `true`. - */ - void cloneChildrenIfShared(); - - /* - * A reference to a cloning function that understands how to clone - * the specific type of ShadowNode. - */ - ShadowNodeCloneFunction cloneFunction_; - - /* - * Indicates that `children` list is shared between nodes and need - * to be cloned before the first mutation. - */ - bool childrenAreShared_; - - /* - * A number of the generation of the ShadowNode instance; - * is used and useful for debug-printing purposes *only*. - * Do not access this value in any circumstances. - */ - const int revision_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/ShadowNodeFragment.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/ShadowNodeFragment.cpp deleted file mode 100644 index 494b9e62..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/ShadowNodeFragment.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ShadowNodeFragment.h" - -namespace facebook { -namespace react { - -SharedProps &ShadowNodeFragment::nullSharedProps() { - static auto &instance = *new SharedProps(); - return instance; -} - -SharedEventEmitter &ShadowNodeFragment::nullSharedEventEmitter() { - static auto &instance = *new SharedEventEmitter(); - return instance; -} - -SharedShadowNodeSharedList &ShadowNodeFragment::nullSharedChildren() { - static auto &instance = *new SharedShadowNodeSharedList(); - return instance; -} - -SharedLocalData &ShadowNodeFragment::nullLocalData() { - static auto &instance = *new SharedLocalData(); - return instance; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/ShadowNodeFragment.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/ShadowNodeFragment.h deleted file mode 100644 index 8dabd156..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/shadownode/ShadowNodeFragment.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * An object which supposed to be used as a parameter specifying a shape - * of created or cloned ShadowNode. - * Note: Most of the fields are `const &` references (essentially just raw - * pointers) which means that the Fragment does not copy/store them or - * retain ownership of them. - */ -struct ShadowNodeFragment { - Tag tag = 0; - Tag rootTag = 0; - const SharedProps &props = nullSharedProps(); - const SharedEventEmitter &eventEmitter = nullSharedEventEmitter(); - const SharedShadowNodeSharedList &children = nullSharedChildren(); - const SharedLocalData &localData = nullLocalData(); - - static SharedProps &nullSharedProps(); - static SharedEventEmitter &nullSharedEventEmitter(); - static SharedShadowNodeSharedList &nullSharedChildren(); - static SharedLocalData &nullLocalData(); -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/tests/ComponentDescriptorTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/tests/ComponentDescriptorTest.cpp deleted file mode 100644 index 91c5b5ef..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/tests/ComponentDescriptorTest.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include "TestComponent.h" - -using namespace facebook::react; - -TEST(ComponentDescriptorTest, createShadowNode) { - SharedComponentDescriptor descriptor = - std::make_shared(nullptr); - - ASSERT_EQ(descriptor->getComponentHandle(), TestShadowNode::Handle()); - ASSERT_STREQ( - descriptor->getComponentName().c_str(), TestShadowNode::Name().c_str()); - ASSERT_STREQ(descriptor->getComponentName().c_str(), "Test"); - - const auto &raw = RawProps(folly::dynamic::object("nativeID", "abc")); - SharedProps props = descriptor->cloneProps(nullptr, raw); - SharedShadowNode node = descriptor->createShadowNode( - ShadowNodeFragment{.tag = 9, - .rootTag = 1, - .props = props, - .eventEmitter = descriptor->createEventEmitter(0, 9)}); - - ASSERT_EQ(node->getComponentHandle(), TestShadowNode::Handle()); - ASSERT_STREQ( - node->getComponentName().c_str(), TestShadowNode::Name().c_str()); - ASSERT_STREQ(node->getComponentName().c_str(), "Test"); - ASSERT_EQ(node->getTag(), 9); - ASSERT_EQ(node->getRootTag(), 1); - ASSERT_STREQ(node->getProps()->nativeId.c_str(), "abc"); -} - -TEST(ComponentDescriptorTest, cloneShadowNode) { - SharedComponentDescriptor descriptor = - std::make_shared(nullptr); - - const auto &raw = RawProps(folly::dynamic::object("nativeID", "abc")); - SharedProps props = descriptor->cloneProps(nullptr, raw); - SharedShadowNode node = descriptor->createShadowNode( - ShadowNodeFragment{.tag = 9, - .rootTag = 1, - .props = props, - .eventEmitter = descriptor->createEventEmitter(0, 9)}); - SharedShadowNode cloned = descriptor->cloneShadowNode(*node, {}); - - ASSERT_STREQ(cloned->getComponentName().c_str(), "Test"); - ASSERT_EQ(cloned->getTag(), 9); - ASSERT_EQ(cloned->getRootTag(), 1); - ASSERT_STREQ(cloned->getProps()->nativeId.c_str(), "abc"); -} - -TEST(ComponentDescriptorTest, appendChild) { - SharedComponentDescriptor descriptor = - std::make_shared(nullptr); - - const auto &raw = RawProps(folly::dynamic::object("nativeID", "abc")); - SharedProps props = descriptor->cloneProps(nullptr, raw); - SharedShadowNode node1 = descriptor->createShadowNode( - ShadowNodeFragment{.tag = 1, - .rootTag = 1, - .props = props, - .eventEmitter = descriptor->createEventEmitter(0, 1)}); - SharedShadowNode node2 = descriptor->createShadowNode( - ShadowNodeFragment{.tag = 2, - .rootTag = 1, - .props = props, - .eventEmitter = descriptor->createEventEmitter(0, 2)}); - SharedShadowNode node3 = descriptor->createShadowNode( - ShadowNodeFragment{.tag = 3, - .rootTag = 1, - .props = props, - .eventEmitter = descriptor->createEventEmitter(0, 3)}); - - descriptor->appendChild(node1, node2); - descriptor->appendChild(node1, node3); - - auto node1Children = node1->getChildren(); - ASSERT_EQ(node1Children.size(), 2); - ASSERT_EQ(node1Children.at(0), node2); - ASSERT_EQ(node1Children.at(1), node3); -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/tests/PrimitivesTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/tests/PrimitivesTest.cpp deleted file mode 100644 index 7c96796a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/tests/PrimitivesTest.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include -#include - -using namespace facebook::react; - -TEST(SealableTest, sealObjectCorrectly) { - Sealable obj; - ASSERT_FALSE(obj.getSealed()); - - obj.seal(); - ASSERT_TRUE(obj.getSealed()); -} - -TEST(SealableTest, handleAssignmentsCorrectly) { - Sealable obj; - Sealable other; - EXPECT_NO_THROW(obj = other); - - // Assignment after getting sealed is not allowed. - obj.seal(); - Sealable other2; - EXPECT_THROW(obj = other2, std::runtime_error); - - // It doesn't matter if the other object is also sealed, it's still not - // allowed. - other2.seal(); - EXPECT_THROW(obj = other2, std::runtime_error); - - // Fresh creation off other Sealable is still unsealed. - Sealable other3(obj); - ASSERT_FALSE(other3.getSealed()); -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/tests/ShadowNodeTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/tests/ShadowNodeTest.cpp deleted file mode 100644 index 9b537626..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/tests/ShadowNodeTest.cpp +++ /dev/null @@ -1,278 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include -#include -#include - -#include "TestComponent.h" - -using namespace facebook::react; - -TEST(ShadowNodeTest, handleProps) { - const auto &raw = RawProps(folly::dynamic::object("nativeID", "abc")); - - auto props = std::make_shared(Props(), raw); - - // Props are not sealed after applying raw props. - ASSERT_FALSE(props->getSealed()); - - ASSERT_STREQ(props->nativeId.c_str(), "abc"); -} - -TEST(ShadowNodeTest, handleShadowNodeCreation) { - auto node = std::make_shared( - ShadowNodeFragment{ - .tag = 9, - .rootTag = 1, - .props = std::make_shared(), - .children = ShadowNode::emptySharedShadowNodeSharedList()}, - nullptr); - - ASSERT_FALSE(node->getSealed()); - ASSERT_STREQ(node->getComponentName().c_str(), "Test"); - ASSERT_EQ(node->getTag(), 9); - ASSERT_EQ(node->getRootTag(), 1); - ASSERT_EQ(node->getEventEmitter(), nullptr); - ASSERT_EQ(node->getChildren().size(), 0); - - ASSERT_STREQ(node->getProps()->nativeId.c_str(), "testNativeID"); - - node->sealRecursive(); - ASSERT_TRUE(node->getSealed()); - ASSERT_TRUE(node->getProps()->getSealed()); -} - -TEST(ShadowNodeTest, handleShadowNodeSimpleCloning) { - auto node = std::make_shared( - ShadowNodeFragment{ - .tag = 9, - .rootTag = 1, - .props = std::make_shared(), - .children = ShadowNode::emptySharedShadowNodeSharedList()}, - nullptr); - auto node2 = std::make_shared(*node, ShadowNodeFragment{}); - - ASSERT_STREQ(node->getComponentName().c_str(), "Test"); - ASSERT_EQ(node->getTag(), 9); - ASSERT_EQ(node->getRootTag(), 1); - ASSERT_EQ(node->getEventEmitter(), nullptr); -} - -TEST(ShadowNodeTest, handleShadowNodeMutation) { - auto props = std::make_shared(); - auto node1 = std::make_shared( - ShadowNodeFragment{ - .tag = 1, - .rootTag = 1, - .props = std::make_shared(), - .children = ShadowNode::emptySharedShadowNodeSharedList()}, - nullptr); - auto node2 = std::make_shared( - ShadowNodeFragment{ - .tag = 2, - .rootTag = 1, - .props = std::make_shared(), - .children = ShadowNode::emptySharedShadowNodeSharedList()}, - nullptr); - auto node3 = std::make_shared( - ShadowNodeFragment{ - .tag = 3, - .rootTag = 1, - .props = std::make_shared(), - .children = ShadowNode::emptySharedShadowNodeSharedList()}, - nullptr); - - node1->appendChild(node2); - node1->appendChild(node3); - auto node1Children = node1->getChildren(); - ASSERT_EQ(node1Children.size(), 2); - ASSERT_EQ(node1Children.at(0), node2); - ASSERT_EQ(node1Children.at(1), node3); - - auto node4 = std::make_shared(*node2, ShadowNodeFragment{}); - node1->replaceChild(node2, node4); - node1Children = node1->getChildren(); - ASSERT_EQ(node1Children.size(), 2); - ASSERT_EQ(node1Children.at(0), node4); - ASSERT_EQ(node1Children.at(1), node3); - - // Seal the entire tree. - node1->sealRecursive(); - ASSERT_TRUE(node1->getSealed()); - ASSERT_TRUE(node3->getSealed()); - ASSERT_TRUE(node4->getSealed()); - - // No more mutation after sealing. - EXPECT_THROW(node4->setLocalData(nullptr), std::runtime_error); - - auto node5 = std::make_shared(*node4, ShadowNodeFragment{}); - node5->setLocalData(nullptr); - ASSERT_EQ(node5->getLocalData(), nullptr); -} - -TEST(ShadowNodeTest, handleCloneFunction) { - auto firstNode = std::make_shared( - ShadowNodeFragment{ - .tag = 9, - .rootTag = 1, - .props = std::make_shared(), - .children = ShadowNode::emptySharedShadowNodeSharedList()}, - nullptr); - - // The shadow node is not clonable if `cloneFunction` is not provided, - ASSERT_DEATH_IF_SUPPORTED(firstNode->clone({}), "cloneFunction_"); - - auto secondNode = std::make_shared( - ShadowNodeFragment{ - .tag = 9, - .rootTag = 1, - .props = std::make_shared(), - .children = ShadowNode::emptySharedShadowNodeSharedList()}, - [](const ShadowNode &shadowNode, const ShadowNodeFragment &fragment) { - return std::make_shared(shadowNode, fragment); - }); - - auto secondNodeClone = secondNode->clone({}); - - // Those two nodes are *not* same. - ASSERT_NE(secondNode, secondNodeClone); - - // `secondNodeClone` is an instance of `TestShadowNode`. - ASSERT_NE( - std::dynamic_pointer_cast(secondNodeClone), - nullptr); - - // Both nodes have same content. - ASSERT_EQ(secondNode->getTag(), secondNodeClone->getTag()); - ASSERT_EQ(secondNode->getRootTag(), secondNodeClone->getRootTag()); - ASSERT_EQ(secondNode->getProps(), secondNodeClone->getProps()); -} - -TEST(ShadowNodeTest, handleLocalData) { - auto localData42 = std::make_shared(); - localData42->setNumber(42); - - auto anotherLocalData42 = std::make_shared(); - anotherLocalData42->setNumber(42); - - auto localDataOver9000 = std::make_shared(); - localDataOver9000->setNumber(9001); - auto props = std::make_shared(); - auto firstNode = std::make_shared( - ShadowNodeFragment{ - .tag = 9, - .rootTag = 1, - .props = props, - .children = ShadowNode::emptySharedShadowNodeSharedList()}, - nullptr); - auto secondNode = std::make_shared( - ShadowNodeFragment{ - .tag = 9, - .rootTag = 1, - .props = props, - .children = ShadowNode::emptySharedShadowNodeSharedList()}, - nullptr); - auto thirdNode = std::make_shared( - ShadowNodeFragment{ - .tag = 9, - .rootTag = 1, - .props = props, - .children = ShadowNode::emptySharedShadowNodeSharedList()}, - nullptr); - - firstNode->setLocalData(localData42); - secondNode->setLocalData(localData42); - thirdNode->setLocalData(localDataOver9000); - - // LocalData object are compared by pointer, not by value. - ASSERT_EQ(firstNode->getLocalData(), secondNode->getLocalData()); - ASSERT_NE(firstNode->getLocalData(), thirdNode->getLocalData()); - secondNode->setLocalData(anotherLocalData42); - ASSERT_NE(firstNode->getLocalData(), secondNode->getLocalData()); - - // LocalData cannot be changed for sealed shadow node. - secondNode->sealRecursive(); - ASSERT_ANY_THROW(secondNode->setLocalData(localDataOver9000)); -} - -TEST(ShadowNodeTest, handleBacktracking) { - /* - * The structure: - * - * - * - * - * - * - * - * - * - */ - - auto props = std::make_shared(); - - auto nodeAA = std::make_shared( - ShadowNodeFragment{ - .props = props, - .children = ShadowNode::emptySharedShadowNodeSharedList()}, - nullptr); - - auto nodeABA = std::make_shared( - ShadowNodeFragment{ - .props = props, - .children = ShadowNode::emptySharedShadowNodeSharedList()}, - nullptr); - auto nodeABB = std::make_shared( - ShadowNodeFragment{ - .props = props, - .children = ShadowNode::emptySharedShadowNodeSharedList()}, - nullptr); - auto nodeABC = std::make_shared( - ShadowNodeFragment{ - .props = props, - .children = ShadowNode::emptySharedShadowNodeSharedList()}, - nullptr); - - auto nodeABChildren = std::make_shared>( - std::vector{nodeABA, nodeABB, nodeABC}); - auto nodeAB = std::make_shared( - ShadowNodeFragment{.props = props, .children = nodeABChildren}, nullptr); - - auto nodeAC = std::make_shared( - ShadowNodeFragment{ - .props = props, - .children = ShadowNode::emptySharedShadowNodeSharedList()}, - nullptr); - - auto nodeAChildren = std::make_shared>( - std::vector{nodeAA, nodeAB, nodeAC}); - auto nodeA = std::make_shared( - ShadowNodeFragment{.props = props, .children = nodeAChildren}, nullptr); - - auto nodeZ = std::make_shared( - ShadowNodeFragment{ - .props = props, - .children = ShadowNode::emptySharedShadowNodeSharedList()}, - nullptr); - - std::vector> ancestors = {}; - - // Negative case: - auto success = nodeZ->constructAncestorPath(*nodeA, ancestors); - ASSERT_FALSE(success); - ASSERT_EQ(ancestors.size(), 0); - - // Positive case: - success = nodeABC->constructAncestorPath(*nodeA, ancestors); - ASSERT_TRUE(success); - ASSERT_EQ(ancestors.size(), 2); - ASSERT_EQ(&ancestors[0].get(), nodeAB.get()); - ASSERT_EQ(&ancestors[1].get(), nodeA.get()); -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/tests/TestComponent.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/tests/TestComponent.h deleted file mode 100644 index 8acb11ee..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/core/tests/TestComponent.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include -#include -#include -#include -#include -#include - -using namespace facebook::react; - -/** - * This defines a set of TestComponent classes: Props, ShadowNode, - * ComponentDescriptor. To be used for testing purpose. - */ - -class TestLocalData : public LocalData { - public: - void setNumber(const int &number) { - number_ = number; - } - - int getNumber() const { - return number_; - } - - private: - int number_{0}; -}; - -static const char TestComponentName[] = "Test"; - -class TestProps : public Props { - public: - using Props::Props; - TestProps() - : Props(Props(), RawProps(folly::dynamic::object("nativeID", "testNativeID"))) {} -}; -using SharedTestProps = std::shared_ptr; - -class TestShadowNode; -using SharedTestShadowNode = std::shared_ptr; -class TestShadowNode : public ConcreteShadowNode { - public: - using ConcreteShadowNode::ConcreteShadowNode; -}; - -class TestComponentDescriptor - : public ConcreteComponentDescriptor { - public: - using ConcreteComponentDescriptor::ConcreteComponentDescriptor; -}; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/BUCK deleted file mode 100644 index 7bbfeb29..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/BUCK +++ /dev/null @@ -1,77 +0,0 @@ -load( - "@fbsource//tools/build_defs/apple:flag_defs.bzl", - "get_debug_preprocessor_flags", -) -load( - "//tools/build_defs/oss:rn_defs.bzl", - "ANDROID", - "APPLE", - "fb_xplat_cxx_test", - "get_apple_compiler_flags", - "get_apple_inspector_flags", - "rn_xplat_cxx_library", - "subdir_glob", -) - -APPLE_COMPILER_FLAGS = get_apple_compiler_flags() - -rn_xplat_cxx_library( - name = "debug", - srcs = glob( - ["**/*.cpp"], - exclude = glob(["tests/**/*.cpp"]), - ), - headers = glob( - ["**/*.h"], - exclude = glob(["tests/**/*.h"]), - ), - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "*.h"), - ], - prefix = "react/debug", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - force_static = True, - macosx_tests_override = [], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - tests = [":tests"], - visibility = ["PUBLIC"], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - ], -) - -fb_xplat_cxx_test( - name = "tests", - srcs = glob(["tests/**/*.cpp"]), - headers = glob(["tests/**/*.h"]), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - contacts = ["oncall+react_native@xmail.facebook.com"], - platforms = (ANDROID, APPLE), - deps = [ - "xplat//folly:molly", - "xplat//third-party/gmock:gtest", - ":debug", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/DebugStringConvertible.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/DebugStringConvertible.cpp deleted file mode 100644 index 20c182c4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/DebugStringConvertible.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "DebugStringConvertible.h" - -namespace facebook { -namespace react { - -#if RN_DEBUG_STRING_CONVERTIBLE - -std::string DebugStringConvertible::getDebugChildrenDescription( - DebugStringConvertibleOptions options, - int depth) const { - if (depth >= options.maximumDepth) { - return ""; - } - - std::string childrenString = ""; - - for (auto child : getDebugChildren()) { - if (!child) { - continue; - } - - childrenString += child->getDebugDescription(options, depth + 1); - } - - return childrenString; -} - -std::string DebugStringConvertible::getDebugPropsDescription( - DebugStringConvertibleOptions options, - int depth) const { - if (depth >= options.maximumDepth) { - return ""; - } - - std::string propsString = ""; - - for (auto prop : getDebugProps()) { - if (!prop) { - continue; - } - - auto name = prop->getDebugName(); - auto value = prop->getDebugValue(); - auto children = prop->getDebugPropsDescription(options, depth + 1); - auto valueAndChildren = - value + (children.empty() ? "" : "(" + children + ")"); - propsString += - " " + name + (valueAndChildren.empty() ? "" : "=" + valueAndChildren); - } - - if (!propsString.empty()) { - // Removing leading space character. - propsString.erase(propsString.begin()); - } - - return propsString; -} - -std::string DebugStringConvertible::getDebugDescription( - DebugStringConvertibleOptions options, - int depth) const { - auto nameString = getDebugName(); - auto valueString = getDebugValue(); - auto childrenString = getDebugChildrenDescription(options, depth); - auto propsString = getDebugPropsDescription(options, depth); - - auto leading = options.format ? std::string(depth * 2, ' ') : std::string{""}; - auto trailing = options.format ? std::string{"\n"} : std::string{""}; - - return leading + "<" + nameString + - (valueString.empty() ? "" : "=" + valueString) + - (propsString.empty() ? "" : " " + propsString) + - (childrenString.empty() ? "/>" + trailing - : ">" + trailing + childrenString + leading + - "" + trailing); -} - -std::string DebugStringConvertible::getDebugName() const { - return "Node"; -} - -std::string DebugStringConvertible::getDebugValue() const { - return ""; -} - -SharedDebugStringConvertibleList DebugStringConvertible::getDebugChildren() - const { - return SharedDebugStringConvertibleList(); -} - -SharedDebugStringConvertibleList DebugStringConvertible::getDebugProps() const { - return SharedDebugStringConvertibleList(); -} - -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/DebugStringConvertible.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/DebugStringConvertible.h deleted file mode 100644 index 2c38093f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/DebugStringConvertible.h +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -#ifndef NDEBUG -#define RN_DEBUG_STRING_CONVERTIBLE 1 -#endif - -#if RN_DEBUG_STRING_CONVERTIBLE - -class DebugStringConvertible; - -using SharedDebugStringConvertible = - std::shared_ptr; -using SharedDebugStringConvertibleList = - std::vector; - -struct DebugStringConvertibleOptions { - bool format{true}; - int maximumDepth{INT_MAX}; -}; - -// Abstract class describes conformance to DebugStringConvertible concept -// and implements basic recursive debug string assembly algorithm. -// Use this as a base class for providing a debugging textual representation -// of your class. -class DebugStringConvertible { - public: - virtual ~DebugStringConvertible() = default; - - // Returns a name of the object. - // Default implementation returns "Node". - virtual std::string getDebugName() const; - - // Returns a value assosiate with the object. - // Default implementation returns an empty string. - virtual std::string getDebugValue() const; - - // Returns a list of `DebugStringConvertible` objects which can be considered - // as *children* of the object. - // Default implementation returns an empty list. - virtual SharedDebugStringConvertibleList getDebugChildren() const; - - // Returns a list of `DebugStringConvertible` objects which can be considered - // as *properties* of the object. - // Default implementation returns an empty list. - virtual SharedDebugStringConvertibleList getDebugProps() const; - - // Returns a string which represents the object in a human-readable way. - // Default implementation returns a description of the subtree - // rooted at this node, represented in XML-like format. - virtual std::string getDebugDescription( - DebugStringConvertibleOptions options = {}, - int depth = 0) const; - - // Do same as `getDebugDescription` but return only *children* and - // *properties* parts (which are used in `getDebugDescription`). - virtual std::string getDebugPropsDescription( - DebugStringConvertibleOptions options = {}, - int depth = 0) const; - virtual std::string getDebugChildrenDescription( - DebugStringConvertibleOptions options = {}, - int depth = 0) const; -}; - -#else - -class DebugStringConvertible {}; - -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/DebugStringConvertibleItem.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/DebugStringConvertibleItem.cpp deleted file mode 100644 index 93961d06..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/DebugStringConvertibleItem.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "DebugStringConvertibleItem.h" - -namespace facebook { -namespace react { - -#if RN_DEBUG_STRING_CONVERTIBLE - -DebugStringConvertibleItem::DebugStringConvertibleItem( - const std::string &name, - const std::string &value, - const SharedDebugStringConvertibleList &props, - const SharedDebugStringConvertibleList &children) - : name_(name), value_(value), props_(props), children_(children) {} - -std::string DebugStringConvertibleItem::getDebugName() const { - return name_; -} - -std::string DebugStringConvertibleItem::getDebugValue() const { - return value_; -} - -SharedDebugStringConvertibleList DebugStringConvertibleItem::getDebugProps() - const { - return props_; -} - -SharedDebugStringConvertibleList DebugStringConvertibleItem::getDebugChildren() - const { - return children_; -} - -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/DebugStringConvertibleItem.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/DebugStringConvertibleItem.h deleted file mode 100644 index f4b60fae..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/DebugStringConvertibleItem.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include - -namespace facebook { -namespace react { - -#if RN_DEBUG_STRING_CONVERTIBLE - -// Trivial implementation of `DebugStringConvertible` abstract class -// with a stored output; useful for assembling `DebugStringConvertible` values -// in custom implementations of `getDebugChildren` and `getDebugProps`. -class DebugStringConvertibleItem : public DebugStringConvertible { - public: - DebugStringConvertibleItem() = default; - DebugStringConvertibleItem(const DebugStringConvertibleItem &item) = default; - - DebugStringConvertibleItem( - const std::string &name = "", - const std::string &value = "", - const SharedDebugStringConvertibleList &props = {}, - const SharedDebugStringConvertibleList &children = {}); - - std::string getDebugName() const override; - std::string getDebugValue() const override; - SharedDebugStringConvertibleList getDebugChildren() const override; - SharedDebugStringConvertibleList getDebugProps() const override; - - private: - std::string name_; - std::string value_; - SharedDebugStringConvertibleList props_; - SharedDebugStringConvertibleList children_; -}; - -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/SystraceSection.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/SystraceSection.h deleted file mode 100644 index e7339c09..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/SystraceSection.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#ifdef WITH_FBSYSTRACE -#include -#endif - -namespace facebook { -namespace react { - -/** - * This is a convenience class to avoid lots of verbose profiling - * #ifdefs. If WITH_FBSYSTRACE is not defined, the optimizer will - * remove this completely. If it is defined, it will behave as - * FbSystraceSection, with the right tag provided. Use two separate classes to - * to ensure that the ODR rule isn't violated, that is, if WITH_FBSYSTRACE has - * different values in different files, there is no inconsistency in the sizes - * of defined symbols. - */ -#ifdef WITH_FBSYSTRACE -struct ConcreteSystraceSection { - public: - template - explicit ConcreteSystraceSection( - const char *name, - ConvertsToStringPiece &&... args) - : m_section(TRACE_TAG_REACT_CXX_BRIDGE, name, args...) {} - - private: - fbsystrace::FbSystraceSection m_section; -}; -using SystraceSection = ConcreteSystraceSection; -#else -struct DummySystraceSection { - public: - template - explicit DummySystraceSection( - const char *name, - ConvertsToStringPiece &&... args) {} -}; -using SystraceSection = DummySystraceSection; -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/debugStringConvertibleUtils.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/debugStringConvertibleUtils.h deleted file mode 100644 index 51bf698b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/debugStringConvertibleUtils.h +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -#if RN_DEBUG_STRING_CONVERTIBLE - -inline std::string toString(const std::string &value) { - return value; -} -inline std::string toString(const int &value) { - return folly::to(value); -} -inline std::string toString(const bool &value) { - return folly::to(value); -} -inline std::string toString(const float &value) { - return folly::to(value); -} -inline std::string toString(const double &value) { - return folly::to(value); -} - -template -inline SharedDebugStringConvertible -debugStringConvertibleItem(std::string name, T value, T defaultValue = {}) { - if (value == defaultValue) { - return nullptr; - } - - return std::make_shared(name, toString(value)); -} - -template -inline SharedDebugStringConvertible debugStringConvertibleItem( - std::string name, - folly::Optional value, - T defaultValue = {}) { - if (!value.hasValue()) { - return nullptr; - } - - return debugStringConvertibleItem( - name, value.value_or(defaultValue), defaultValue); -} - -inline SharedDebugStringConvertibleList operator+( - const SharedDebugStringConvertibleList &lhs, - const SharedDebugStringConvertibleList &rhs) { - auto result = SharedDebugStringConvertibleList{}; - std::move(lhs.begin(), lhs.end(), std::back_inserter(result)); - std::move(rhs.begin(), rhs.end(), std::back_inserter(result)); - return result; -} - -inline SharedDebugStringConvertible debugStringConvertibleItem( - std::string name, - DebugStringConvertible value, - std::string defaultValue) { - return debugStringConvertibleItem( - name, value.getDebugDescription(), defaultValue); -} - -#endif - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/tests/DebugStringConvertibleTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/tests/DebugStringConvertibleTest.cpp deleted file mode 100644 index 99a1e43a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/debug/tests/DebugStringConvertibleTest.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include -#include - -using namespace facebook::react; - -TEST(DebugStringConvertibleTest, handleSimpleNode) { - SharedDebugStringConvertibleList empty; - auto item = std::make_shared( - "View", "hello", empty, empty); - - ASSERT_STREQ(item->getDebugName().c_str(), "View"); - ASSERT_STREQ(item->getDebugValue().c_str(), "hello"); - ASSERT_STREQ(item->getDebugDescription().c_str(), "\n"); -} - -TEST(DebugStringConvertibleTest, handleSimpleNodeWithProps) { - SharedDebugStringConvertibleList empty; - SharedDebugStringConvertibleList props = { - std::make_shared("x", "1", empty, empty)}; - auto item = std::make_shared( - "View", "hello", props, empty); - - ASSERT_STREQ(item->getDebugName().c_str(), "View"); - ASSERT_STREQ(item->getDebugValue().c_str(), "hello"); - ASSERT_STREQ(item->getDebugDescription().c_str(), "\n"); -} - -TEST(DebugStringConvertibleTest, handleSimpleNodeWithChildren) { - SharedDebugStringConvertibleList empty; - SharedDebugStringConvertibleList children = { - std::make_shared("Child", "a", empty, empty)}; - auto item = std::make_shared( - "View", "hello", empty, children); - - ASSERT_STREQ(item->getDebugName().c_str(), "View"); - ASSERT_STREQ(item->getDebugValue().c_str(), "hello"); - ASSERT_STREQ( - item->getDebugDescription().c_str(), - "\n \n\n"); -} - -TEST(DebugStringConvertibleTest, handleNestedNode) { - SharedDebugStringConvertibleList empty; - SharedDebugStringConvertibleList props = { - std::make_shared("x", "1", empty, empty)}; - SharedDebugStringConvertibleList children = { - std::make_shared("Child", "a", props, empty)}; - auto item = std::make_shared( - "View", "hello", props, children); - - ASSERT_STREQ(item->getDebugName().c_str(), "View"); - ASSERT_STREQ(item->getDebugValue().c_str(), "hello"); - ASSERT_STREQ( - item->getDebugDescription().c_str(), - "\n \n\n"); -} - -TEST(DebugStringConvertibleTest, handleNodeWithComplexProps) { - SharedDebugStringConvertibleList empty; - SharedDebugStringConvertibleList subProps = { - std::make_shared( - "height", "100", empty, empty), - std::make_shared( - "width", "200", empty, empty)}; - SharedDebugStringConvertibleList props = { - std::make_shared("x", "1", subProps, empty)}; - auto item = std::make_shared( - "View", "hello", props, empty); - - ASSERT_STREQ(item->getDebugName().c_str(), "View"); - ASSERT_STREQ(item->getDebugValue().c_str(), "hello"); - ASSERT_STREQ( - item->getDebugDescription().c_str(), - "\n"); -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/BUCK deleted file mode 100644 index df59cde2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/BUCK +++ /dev/null @@ -1,80 +0,0 @@ -load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load( - "//tools/build_defs/oss:rn_defs.bzl", - "ANDROID", - "APPLE", - "fb_xplat_cxx_test", - "get_apple_compiler_flags", - "get_apple_inspector_flags", - "react_native_xplat_target", - "rn_xplat_cxx_library", - "subdir_glob", -) - -APPLE_COMPILER_FLAGS = get_apple_compiler_flags() - -rn_xplat_cxx_library( - name = "events", - srcs = glob( - ["**/*.cpp"], - exclude = glob(["tests/**/*.cpp"]), - ), - headers = glob( - ["**/*.h"], - exclude = glob(["tests/**/*.h"]), - ), - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "*.h"), - ], - prefix = "react/events", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - force_static = True, - macosx_tests_override = [], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - # Systraces are temporary disabled. - # "-DWITH_FBSYSTRACE=1", - ], - tests = [":tests"], - visibility = ["PUBLIC"], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//jsi:JSIDynamic", - "xplat//jsi:jsi", - "xplat//third-party/glog:glog", - react_native_xplat_target("fabric/debug:debug"), - ], -) - -fb_xplat_cxx_test( - name = "tests", - srcs = glob(["tests/**/*.cpp"]), - headers = glob(["tests/**/*.h"]), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - contacts = ["oncall+react_native@xmail.facebook.com"], - platforms = (ANDROID, APPLE), - deps = [ - "xplat//folly:molly", - "xplat//third-party/gmock:gtest", - ":events", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/BatchedEventQueue.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/BatchedEventQueue.cpp deleted file mode 100644 index 415958e7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/BatchedEventQueue.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "BatchedEventQueue.h" - -namespace facebook { -namespace react { - -void BatchedEventQueue::enqueueEvent(const RawEvent &rawEvent) const { - EventQueue::enqueueEvent(rawEvent); - eventBeat_->request(); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/BatchedEventQueue.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/BatchedEventQueue.h deleted file mode 100644 index c73490a5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/BatchedEventQueue.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -namespace facebook { -namespace react { - -/* - * Event Queue that dispatches event in batches synchronizing them with - * an Event Beat. - */ -class BatchedEventQueue final : public EventQueue { - public: - using EventQueue::EventQueue; - - void enqueueEvent(const RawEvent &rawEvent) const override; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventBeat.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventBeat.cpp deleted file mode 100644 index 2ce95b4d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventBeat.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "EventBeat.h" - -namespace facebook { -namespace react { - -void EventBeat::request() const { - isRequested_ = true; -} - -void EventBeat::beat(jsi::Runtime &runtime) const { - if (!this->isRequested_) { - return; - } - - isRequested_ = false; - - if (beatCallback_) { - beatCallback_(runtime); - } -} - -void EventBeat::induce() const { - // Default implementation does nothing. -} - -void EventBeat::setBeatCallback(const BeatCallback &beatCallback) { - beatCallback_ = beatCallback; -} - -void EventBeat::setFailCallback(const FailCallback &failCallback) { - failCallback_ = failCallback; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventBeat.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventBeat.h deleted file mode 100644 index 448da6de..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventBeat.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * Event Beat serves two interleaving purposes: synchronization of event queues - * and ensuring that event dispatching happens on propper threads. - */ -class EventBeat { - public: - virtual ~EventBeat() = default; - - using BeatCallback = std::function; - using FailCallback = std::function; - - /* - * Communicates to the Beat that a consumer is waiting for the coming beat. - * A consumer must request coming beat after the previous beat happened - * to receive a next coming one. - */ - virtual void request() const; - - /* - * Induces the next beat to happen as soon as possible. If the method - * is called on the proper thread, the beat must happen synchronously. - * Subclasses might override this method to implement specific - * out-of-turn beat scheduling. - * Some types of Event Beats do not support inducing, hence the default - * implementation does nothing. - * Receiver might ignore the call if a beat was not requested. - */ - virtual void induce() const; - - /* - * Sets the beat callback function. - * The callback is must be called on the proper thread. - */ - void setBeatCallback(const BeatCallback &beatCallback); - - /* - * Sets the fail callback function. - * Called in case if the beat cannot be performed anymore because of - * some external circumstances (e.g. execution thread is beling destructed). - * The callback can be called on any thread. - */ - void setFailCallback(const FailCallback &failCallback); - - /* - * Should be used by sublasses to send a beat. - * Receiver might ignore the call if a beat was not requested. - */ - void beat(jsi::Runtime &runtime) const; - - protected: - BeatCallback beatCallback_; - FailCallback failCallback_; - mutable std::atomic isRequested_{false}; -}; - -using EventBeatFactory = std::function()>; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventBeatBasedExecutor.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventBeatBasedExecutor.cpp deleted file mode 100644 index 2f09d0bb..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventBeatBasedExecutor.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include "EventBeatBasedExecutor.h" - -#include - -namespace facebook { -namespace react { - -using Mode = EventBeatBasedExecutor::Mode; - -EventBeatBasedExecutor::EventBeatBasedExecutor( - std::unique_ptr eventBeat) - : eventBeat_(std::move(eventBeat)) { - eventBeat_->setBeatCallback( - std::bind(&EventBeatBasedExecutor::onBeat, this, true)); - eventBeat_->setFailCallback( - std::bind(&EventBeatBasedExecutor::onBeat, this, false)); -} - -void EventBeatBasedExecutor::operator()(Routine routine, Mode mode) const { - if (mode == Mode::Asynchronous) { - execute({.routine = std::move(routine)}); - return; - } - - std::mutex mutex; - mutex.lock(); - - execute({.routine = std::move(routine), - .callback = [&mutex]() { mutex.unlock(); }}); - - mutex.lock(); -} - -void EventBeatBasedExecutor::execute(Task task) const { - { - std::lock_guard lock(mutex_); - - tasks_.push_back(std::move(task)); - } - - eventBeat_->request(); - eventBeat_->induce(); -} - -void EventBeatBasedExecutor::onBeat(bool success) const { - std::vector tasks; - - { - std::lock_guard lock(mutex_); - - if (tasks_.size() == 0) { - return; - } - - tasks = std::move(tasks_); - tasks_.clear(); - } - - for (const auto task : tasks) { - if (success) { - task.routine(); - } - - if (task.callback) { - task.callback(); - } - } -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventBeatBasedExecutor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventBeatBasedExecutor.h deleted file mode 100644 index 7ef5a2d7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventBeatBasedExecutor.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include - -#include - -namespace facebook { -namespace react { - -/* - * General purpose executor that uses EventBeat to ensure proper threading. - */ -class EventBeatBasedExecutor { - public: - using Routine = std::function; - using Callback = std::function; - - struct Task { - Routine routine; - Callback callback; - }; - - enum class Mode { Synchronous, Asynchronous }; - - EventBeatBasedExecutor(std::unique_ptr eventBeat); - - /* - * Executes given routine with given mode. - */ - void operator()(Routine routine, Mode mode = Mode::Asynchronous) const; - - private: - void onBeat(bool success = true) const; - void execute(Task task) const; - - std::unique_ptr eventBeat_; - mutable std::vector tasks_; // Protected by `mutex_`. - mutable std::mutex mutex_; -}; - -using EventBeatFactory = std::function()>; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventDispatcher.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventDispatcher.cpp deleted file mode 100644 index 737b8a7a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventDispatcher.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "EventDispatcher.h" - -#include "BatchedEventQueue.h" -#include "UnbatchedEventQueue.h" - -#define REACT_FABRIC_SYNC_EVENT_DISPATCHING_DISABLED - -namespace facebook { -namespace react { - -EventDispatcher::EventDispatcher( - const EventPipe &eventPipe, - const EventBeatFactory &synchonousEventBeatFactory, - const EventBeatFactory &asynchonousEventBeatFactory) { - // Synchronous/Unbatched - eventQueues_[(int)EventPriority::SynchronousUnbatched] = - std::make_unique( - eventPipe, synchonousEventBeatFactory()); - - // Synchronous/Batched - eventQueues_[(int)EventPriority::SynchronousBatched] = - std::make_unique( - eventPipe, synchonousEventBeatFactory()); - - // Asynchronous/Unbatched - eventQueues_[(int)EventPriority::AsynchronousUnbatched] = - std::make_unique( - eventPipe, asynchonousEventBeatFactory()); - - // Asynchronous/Batched - eventQueues_[(int)EventPriority::AsynchronousBatched] = - std::make_unique( - eventPipe, asynchonousEventBeatFactory()); -} - -void EventDispatcher::dispatchEvent( - const RawEvent &rawEvent, - EventPriority priority) const { -#ifdef REACT_FABRIC_SYNC_EVENT_DISPATCHING_DISABLED - // Synchronous dispatch works, but JavaScript interop layer does not have - // proper synchonization yet and it crashes. - if (priority == EventPriority::SynchronousUnbatched) { - priority = EventPriority::AsynchronousUnbatched; - } - - if (priority == EventPriority::SynchronousBatched) { - priority = EventPriority::AsynchronousBatched; - } -#endif - - eventQueues_[(int)priority]->enqueueEvent(rawEvent); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventDispatcher.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventDispatcher.h deleted file mode 100644 index 897376b1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventDispatcher.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -#pragma once - -#include - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class EventDispatcher; -using SharedEventDispatcher = std::shared_ptr; -using WeakEventDispatcher = std::weak_ptr; - -/* - * Represents event-delivery infrastructure. - * Particular `EventEmitter` clases use this for sending events. - */ -class EventDispatcher { - public: - EventDispatcher( - const EventPipe &eventPipe, - const EventBeatFactory &synchonousEventBeatFactory, - const EventBeatFactory &asynchonousEventBeatFactory); - - /* - * Dispatches a raw event with given priority using event-delivery pipe. - */ - void dispatchEvent(const RawEvent &rawEvent, EventPriority priority) const; - - private: - std::array, 4> eventQueues_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventEmitter.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventEmitter.cpp deleted file mode 100644 index e5a8eeec..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventEmitter.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "EventEmitter.h" - -#include -#include -#include -#include - -#include "RawEvent.h" - -namespace facebook { -namespace react { - -// TODO(T29874519): Get rid of "top" prefix once and for all. -/* - * Capitalizes the first letter of the event type and adds "top" prefix if - * necessary (e.g. "layout" becames "topLayout"). - */ -static std::string normalizeEventType(const std::string &type) { - auto prefixedType = type; - if (type.find("top", 0) != 0) { - prefixedType.insert(0, "top"); - prefixedType[3] = toupper(prefixedType[3]); - } - return prefixedType; -} - -std::mutex &EventEmitter::DispatchMutex() { - static std::mutex mutex; - return mutex; -} - -ValueFactory EventEmitter::defaultPayloadFactory() { - static auto payloadFactory = - ValueFactory{[](jsi::Runtime &runtime) { return jsi::Object(runtime); }}; - return payloadFactory; -} - -EventEmitter::EventEmitter( - SharedEventTarget eventTarget, - Tag tag, - WeakEventDispatcher eventDispatcher) - : eventTarget_(std::move(eventTarget)), - eventDispatcher_(std::move(eventDispatcher)) {} - -void EventEmitter::dispatchEvent( - const std::string &type, - const folly::dynamic &payload, - const EventPriority &priority) const { - dispatchEvent( - type, - [payload](jsi::Runtime &runtime) { - return valueFromDynamic(runtime, payload); - }, - priority); -} - -void EventEmitter::dispatchEvent( - const std::string &type, - const ValueFactory &payloadFactory, - const EventPriority &priority) const { - SystraceSection s("EventEmitter::dispatchEvent"); - - auto eventDispatcher = eventDispatcher_.lock(); - if (!eventDispatcher) { - return; - } - - eventDispatcher->dispatchEvent( - RawEvent(normalizeEventType(type), payloadFactory, eventTarget_), - priority); -} - -void EventEmitter::setEnabled(bool enabled) const { - enableCounter_ += enabled ? 1 : -1; - - bool shouldBeEnabled = enableCounter_ > 0; - if (isEnabled_ != shouldBeEnabled) { - isEnabled_ = shouldBeEnabled; - if (eventTarget_) { - eventTarget_->setEnabled(isEnabled_); - } - } - - // Note: Initially, the state of `eventTarget_` and the value `enableCounter_` - // is mismatched intentionally (it's `non-null` and `0` accordingly). We need - // this to support an initial nebula state where the event target must be - // retained without any associated mounted node. - bool shouldBeRetained = enableCounter_ > 0; - if (shouldBeRetained != (eventTarget_ != nullptr)) { - if (!shouldBeRetained) { - eventTarget_.reset(); - } - } -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventEmitter.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventEmitter.h deleted file mode 100644 index 3e06c81e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventEmitter.h +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -#pragma once - -#include -#include - -#include -#include -#include - -namespace facebook { -namespace react { - -class EventEmitter; - -using SharedEventEmitter = std::shared_ptr; - -/* - * Base class for all particular typed event handlers. - * Stores a pointer to `EventTarget` identifying a particular component and - * a weak pointer to `EventDispatcher` which is responsible for delivering the - * event. - */ -class EventEmitter { - /* - * We have to repeat `Tag` type definition here because `events` module does - * not depend on `core` module (and should not). - */ - using Tag = int32_t; - - public: - static std::mutex &DispatchMutex(); - - static ValueFactory defaultPayloadFactory(); - - EventEmitter( - SharedEventTarget eventTarget, - Tag tag, - WeakEventDispatcher eventDispatcher); - - virtual ~EventEmitter() = default; - - /* - * Enables/disables event emitter. - * Enabled event emitter retains a pointer to `eventTarget` strongly (as - * `std::shared_ptr`) whereas disabled one don't. - * Enabled/disabled state is also proxied to `eventTarget` where it indicates - * a possibility to extract JSI value from it. - * The enable state is additive; a number of `enable` calls should be equal to - * a number of `disable` calls to release the event target. - * `DispatchMutex` must be acquired before calling. - */ - void setEnabled(bool enabled) const; - - protected: -#ifdef ANDROID - // We need this temporarily due to lack of Java-counterparts for particular - // subclasses. - public: -#endif - - /* - * Initates an event delivery process. - * Is used by particular subclasses only. - */ - void dispatchEvent( - const std::string &type, - const ValueFactory &payloadFactory = - EventEmitter::defaultPayloadFactory(), - const EventPriority &priority = EventPriority::AsynchronousBatched) const; - - void dispatchEvent( - const std::string &type, - const folly::dynamic &payload, - const EventPriority &priority = EventPriority::AsynchronousBatched) const; - - private: - void toggleEventTargetOwnership_() const; - - mutable SharedEventTarget eventTarget_; - WeakEventDispatcher eventDispatcher_; - mutable int enableCounter_{0}; - mutable bool isEnabled_{false}; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventQueue.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventQueue.cpp deleted file mode 100644 index 3eb77554..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventQueue.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "EventQueue.h" - -#include "EventEmitter.h" - -namespace facebook { -namespace react { - -EventQueue::EventQueue( - EventPipe eventPipe, - std::unique_ptr eventBeat) - : eventPipe_(std::move(eventPipe)), eventBeat_(std::move(eventBeat)) { - eventBeat_->setBeatCallback( - std::bind(&EventQueue::onBeat, this, std::placeholders::_1)); -} - -void EventQueue::enqueueEvent(const RawEvent &rawEvent) const { - std::lock_guard lock(queueMutex_); - queue_.push_back(rawEvent); -} - -void EventQueue::onBeat(jsi::Runtime &runtime) const { - std::vector queue; - - { - std::lock_guard lock(queueMutex_); - - if (queue_.size() == 0) { - return; - } - - queue = std::move(queue_); - queue_.clear(); - } - - { - std::lock_guard lock(EventEmitter::DispatchMutex()); - - for (const auto &event : queue) { - if (event.eventTarget) { - event.eventTarget->retain(runtime); - } - } - } - - for (const auto &event : queue) { - eventPipe_( - runtime, event.eventTarget.get(), event.type, event.payloadFactory); - } - - // No need to lock `EventEmitter::DispatchMutex()` here. - // The mutex protects from a situation when the `instanceHandle` can be - // deallocated during accessing, but that's impossible at this point because - // we have a strong pointer to it. - for (const auto &event : queue) { - if (event.eventTarget) { - event.eventTarget->release(runtime); - } - } -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventQueue.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventQueue.h deleted file mode 100644 index 1a322bed..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventQueue.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * Event Queue synchronized with given Event Beat and dispatching event - * using given Event Pipe. - */ -class EventQueue { - public: - EventQueue(EventPipe eventPipe, std::unique_ptr eventBeat); - virtual ~EventQueue() = default; - - /* - * Enqueues and (probably later) dispatch a given event. - * Can be called on any thread. - */ - virtual void enqueueEvent(const RawEvent &rawEvent) const; - - protected: - void onBeat(jsi::Runtime &runtime) const; - - const EventPipe eventPipe_; - const std::unique_ptr eventBeat_; - // Thread-safe, protected by `queueMutex_`. - mutable std::vector queue_; - mutable std::mutex queueMutex_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventTarget.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventTarget.cpp deleted file mode 100644 index 112ca568..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventTarget.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "EventTarget.h" - -namespace facebook { -namespace react { - -using Tag = EventTarget::Tag; - -EventTarget::EventTarget( - jsi::Runtime &runtime, - const jsi::Value &instanceHandle, - Tag tag) - : weakInstanceHandle_( - jsi::WeakObject(runtime, instanceHandle.asObject(runtime))), - strongInstanceHandle_(jsi::Value::null()), - tag_(tag) {} - -void EventTarget::setEnabled(bool enabled) const { - enabled_ = enabled; -} - -void EventTarget::retain(jsi::Runtime &runtime) const { - if (!enabled_) { - return; - } - - strongInstanceHandle_ = weakInstanceHandle_.lock(runtime); - - // Having a `null` or `undefined` object here indicates that - // `weakInstanceHandle_` was already deallocated. This should *not* happen by - // design, and if it happens it's a severe problem. This basically means that - // particular implementation of JSI was able to detect this inconsistency and - // dealt with it, but some JSI implementation may not support this feature and - // that case will lead to a crash in those environments. - assert(!strongInstanceHandle_.isNull()); - assert(!strongInstanceHandle_.isUndefined()); -} - -void EventTarget::release(jsi::Runtime &runtime) const { - // The method does not use `jsi::Runtime` reference. - // It takes it only to ensure thread-safety (if the caller has the reference, - // we are on a proper thread). - strongInstanceHandle_ = jsi::Value::null(); -} - -jsi::Value EventTarget::getInstanceHandle(jsi::Runtime &runtime) const { - if (strongInstanceHandle_.isNull()) { - // The `instanceHandle` is not retained. - return jsi::Value::null(); - } - - return jsi::Value(runtime, strongInstanceHandle_); -} - -Tag EventTarget::getTag() const { - return tag_; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventTarget.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventTarget.h deleted file mode 100644 index 7567d994..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/EventTarget.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -#pragma once - -#include - -#include - -namespace facebook { -namespace react { - -/* - * `EventTarget` represents storage of a weak instance handle object with some - * information about the possibility of retaining that strongly on demand. - * Note: Retaining an `EventTarget` does *not* guarantee that actual event - * target (a JavaScript object) is retaining and/or valid in JavaScript realm. - * The `EventTarget` retains an `instanceHandle` value in `unsafe-unretained` - * manner. - * All `EventTarget` instances must be deallocated before - * stopping JavaScript machine. - */ -class EventTarget { - public: - /* - * We have to repeat `Tag` type definition here because `events` module does - * not depend on `core` module (and should not). - */ - using Tag = int32_t; - - /* - * Constructs an EventTarget from a weak instance handler and a tag. - */ - EventTarget(jsi::Runtime &runtime, const jsi::Value &instanceHandle, Tag tag); - - /* - * Sets the `enabled` flag that allows creating a strong instance handle from - * a weak one. - */ - void setEnabled(bool enabled) const; - - /* - * Retains an instance handler by creating a strong reference to it. - * If the EventTarget is disabled, does nothing. - */ - void retain(jsi::Runtime &runtime) const; - - /* - * Releases the instance handler by nulling a strong reference to it. - */ - void release(jsi::Runtime &runtime) const; - - /* - * Creates and returns the `instanceHandle`. - * Returns `null` if the `instanceHandle` is not retained at this moment. - */ - jsi::Value getInstanceHandle(jsi::Runtime &runtime) const; - - /* - * Deprecated. Do not use. - */ - Tag getTag() const; - - private: - mutable bool enabled_{false}; // Protected by `EventEmitter::DispatchMutex()`. - mutable jsi::WeakObject weakInstanceHandle_; // Protected by `jsi::Runtime &`. - mutable jsi::Value strongInstanceHandle_; // Protected by `jsi::Runtime &`. - Tag tag_; -}; - -using SharedEventTarget = std::shared_ptr; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/RawEvent.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/RawEvent.cpp deleted file mode 100644 index 990e8380..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/RawEvent.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "RawEvent.h" - -namespace facebook { -namespace react { - -RawEvent::RawEvent( - std::string type, - ValueFactory payloadFactory, - SharedEventTarget eventTarget) - : type(std::move(type)), - payloadFactory(std::move(payloadFactory)), - eventTarget(std::move(eventTarget)) {} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/RawEvent.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/RawEvent.h deleted file mode 100644 index bcf4fc5f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/RawEvent.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -#pragma once - -#include - -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * Represents ready-to-dispatch event object. - */ -class RawEvent { - public: - RawEvent( - std::string type, - ValueFactory payloadFactory, - SharedEventTarget eventTarget); - - const std::string type; - const ValueFactory payloadFactory; - const SharedEventTarget eventTarget; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/UnbatchedEventQueue.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/UnbatchedEventQueue.cpp deleted file mode 100644 index 9c3b2067..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/UnbatchedEventQueue.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "UnbatchedEventQueue.h" - -namespace facebook { -namespace react { - -void UnbatchedEventQueue::enqueueEvent(const RawEvent &rawEvent) const { - EventQueue::enqueueEvent(rawEvent); - - eventBeat_->request(); - eventBeat_->induce(); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/UnbatchedEventQueue.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/UnbatchedEventQueue.h deleted file mode 100644 index 46f2392e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/UnbatchedEventQueue.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -namespace facebook { -namespace react { - -/* - * Event Queue that dispatches events as granular as possible without waiting - * for the next beat. - */ -class UnbatchedEventQueue final : public EventQueue { - public: - using EventQueue::EventQueue; - - void enqueueEvent(const RawEvent &rawEvent) const override; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/primitives.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/primitives.h deleted file mode 100644 index 3f6edc0b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/primitives.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -#include - -namespace facebook { -namespace react { - -enum class EventPriority : int { - SynchronousUnbatched, - SynchronousBatched, - AsynchronousUnbatched, - AsynchronousBatched, - - Sync = SynchronousUnbatched, - Work = SynchronousBatched, - Interactive = AsynchronousUnbatched, - Deferred = AsynchronousBatched -}; - -/* - * We need this types only to ensure type-safety when we deal with them. - * Conceptually, they are opaque pointers to some types that derived from those - * classes. - * - * `EventHandler` is managed as a `unique_ptr`, so it must have a *virtual* - * destructor to allow proper deallocation having only a pointer - * to the base (`EventHandler`) class. - */ -struct EventHandler { - virtual ~EventHandler() = default; -}; -using UniqueEventHandler = std::unique_ptr; - -using ValueFactory = std::function; - -using EventPipe = std::function; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/tests/EventsTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/tests/EventsTest.cpp deleted file mode 100644 index c6fe25b8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/events/tests/EventsTest.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include - -TEST(EventsTest, testSomething) { - // TODO -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/BUCK deleted file mode 100644 index 07b53c96..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/BUCK +++ /dev/null @@ -1,110 +0,0 @@ -load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load( - "//tools/build_defs/oss:rn_defs.bzl", - "ANDROID", - "APPLE", - "fb_xplat_cxx_test", - "get_apple_compiler_flags", - "get_apple_inspector_flags", - "rn_xplat_cxx_library", - "subdir_glob", -) - -APPLE_COMPILER_FLAGS = get_apple_compiler_flags() - -rn_xplat_cxx_library( - name = "graphics", - srcs = glob( - [ - "*.cpp", - ], - ), - headers = subdir_glob( - [ - ("", "*.h"), - ], - prefix = "", - ), - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "*.h"), - ], - prefix = "react/graphics", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbandroid_exported_headers = subdir_glob( - [ - ("platform/android", "**/*.h"), - ], - prefix = "react/graphics", - ), - fbandroid_srcs = glob( - [ - "platform/android/**/*.cpp", - ], - ), - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - force_static = True, - ios_deps = [ - "xplat//js:RCTImage", - "xplat//js/react-native-github:RCTCxxBridge", - ], - ios_exported_headers = subdir_glob( - [ - ("platform/ios", "*.h"), - ], - prefix = "react/graphics", - ), - ios_frameworks = [ - "$SDKROOT/System/Library/Frameworks/CoreGraphics.framework", - "$SDKROOT/System/Library/Frameworks/Foundation.framework", - "$SDKROOT/System/Library/Frameworks/UIKit.framework", - ], - ios_srcs = glob( - [ - "platform/ios/**/*.cpp", - "platform/ios/**/*.mm", - ], - ), - macosx_tests_override = [], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - tests = [":tests"], - visibility = ["PUBLIC"], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//third-party/glog:glog", - ], -) - -fb_xplat_cxx_test( - name = "tests", - srcs = glob(["tests/**/*.cpp"]), - headers = glob(["tests/**/*.h"]), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - contacts = ["oncall+react_native@xmail.facebook.com"], - platforms = (ANDROID, APPLE), - deps = [ - "xplat//folly:molly", - "xplat//third-party/gmock:gtest", - ":graphics", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/ColorComponents.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/ColorComponents.h deleted file mode 100644 index 3f312386..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/ColorComponents.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -namespace facebook { -namespace react { - -struct ColorComponents { - float red{0}; - float green{0}; - float blue{0}; - float alpha{0}; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/Geometry.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/Geometry.h deleted file mode 100644 index 0cc3fe4a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/Geometry.h +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include - -#include -#include - -namespace facebook { -namespace react { - -/* - * Point - */ -struct Point { - Float x{0}; - Float y{0}; - - Point &operator+=(const Point &point) { - x += point.x; - y += point.y; - return *this; - } - - Point &operator*=(const Point &point) { - x *= point.x; - y *= point.y; - return *this; - } - - friend Point operator+(Point lhs, const Point &rhs) { - return lhs += rhs; - } - - bool operator==(const Point &rhs) const { - return std::tie(this->x, this->y) == std::tie(rhs.x, rhs.y); - } - - bool operator!=(const Point &rhs) const { - return !(*this == rhs); - } -}; - -/* - * Size - */ -struct Size { - Float width{0}; - Float height{0}; - - Size &operator+=(const Point &point) { - width += point.x; - height += point.y; - return *this; - } - - Size &operator*=(const Point &point) { - width *= point.x; - height *= point.y; - return *this; - } - - bool operator==(const Size &rhs) const { - return std::tie(this->width, this->height) == - std::tie(rhs.width, rhs.height); - } - - bool operator!=(const Size &rhs) const { - return !(*this == rhs); - } -}; - -/* - * Rect: Point and Size - */ -struct Rect { - Point origin{0, 0}; - Size size{0, 0}; - - bool operator==(const Rect &rhs) const { - return std::tie(this->origin, this->size) == std::tie(rhs.origin, rhs.size); - } - - bool operator!=(const Rect &rhs) const { - return !(*this == rhs); - } - - Float getMaxX() const { - return size.width > 0 ? origin.x + size.width : origin.x; - } - Float getMaxY() const { - return size.height > 0 ? origin.y + size.height : origin.y; - } - Float getMinX() const { - return size.width >= 0 ? origin.x : origin.x + size.width; - } - Float getMinY() const { - return size.height >= 0 ? origin.y : origin.y + size.height; - } - - void unionInPlace(const Rect &rect) { - auto x1 = std::min(getMinX(), rect.getMinX()); - auto y1 = std::min(getMinY(), rect.getMinY()); - auto x2 = std::max(getMaxX(), rect.getMaxX()); - auto y2 = std::max(getMaxY(), rect.getMaxY()); - origin = {x1, y1}; - size = {x2 - x1, y2 - y1}; - } -}; - -/* - * Generic data structure describes some values associated with *edges* - * of a rectangle. - */ -template -struct RectangleEdges { - T left{}; - T top{}; - T right{}; - T bottom{}; - - bool operator==(const RectangleEdges &rhs) const { - return std::tie(this->left, this->top, this->right, this->bottom) == - std::tie(rhs.left, rhs.top, rhs.right, rhs.bottom); - } - - bool operator!=(const RectangleEdges &rhs) const { - return !(*this == rhs); - } - - bool isUniform() const { - return left == top && left == right && left == bottom; - } -}; - -/* - * Generic data structure describes some values associated with *corners* - * of a rectangle. - */ -template -struct RectangleCorners { - T topLeft{}; - T topRight{}; - T bottomLeft{}; - T bottomRight{}; - - bool operator==(const RectangleCorners &rhs) const { - return std::tie( - this->topLeft, - this->topRight, - this->bottomLeft, - this->bottomRight) == - std::tie(rhs.topLeft, rhs.topRight, rhs.bottomLeft, rhs.bottomRight); - } - - bool operator!=(const RectangleCorners &rhs) const { - return !(*this == rhs); - } - - bool isUniform() const { - return topLeft == topRight && topLeft == bottomLeft && - topLeft == bottomRight; - } -}; - -/* - * EdgeInsets - */ -using EdgeInsets = RectangleEdges; - -/* - * CornerInsets - */ -using CornerInsets = RectangleCorners; - -} // namespace react -} // namespace facebook - -namespace std { -template <> -struct hash { - size_t operator()(const facebook::react::Point &point) const { - auto seed = size_t{0}; - folly::hash::hash_combine(seed, point.x, point.y); - return seed; - } -}; - -template <> -struct hash { - size_t operator()(const facebook::react::Size &size) const { - auto seed = size_t{0}; - folly::hash::hash_combine(seed, size.width, size.height); - return seed; - } -}; - -template <> -struct hash { - size_t operator()(const facebook::react::Rect &rect) const { - auto seed = size_t{0}; - folly::hash::hash_combine(seed, rect.origin, rect.size); - return seed; - } -}; - -template -struct hash> { - size_t operator()(const facebook::react::RectangleEdges &edges) const { - auto seed = size_t{0}; - folly::hash::hash_combine( - seed, edges.left, edges.right, edges.top, edges.bottom); - return seed; - } -}; - -template -struct hash> { - size_t operator()(const facebook::react::RectangleCorners &corners) const { - auto seed = size_t{0}; - folly::hash::hash_combine( - seed, - corners.topLeft, - corners.bottomLeft, - corners.topRight, - corners.bottomRight); - return seed; - } -}; - -} // namespace std diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/conversions.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/conversions.h deleted file mode 100644 index 4cd7e456..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/conversions.h +++ /dev/null @@ -1,182 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -#pragma mark - Color - -inline void fromRawValue(const RawValue &value, SharedColor &result) { - float red; - float green; - float blue; - float alpha; - - if (value.hasType()) { - auto argb = (int64_t)value; - auto ratio = 256.f; - alpha = ((argb >> 24) & 0xFF) / ratio; - red = ((argb >> 16) & 0xFF) / ratio; - green = ((argb >> 8) & 0xFF) / ratio; - blue = (argb & 0xFF) / ratio; - } else if (value.hasType>()) { - auto items = (std::vector)value; - auto length = items.size(); - assert(length == 3 || length == 4); - red = items.at(0); - green = items.at(1); - blue = items.at(2); - alpha = length == 4 ? items.at(3) : 1.0; - } else { - abort(); - } - result = colorFromComponents({red, green, blue, alpha}); -} - -#ifdef ANDROID - -inline folly::dynamic toDynamic(const SharedColor &color) { - ColorComponents components = colorComponentsFromColor(color); - auto ratio = 256.f; - return ( - ((int)(components.alpha * ratio) & 0xff) << 24 | - ((int)(components.red * ratio) & 0xff) << 16 | - ((int)(components.green * ratio) & 0xff) << 8 | - ((int)(components.blue * ratio) & 0xff)); -} - -#endif - -inline std::string toString(const SharedColor &value) { - ColorComponents components = colorComponentsFromColor(value); - auto ratio = 256.f; - return "rgba(" + folly::to(round(components.red * ratio)) + - ", " + folly::to(round(components.green * ratio)) + ", " + - folly::to(round(components.blue * ratio)) + ", " + - folly::to(round(components.alpha * ratio)) + ")"; -} - -#pragma mark - Geometry - -inline void fromRawValue(const RawValue &value, Point &result) { - if (value.hasType>()) { - auto map = (std::unordered_map)value; - result = {map.at("x"), map.at("y")}; - return; - } - - if (value.hasType>()) { - auto array = (std::vector)value; - assert(array.size() == 2); - result = {array.at(0), array.at(1)}; - return; - } - - abort(); -} - -inline void fromRawValue(const RawValue &value, Size &result) { - if (value.hasType>()) { - auto map = (std::unordered_map)value; - result = {map.at("width"), map.at("height")}; - return; - } - - if (value.hasType>()) { - auto array = (std::vector)value; - assert(array.size() == 2); - result = {array.at(0), array.at(1)}; - return; - } - - abort(); -} - -inline void fromRawValue(const RawValue &value, EdgeInsets &result) { - if (value.hasType()) { - auto number = (Float)value; - result = {number, number, number, number}; - } - - if (value.hasType>()) { - auto map = (std::unordered_map)value; - result = {map.at("top"), map.at("left"), map.at("bottom"), map.at("right")}; - return; - } - - if (value.hasType>()) { - auto array = (std::vector)value; - assert(array.size() == 4); - result = {array.at(0), array.at(1), array.at(2), array.at(3)}; - return; - } - - abort(); -} - -inline void fromRawValue(const RawValue &value, CornerInsets &result) { - if (value.hasType()) { - auto number = (Float)value; - result = {number, number, number, number}; - } - - if (value.hasType>()) { - auto map = (std::unordered_map)value; - result = {map.at("topLeft"), - map.at("topRight"), - map.at("bottomLeft"), - map.at("bottomRight")}; - return; - } - - if (value.hasType>()) { - auto array = (std::vector)value; - assert(array.size() == 4); - result = {array.at(0), array.at(1), array.at(2), array.at(3)}; - return; - } - - abort(); -} - -inline std::string toString(const Point &point) { - return "{" + folly::to(point.x) + ", " + - folly::to(point.y) + "}"; -} - -inline std::string toString(const Size &size) { - return "{" + folly::to(size.width) + ", " + - folly::to(size.height) + "}"; -} - -inline std::string toString(const Rect &rect) { - return "{" + toString(rect.origin) + ", " + toString(rect.size) + "}"; -} - -inline std::string toString(const EdgeInsets &edgeInsets) { - return "{" + folly::to(edgeInsets.left) + ", " + - folly::to(edgeInsets.top) + ", " + - folly::to(edgeInsets.right) + ", " + - folly::to(edgeInsets.bottom) + "}"; -} - -inline std::string toString(const CornerInsets &cornerInsets) { - return "{" + folly::to(cornerInsets.topLeft) + ", " + - folly::to(cornerInsets.topRight) + ", " + - folly::to(cornerInsets.bottomLeft) + ", " + - folly::to(cornerInsets.bottomRight) + "}"; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/platform/android/Color.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/platform/android/Color.cpp deleted file mode 100644 index 35fc3e2a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/platform/android/Color.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "Color.h" - -namespace facebook { -namespace react { - -SharedColor colorFromComponents(ColorComponents components) { - float ratio = 255.9999; - return SharedColor( - ((int)(components.alpha * ratio) & 0xff) << 24 | - ((int)(components.red * ratio) & 0xff) << 16 | - ((int)(components.green * ratio) & 0xff) << 8 | - ((int)(components.blue * ratio) & 0xff)); -} - -ColorComponents colorComponentsFromColor(SharedColor sharedColor) { - float ratio = 256; - Color color = *sharedColor; - return ColorComponents{(float)((color >> 16) & 0xff) / ratio, - (float)((color >> 8) & 0xff) / ratio, - (float)((color >> 0) & 0xff) / ratio, - (float)((color >> 24) & 0xff) / ratio}; -} - -SharedColor clearColor() { - static SharedColor color = colorFromComponents(ColorComponents{0, 0, 0, 0}); - return color; -} - -SharedColor blackColor() { - static SharedColor color = colorFromComponents(ColorComponents{0, 0, 0, 1}); - return color; -} - -SharedColor whiteColor() { - static SharedColor color = colorFromComponents(ColorComponents{1, 1, 1, 1}); - return color; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/platform/android/Color.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/platform/android/Color.h deleted file mode 100644 index 15392456..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/platform/android/Color.h +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -#include - -namespace facebook { -namespace react { - -using Color = int; - -/* - * On Android, a color can be represented as 32 bits integer, so there is no - * need to instantiate complex color objects and then pass them as shared - * pointers. Hense instead of using shared_ptr, we use a simple wrapper class - * which provides a pointer-like interface. - */ -class SharedColor { - public: - static const Color UndefinedColor = std::numeric_limits::max(); - - SharedColor() : color_(UndefinedColor) {} - - SharedColor(const SharedColor &sharedColor) : color_(sharedColor.color_) {} - - SharedColor(Color color) : color_(color) {} - - SharedColor &operator=(const SharedColor &sharedColor) { - color_ = sharedColor.color_; - return *this; - } - - Color operator*() const { - return color_; - } - - operator bool() const { - return color_ != UndefinedColor; - } - - private: - Color color_; -}; - -SharedColor colorFromComponents(ColorComponents components); -ColorComponents colorComponentsFromColor(SharedColor color); - -SharedColor clearColor(); -SharedColor blackColor(); -SharedColor whiteColor(); - -} // namespace react -} // namespace facebook - -namespace std { -template <> -struct hash { - size_t operator()(const facebook::react::SharedColor &sharedColor) const { - return hash{}(*sharedColor); - } -}; -} // namespace std diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/platform/android/Float.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/platform/android/Float.h deleted file mode 100644 index 3a6460b6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/platform/android/Float.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include - -namespace facebook { -namespace react { - -/* - * Exact type of float numbers which ideally should match a type behing - * platform- and chip-architecture-specific float type. - */ -using Float = float; - -/* - * Large positive number signifies that the `Float` values is `undefined`. - */ -const Float kFloatUndefined = std::numeric_limits::max(); - -const Float kFloatMax = std::numeric_limits::max(); -const Float kFloatMin = std::numeric_limits::min(); - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/platform/ios/Color.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/platform/ios/Color.cpp deleted file mode 100644 index 552cf5ce..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/platform/ios/Color.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "Color.h" - -namespace facebook { -namespace react { - -SharedColor colorFromComponents(ColorComponents components) { - const CGFloat componentsArray[] = { - components.red, components.green, components.blue, components.alpha}; - - auto color = CGColorCreate(CGColorSpaceCreateDeviceRGB(), componentsArray); - - return SharedColor(color, CFRelease); -} - -ColorComponents colorComponentsFromColor(SharedColor color) { - if (!color) { - // Empty color object can be considered as `clear` (black, fully - // transparent) color. - return ColorComponents{0, 0, 0, 0}; - } - - auto numberOfComponents = CGColorGetNumberOfComponents(color.get()); - assert(numberOfComponents == 4); - const CGFloat *components = CGColorGetComponents(color.get()); - return ColorComponents{(float)components[0], - (float)components[1], - (float)components[2], - (float)components[3]}; -} - -SharedColor clearColor() { - static SharedColor color = colorFromComponents(ColorComponents{0, 0, 0, 0}); - return color; -} - -SharedColor blackColor() { - static SharedColor color = colorFromComponents(ColorComponents{0, 0, 0, 1}); - return color; -} - -SharedColor whiteColor() { - static SharedColor color = colorFromComponents(ColorComponents{1, 1, 1, 1}); - return color; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/platform/ios/Color.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/platform/ios/Color.h deleted file mode 100644 index 90780062..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/platform/ios/Color.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include -#include -#include - -namespace facebook { -namespace react { - -using Color = CGColor; -using SharedColor = std::shared_ptr; - -SharedColor colorFromComponents(ColorComponents components); -ColorComponents colorComponentsFromColor(SharedColor color); - -SharedColor clearColor(); -SharedColor blackColor(); -SharedColor whiteColor(); - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/platform/ios/Float.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/platform/ios/Float.h deleted file mode 100644 index 721922d1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/platform/ios/Float.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -/* - * Exact type of float numbers which ideally should match a type behing - * platform- and chip-architecture-specific float type. - */ -using Float = CGFloat; - -/* - * Large positive number signifies that the `Float` values is `undefined`. - */ -const Float kFloatUndefined = std::numeric_limits::max(); - -const Float kFloatMax = std::numeric_limits::max(); -const Float kFloatMin = std::numeric_limits::min(); - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/tests/GraphicsTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/tests/GraphicsTest.cpp deleted file mode 100644 index 53721e9c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/graphics/tests/GraphicsTest.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include - -TEST(GraphicsTest, testSomething) { - // TODO -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/BUCK deleted file mode 100644 index 79d533fc..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/BUCK +++ /dev/null @@ -1,121 +0,0 @@ -load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load( - "//tools/build_defs/oss:rn_defs.bzl", - "ANDROID", - "APPLE", - "fb_xplat_cxx_test", - "get_apple_compiler_flags", - "get_apple_inspector_flags", - "react_native_xplat_target", - "rn_xplat_cxx_library", - "subdir_glob", -) - -APPLE_COMPILER_FLAGS = get_apple_compiler_flags() - -rn_xplat_cxx_library( - name = "imagemanager", - srcs = glob( - [ - "*.cpp", - ], - exclude = glob(["tests/**/*.cpp"]), - ), - header_namespace = "", - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbandroid_exported_headers = subdir_glob( - [ - ("", "*.h"), - ], - prefix = "react/imagemanager", - ), - fbandroid_headers = subdir_glob( - [ - ("", "*.h"), - ("platform/android", "**/*.h"), - ], - prefix = "", - ), - fbandroid_srcs = glob( - [ - "platform/android/**/*.cpp", - ], - ), - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - force_static = True, - ios_deps = [ - "xplat//js:RCTImage", - "xplat//js/react-native-github:RCTCxxBridge", - ], - ios_exported_headers = subdir_glob( - [ - ("", "*.h"), - ("platform/ios", "RCTImagePrimitivesConversions.h"), - ], - prefix = "react/imagemanager", - ), - ios_frameworks = [ - "$SDKROOT/System/Library/Frameworks/CoreGraphics.framework", - "$SDKROOT/System/Library/Frameworks/Foundation.framework", - "$SDKROOT/System/Library/Frameworks/UIKit.framework", - ], - ios_headers = subdir_glob( - [ - ("", "*.h"), - ("platform/ios", "**/*.h"), - ], - prefix = "", - ), - ios_srcs = glob( - [ - "platform/ios/**/*.cpp", - "platform/ios/**/*.mm", - ], - ), - macosx_tests_override = [], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - tests = [":tests"], - visibility = ["PUBLIC"], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:futures", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//third-party/glog:glog", - "xplat//yoga:yoga", - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/mounting:mounting"), - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/graphics:graphics"), - ], -) - -fb_xplat_cxx_test( - name = "tests", - srcs = glob(["tests/**/*.cpp"]), - headers = glob(["tests/**/*.h"]), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - contacts = ["oncall+react_native@xmail.facebook.com"], - platforms = (ANDROID, APPLE), - deps = [ - "xplat//folly:molly", - "xplat//third-party/gmock:gtest", - ":imagemanager", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageManager.h deleted file mode 100644 index dba71a37..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageManager.h +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include -#include - -namespace facebook { -namespace react { - -class ImageManager; - -using SharedImageManager = std::shared_ptr; - -/* - * Cross platform facade for iOS-specific RCTImageManager. - */ -class ImageManager { - public: - ImageManager(void *platformSpecificCounterpart); - ~ImageManager(); - - ImageRequest requestImage(const ImageSource &imageSource) const; - - private: - void *self_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageRequest.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageRequest.h deleted file mode 100644 index 0ccc95a6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageRequest.h +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * Represents ongoing request for an image resource. - * The separate object must be constructed for every single separate - * image request. The object cannot be copied because it would make managing of - * event listeners hard and inefficient; the object can be moved though. - * Destroy to cancel the underlying request. - */ -class ImageRequest final { - public: - /* - * The exception which is thrown when `ImageRequest` is being deallocated - * if the future is not ready yet. - */ - class ImageNoLongerNeededException; - - /* - * The default constructor - */ - ImageRequest(const ImageSource &imageSource); - - /* - * The move constructor. - */ - ImageRequest(ImageRequest &&other) noexcept; - - /* - * `ImageRequest` does not support copying by design. - */ - ImageRequest(const ImageRequest &other) = delete; - - ~ImageRequest(); - - /** - * Set cancelation function. - */ - void setCancelationFunction(std::function cancelationFunction); - - /* - * Get observer coordinator. - */ - const ImageResponseObserverCoordinator *getObserverCoordinator() const; - - private: - /* - * Image source assosiated with the request. - */ - ImageSource imageSource_; - - /* - * Event coordinator associated with the reqest. - */ - std::shared_ptr coordinator_{}; - - /* - * Function we can call to cancel image request (see destructor). - */ - std::function cancelRequest_; - - /* - * Indicates that the object was moved and hence cannot be used anymore. - */ - bool moved_{false}; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageResponse.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageResponse.cpp deleted file mode 100644 index c9dae8d6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageResponse.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ImageResponse.h" - -namespace facebook { -namespace react { - -ImageResponse::ImageResponse(const std::shared_ptr &image) - : image_(image) {} - -std::shared_ptr ImageResponse::getImage() const { - return image_; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageResponse.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageResponse.h deleted file mode 100644 index 3aef630d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageResponse.h +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -namespace facebook { -namespace react { - -/* - * Represents retrieved image bitmap and any assotiated platform-specific info. - */ -class ImageResponse final { - public: - enum class Status { - Loading, - Completed, - Failed, - }; - - ImageResponse(const std::shared_ptr &image); - - std::shared_ptr getImage() const; - - private: - std::shared_ptr image_{}; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageResponseObserver.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageResponseObserver.h deleted file mode 100644 index 55fe4f64..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageResponseObserver.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -namespace facebook { -namespace react { - -/* - * Represents any observer of ImageResponse progression, completion, or failure. - */ -class ImageResponseObserver { - public: - virtual void didReceiveProgress(float) = 0; - virtual void didReceiveImage(const ImageResponse &imageResponse) = 0; - virtual void didReceiveFailure() = 0; - virtual ~ImageResponseObserver() noexcept = default; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageResponseObserverCoordinator.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageResponseObserverCoordinator.cpp deleted file mode 100644 index 57b72966..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageResponseObserverCoordinator.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ImageResponseObserverCoordinator.h" - -#include - -namespace facebook { -namespace react { - -ImageResponseObserverCoordinator::ImageResponseObserverCoordinator() { - status_ = ImageResponse::Status::Loading; -} - -ImageResponseObserverCoordinator::~ImageResponseObserverCoordinator() {} - -void ImageResponseObserverCoordinator::addObserver( - ImageResponseObserver *observer) const { - ImageResponse::Status status = [this] { - std::shared_lock read(mutex_); - return status_; - }(); - - if (status == ImageResponse::Status::Loading) { - std::unique_lock write(mutex_); - observers_.push_back(observer); - } else if (status == ImageResponse::Status::Completed) { - ImageResponse imageResponseCopy = [this] { - std::unique_lock read(mutex_); - return ImageResponse(imageData_); - }(); - observer->didReceiveImage(imageResponseCopy); - } else { - observer->didReceiveFailure(); - } -} - -void ImageResponseObserverCoordinator::removeObserver( - ImageResponseObserver *observer) const { - std::unique_lock write(mutex_); - - auto position = std::find(observers_.begin(), observers_.end(), observer); - if (position != observers_.end()) { - observers_.erase(position, observers_.end()); - } -} - -void ImageResponseObserverCoordinator::nativeImageResponseProgress( - float progress) const { - std::vector observersCopy = [this] { - std::shared_lock read(mutex_); - return observers_; - }(); - - for (auto observer : observersCopy) { - observer->didReceiveProgress(progress); - } -} - -void ImageResponseObserverCoordinator::nativeImageResponseComplete( - const ImageResponse &imageResponse) const { - { - std::unique_lock write(mutex_); - imageData_ = imageResponse.getImage(); - status_ = ImageResponse::Status::Completed; - } - - std::vector observersCopy = [this] { - std::shared_lock read(mutex_); - return observers_; - }(); - - for (auto observer : observersCopy) { - ImageResponse imageResponseCopy = [this] { - std::unique_lock read(mutex_); - return ImageResponse(imageData_); - }(); - observer->didReceiveImage(imageResponseCopy); - } -} - -void ImageResponseObserverCoordinator::nativeImageResponseFailed() const { - { - std::unique_lock write(mutex_); - status_ = ImageResponse::Status::Failed; - } - - std::vector observersCopy = [this] { - std::shared_lock read(mutex_); - return observers_; - }(); - - for (auto observer : observersCopy) { - observer->didReceiveFailure(); - } -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageResponseObserverCoordinator.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageResponseObserverCoordinator.h deleted file mode 100644 index b5b22e40..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/ImageResponseObserverCoordinator.h +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * The ImageResponseObserverCoordinator receives events and completed image - * data from native image loaders and sends events to any observers attached - * to the coordinator. The Coordinator also keeps track of response status - * and caches completed images. - */ -class ImageResponseObserverCoordinator { - public: - /* - * Default constructor. - */ - ImageResponseObserverCoordinator(); - - /* - * Default destructor. - */ - ~ImageResponseObserverCoordinator(); - - /* - * Interested parties may observe the image response. - */ - void addObserver(ImageResponseObserver *observer) const; - - /* - * Interested parties may stop observing the image response. - */ - void removeObserver(ImageResponseObserver *observer) const; - - /* - * Platform-specific image loader will call this method with progress updates. - */ - void nativeImageResponseProgress(float) const; - - /* - * Platform-specific image loader will call this method with a completed image - * response. - */ - void nativeImageResponseComplete(const ImageResponse &imageResponse) const; - - /* - * Platform-specific image loader will call this method in case of any - * failures. - */ - void nativeImageResponseFailed() const; - - private: - /* - * List of observers. - * Mutable: protected by mutex_. - */ - mutable std::vector observers_; - - /* - * Current status of image loading. - * Mutable: protected by mutex_. - */ - mutable ImageResponse::Status status_; - - /* - * Cache image data. - * Mutable: protected by mutex_. - */ - mutable std::shared_ptr imageData_{}; - - /* - * Observer and data mutex. - */ - mutable folly::SharedMutex mutex_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/android/ImageManager.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/android/ImageManager.cpp deleted file mode 100644 index fce052dc..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/android/ImageManager.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ImageManager.h" - -namespace facebook { -namespace react { - -ImageManager::ImageManager(void *platformSpecificCounterpart) { - // Silence unused-private-field warning. - (void)self_; - // Not implemented. -} - -ImageManager::~ImageManager() { - // Not implemented. -} - -ImageRequest ImageManager::requestImage(const ImageSource &imageSource) const { - // Not implemented. - return ImageRequest(imageSource); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/android/ImageRequest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/android/ImageRequest.cpp deleted file mode 100644 index 06678387..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/android/ImageRequest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ImageRequest.h" - -namespace facebook { -namespace react { - -ImageRequest::ImageRequest(const ImageSource &imageSource) - : imageSource_(imageSource) { - // Not implemented. -} - -ImageRequest::ImageRequest(ImageRequest &&other) noexcept - : imageSource_(std::move(other.imageSource_)), - coordinator_(std::move(other.coordinator_)) { - // Not implemented. -} - -ImageRequest::~ImageRequest() { - // Not implemented. -} - -const ImageResponseObserverCoordinator *ImageRequest::getObserverCoordinator() - const { - // Not implemented - abort(); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/ios/ImageManager.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/ios/ImageManager.mm deleted file mode 100644 index 62255d9b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/ios/ImageManager.mm +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ImageManager.h" - -#import - -#import "RCTImageManager.h" - -namespace facebook { -namespace react { - -ImageManager::ImageManager(void *platformSpecificCounterpart) { - self_ = (__bridge_retained void *)[[RCTImageManager alloc] - initWithImageLoader:(__bridge RCTImageLoader *) - platformSpecificCounterpart]; -} - -ImageManager::~ImageManager() { - CFRelease(self_); - self_ = nullptr; -} - -ImageRequest ImageManager::requestImage(const ImageSource &imageSource) const { - RCTImageManager *imageManager = (__bridge RCTImageManager *)self_; - return [imageManager requestImage:imageSource]; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/ios/ImageRequest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/ios/ImageRequest.cpp deleted file mode 100644 index 19555035..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/ios/ImageRequest.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ImageRequest.h" - -namespace facebook { -namespace react { - -class ImageRequest::ImageNoLongerNeededException : public std::logic_error { - public: - ImageNoLongerNeededException() - : std::logic_error("Image no longer needed.") {} -}; - -ImageRequest::ImageRequest(const ImageSource &imageSource) - : imageSource_(imageSource) { - coordinator_ = std::make_shared(); -} - -ImageRequest::ImageRequest(ImageRequest &&other) noexcept - : imageSource_(std::move(other.imageSource_)), - coordinator_(std::move(other.coordinator_)) { - other.moved_ = true; - other.coordinator_ = nullptr; - other.cancelRequest_ = nullptr; -} - -ImageRequest::~ImageRequest() { - if (cancelRequest_) { - cancelRequest_(); - } -} - -void ImageRequest::setCancelationFunction( - std::function cancelationFunction) { - cancelRequest_ = cancelationFunction; -} - -const ImageResponseObserverCoordinator *ImageRequest::getObserverCoordinator() - const { - return coordinator_.get(); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/ios/RCTImageManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/ios/RCTImageManager.h deleted file mode 100644 index 0bd16fda..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/ios/RCTImageManager.h +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RCTImageLoader; - -/** - * iOS-specific ImageManager. - */ -@interface RCTImageManager : NSObject - -- (instancetype)initWithImageLoader:(RCTImageLoader *)imageLoader; - -- (facebook::react::ImageRequest)requestImage: - (const facebook::react::ImageSource &)imageSource; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/ios/RCTImageManager.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/ios/RCTImageManager.mm deleted file mode 100644 index 94e3a26a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/ios/RCTImageManager.mm +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTImageManager.h" - -#import -#import -#import - -#import "RCTImagePrimitivesConversions.h" - -using namespace facebook::react; - -@implementation RCTImageManager { - RCTImageLoader *_imageLoader; -} - -- (instancetype)initWithImageLoader:(RCTImageLoader *)imageLoader { - if (self = [super init]) { - _imageLoader = imageLoader; - } - - return self; -} - -- (ImageRequest)requestImage:(const ImageSource &)imageSource { - auto imageRequest = ImageRequest(imageSource); - - auto observerCoordinator = imageRequest.getObserverCoordinator(); - - NSURLRequest *request = NSURLRequestFromImageSource(imageSource); - - auto completionBlock = ^(NSError *error, UIImage *image) { - if (image && !error) { - auto imageResponse = ImageResponse( - std::shared_ptr((__bridge_retained void *)image, CFRelease)); - observerCoordinator->nativeImageResponseComplete( - std::move(imageResponse)); - } else { - observerCoordinator->nativeImageResponseFailed(); - } - }; - - auto progressBlock = ^(int64_t progress, int64_t total) { - observerCoordinator->nativeImageResponseProgress(progress / (float)total); - }; - - RCTImageLoaderCancellationBlock cancelationBlock = - [_imageLoader loadImageWithURLRequest:request - size:CGSizeMake( - imageSource.size.width, - imageSource.size.height) - scale:imageSource.scale - clipped:YES - resizeMode:RCTResizeModeStretch - progressBlock:progressBlock - partialLoadBlock:nil - completionBlock:completionBlock]; - - std::function cancelationFunction = [cancelationBlock](void) { - cancelationBlock(); - }; - - imageRequest.setCancelationFunction(cancelationFunction); - - return imageRequest; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/ios/RCTImagePrimitivesConversions.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/ios/RCTImagePrimitivesConversions.h deleted file mode 100644 index 2a4b6f0f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/platform/ios/RCTImagePrimitivesConversions.h +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -using namespace facebook::react; - -inline static RCTResizeMode RCTResizeModeFromImageResizeMode( - ImageResizeMode imageResizeMode) { - switch (imageResizeMode) { - case ImageResizeMode::Cover: - return RCTResizeModeCover; - case ImageResizeMode::Contain: - return RCTResizeModeContain; - case ImageResizeMode::Stretch: - return RCTResizeModeStretch; - case ImageResizeMode::Center: - return RCTResizeModeCenter; - case ImageResizeMode::Repeat: - return RCTResizeModeRepeat; - } -} - -inline std::string toString(const ImageResizeMode &value) { - switch (value) { - case ImageResizeMode::Cover: - return "cover"; - case ImageResizeMode::Contain: - return "contain"; - case ImageResizeMode::Stretch: - return "stretch"; - case ImageResizeMode::Center: - return "center"; - case ImageResizeMode::Repeat: - return "repeat"; - } -} - -inline static NSURL *NSURLFromImageSource(const ImageSource &imageSource) { - // `NSURL` has a history of crashing with bad input, so let's be safe. - @try { - NSString *urlString = [NSString stringWithCString:imageSource.uri.c_str() - encoding:NSASCIIStringEncoding]; - - if (!imageSource.bundle.empty()) { - NSString *bundle = [NSString stringWithCString:imageSource.bundle.c_str() - encoding:NSASCIIStringEncoding]; - urlString = - [NSString stringWithFormat:@"%@.bundle/%@", bundle, urlString]; - } - - NSURL *url = [[NSURL alloc] initWithString:urlString]; - - if (url.scheme) { - // Well-formed absolute URL. - return url; - } - - if ([urlString rangeOfString:@":"].location != NSNotFound) { - // The URL has a scheme. - urlString = [urlString - stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - url = [NSURL URLWithString:urlString]; - return url; - } - - // Assume that it's a local path. - urlString = [urlString stringByRemovingPercentEncoding]; - - if ([urlString hasPrefix:@"~"]) { - // Path is inside user directory. - urlString = [urlString stringByExpandingTildeInPath]; - } else { - if (![urlString isAbsolutePath]) { - // Assume it's a resource path. - urlString = [[[NSBundle mainBundle] resourcePath] - stringByAppendingPathComponent:urlString]; - } - } - - url = [NSURL fileURLWithPath:urlString]; - - return url; - } @catch (__unused NSException *exception) { - return nil; - } -} - -inline static NSURLRequest *NSURLRequestFromImageSource( - const ImageSource &imageSource) { - NSURL *url = NSURLFromImageSource(imageSource); - - if (!url) { - RCTLogError(@"URI parsing error."); - return nil; - } - - NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url]; - - /* - // TODO(shergin): To be implemented. - request.HTTPBody = ...; - request.HTTPMethod = ...; - request.cachePolicy = ...; - request.allHTTPHeaderFields = ...; - */ - - return [request copy]; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/primitives.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/primitives.h deleted file mode 100644 index 5544a82a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/primitives.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -#include - -namespace facebook { -namespace react { - -class ImageSource { - public: - enum class Type { Invalid, Remote, Local }; - - Type type{}; - std::string uri{}; - std::string bundle{}; - Float scale{3}; - Size size{0}; - - bool operator==(const ImageSource &rhs) const { - return std::tie(this->type, this->uri) == std::tie(rhs.type, rhs.uri); - } - - bool operator!=(const ImageSource &rhs) const { - return !(*this == rhs); - } -}; - -using ImageSources = std::vector; - -enum class ImageResizeMode { - Cover, - Contain, - Stretch, - Center, - Repeat, -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/tests/ImageManagerTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/tests/ImageManagerTest.cpp deleted file mode 100644 index 1611e019..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/imagemanager/tests/ImageManagerTest.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include - -#include - -using namespace facebook::react; - -TEST(ImageManagerTest, testSomething) { - // TODO: -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/BUCK deleted file mode 100644 index 8eed8def..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/BUCK +++ /dev/null @@ -1,81 +0,0 @@ -load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load( - "//tools/build_defs/oss:rn_defs.bzl", - "ANDROID", - "APPLE", - "fb_xplat_cxx_test", - "get_apple_compiler_flags", - "get_apple_inspector_flags", - "react_native_xplat_target", - "rn_xplat_cxx_library", - "subdir_glob", -) - -APPLE_COMPILER_FLAGS = get_apple_compiler_flags() - -rn_xplat_cxx_library( - name = "mounting", - srcs = glob( - ["**/*.cpp"], - exclude = glob(["tests/**/*.cpp"]), - ), - headers = glob( - ["**/*.h"], - exclude = glob(["tests/**/*.h"]), - ), - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "*.h"), - ], - prefix = "react/mounting", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - force_static = True, - macosx_tests_override = [], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - # Systraces are temporary disabled. - # "-DWITH_FBSYSTRACE=1", - ], - tests = [":tests"], - visibility = ["PUBLIC"], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//third-party/glog:glog", - react_native_xplat_target("better:better"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/events:events"), - ], -) - -fb_xplat_cxx_test( - name = "tests", - srcs = glob(["tests/**/*.cpp"]), - headers = glob(["tests/**/*.h"]), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - contacts = ["oncall+react_native@xmail.facebook.com"], - platforms = (ANDROID, APPLE), - deps = [ - "xplat//folly:molly", - "xplat//third-party/gmock:gtest", - ":mounting", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/Differentiator.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/Differentiator.cpp deleted file mode 100644 index f0f56225..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/Differentiator.cpp +++ /dev/null @@ -1,244 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "Differentiator.h" - -#include -#include -#include -#include "ShadowView.h" - -namespace facebook { -namespace react { - -static void sliceChildShadowNodeViewPairsRecursively( - ShadowViewNodePairList &pairList, - Point layoutOffset, - const ShadowNode &shadowNode) { - for (const auto &childShadowNode : shadowNode.getChildren()) { - auto shadowView = ShadowView(*childShadowNode); - - const auto layoutableShadowNode = - dynamic_cast(childShadowNode.get()); -#ifndef ANDROID - // New approach (iOS): - // Non-view components are treated as layout-only views (they aren't - // represented as `ShadowView`s). - if (!layoutableShadowNode || layoutableShadowNode->isLayoutOnly()) { -#else - // Previous approach (Android): - // Non-view components are treated as normal views with an empty layout - // (they are represented as `ShadowView`s). - if (layoutableShadowNode && layoutableShadowNode->isLayoutOnly()) { -#endif - sliceChildShadowNodeViewPairsRecursively( - pairList, - layoutOffset + shadowView.layoutMetrics.frame.origin, - *childShadowNode); - } else { - shadowView.layoutMetrics.frame.origin += layoutOffset; - pairList.push_back({shadowView, *childShadowNode}); - } - } -} - -static ShadowViewNodePairList sliceChildShadowNodeViewPairs( - const ShadowNode &shadowNode) { - ShadowViewNodePairList pairList; - sliceChildShadowNodeViewPairsRecursively(pairList, {0, 0}, shadowNode); - return pairList; -} - -static void calculateShadowViewMutations( - ShadowViewMutationList &mutations, - const ShadowView &parentShadowView, - const ShadowViewNodePairList &oldChildPairs, - const ShadowViewNodePairList &newChildPairs) { - // The current version of the algorithm is otimized for simplicity, - // not for performance or optimal result. - - if (oldChildPairs == newChildPairs) { - return; - } - - if (oldChildPairs.size() == 0 && newChildPairs.size() == 0) { - return; - } - - better::map insertedPairs; - int index = 0; - - ShadowViewMutationList createMutations = {}; - ShadowViewMutationList deleteMutations = {}; - ShadowViewMutationList insertMutations = {}; - ShadowViewMutationList removeMutations = {}; - ShadowViewMutationList updateMutations = {}; - ShadowViewMutationList downwardMutations = {}; - ShadowViewMutationList destructiveDownwardMutations = {}; - - // Stage 1: Collecting `Update` mutations - for (index = 0; index < oldChildPairs.size() && index < newChildPairs.size(); - index++) { - const auto &oldChildPair = oldChildPairs[index]; - const auto &newChildPair = newChildPairs[index]; - - if (oldChildPair.shadowView.tag != newChildPair.shadowView.tag) { - // Totally different nodes, updating is impossible. - break; - } - - if (oldChildPair.shadowView != newChildPair.shadowView) { - updateMutations.push_back(ShadowViewMutation::UpdateMutation( - parentShadowView, - oldChildPair.shadowView, - newChildPair.shadowView, - index)); - } - - const auto oldGrandChildPairs = - sliceChildShadowNodeViewPairs(oldChildPair.shadowNode); - const auto newGrandChildPairs = - sliceChildShadowNodeViewPairs(newChildPair.shadowNode); - calculateShadowViewMutations( - *(newGrandChildPairs.size() ? &downwardMutations - : &destructiveDownwardMutations), - oldChildPair.shadowView, - oldGrandChildPairs, - newGrandChildPairs); - } - - int lastIndexAfterFirstStage = index; - - // Stage 2: Collecting `Insert` mutations - for (; index < newChildPairs.size(); index++) { - const auto &newChildPair = newChildPairs[index]; - - insertMutations.push_back(ShadowViewMutation::InsertMutation( - parentShadowView, newChildPair.shadowView, index)); - - insertedPairs.insert({newChildPair.shadowView.tag, newChildPair}); - } - - // Stage 3: Collecting `Delete` and `Remove` mutations - for (index = lastIndexAfterFirstStage; index < oldChildPairs.size(); - index++) { - const auto &oldChildPair = oldChildPairs[index]; - - // Even if the old view was (re)inserted, we have to generate `remove` - // mutation. - removeMutations.push_back(ShadowViewMutation::RemoveMutation( - parentShadowView, oldChildPair.shadowView, index)); - - const auto &it = insertedPairs.find(oldChildPair.shadowView.tag); - - if (it == insertedPairs.end()) { - // The old view was *not* (re)inserted. - // We have to generate `delete` mutation and apply the algorithm - // recursively. - deleteMutations.push_back( - ShadowViewMutation::DeleteMutation(oldChildPair.shadowView)); - - // We also have to call the algorithm recursively to clean up the entire - // subtree starting from the removed view. - calculateShadowViewMutations( - destructiveDownwardMutations, - oldChildPair.shadowView, - sliceChildShadowNodeViewPairs(oldChildPair.shadowNode), - {}); - } else { - // The old view *was* (re)inserted. - // We have to call the algorithm recursively if the inserted view - // is *not* the same as removed one. - const auto &newChildPair = it->second; - if (newChildPair.shadowView != oldChildPair.shadowView) { - const auto oldGrandChildPairs = - sliceChildShadowNodeViewPairs(oldChildPair.shadowNode); - const auto newGrandChildPairs = - sliceChildShadowNodeViewPairs(newChildPair.shadowNode); - calculateShadowViewMutations( - *(newGrandChildPairs.size() ? &downwardMutations - : &destructiveDownwardMutations), - newChildPair.shadowView, - oldGrandChildPairs, - newGrandChildPairs); - } - - // In any case we have to remove the view from `insertedPairs` as - // indication that the view was actually removed (which means that - // the view existed before), hence we don't have to generate - // `create` mutation. - insertedPairs.erase(it); - } - } - - // Stage 4: Collecting `Create` mutations - for (index = lastIndexAfterFirstStage; index < newChildPairs.size(); - index++) { - const auto &newChildPair = newChildPairs[index]; - - if (insertedPairs.find(newChildPair.shadowView.tag) == - insertedPairs.end()) { - // The new view was (re)inserted, so there is no need to create it. - continue; - } - - createMutations.push_back( - ShadowViewMutation::CreateMutation(newChildPair.shadowView)); - - calculateShadowViewMutations( - downwardMutations, - newChildPair.shadowView, - {}, - sliceChildShadowNodeViewPairs(newChildPair.shadowNode)); - } - - // All mutations in an optimal order: - mutations.insert( - mutations.end(), - destructiveDownwardMutations.begin(), - destructiveDownwardMutations.end()); - mutations.insert( - mutations.end(), updateMutations.begin(), updateMutations.end()); - mutations.insert( - mutations.end(), removeMutations.rbegin(), removeMutations.rend()); - mutations.insert( - mutations.end(), deleteMutations.begin(), deleteMutations.end()); - mutations.insert( - mutations.end(), createMutations.begin(), createMutations.end()); - mutations.insert( - mutations.end(), insertMutations.begin(), insertMutations.end()); - mutations.insert( - mutations.end(), downwardMutations.begin(), downwardMutations.end()); -} - -ShadowViewMutationList calculateShadowViewMutations( - const ShadowNode &oldRootShadowNode, - const ShadowNode &newRootShadowNode) { - SystraceSection s("calculateShadowViewMutations"); - - // Root shadow nodes must have same tag. - assert(oldRootShadowNode.getTag() == newRootShadowNode.getTag()); - - ShadowViewMutationList mutations; - - auto oldRootShadowView = ShadowView(oldRootShadowNode); - auto newRootShadowView = ShadowView(newRootShadowNode); - - if (oldRootShadowView != newRootShadowView) { - mutations.push_back(ShadowViewMutation::UpdateMutation( - ShadowView(), oldRootShadowView, newRootShadowView, -1)); - } - - calculateShadowViewMutations( - mutations, - ShadowView(oldRootShadowNode), - sliceChildShadowNodeViewPairs(oldRootShadowNode), - sliceChildShadowNodeViewPairs(newRootShadowNode)); - - return mutations; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/Differentiator.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/Differentiator.h deleted file mode 100644 index d2098094..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/Differentiator.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -/* - * Calculates a list of view mutations which describes how the old - * `ShadowTree` can be transformed to the new one. - * The list of mutations might be and might not be optimal. - */ -ShadowViewMutationList calculateShadowViewMutations( - const ShadowNode &oldRootShadowNode, - const ShadowNode &newRootShadowNode); - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/ShadowView.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/ShadowView.cpp deleted file mode 100644 index 1120745c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/ShadowView.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "ShadowView.h" - -#include - -namespace facebook { -namespace react { - -static LayoutMetrics layoutMetricsFromShadowNode(const ShadowNode &shadowNode) { - auto layoutableShadowNode = - dynamic_cast(&shadowNode); - return layoutableShadowNode ? layoutableShadowNode->getLayoutMetrics() - : EmptyLayoutMetrics; -} - -ShadowView::ShadowView(const ShadowNode &shadowNode) - : componentName(shadowNode.getComponentName()), - componentHandle(shadowNode.getComponentHandle()), - tag(shadowNode.getTag()), - props(shadowNode.getProps()), - eventEmitter(shadowNode.getEventEmitter()), - layoutMetrics(layoutMetricsFromShadowNode(shadowNode)), - localData(shadowNode.getLocalData()) {} - -bool ShadowView::operator==(const ShadowView &rhs) const { - return std::tie( - this->tag, - this->componentName, - this->props, - this->eventEmitter, - this->layoutMetrics, - this->localData) == - std::tie( - rhs.tag, - rhs.componentName, - rhs.props, - rhs.eventEmitter, - rhs.layoutMetrics, - rhs.localData); -} - -bool ShadowView::operator!=(const ShadowView &rhs) const { - return !(*this == rhs); -} - -bool ShadowViewNodePair::operator==(const ShadowViewNodePair &rhs) const { - return &this->shadowNode == &rhs.shadowNode; -} - -bool ShadowViewNodePair::operator!=(const ShadowViewNodePair &rhs) const { - return !(*this == rhs); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/ShadowView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/ShadowView.h deleted file mode 100644 index 8f242eff..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/ShadowView.h +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * Describes a view that can be mounted. - */ -struct ShadowView final { - ShadowView() = default; - ShadowView(const ShadowView &shadowView) = default; - - /* - * Constructs a `ShadowView` from given `ShadowNode`. - */ - explicit ShadowView(const ShadowNode &shadowNode); - - ShadowView &operator=(const ShadowView &other) = default; - - bool operator==(const ShadowView &rhs) const; - bool operator!=(const ShadowView &rhs) const; - - ComponentName componentName = ""; - ComponentHandle componentHandle = 0; - Tag tag = -1; // Tag does not change during the lifetime of a shadow view. - SharedProps props = {}; - SharedEventEmitter eventEmitter = {}; - LayoutMetrics layoutMetrics = EmptyLayoutMetrics; - SharedLocalData localData = {}; -}; - -/* - * Describes pair of a `ShadowView` and a `ShadowNode`. - */ -struct ShadowViewNodePair final { - const ShadowView shadowView; - const ShadowNode &shadowNode; - - /* - * The stored pointer to `ShadowNode` represents an indentity of the pair. - */ - bool operator==(const ShadowViewNodePair &rhs) const; - bool operator!=(const ShadowViewNodePair &rhs) const; -}; - -using ShadowViewNodePairList = std::vector; - -} // namespace react -} // namespace facebook - -namespace std { - -template <> -struct hash { - size_t operator()(const facebook::react::ShadowView &shadowView) const { - auto seed = size_t{0}; - folly::hash::hash_combine( - seed, - shadowView.componentHandle, - shadowView.tag, - shadowView.props, - shadowView.eventEmitter, - shadowView.localData); - return seed; - } -}; - -} // namespace std diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/ShadowViewMutation.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/ShadowViewMutation.cpp deleted file mode 100644 index 023107a5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/ShadowViewMutation.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "ShadowViewMutation.h" - -namespace facebook { -namespace react { - -ShadowViewMutation ShadowViewMutation::CreateMutation(ShadowView shadowView) { - return ShadowViewMutation{ - .type = Create, .newChildShadowView = shadowView, .index = -1}; -} - -ShadowViewMutation ShadowViewMutation::DeleteMutation(ShadowView shadowView) { - return {.type = Delete, .oldChildShadowView = shadowView, .index = -1}; -} - -ShadowViewMutation ShadowViewMutation::InsertMutation( - ShadowView parentShadowView, - ShadowView childShadowView, - int index) { - return {.type = Insert, - .parentShadowView = parentShadowView, - .newChildShadowView = childShadowView, - .index = index}; -} - -ShadowViewMutation ShadowViewMutation::RemoveMutation( - ShadowView parentShadowView, - ShadowView childShadowView, - int index) { - return {.type = Remove, - .parentShadowView = parentShadowView, - .oldChildShadowView = childShadowView, - .index = index}; -} - -ShadowViewMutation ShadowViewMutation::UpdateMutation( - ShadowView parentShadowView, - ShadowView oldChildShadowView, - ShadowView newChildShadowView, - int index) { - return {.type = Update, - .parentShadowView = parentShadowView, - .oldChildShadowView = oldChildShadowView, - .newChildShadowView = newChildShadowView, - .index = index}; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/ShadowViewMutation.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/ShadowViewMutation.h deleted file mode 100644 index 2de6e06a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/ShadowViewMutation.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include - -namespace facebook { -namespace react { - -/* - * Describes a single native view tree mutation which may contain - * pointers to an old shadow view, a new shadow view, a parent shadow view and - * final index of inserted or updated view. - * Use static methods to instantiate mutations of different types. - */ -struct ShadowViewMutation final { -#pragma mark - Designated Initializers - - /* - * Creates and returns an `Create` mutation. - */ - static ShadowViewMutation CreateMutation(ShadowView shadowView); - - /* - * Creates and returns an `Delete` mutation. - */ - static ShadowViewMutation DeleteMutation(ShadowView shadowView); - - /* - * Creates and returns an `Insert` mutation. - */ - static ShadowViewMutation InsertMutation( - ShadowView parentShadowView, - ShadowView childShadowView, - int index); - - /* - * Creates and returns a `Remove` mutation. - */ - static ShadowViewMutation RemoveMutation( - ShadowView parentShadowView, - ShadowView childShadowView, - int index); - - /* - * Creates and returns an `Update` mutation. - */ - static ShadowViewMutation UpdateMutation( - ShadowView parentShadowView, - ShadowView oldChildShadowView, - ShadowView newChildShadowView, - int index); - -#pragma mark - Type - - enum Type { Create, Delete, Insert, Remove, Update }; - -#pragma mark - Fields - - Type type = {Create}; - ShadowView parentShadowView = {}; - ShadowView oldChildShadowView = {}; - ShadowView newChildShadowView = {}; - int index = {}; -}; - -using ShadowViewMutationList = std::vector; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/tests/MountingTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/tests/MountingTest.cpp deleted file mode 100644 index 5bc4d381..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/mounting/tests/MountingTest.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include - -TEST(MountingTest, testSomething) { - // TODO -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/sample/SampleComponentDescriptorFactor.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/sample/SampleComponentDescriptorFactor.cpp deleted file mode 100644 index 9cd6ffa2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/sample/SampleComponentDescriptorFactor.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -/** - * This is a sample implementation. Each app should provide its own. - */ -ComponentRegistryFactory getDefaultComponentRegistryFactory() { - return [](const SharedEventDispatcher &eventDispatcher, - const SharedContextContainer &contextContainer) { - auto registry = std::make_shared(); - return registry; - } -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/BUCK deleted file mode 100644 index 5d541d22..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/BUCK +++ /dev/null @@ -1,132 +0,0 @@ -load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load( - "//tools/build_defs/oss:rn_defs.bzl", - "ANDROID", - "APPLE", - "fb_xplat_cxx_test", - "get_apple_compiler_flags", - "get_apple_inspector_flags", - "react_native_target", - "react_native_xplat_target", - "rn_xplat_cxx_library", - "subdir_glob", -) - -APPLE_COMPILER_FLAGS = get_apple_compiler_flags() - -rn_xplat_cxx_library( - name = "textlayoutmanager", - srcs = glob( - [ - "*.cpp", - ], - ), - headers = subdir_glob( - [ - ("", "*.h"), - ], - prefix = "", - ), - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "*.h"), - ], - prefix = "react/textlayoutmanager", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbandroid_deps = [ - react_native_target("jni/react/jni:jni"), - ], - fbandroid_exported_headers = subdir_glob( - [ - ("", "*.h"), - ("platform/android", "*.h"), - ], - prefix = "react/textlayoutmanager", - ), - fbandroid_headers = subdir_glob( - [ - ("platform/android", "**/*.h"), - ], - prefix = "", - ), - fbandroid_srcs = glob( - [ - "platform/android/**/*.cpp", - ], - ), - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - force_static = True, - ios_deps = [ - ], - ios_exported_headers = subdir_glob( - [ - ("platform/ios", "*.h"), - ], - prefix = "react/textlayoutmanager", - ), - ios_frameworks = [ - "$SDKROOT/System/Library/Frameworks/CoreGraphics.framework", - "$SDKROOT/System/Library/Frameworks/Foundation.framework", - "$SDKROOT/System/Library/Frameworks/UIKit.framework", - ], - ios_headers = subdir_glob( - [ - ("platform/ios", "**/*.h"), - ], - prefix = "", - ), - ios_srcs = glob( - [ - "platform/ios/**/*.cpp", - "platform/ios/**/*.mm", - ], - ), - macosx_tests_override = [], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - tests = [":tests"], - visibility = ["PUBLIC"], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//third-party/glog:glog", - "xplat//yoga:yoga", - react_native_xplat_target("fabric/attributedstring:attributedstring"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/uimanager:uimanager"), - ], -) - -fb_xplat_cxx_test( - name = "tests", - srcs = glob(["tests/**/*.cpp"]), - headers = glob(["tests/**/*.h"]), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - contacts = ["oncall+react_native@xmail.facebook.com"], - platforms = (ANDROID, APPLE), - deps = [ - "xplat//folly:molly", - "xplat//third-party/gmock:gtest", - ":textlayoutmanager", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.cpp deleted file mode 100644 index fd18e476..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "TextLayoutManager.h" - -#include -#include -#include - -using namespace facebook::jni; - -namespace facebook { -namespace react { - -TextLayoutManager::~TextLayoutManager() {} - -void *TextLayoutManager::getNativeTextLayoutManager() const { - return self_; -} - -Size TextLayoutManager::measure( - AttributedString attributedString, - ParagraphAttributes paragraphAttributes, - LayoutConstraints layoutConstraints) const { - const jni::global_ref &fabricUIManager = - contextContainer_->getInstance>( - "FabricUIManager"); - - static auto measure = - jni::findClassStatic("com/facebook/react/fabric/FabricUIManager") - ->getMethod("measure"); - - auto minimumSize = layoutConstraints.minimumSize; - auto maximumSize = layoutConstraints.maximumSize; - int minWidth = (int)minimumSize.width; - int minHeight = (int)minimumSize.height; - int maxWidth = (int)maximumSize.width; - int maxHeight = (int)maximumSize.height; - local_ref componentName = make_jstring("RCTText"); - return yogaMeassureToSize(measure( - fabricUIManager, - componentName.get(), - ReadableNativeMap::newObjectCxxArgs(toDynamic(attributedString)).get(), - ReadableNativeMap::newObjectCxxArgs(toDynamic(paragraphAttributes)).get(), - minWidth, - maxWidth, - minHeight, - maxHeight)); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.h deleted file mode 100644 index 811dd55c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.h +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class TextLayoutManager; - -using SharedTextLayoutManager = std::shared_ptr; - -/* - * Cross platform facade for Android-specific TextLayoutManager. - */ -class TextLayoutManager { - public: - TextLayoutManager(const SharedContextContainer &contextContainer) - : contextContainer_(contextContainer){}; - ~TextLayoutManager(); - - /* - * Measures `attributedString` using native text rendering infrastructure. - */ - Size measure( - AttributedString attributedString, - ParagraphAttributes paragraphAttributes, - LayoutConstraints layoutConstraints) const; - - /* - * Returns an opaque pointer to platform-specific TextLayoutManager. - * Is used on a native views layer to delegate text rendering to the manager. - */ - void *getNativeTextLayoutManager() const; - - private: - void *self_; - - SharedContextContainer contextContainer_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.h deleted file mode 100644 index 1ec019ef..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface NSTextStorage (FontScaling) - -- (void)scaleFontSizeToFitSize:(CGSize)size - minimumFontSize:(CGFloat)minimumFontSize - maximumFontSize:(CGFloat)maximumFontSize; - -- (void)scaleFontSizeWithRatio:(CGFloat)ratio - minimumFontSize:(CGFloat)minimumFontSize - maximumFontSize:(CGFloat)maximumFontSize; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.m deleted file mode 100644 index 36938fa1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.m +++ /dev/null @@ -1,135 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "NSTextStorage+FontScaling.h" - -typedef NS_OPTIONS(NSInteger, RCTTextSizeComparisonOptions) { - RCTTextSizeComparisonSmaller = 1 << 0, - RCTTextSizeComparisonLarger = 1 << 1, - RCTTextSizeComparisonWithinRange = 1 << 2, -}; - -@implementation NSTextStorage (FontScaling) - -- (void)scaleFontSizeToFitSize:(CGSize)size - minimumFontSize:(CGFloat)minimumFontSize - maximumFontSize:(CGFloat)maximumFontSize { - CGFloat bottomRatio = 1.0 / 128.0; - CGFloat topRatio = 128.0; - CGFloat ratio = 1.0; - - NSAttributedString *originalAttributedString = [self copy]; - - CGFloat lastRatioWhichFits = 0.02; - - while (true) { - [self scaleFontSizeWithRatio:ratio - minimumFontSize:minimumFontSize - maximumFontSize:maximumFontSize]; - - RCTTextSizeComparisonOptions comparsion = [self compareToSize:size - thresholdRatio:0.01]; - - if ((comparsion & RCTTextSizeComparisonWithinRange) && - (comparsion & RCTTextSizeComparisonSmaller)) { - return; - } else if (comparsion & RCTTextSizeComparisonSmaller) { - bottomRatio = ratio; - lastRatioWhichFits = ratio; - } else { - topRatio = ratio; - } - - ratio = (topRatio + bottomRatio) / 2.0; - - CGFloat kRatioThreshold = 0.005; - if (ABS(topRatio - bottomRatio) < kRatioThreshold || - ABS(topRatio - ratio) < kRatioThreshold || - ABS(bottomRatio - ratio) < kRatioThreshold) { - [self replaceCharactersInRange:(NSRange){0, self.length} - withAttributedString:originalAttributedString]; - - [self scaleFontSizeWithRatio:lastRatioWhichFits - minimumFontSize:minimumFontSize - maximumFontSize:maximumFontSize]; - return; - } - - [self replaceCharactersInRange:(NSRange){0, self.length} - withAttributedString:originalAttributedString]; - } -} - -- (RCTTextSizeComparisonOptions)compareToSize:(CGSize)size - thresholdRatio:(CGFloat)thresholdRatio { - NSLayoutManager *layoutManager = self.layoutManagers.firstObject; - NSTextContainer *textContainer = layoutManager.textContainers.firstObject; - - [layoutManager ensureLayoutForTextContainer:textContainer]; - - // Does it fit the text container? - NSRange glyphRange = [layoutManager glyphRangeForTextContainer:textContainer]; - NSRange truncatedGlyphRange = [layoutManager - truncatedGlyphRangeInLineFragmentForGlyphAtIndex:glyphRange.length - 1]; - - if (truncatedGlyphRange.location != NSNotFound) { - return RCTTextSizeComparisonLarger; - } - - CGSize measuredSize = - [layoutManager usedRectForTextContainer:textContainer].size; - - // Does it fit the size? - BOOL fitsSize = - size.width >= measuredSize.width && size.height >= measuredSize.height; - - CGSize thresholdSize = (CGSize){ - size.width * thresholdRatio, - size.height * thresholdRatio, - }; - - RCTTextSizeComparisonOptions result = 0; - - result |= - (fitsSize) ? RCTTextSizeComparisonSmaller : RCTTextSizeComparisonLarger; - - if (ABS(measuredSize.width - size.width) < thresholdSize.width) { - result = result | RCTTextSizeComparisonWithinRange; - } - - return result; -} - -- (void)scaleFontSizeWithRatio:(CGFloat)ratio - minimumFontSize:(CGFloat)minimumFontSize - maximumFontSize:(CGFloat)maximumFontSize { - [self beginEditing]; - - [self - enumerateAttribute:NSFontAttributeName - inRange:(NSRange){0, self.length} - options: - NSAttributedStringEnumerationLongestEffectiveRangeNotRequired - usingBlock:^( - UIFont *_Nullable font, NSRange range, BOOL *_Nonnull stop) { - if (!font) { - return; - } - - CGFloat fontSize = - MAX(MIN(font.pointSize * ratio, maximumFontSize), - minimumFontSize); - - [self addAttribute:NSFontAttributeName - value:[font fontWithSize:fontSize] - range:range]; - }]; - - [self endEditing]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h deleted file mode 100644 index 8a33bef8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#include -#include - -NS_ASSUME_NONNULL_BEGIN - -NSString *const RCTAttributedStringIsHighlightedAttributeName = - @"IsHighlighted"; -NSString *const RCTAttributedStringEventEmitterKey = @"EventEmitter"; - -/** - * Constructs ready-to-render `NSAttributedString` by given `AttributedString`. - */ -NSAttributedString *RCTNSAttributedStringFromAttributedString( - const facebook::react::AttributedString &attributedString); - -@interface RCTWeakEventEmitterWrapper : NSObject -@property(nonatomic, assign) facebook::react::SharedEventEmitter eventEmitter; -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm deleted file mode 100644 index 09c3ff40..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm +++ /dev/null @@ -1,280 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAttributedTextUtils.h" - -#include -#include -#include -#include - -using namespace facebook::react; - -@implementation RCTWeakEventEmitterWrapper { - std::weak_ptr _weakEventEmitter; -} - -- (void)setEventEmitter:(SharedEventEmitter)eventEmitter { - _weakEventEmitter = eventEmitter; -} - -- (SharedEventEmitter)eventEmitter { - return _weakEventEmitter.lock(); -} - -- (void)dealloc { - _weakEventEmitter.reset(); -} - -@end - -inline static UIFont *RCTEffectiveFontFromTextAttributes( - const TextAttributes &textAttributes) { - NSString *fontFamily = - [NSString stringWithCString:textAttributes.fontFamily.c_str() - encoding:NSUTF8StringEncoding]; - - RCTFontProperties fontProperties; - fontProperties.family = fontFamily; - fontProperties.size = textAttributes.fontSize; - fontProperties.style = textAttributes.fontStyle.hasValue() - ? RCTFontStyleFromFontStyle(textAttributes.fontStyle.value()) - : RCTFontStyleUndefined; - fontProperties.variant = textAttributes.fontVariant.hasValue() - ? RCTFontVariantFromFontVariant(textAttributes.fontVariant.value()) - : RCTFontVariantDefault; - fontProperties.weight = textAttributes.fontWeight.hasValue() - ? CGFloat(textAttributes.fontWeight.value()) - : NAN; - fontProperties.sizeMultiplier = textAttributes.fontSizeMultiplier; - - return RCTFontWithFontProperties(fontProperties); -} - -inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes( - const TextAttributes &textAttributes) { - return textAttributes.allowFontScaling.value_or(true) && - !isnan(textAttributes.fontSizeMultiplier) - ? textAttributes.fontSizeMultiplier - : 1.0; -} - -inline static UIColor *RCTEffectiveForegroundColorFromTextAttributes( - const TextAttributes &textAttributes) { - UIColor *effectiveForegroundColor = - RCTUIColorFromSharedColor(textAttributes.foregroundColor) - ?: [UIColor blackColor]; - - if (!isnan(textAttributes.opacity)) { - effectiveForegroundColor = [effectiveForegroundColor - colorWithAlphaComponent:CGColorGetAlpha( - effectiveForegroundColor.CGColor) * - textAttributes.opacity]; - } - - return effectiveForegroundColor; -} - -inline static UIColor *RCTEffectiveBackgroundColorFromTextAttributes( - const TextAttributes &textAttributes) { - UIColor *effectiveBackgroundColor = - RCTUIColorFromSharedColor(textAttributes.backgroundColor); - - if (effectiveBackgroundColor && !isnan(textAttributes.opacity)) { - effectiveBackgroundColor = [effectiveBackgroundColor - colorWithAlphaComponent:CGColorGetAlpha( - effectiveBackgroundColor.CGColor) * - textAttributes.opacity]; - } - - return effectiveBackgroundColor ?: [UIColor clearColor]; -} - -static NSDictionary * -RCTNSTextAttributesFromTextAttributes(const TextAttributes &textAttributes) { - NSMutableDictionary *attributes = - [NSMutableDictionary dictionaryWithCapacity:10]; - - // Font - UIFont *font = RCTEffectiveFontFromTextAttributes(textAttributes); - if (font) { - attributes[NSFontAttributeName] = font; - } - - // Colors - UIColor *effectiveForegroundColor = - RCTEffectiveForegroundColorFromTextAttributes(textAttributes); - - if (textAttributes.foregroundColor || !isnan(textAttributes.opacity)) { - attributes[NSForegroundColorAttributeName] = effectiveForegroundColor; - } - - if (textAttributes.backgroundColor || !isnan(textAttributes.opacity)) { - attributes[NSBackgroundColorAttributeName] = - RCTEffectiveBackgroundColorFromTextAttributes(textAttributes); - } - - // Kerning - if (!isnan(textAttributes.letterSpacing)) { - attributes[NSKernAttributeName] = @(textAttributes.letterSpacing); - } - - // Paragraph Style - NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new]; - BOOL isParagraphStyleUsed = NO; - if (textAttributes.alignment.hasValue()) { - TextAlignment textAlignment = - textAttributes.alignment.value_or(TextAlignment::Natural); - if (textAttributes.layoutDirection.value_or(LayoutDirection::LeftToRight) == - LayoutDirection::RightToLeft) { - if (textAlignment == TextAlignment::Right) { - textAlignment = TextAlignment::Left; - } else if (textAlignment == TextAlignment::Left) { - textAlignment = TextAlignment::Right; - } - } - - paragraphStyle.alignment = - RCTNSTextAlignmentFromTextAlignment(textAlignment); - isParagraphStyleUsed = YES; - } - - if (textAttributes.baseWritingDirection.hasValue()) { - paragraphStyle.baseWritingDirection = - RCTNSWritingDirectionFromWritingDirection( - textAttributes.baseWritingDirection.value()); - isParagraphStyleUsed = YES; - } - - if (!isnan(textAttributes.lineHeight)) { - CGFloat lineHeight = textAttributes.lineHeight * - RCTEffectiveFontSizeMultiplierFromTextAttributes(textAttributes); - paragraphStyle.minimumLineHeight = lineHeight; - paragraphStyle.maximumLineHeight = lineHeight; - isParagraphStyleUsed = YES; - } - - if (isParagraphStyleUsed) { - attributes[NSParagraphStyleAttributeName] = paragraphStyle; - } - - // Decoration - if (textAttributes.textDecorationLineType.value_or( - TextDecorationLineType::None) != TextDecorationLineType::None) { - auto textDecorationLineType = textAttributes.textDecorationLineType.value(); - - NSUnderlineStyle style = RCTNSUnderlineStyleFromStyleAndPattern( - textAttributes.textDecorationLineStyle.value_or( - TextDecorationLineStyle::Single), - textAttributes.textDecorationLinePattern.value_or( - TextDecorationLinePattern::Solid)); - - UIColor *textDecorationColor = - RCTUIColorFromSharedColor(textAttributes.textDecorationColor); - - // Underline - if (textDecorationLineType == TextDecorationLineType::Underline || - textDecorationLineType == - TextDecorationLineType::UnderlineStrikethrough) { - attributes[NSUnderlineStyleAttributeName] = @(style); - - if (textDecorationColor) { - attributes[NSUnderlineColorAttributeName] = textDecorationColor; - } - } - - // Strikethrough - if (textDecorationLineType == TextDecorationLineType::Strikethrough || - textDecorationLineType == - TextDecorationLineType::UnderlineStrikethrough) { - attributes[NSStrikethroughStyleAttributeName] = @(style); - - if (textDecorationColor) { - attributes[NSStrikethroughColorAttributeName] = textDecorationColor; - } - } - } - - // Shadow - if (textAttributes.textShadowOffset.hasValue()) { - auto textShadowOffset = textAttributes.textShadowOffset.value(); - NSShadow *shadow = [NSShadow new]; - shadow.shadowOffset = - CGSize{textShadowOffset.width, textShadowOffset.height}; - shadow.shadowBlurRadius = textAttributes.textShadowRadius; - shadow.shadowColor = - RCTUIColorFromSharedColor(textAttributes.textShadowColor); - attributes[NSShadowAttributeName] = shadow; - } - - // Special - if (textAttributes.isHighlighted) { - attributes[RCTAttributedStringIsHighlightedAttributeName] = @YES; - } - - return [attributes copy]; -} - -NSAttributedString *RCTNSAttributedStringFromAttributedString( - const AttributedString &attributedString) { - NSMutableAttributedString *nsAttributedString = - [[NSMutableAttributedString alloc] init]; - - [nsAttributedString beginEditing]; - - for (auto fragment : attributedString.getFragments()) { - NSAttributedString *nsAttributedStringFragment; - - auto layoutMetrics = fragment.shadowView.layoutMetrics; - - if (layoutMetrics != EmptyLayoutMetrics) { - CGRect bounds = {.origin = {.x = layoutMetrics.frame.origin.x, - .y = layoutMetrics.frame.origin.y}, - .size = {.width = layoutMetrics.frame.size.width, - .height = layoutMetrics.frame.size.height}}; - - NSTextAttachment *attachment = [NSTextAttachment new]; - attachment.bounds = bounds; - - nsAttributedStringFragment = - [NSAttributedString attributedStringWithAttachment:attachment]; - } else { - NSString *string = [NSString stringWithCString:fragment.string.c_str() - encoding:NSUTF8StringEncoding]; - - nsAttributedStringFragment = [[NSAttributedString alloc] - initWithString:string - attributes:RCTNSTextAttributesFromTextAttributes( - fragment.textAttributes)]; - } - - NSMutableAttributedString *nsMutableAttributedStringFragment = - [[NSMutableAttributedString alloc] - initWithAttributedString:nsAttributedStringFragment]; - - if (fragment.parentShadowView.componentHandle) { - RCTWeakEventEmitterWrapper *eventEmitterWrapper = - [RCTWeakEventEmitterWrapper new]; - eventEmitterWrapper.eventEmitter = fragment.parentShadowView.eventEmitter; - - NSDictionary *additionalTextAttributes = - @{RCTAttributedStringEventEmitterKey : eventEmitterWrapper}; - - [nsMutableAttributedStringFragment - addAttributes:additionalTextAttributes - range:NSMakeRange( - 0, nsMutableAttributedStringFragment.length)]; - } - - [nsAttributedString - appendAttributedString:nsMutableAttributedStringFragment]; - } - - [nsAttributedString endEditing]; - - return nsAttributedString; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTFontProperties.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTFontProperties.h deleted file mode 100644 index c4323c4a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTFontProperties.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -typedef NS_ENUM(NSInteger, RCTFontStyle) { - RCTFontStyleUndefined = -1, - RCTFontStyleNormal, - RCTFontStyleItalic, - RCTFontStyleOblique, -}; - -typedef NS_OPTIONS(NSInteger, RCTFontVariant) { - RCTFontVariantUndefined = -1, - RCTFontVariantDefault = 0, - RCTFontVariantSmallCaps = 1 << 1, - RCTFontVariantOldstyleNums = 1 << 2, - RCTFontVariantLiningNums = 1 << 3, - RCTFontVariantTabularNums = 1 << 4, - RCTFontVariantProportionalNums = 1 << 5, -}; - -struct RCTFontProperties { - NSString *family; - CGFloat size; - UIFontWeight weight; - RCTFontStyle style; - RCTFontVariant variant; - CGFloat sizeMultiplier; -}; - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTFontUtils.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTFontUtils.h deleted file mode 100644 index 3740072e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTFontUtils.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Returns UIFont instance corresponded to given font properties. - */ -UIFont *RCTFontWithFontProperties(RCTFontProperties fontProperties); - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTFontUtils.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTFontUtils.mm deleted file mode 100644 index dfe13ff8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTFontUtils.mm +++ /dev/null @@ -1,200 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTFontUtils.h" - -#import -#import - -static RCTFontProperties RCTDefaultFontProperties() { - static RCTFontProperties defaultFontProperties; - static dispatch_once_t onceToken; - - dispatch_once(&onceToken, ^{ - defaultFontProperties.size = 14; - defaultFontProperties.family = - [UIFont systemFontOfSize:defaultFontProperties.size].familyName; - defaultFontProperties.style = RCTFontStyleNormal; - defaultFontProperties.variant = RCTFontVariantDefault; - defaultFontProperties.sizeMultiplier = 1.0; - }); - - return defaultFontProperties; -} - -static RCTFontProperties RCTResolveFontProperties( - RCTFontProperties fontProperties) { - RCTFontProperties defaultFontProperties = RCTDefaultFontProperties(); - fontProperties.family = fontProperties.family.length && - ![fontProperties.family isEqualToString:@"System"] - ? fontProperties.family - : defaultFontProperties.family; - fontProperties.size = !isnan(fontProperties.size) - ? fontProperties.size - : defaultFontProperties.size; - fontProperties.weight = !isnan(fontProperties.weight) - ? fontProperties.weight - : defaultFontProperties.weight; - fontProperties.style = fontProperties.style != RCTFontStyleUndefined - ? fontProperties.style - : defaultFontProperties.style; - fontProperties.variant = fontProperties.variant != RCTFontVariantUndefined - ? fontProperties.variant - : defaultFontProperties.variant; - return fontProperties; -} - -static UIFontWeight RCTGetFontWeight(UIFont *font) { - NSDictionary *traits = - [font.fontDescriptor objectForKey:UIFontDescriptorTraitsAttribute]; - return [traits[UIFontWeightTrait] doubleValue]; -} - -static RCTFontStyle RCTGetFontStyle(UIFont *font) { - NSDictionary *traits = - [font.fontDescriptor objectForKey:UIFontDescriptorTraitsAttribute]; - UIFontDescriptorSymbolicTraits symbolicTraits = - [traits[UIFontSymbolicTrait] unsignedIntValue]; - if (symbolicTraits & UIFontDescriptorTraitItalic) { - return RCTFontStyleItalic; - } - - return RCTFontStyleNormal; -} - -static NSArray *RCTFontFeatures(RCTFontVariant fontVariant) { - // FIXME: - return @[]; -} - -static UIFontWeight RCTUIFontWeightFromFloat(CGFloat fontWeight) { - // Note: Even if the underlying type of `UIFontWeight` is `CGFloat` - // and UIKit uses the same numerical notation, we have to use exact - // `UIFontWeight*` constants to make it work properly (because - // float values comparison is tricky). - static UIFontWeight weights[] = {/* ~100 */ UIFontWeightUltraLight, - /* ~200 */ UIFontWeightThin, - /* ~300 */ UIFontWeightLight, - /* ~400 */ UIFontWeightRegular, - /* ~500 */ UIFontWeightMedium, - /* ~600 */ UIFontWeightSemibold, - /* ~700 */ UIFontWeightBold, - /* ~800 */ UIFontWeightHeavy, - /* ~900 */ UIFontWeightBlack}; - return weights[std::llround((fontWeight / 100) - 1)]; -} - -static UIFont *RCTDefaultFontWithFontProperties( - RCTFontProperties fontProperties) { - static NSCache *fontCache; - static std::mutex fontCacheMutex; - - NSString *cacheKey = [NSString stringWithFormat:@"%.1f/%.2f", - fontProperties.size, - fontProperties.weight]; - UIFont *font; - - { - std::lock_guard lock(fontCacheMutex); - if (!fontCache) { - fontCache = [NSCache new]; - } - font = [fontCache objectForKey:cacheKey]; - } - - if (!font) { - font = [UIFont - systemFontOfSize:fontProperties.size - weight:RCTUIFontWeightFromFloat(fontProperties.weight)]; - - if (fontProperties.variant == RCTFontStyleItalic) { - UIFontDescriptor *fontDescriptor = [font fontDescriptor]; - UIFontDescriptorSymbolicTraits symbolicTraits = - fontDescriptor.symbolicTraits; - - symbolicTraits |= UIFontDescriptorTraitItalic; - - fontDescriptor = - [fontDescriptor fontDescriptorWithSymbolicTraits:symbolicTraits]; - font = [UIFont fontWithDescriptor:fontDescriptor - size:fontProperties.size]; - } - - { - std::lock_guard lock(fontCacheMutex); - [fontCache setObject:font forKey:cacheKey]; - } - } - - return font; -} - -UIFont *RCTFontWithFontProperties(RCTFontProperties fontProperties) { - RCTFontProperties defaultFontProperties = RCTDefaultFontProperties(); - fontProperties = RCTResolveFontProperties(fontProperties); - - CGFloat effectiveFontSize = - fontProperties.sizeMultiplier * fontProperties.size; - UIFont *font; - if ([fontProperties.family isEqualToString:defaultFontProperties.family]) { - // Handle system font as special case. This ensures that we preserve - // the specific metrics of the standard system font as closely as possible. - font = RCTDefaultFontWithFontProperties(fontProperties); - } else { - NSArray *fontNames = - [UIFont fontNamesForFamilyName:fontProperties.family]; - - if (fontNames.count == 0) { - // Gracefully handle being given a font name rather than font family, for - // example: "Helvetica Light Oblique" rather than just "Helvetica". - font = [UIFont fontWithName:fontProperties.family size:effectiveFontSize]; - - if (!font) { - // Failback to system font. - font = [UIFont - systemFontOfSize:effectiveFontSize - weight:RCTUIFontWeightFromFloat(fontProperties.weight)]; - } - } else { - // Get the closest font that matches the given weight for the fontFamily - CGFloat closestWeight = INFINITY; - for (NSString *name in fontNames) { - UIFont *fontMatch = [UIFont fontWithName:name size:effectiveFontSize]; - - if (RCTGetFontStyle(fontMatch) != fontProperties.style) { - continue; - } - - CGFloat testWeight = RCTGetFontWeight(fontMatch); - if (ABS(testWeight - fontProperties.weight) < - ABS(closestWeight - fontProperties.weight)) { - font = fontMatch; - closestWeight = testWeight; - } - } - - if (!font) { - // If we still don't have a match at least return the first font in the - // fontFamily This is to support built-in font Zapfino and other custom - // single font families like Impact - font = [UIFont fontWithName:fontNames[0] size:effectiveFontSize]; - } - } - } - - // Apply font variants to font object. - if (fontProperties.variant != RCTFontVariantDefault) { - NSArray *fontFeatures = RCTFontFeatures(fontProperties.variant); - UIFontDescriptor *fontDescriptor = - [font.fontDescriptor fontDescriptorByAddingAttributes:@{ - UIFontDescriptorFeatureSettingsAttribute : fontFeatures - }]; - font = [UIFont fontWithDescriptor:fontDescriptor size:effectiveFontSize]; - } - - return font; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextLayoutManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextLayoutManager.h deleted file mode 100644 index 9306045d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextLayoutManager.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * iOS-specific TextLayoutManager - */ -@interface RCTTextLayoutManager : NSObject - -- (facebook::react::Size) - measureWithAttributedString: - (facebook::react::AttributedString)attributedString - paragraphAttributes: - (facebook::react::ParagraphAttributes)paragraphAttributes - layoutConstraints: - (facebook::react::LayoutConstraints)layoutConstraints; - -- (void)drawAttributedString:(facebook::react::AttributedString)attributedString - paragraphAttributes: - (facebook::react::ParagraphAttributes)paragraphAttributes - frame:(CGRect)frame; - -- (facebook::react::SharedEventEmitter) - getEventEmitterWithAttributeString: - (facebook::react::AttributedString)attributedString - paragraphAttributes: - (facebook::react::ParagraphAttributes)paragraphAttributes - frame:(CGRect)frame - atPoint:(CGPoint)point; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextLayoutManager.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextLayoutManager.mm deleted file mode 100644 index 0e885b26..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextLayoutManager.mm +++ /dev/null @@ -1,143 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTextLayoutManager.h" - -#import "NSTextStorage+FontScaling.h" -#import "RCTAttributedTextUtils.h" - -using namespace facebook::react; - -@implementation RCTTextLayoutManager - -static NSLineBreakMode RCTNSLineBreakModeFromWritingDirection( - EllipsizeMode ellipsizeMode) { - switch (ellipsizeMode) { - case EllipsizeMode::Clip: - return NSLineBreakByClipping; - case EllipsizeMode::Head: - return NSLineBreakByTruncatingHead; - case EllipsizeMode::Tail: - return NSLineBreakByTruncatingTail; - case EllipsizeMode::Middle: - return NSLineBreakByTruncatingMiddle; - } -} - -- (facebook::react::Size) - measureWithAttributedString:(AttributedString)attributedString - paragraphAttributes:(ParagraphAttributes)paragraphAttributes - layoutConstraints:(LayoutConstraints)layoutConstraints { - CGSize maximumSize = CGSize{layoutConstraints.maximumSize.width, - layoutConstraints.maximumSize.height}; - NSTextStorage *textStorage = - [self _textStorageAndLayoutManagerWithAttributesString: - RCTNSAttributedStringFromAttributedString(attributedString) - paragraphAttributes:paragraphAttributes - size:maximumSize]; - - NSLayoutManager *layoutManager = textStorage.layoutManagers.firstObject; - NSTextContainer *textContainer = layoutManager.textContainers.firstObject; - [layoutManager ensureLayoutForTextContainer:textContainer]; - - CGSize size = [layoutManager usedRectForTextContainer:textContainer].size; - - size = (CGSize){MIN(size.width, maximumSize.width), - MIN(size.height, maximumSize.height)}; - - return facebook::react::Size{size.width, size.height}; -} - -- (void)drawAttributedString:(AttributedString)attributedString - paragraphAttributes:(ParagraphAttributes)paragraphAttributes - frame:(CGRect)frame { - NSTextStorage *textStorage = - [self _textStorageAndLayoutManagerWithAttributesString: - RCTNSAttributedStringFromAttributedString(attributedString) - paragraphAttributes:paragraphAttributes - size:frame.size]; - NSLayoutManager *layoutManager = textStorage.layoutManagers.firstObject; - NSTextContainer *textContainer = layoutManager.textContainers.firstObject; - - NSRange glyphRange = [layoutManager glyphRangeForTextContainer:textContainer]; - [layoutManager drawBackgroundForGlyphRange:glyphRange atPoint:frame.origin]; - [layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:frame.origin]; -} - -- (NSTextStorage *) - _textStorageAndLayoutManagerWithAttributesString: - (NSAttributedString *)attributedString - paragraphAttributes: - (ParagraphAttributes)paragraphAttributes - size:(CGSize)size { - NSTextContainer *textContainer = [[NSTextContainer alloc] initWithSize:size]; - - textContainer.lineFragmentPadding = 0.0; // Note, the default value is 5. - textContainer.lineBreakMode = paragraphAttributes.maximumNumberOfLines > 0 - ? RCTNSLineBreakModeFromWritingDirection( - paragraphAttributes.ellipsizeMode) - : NSLineBreakByClipping; - textContainer.maximumNumberOfLines = paragraphAttributes.maximumNumberOfLines; - - NSLayoutManager *layoutManager = [NSLayoutManager new]; - [layoutManager addTextContainer:textContainer]; - - NSTextStorage *textStorage = - [[NSTextStorage alloc] initWithAttributedString:attributedString]; - - [textStorage addLayoutManager:layoutManager]; - - if (paragraphAttributes.adjustsFontSizeToFit) { - CGFloat minimumFontSize = !isnan(paragraphAttributes.minimumFontSize) - ? paragraphAttributes.minimumFontSize - : 4.0; - CGFloat maximumFontSize = !isnan(paragraphAttributes.maximumFontSize) - ? paragraphAttributes.maximumFontSize - : 96.0; - [textStorage scaleFontSizeToFitSize:size - minimumFontSize:minimumFontSize - maximumFontSize:maximumFontSize]; - } - - return textStorage; -} - -- (SharedEventEmitter) - getEventEmitterWithAttributeString:(AttributedString)attributedString - paragraphAttributes:(ParagraphAttributes)paragraphAttributes - frame:(CGRect)frame - atPoint:(CGPoint)point { - NSTextStorage *textStorage = - [self _textStorageAndLayoutManagerWithAttributesString: - RCTNSAttributedStringFromAttributedString(attributedString) - paragraphAttributes:paragraphAttributes - size:frame.size]; - NSLayoutManager *layoutManager = textStorage.layoutManagers.firstObject; - NSTextContainer *textContainer = layoutManager.textContainers.firstObject; - - CGFloat fraction; - NSUInteger characterIndex = - [layoutManager characterIndexForPoint:point - inTextContainer:textContainer - fractionOfDistanceBetweenInsertionPoints:&fraction]; - - // If the point is not before (fraction == 0.0) the first character and not - // after (fraction == 1.0) the last character, then the attribute is valid. - if (textStorage.length > 0 && (fraction > 0 || characterIndex > 0) && - (fraction < 1 || characterIndex < textStorage.length - 1)) { - RCTWeakEventEmitterWrapper *eventEmitterWrapper = - (RCTWeakEventEmitterWrapper *)[textStorage - attribute:RCTAttributedStringEventEmitterKey - atIndex:characterIndex - effectiveRange:NULL]; - return eventEmitterWrapper.eventEmitter; - } - - return nil; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h deleted file mode 100644 index 78800775..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#include -#include - -using namespace facebook::react; - -inline static NSTextAlignment RCTNSTextAlignmentFromTextAlignment( - TextAlignment textAlignment) { - switch (textAlignment) { - case TextAlignment::Natural: - return NSTextAlignmentNatural; - case TextAlignment::Left: - return NSTextAlignmentLeft; - case TextAlignment::Right: - return NSTextAlignmentRight; - case TextAlignment::Center: - return NSTextAlignmentCenter; - case TextAlignment::Justified: - return NSTextAlignmentJustified; - } -} - -inline static NSWritingDirection RCTNSWritingDirectionFromWritingDirection( - WritingDirection writingDirection) { - switch (writingDirection) { - case WritingDirection::Natural: - return NSWritingDirectionNatural; - case WritingDirection::LeftToRight: - return NSWritingDirectionLeftToRight; - case WritingDirection::RightToLeft: - return NSWritingDirectionRightToLeft; - } -} - -inline static RCTFontStyle RCTFontStyleFromFontStyle(FontStyle fontStyle) { - switch (fontStyle) { - case FontStyle::Normal: - return RCTFontStyleNormal; - case FontStyle::Italic: - return RCTFontStyleItalic; - case FontStyle::Oblique: - return RCTFontStyleOblique; - } -} - -inline static RCTFontVariant RCTFontVariantFromFontVariant( - FontVariant fontVariant) { - return (RCTFontVariant)fontVariant; -} - -inline static NSUnderlineStyle RCTNSUnderlineStyleFromStyleAndPattern( - TextDecorationLineStyle textDecorationLineStyle, - TextDecorationLinePattern textDecorationLinePattern) { - NSUnderlineStyle style = NSUnderlineStyleNone; - - switch (textDecorationLineStyle) { - case TextDecorationLineStyle::Single: - style = NSUnderlineStyle(style | NSUnderlineStyleSingle); - break; - case TextDecorationLineStyle::Thick: - style = NSUnderlineStyle(style | NSUnderlineStyleThick); - break; - case TextDecorationLineStyle::Double: - style = NSUnderlineStyle(style | NSUnderlineStyleDouble); - break; - } - - switch (textDecorationLinePattern) { - case TextDecorationLinePattern::Solid: - style = NSUnderlineStyle(style | NSUnderlinePatternSolid); - break; - case TextDecorationLinePattern::Dash: - style = NSUnderlineStyle(style | NSUnderlinePatternDash); - break; - case TextDecorationLinePattern::Dot: - style = NSUnderlineStyle(style | NSUnderlinePatternDot); - break; - case TextDecorationLinePattern::DashDot: - style = NSUnderlineStyle(style | NSUnderlinePatternDashDot); - break; - case TextDecorationLinePattern::DashDotDot: - style = NSUnderlineStyle(style | NSUnderlinePatternDashDotDot); - break; - } - - return style; -} - -inline static UIColor *RCTUIColorFromSharedColor(const SharedColor &color) { - return color ? [UIColor colorWithCGColor:color.get()] : nil; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/TextLayoutManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/TextLayoutManager.h deleted file mode 100644 index d703f6c5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/TextLayoutManager.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class TextLayoutManager; - -using SharedTextLayoutManager = std::shared_ptr; - -/* - * Cross platform facade for iOS-specific RCTTTextLayoutManager. - */ -class TextLayoutManager { - public: - TextLayoutManager(const SharedContextContainer &contextContainer); - ~TextLayoutManager(); - - /* - * Measures `attributedString` using native text rendering infrastructure. - */ - Size measure( - AttributedString attributedString, - ParagraphAttributes paragraphAttributes, - LayoutConstraints layoutConstraints) const; - - /* - * Returns an opaque pointer to platform-specific TextLayoutManager. - * Is used on a native views layer to delegate text rendering to the manager. - */ - void *getNativeTextLayoutManager() const; - - private: - void *self_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/TextLayoutManager.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/TextLayoutManager.mm deleted file mode 100644 index a900d7b4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/platform/ios/TextLayoutManager.mm +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "TextLayoutManager.h" - -#import "RCTTextLayoutManager.h" - -namespace facebook { -namespace react { - -TextLayoutManager::TextLayoutManager( - const SharedContextContainer &contextContainer) { - self_ = (__bridge_retained void *)[RCTTextLayoutManager new]; -} - -TextLayoutManager::~TextLayoutManager() { - CFRelease(self_); - self_ = nullptr; -} - -void *TextLayoutManager::getNativeTextLayoutManager() const { - return self_; -} - -Size TextLayoutManager::measure( - AttributedString attributedString, - ParagraphAttributes paragraphAttributes, - LayoutConstraints layoutConstraints) const { - RCTTextLayoutManager *textLayoutManager = - (__bridge RCTTextLayoutManager *)self_; - return [textLayoutManager measureWithAttributedString:attributedString - paragraphAttributes:paragraphAttributes - layoutConstraints:layoutConstraints]; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/tests/TextLayoutManagerTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/tests/TextLayoutManagerTest.cpp deleted file mode 100644 index 17ba1733..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/textlayoutmanager/tests/TextLayoutManagerTest.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include - -#include - -using namespace facebook::react; - -TEST(TextLayoutManagerTest, testSomething) { - // TODO: -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/BUCK deleted file mode 100644 index 76cd39b1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/BUCK +++ /dev/null @@ -1,94 +0,0 @@ -load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load( - "//tools/build_defs/oss:rn_defs.bzl", - "ANDROID", - "APPLE", - "fb_xplat_cxx_test", - "get_apple_compiler_flags", - "get_apple_inspector_flags", - "react_native_xplat_target", - "rn_xplat_cxx_library", - "subdir_glob", -) - -APPLE_COMPILER_FLAGS = get_apple_compiler_flags() - -rn_xplat_cxx_library( - name = "uimanager", - srcs = glob( - ["**/*.cpp"], - exclude = glob(["tests/**/*.cpp"]), - ), - headers = glob( - ["**/*.h"], - exclude = glob(["tests/**/*.h"]), - ), - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "*.h"), - ], - prefix = "react/uimanager", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), - force_static = True, - macosx_tests_override = [], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - # Systraces are temporary disabled. - # "-DWITH_FBSYSTRACE=1", - ], - tests = [":tests"], - visibility = ["PUBLIC"], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//jsi:JSIDynamic", - "xplat//jsi:jsi", - "xplat//third-party/glog:glog", - react_native_xplat_target("config:config"), - react_native_xplat_target("fabric/components/root:root"), - react_native_xplat_target("fabric/components/view:view"), - react_native_xplat_target("fabric/mounting:mounting"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/events:events"), - ], -) - -fb_xplat_cxx_test( - name = "tests", - srcs = glob(["tests/**/*.cpp"]), - headers = glob(["tests/**/*.h"]), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - contacts = ["oncall+react_native@xmail.facebook.com"], - fbandroid_use_instrumentation_test = True, - platforms = (ANDROID, APPLE), - deps = [ - "xplat//folly:molly", - "xplat//third-party/gmock:gtest", - ":uimanager", - react_native_xplat_target("config:config"), - react_native_xplat_target("fabric/components/activityindicator:activityindicator"), - react_native_xplat_target("fabric/components/image:image"), - react_native_xplat_target("fabric/components/root:root"), - react_native_xplat_target("fabric/components/scrollview:scrollview"), - react_native_xplat_target("fabric/components/text:text"), - react_native_xplat_target("fabric/components/view:view"), - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ComponentDescriptorFactory.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ComponentDescriptorFactory.h deleted file mode 100644 index 94e4260f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ComponentDescriptorFactory.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include -#include -#include - -#include "ComponentDescriptorRegistry.h" - -namespace facebook { -namespace react { - -/** - * A factory to provide hosting app specific set of ComponentDescriptor's. - * Each app must provide an implementation of the static class method which - * should register its specific set of supported components. - */ -using ComponentRegistryFactory = - std::function; - -ComponentRegistryFactory getDefaultComponentRegistryFactory(); - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ComponentDescriptorRegistry.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ComponentDescriptorRegistry.cpp deleted file mode 100644 index 3af8cf01..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ComponentDescriptorRegistry.cpp +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "ComponentDescriptorRegistry.h" - -#include -#include - -namespace facebook { -namespace react { - -void ComponentDescriptorRegistry::registerComponentDescriptor( - SharedComponentDescriptor componentDescriptor) { - ComponentHandle componentHandle = componentDescriptor->getComponentHandle(); - _registryByHandle[componentHandle] = componentDescriptor; - - ComponentName componentName = componentDescriptor->getComponentName(); - _registryByName[componentName] = componentDescriptor; -} - -const SharedComponentDescriptor ComponentDescriptorRegistry::operator[]( - const SharedShadowNode &shadowNode) const { - ComponentHandle componentHandle = shadowNode->getComponentHandle(); - return _registryByHandle.at(componentHandle); -} - -const SharedComponentDescriptor ComponentDescriptorRegistry::operator[]( - const ComponentName &componentName) const { - auto it = _registryByName.find(componentName); - if (it == _registryByName.end()) { - throw std::invalid_argument( - ("Unable to find componentDescriptor for " + componentName).c_str()); - } - return it->second; -} - -static const std::string componentNameByReactViewName(std::string viewName) { - // We need this function only for the transition period; - // eventually, all names will be unified. - - std::string rctPrefix("RCT"); - if (std::mismatch(rctPrefix.begin(), rctPrefix.end(), viewName.begin()) - .first == rctPrefix.end()) { - // If `viewName` has "RCT" prefix, remove it. - viewName.erase(0, rctPrefix.length()); - } - - // Fabric uses slightly new names for Text components because of differences - // in semantic. - if (viewName == "Text") { - return "Paragraph"; - } - if (viewName == "VirtualText") { - return "Text"; - } - - if (viewName == "ImageView") { - return "Image"; - } - - if (viewName == "AndroidHorizontalScrollView") { - return "ScrollView"; - } - - if (viewName == "RKShimmeringView") { - return "ShimmeringView"; - } - - if (viewName == "AndroidProgressBar") { - return "ActivityIndicatorView"; - } - - // We need this temporarly for testing purposes until we have proper - // implementation of core components. - if (viewName == "SinglelineTextInputView" || - viewName == "MultilineTextInputView" || viewName == "AndroidTextInput" || - viewName == "RefreshControl" || viewName == "AndroidSwipeRefreshLayout" || - viewName == "SafeAreaView" || viewName == "ScrollContentView" || - viewName == "AndroidHorizontalScrollContentView" // Android - ) { - return "View"; - } - - return viewName; -} - -const ComponentDescriptor &ComponentDescriptorRegistry::at( - ComponentName componentName) const { - auto unifiedComponentName = componentNameByReactViewName(componentName); - - auto it = _registryByName.find(unifiedComponentName); - if (it == _registryByName.end()) { - throw std::invalid_argument( - ("Unable to find componentDescriptor for " + unifiedComponentName) - .c_str()); - } - return *it->second; -} - -const ComponentDescriptor &ComponentDescriptorRegistry::at( - ComponentHandle componentHandle) const { - return *_registryByHandle.at(componentHandle); -} - -SharedShadowNode ComponentDescriptorRegistry::createNode( - Tag tag, - const std::string &viewName, - Tag rootTag, - const folly::dynamic &props, - const SharedEventTarget &eventTarget) const { - ComponentName componentName = componentNameByReactViewName(viewName); - const SharedComponentDescriptor &componentDescriptor = (*this)[componentName]; - - SharedShadowNode shadowNode = componentDescriptor->createShadowNode( - {.tag = tag, - .rootTag = rootTag, - .eventEmitter = - componentDescriptor->createEventEmitter(std::move(eventTarget), tag), - .props = componentDescriptor->cloneProps(nullptr, RawProps(props))}); - return shadowNode; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ComponentDescriptorRegistry.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ComponentDescriptorRegistry.h deleted file mode 100644 index 7f6614fb..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ComponentDescriptorRegistry.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include - -#include - -namespace facebook { -namespace react { - -class ComponentDescriptorRegistry; - -using SharedComponentDescriptorRegistry = - std::shared_ptr; - -/* - * Registry of particular `ComponentDescriptor`s. - */ -class ComponentDescriptorRegistry { - public: - void registerComponentDescriptor( - SharedComponentDescriptor componentDescriptor); - - const ComponentDescriptor &at(ComponentName componentName) const; - const ComponentDescriptor &at(ComponentHandle componentHandle) const; - - const SharedComponentDescriptor operator[]( - const SharedShadowNode &shadowNode) const; - const SharedComponentDescriptor operator[]( - const ComponentName &componentName) const; - SharedShadowNode createNode( - Tag tag, - const std::string &viewName, - Tag rootTag, - const folly::dynamic &props, - const SharedEventTarget &eventTarget) const; - - private: - std::unordered_map - _registryByHandle; - std::unordered_map _registryByName; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ContextContainer.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ContextContainer.h deleted file mode 100644 index 3ae07673..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ContextContainer.h +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class ContextContainer; - -using SharedContextContainer = std::shared_ptr; - -/* - * General purpose dependecy injection container. - * Instance types must be copyable. - */ -class ContextContainer final { - public: - /* - * Registers an instance of the particular type `T` in the container - * using the provided `key`. Only one instance can be registered per key. - * - * Convention is to use the plain base class name for the key, so for - * example if the type `T` is `std::shared_ptr`, - * then one would use `"ReactNativeConfig"` for the `key`, even if the - * instance is actually a `shared_ptr` of derived class - *`EmptyReactNativeConfig`. - */ - template - void registerInstance(const T &instance, const std::string &key) { - std::lock_guard lock(mutex_); - - const auto res = instances_.insert({key, std::make_shared(instance)}); - if (res.second == false) { - LOG(FATAL) << "ContextContainer already had instance for key '" << key - << "'"; - } - } - - /* - * Returns a previously registered instance of the particular type `T` - * for `key`. - */ - template - T getInstance(const std::string &key) const { - std::lock_guard lock(mutex_); - - return *std::static_pointer_cast(instances_.at(key)); - } - - private: - std::unordered_map> instances_; - - mutable std::mutex mutex_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/Scheduler.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/Scheduler.cpp deleted file mode 100644 index c0212fd2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/Scheduler.cpp +++ /dev/null @@ -1,255 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "Scheduler.h" - -#include - -#include -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -Scheduler::Scheduler( - const SharedContextContainer &contextContainer, - ComponentRegistryFactory buildRegistryFunction) { - const auto asynchronousEventBeatFactory = - contextContainer->getInstance("asynchronous"); - const auto synchronousEventBeatFactory = - contextContainer->getInstance("synchronous"); - - runtimeExecutor_ = - contextContainer->getInstance("runtime-executor"); - - reactNativeConfig_ = - contextContainer->getInstance>( - "ReactNativeConfig"); - - auto uiManager = std::make_unique(); - auto &uiManagerRef = *uiManager; - uiManagerBinding_ = std::make_shared(std::move(uiManager)); - - auto eventPipe = [uiManagerBinding = uiManagerBinding_.get()]( - jsi::Runtime &runtime, - const EventTarget *eventTarget, - const std::string &type, - const ValueFactory &payloadFactory) { - uiManagerBinding->dispatchEvent(runtime, eventTarget, type, payloadFactory); - }; - - auto eventDispatcher = std::make_shared( - eventPipe, synchronousEventBeatFactory, asynchronousEventBeatFactory); - - componentDescriptorRegistry_ = - buildRegistryFunction(eventDispatcher, contextContainer); - - uiManagerRef.setDelegate(this); - uiManagerRef.setShadowTreeRegistry(&shadowTreeRegistry_); - uiManagerRef.setComponentDescriptorRegistry(componentDescriptorRegistry_); - - runtimeExecutor_([=](jsi::Runtime &runtime) { - UIManagerBinding::install(runtime, uiManagerBinding_); - }); -} - -Scheduler::~Scheduler() { - uiManagerBinding_->invalidate(); -} - -void Scheduler::startSurface( - SurfaceId surfaceId, - const std::string &moduleName, - const folly::dynamic &initialProps, - const LayoutConstraints &layoutConstraints, - const LayoutContext &layoutContext) const { - SystraceSection s("Scheduler::startSurface"); - - auto shadowTree = - std::make_unique(surfaceId, layoutConstraints, layoutContext); - shadowTree->setDelegate(this); - - shadowTreeRegistry_.add(std::move(shadowTree)); - -#ifndef ANDROID - runtimeExecutor_([=](jsi::Runtime &runtime) { - uiManagerBinding_->startSurface( - runtime, surfaceId, moduleName, initialProps); - }); -#endif -} - -void Scheduler::renderTemplateToSurface( - SurfaceId surfaceId, - const std::string &uiTemplate) { - SystraceSection s("Scheduler::renderTemplateToSurface"); - long commitStartTime = getTime(); - - try { - if (uiTemplate.size() == 0) { - return; - } - NativeModuleRegistry nMR; - auto tree = UITemplateProcessor::buildShadowTree( - uiTemplate, - surfaceId, - folly::dynamic::object(), - *componentDescriptorRegistry_, - nMR, - reactNativeConfig_); - - shadowTreeRegistry_.visit(surfaceId, [=](const ShadowTree &shadowTree) { - return shadowTree.tryCommit( - [&](const SharedRootShadowNode &oldRootShadowNode) { - return std::make_shared( - *oldRootShadowNode, - ShadowNodeFragment{.children = - std::make_shared( - SharedShadowNodeList{tree})}); - }, - commitStartTime); - }); - } catch (const std::exception &e) { - LOG(ERROR) << " >>>> EXCEPTION <<< rendering uiTemplate in " - << "Scheduler::renderTemplateToSurface: " << e.what(); - } -} - -void Scheduler::stopSurface(SurfaceId surfaceId) const { - SystraceSection s("Scheduler::stopSurface"); - - long commitStartTime = getTime(); - shadowTreeRegistry_.visit( - surfaceId, [commitStartTime](const ShadowTree &shadowTree) { - // As part of stopping the Surface, we have to commit an empty tree. - return shadowTree.tryCommit( - [&](const SharedRootShadowNode &oldRootShadowNode) { - return std::make_shared( - *oldRootShadowNode, - ShadowNodeFragment{ - .children = - ShadowNode::emptySharedShadowNodeSharedList()}); - }, - commitStartTime); - }); - - auto shadowTree = shadowTreeRegistry_.remove(surfaceId); - shadowTree->setDelegate(nullptr); - -#ifndef ANDROID - runtimeExecutor_([=](jsi::Runtime &runtime) { - uiManagerBinding_->stopSurface(runtime, surfaceId); - }); -#endif -} - -Size Scheduler::measureSurface( - SurfaceId surfaceId, - const LayoutConstraints &layoutConstraints, - const LayoutContext &layoutContext) const { - SystraceSection s("Scheduler::measureSurface"); - - long commitStartTime = getTime(); - - Size size; - shadowTreeRegistry_.visit(surfaceId, [&](const ShadowTree &shadowTree) { - shadowTree.tryCommit( - [&](const SharedRootShadowNode &oldRootShadowNode) { - auto rootShadowNode = - oldRootShadowNode->clone(layoutConstraints, layoutContext); - rootShadowNode->layout(); - size = rootShadowNode->getLayoutMetrics().frame.size; - return nullptr; - }, - commitStartTime); - }); - return size; -} - -void Scheduler::constraintSurfaceLayout( - SurfaceId surfaceId, - const LayoutConstraints &layoutConstraints, - const LayoutContext &layoutContext) const { - SystraceSection s("Scheduler::constraintSurfaceLayout"); - - long commitStartTime = getTime(); - - shadowTreeRegistry_.visit(surfaceId, [&](const ShadowTree &shadowTree) { - shadowTree.commit( - [&](const SharedRootShadowNode &oldRootShadowNode) { - return oldRootShadowNode->clone(layoutConstraints, layoutContext); - }, - commitStartTime); - }); -} - -#pragma mark - Delegate - -void Scheduler::setDelegate(SchedulerDelegate *delegate) { - delegate_ = delegate; -} - -SchedulerDelegate *Scheduler::getDelegate() const { - return delegate_; -} - -#pragma mark - ShadowTreeDelegate - -void Scheduler::shadowTreeDidCommit( - const ShadowTree &shadowTree, - const ShadowViewMutationList &mutations, - long commitStartTime, - long layoutTime) const { - SystraceSection s("Scheduler::shadowTreeDidCommit"); - - if (delegate_) { - delegate_->schedulerDidFinishTransaction( - shadowTree.getSurfaceId(), mutations, commitStartTime, layoutTime); - } -} - -#pragma mark - UIManagerDelegate - -void Scheduler::uiManagerDidFinishTransaction( - SurfaceId surfaceId, - const SharedShadowNodeUnsharedList &rootChildNodes, - long startCommitTime) { - SystraceSection s("Scheduler::uiManagerDidFinishTransaction"); - - shadowTreeRegistry_.visit(surfaceId, [&](const ShadowTree &shadowTree) { - shadowTree.commit( - [&](const SharedRootShadowNode &oldRootShadowNode) { - return std::make_shared( - *oldRootShadowNode, - ShadowNodeFragment{.children = rootChildNodes}); - }, - startCommitTime); - }); -} - -void Scheduler::uiManagerDidCreateShadowNode( - const SharedShadowNode &shadowNode) { - SystraceSection s("Scheduler::uiManagerDidCreateShadowNode"); - - if (delegate_) { - auto layoutableShadowNode = - dynamic_cast(shadowNode.get()); - auto isLayoutable = layoutableShadowNode != nullptr; - - delegate_->schedulerDidRequestPreliminaryViewAllocation( - shadowNode->getRootTag(), - shadowNode->getComponentName(), - isLayoutable, - shadowNode->getComponentHandle()); - } -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/Scheduler.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/Scheduler.h deleted file mode 100644 index 1d2bc10f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/Scheduler.h +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * Scheduler coordinates Shadow Tree updates and event flows. - */ -class Scheduler final : public UIManagerDelegate, public ShadowTreeDelegate { - public: - Scheduler( - const SharedContextContainer &contextContainer, - ComponentRegistryFactory buildRegistryFunction); - ~Scheduler(); - -#pragma mark - Surface Management - - void startSurface( - SurfaceId surfaceId, - const std::string &moduleName, - const folly::dynamic &initialProps, - const LayoutConstraints &layoutConstraints = {}, - const LayoutContext &layoutContext = {}) const; - - void renderTemplateToSurface( - SurfaceId surfaceId, - const std::string &uiTemplate); - - void stopSurface(SurfaceId surfaceId) const; - - Size measureSurface( - SurfaceId surfaceId, - const LayoutConstraints &layoutConstraints, - const LayoutContext &layoutContext) const; - - /* - * Applies given `layoutConstraints` and `layoutContext` to a Surface. - * The user interface will be relaid out as a result. The operation will be - * performed synchronously (including mounting) if the method is called - * on the main thread. - * Can be called from any thread. - */ - void constraintSurfaceLayout( - SurfaceId surfaceId, - const LayoutConstraints &layoutConstraints, - const LayoutContext &layoutContext) const; - -#pragma mark - Delegate - - /* - * Sets and gets the Scheduler's delegate. - * The delegate is stored as a raw pointer, so the owner must null - * the pointer before being destroyed. - */ - void setDelegate(SchedulerDelegate *delegate); - SchedulerDelegate *getDelegate() const; - -#pragma mark - UIManagerDelegate - - void uiManagerDidFinishTransaction( - SurfaceId surfaceId, - const SharedShadowNodeUnsharedList &rootChildNodes, - long startCommitTime) override; - void uiManagerDidCreateShadowNode( - const SharedShadowNode &shadowNode) override; - -#pragma mark - ShadowTreeDelegate - - void shadowTreeDidCommit( - const ShadowTree &shadowTree, - const ShadowViewMutationList &mutations, - long commitStartTime, - long layoutTime) const override; - - private: - SchedulerDelegate *delegate_; - SharedComponentDescriptorRegistry componentDescriptorRegistry_; - ShadowTreeRegistry shadowTreeRegistry_; - RuntimeExecutor runtimeExecutor_; - std::shared_ptr uiManagerBinding_; - std::shared_ptr reactNativeConfig_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/SchedulerDelegate.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/SchedulerDelegate.h deleted file mode 100644 index e62c31b7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/SchedulerDelegate.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include - -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * Abstract class for Scheduler's delegate. - */ -class SchedulerDelegate { - public: - /* - * Called right after Scheduler computed (and laid out) a new updated version - * of the tree and calculated a set of mutations which are suffisient - * to construct a new one. - */ - virtual void schedulerDidFinishTransaction( - Tag rootTag, - const ShadowViewMutationList &mutations, - const long commitStartTime, - const long layoutTime) = 0; - - /* - * Called right after a new ShadowNode was created. - */ - virtual void schedulerDidRequestPreliminaryViewAllocation( - SurfaceId surfaceId, - ComponentName componentName, - bool isLayoutable, - ComponentHandle componentHandle) = 0; - - virtual ~SchedulerDelegate() noexcept = default; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ShadowTree.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ShadowTree.cpp deleted file mode 100644 index 1968bc9a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ShadowTree.cpp +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "ShadowTree.h" - -#include -#include -#include -#include -#include -#include - -#include "ShadowTreeDelegate.h" - -namespace facebook { -namespace react { - -static void updateMountedFlag( - const SharedShadowNodeList &oldChildren, - const SharedShadowNodeList &newChildren) { - // This is a simplified version of Diffing algorithm that only updates - // `mounted` flag on `ShadowNode`s. The algorithm sets "mounted" flag before - // "unmounted" to allow `ShadowNode` detect a situation where the node was - // remounted. - - if (&oldChildren == &newChildren) { - // Lists are identical, nothing to do. - return; - } - - if (oldChildren.size() == 0 && newChildren.size() == 0) { - // Both lists are empty, nothing to do. - return; - } - - int index; - - // Stage 1: Mount and unmount "updated" children. - for (index = 0; index < oldChildren.size() && index < newChildren.size(); - index++) { - const auto &oldChild = oldChildren[index]; - const auto &newChild = newChildren[index]; - - if (oldChild == newChild) { - // Nodes are identical, skipping the subtree. - continue; - } - - if (oldChild->getTag() != newChild->getTag()) { - // Totally different nodes, updating is impossible. - break; - } - - newChild->setMounted(true); - oldChild->setMounted(false); - - updateMountedFlag(oldChild->getChildren(), newChild->getChildren()); - } - - int lastIndexAfterFirstStage = index; - - // State 2: Mount new children. - for (index = lastIndexAfterFirstStage; index < newChildren.size(); index++) { - const auto &newChild = newChildren[index]; - newChild->setMounted(true); - updateMountedFlag({}, newChild->getChildren()); - } - - // State 3: Unmount old children. - for (index = lastIndexAfterFirstStage; index < oldChildren.size(); index++) { - const auto &oldChild = oldChildren[index]; - oldChild->setMounted(false); - updateMountedFlag(oldChild->getChildren(), {}); - } -} - -ShadowTree::ShadowTree( - SurfaceId surfaceId, - const LayoutConstraints &layoutConstraints, - const LayoutContext &layoutContext) - : surfaceId_(surfaceId) { - const auto noopEventEmitter = std::make_shared( - nullptr, -1, std::shared_ptr()); - - const auto props = std::make_shared( - *RootShadowNode::defaultSharedProps(), layoutConstraints, layoutContext); - - rootShadowNode_ = std::make_shared( - ShadowNodeFragment{ - .tag = surfaceId, - .rootTag = surfaceId, - .props = props, - .eventEmitter = noopEventEmitter, - }, - nullptr); -} - -ShadowTree::~ShadowTree() { - commit( - [](const SharedRootShadowNode &oldRootShadowNode) { - return std::make_shared( - *oldRootShadowNode, - ShadowNodeFragment{ - .children = ShadowNode::emptySharedShadowNodeSharedList()}); - }, - getTime()); -} - -Tag ShadowTree::getSurfaceId() const { - return surfaceId_; -} - -void ShadowTree::commit( - ShadowTreeCommitTransaction transaction, - long commitStartTime, - int *revision) const { - SystraceSection s("ShadowTree::commit"); - - int attempts = 0; - - while (true) { - attempts++; - if (tryCommit(transaction, commitStartTime, revision)) { - return; - } - - // After multiple attempts, we failed to commit the transaction. - // Something internally went terribly wrong. - assert(attempts < 1024); - } -} - -bool ShadowTree::tryCommit( - ShadowTreeCommitTransaction transaction, - long commitStartTime, - int *revision) const { - SystraceSection s("ShadowTree::tryCommit"); - - SharedRootShadowNode oldRootShadowNode; - - { - // Reading `rootShadowNode_` in shared manner. - std::shared_lock lock(commitMutex_); - oldRootShadowNode = rootShadowNode_; - } - - UnsharedRootShadowNode newRootShadowNode = transaction(oldRootShadowNode); - - if (!newRootShadowNode) { - return false; - } - - long layoutTime = getTime(); - newRootShadowNode->layout(); - layoutTime = getTime() - layoutTime; - newRootShadowNode->sealRecursive(); - - auto mutations = - calculateShadowViewMutations(*oldRootShadowNode, *newRootShadowNode); - - { - // Updating `rootShadowNode_` in unique manner if it hasn't changed. - std::unique_lock lock(commitMutex_); - - if (rootShadowNode_ != oldRootShadowNode) { - return false; - } - - rootShadowNode_ = newRootShadowNode; - - { - std::lock_guard dispatchLock(EventEmitter::DispatchMutex()); - - updateMountedFlag( - oldRootShadowNode->getChildren(), newRootShadowNode->getChildren()); - } - - revision_++; - - // Returning last revision if requested. - if (revision) { - *revision = revision_; - } - } - - emitLayoutEvents(mutations); - - if (delegate_) { - delegate_->shadowTreeDidCommit( - *this, mutations, commitStartTime, layoutTime); - } - - return true; -} - -void ShadowTree::emitLayoutEvents( - const ShadowViewMutationList &mutations) const { - SystraceSection s("ShadowTree::emitLayoutEvents"); - - for (const auto &mutation : mutations) { - // Only `Insert` and `Update` mutations can affect layout metrics. - if (mutation.type != ShadowViewMutation::Insert && - mutation.type != ShadowViewMutation::Update) { - continue; - } - - const auto viewEventEmitter = - std::dynamic_pointer_cast( - mutation.newChildShadowView.eventEmitter); - - // Checking if particular shadow node supports `onLayout` event (part of - // `ViewEventEmitter`). - if (!viewEventEmitter) { - continue; - } - - // Checking if the `onLayout` event was requested for the particular Shadow - // Node. - const auto viewProps = std::dynamic_pointer_cast( - mutation.newChildShadowView.props); - if (viewProps && !viewProps->onLayout) { - continue; - } - - // In case if we have `oldChildShadowView`, checking that layout metrics - // have changed. - if (mutation.type != ShadowViewMutation::Update && - mutation.oldChildShadowView.layoutMetrics == - mutation.newChildShadowView.layoutMetrics) { - continue; - } - - viewEventEmitter->onLayout(mutation.newChildShadowView.layoutMetrics); - } -} - -#pragma mark - Delegate - -void ShadowTree::setDelegate(ShadowTreeDelegate const *delegate) { - delegate_ = delegate; -} - -ShadowTreeDelegate const *ShadowTree::getDelegate() const { - return delegate_; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ShadowTree.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ShadowTree.h deleted file mode 100644 index 03e9de41..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ShadowTree.h +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -using ShadowTreeCommitTransaction = std::function; - -/* - * Represents the shadow tree and its lifecycle. - */ -class ShadowTree final { - public: - /* - * Creates a new shadow tree instance. - */ - ShadowTree( - SurfaceId surfaceId, - const LayoutConstraints &layoutConstraints, - const LayoutContext &layoutContext); - - ~ShadowTree(); - - /* - * Returns the `SurfaceId` associated with the shadow tree. - */ - SurfaceId getSurfaceId() const; - - /* - * Performs commit calling `transaction` function with a `oldRootShadowNode` - * and expecting a `newRootShadowNode` as a return value. - * The `transaction` function can abort commit returning `nullptr`. - * If a `revision` pointer is not null, the method will store there a - * contiguous revision number of the successfully performed transaction. - * Returns `true` if the operation finished successfully. - */ - bool tryCommit( - ShadowTreeCommitTransaction transaction, - long commitStartTime, - int *revision = nullptr) const; - - /* - * Calls `tryCommit` in a loop until it finishes successfully. - */ - void commit( - ShadowTreeCommitTransaction transaction, - long commitStartTime, - int *revision = nullptr) const; - -#pragma mark - Delegate - - /* - * Sets and gets the delegate. - * The delegate is stored as a raw pointer, so the owner must null - * the pointer before being destroyed. - */ - void setDelegate(ShadowTreeDelegate const *delegate); - ShadowTreeDelegate const *getDelegate() const; - - private: - UnsharedRootShadowNode cloneRootShadowNode( - const SharedRootShadowNode &oldRootShadowNode, - const LayoutConstraints &layoutConstraints, - const LayoutContext &layoutContext) const; - - void emitLayoutEvents(const ShadowViewMutationList &mutations) const; - - const SurfaceId surfaceId_; - mutable folly::SharedMutex commitMutex_; - mutable SharedRootShadowNode rootShadowNode_; // Protected by `commitMutex_`. - mutable int revision_{1}; // Protected by `commitMutex_`. - ShadowTreeDelegate const *delegate_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ShadowTreeDelegate.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ShadowTreeDelegate.h deleted file mode 100644 index 8ab9abf5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ShadowTreeDelegate.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include - -namespace facebook { -namespace react { - -class ShadowTree; - -/* - * Abstract class for ShadowTree's delegate. - */ -class ShadowTreeDelegate { - public: - /* - * Called right after Shadow Tree commit a new state of the the tree. - */ - virtual void shadowTreeDidCommit( - const ShadowTree &shadowTree, - const ShadowViewMutationList &mutations, - long commitStartTime, - long layoutTime) const = 0; - - virtual ~ShadowTreeDelegate() noexcept = default; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ShadowTreeRegistry.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ShadowTreeRegistry.cpp deleted file mode 100644 index 24babca9..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ShadowTreeRegistry.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "ShadowTreeRegistry.h" - -namespace facebook { -namespace react { - -void ShadowTreeRegistry::add(std::unique_ptr &&shadowTree) const { - std::unique_lock lock(mutex_); - - registry_.emplace(shadowTree->getSurfaceId(), std::move(shadowTree)); -} - -std::unique_ptr ShadowTreeRegistry::remove( - SurfaceId surfaceId) const { - std::unique_lock lock(mutex_); - - auto iterator = registry_.find(surfaceId); - auto shadowTree = std::unique_ptr(iterator->second.release()); - registry_.erase(iterator); - return shadowTree; -} - -bool ShadowTreeRegistry::visit( - SurfaceId surfaceId, - std::function callback) const { - std::shared_lock lock(mutex_); - - auto iterator = registry_.find(surfaceId); - - if (iterator == registry_.end()) { - return false; - } - - callback(*iterator->second); - return true; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ShadowTreeRegistry.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ShadowTreeRegistry.h deleted file mode 100644 index 24ac33a8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/ShadowTreeRegistry.h +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include - -#include -#include - -namespace facebook { -namespace react { - -/* - * Owning registry of `ShadowTree`s. - */ -class ShadowTreeRegistry final { - public: - ShadowTreeRegistry() = default; - - /* - * Adds a `ShadowTree` instance to the registry. - * The ownership of the instance is also transferred to the registry. - * Can be called from any thread. - */ - void add(std::unique_ptr &&shadowTree) const; - - /* - * Removes a `ShadowTree` instance with given `surfaceId` from the registry - * and returns it as a result. - * The ownership of the instance is also transferred to the caller. - * Can be called from any thread. - */ - std::unique_ptr remove(SurfaceId surfaceId) const; - - /* - * Finds a `ShadowTree` instance with a given `surfaceId` in the registry and - * synchronously calls the `callback` with a reference to the instance while - * the mutex is being acquired. - * Returns `true` if the registry has `ShadowTree` instance with corresponding - * `surfaceId`, otherwise returns `false` without calling the `callback`. - * Can be called from any thread. - */ - bool visit( - SurfaceId surfaceId, - std::function callback) const; - - private: - mutable folly::SharedMutex mutex_; - mutable std::unordered_map> - registry_; // Protected by `mutex_`. -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/TimeUtils.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/TimeUtils.h deleted file mode 100644 index 7c7bc3fa..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/TimeUtils.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2004-present Facebook. All Rights Reserved. - -#pragma once - -namespace facebook { -namespace react { - -inline static long getTime() { -#ifdef ANDROID - static const int64_t NANOSECONDS_IN_SECOND = 1000000000LL; - static const int64_t NANOSECONDS_IN_MILLISECOND = 1000000LL; - - // Since SystemClock.uptimeMillis() is commonly used for performance - // measurement in Java and uptimeMillis() internally uses - // clock_gettime(CLOCK_MONOTONIC), we use the same API here. We need that to - // make sure we use the same time system on both JS and Java sides. Links to - // the source code: - // https://android.googlesource.com/platform/frameworks/native/+/jb-mr1-release/libs/utils/SystemClock.cpp - // https://android.googlesource.com/platform/system/core/+/master/libutils/Timers.cpp - struct timespec now; - clock_gettime(CLOCK_MONOTONIC, &now); - int64_t nano = now.tv_sec * NANOSECONDS_IN_SECOND + now.tv_nsec; - return nano / (double)NANOSECONDS_IN_MILLISECOND; -#else - return 0l; -#endif -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UIManager.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UIManager.cpp deleted file mode 100644 index 082b0b06..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UIManager.cpp +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright 2004-present Facebook. All Rights Reserved. - -#include "UIManager.h" - -#include -#include -#include - -namespace facebook { -namespace react { - -SharedShadowNode UIManager::createNode( - Tag tag, - const ComponentName &name, - SurfaceId surfaceId, - const RawProps &rawProps, - SharedEventTarget eventTarget) const { - SystraceSection s("UIManager::createNode"); - - auto &componentDescriptor = componentDescriptorRegistry_->at(name); - - auto shadowNode = componentDescriptor.createShadowNode( - {.tag = tag, - .rootTag = surfaceId, - .eventEmitter = - componentDescriptor.createEventEmitter(std::move(eventTarget), tag), - .props = componentDescriptor.cloneProps(nullptr, rawProps)}); - - if (delegate_) { - delegate_->uiManagerDidCreateShadowNode(shadowNode); - } - - return std::const_pointer_cast(shadowNode); -} - -SharedShadowNode UIManager::cloneNode( - const SharedShadowNode &shadowNode, - const SharedShadowNodeSharedList &children, - const RawProps *rawProps) const { - SystraceSection s("UIManager::cloneNode"); - - auto &componentDescriptor = - componentDescriptorRegistry_->at(shadowNode->getComponentHandle()); - - auto clonedShadowNode = componentDescriptor.cloneShadowNode( - *shadowNode, - { - .props = rawProps ? componentDescriptor.cloneProps( - shadowNode->getProps(), *rawProps) - : ShadowNodeFragment::nullSharedProps(), - .children = children, - }); - - return std::const_pointer_cast(clonedShadowNode); -} - -void UIManager::appendChild( - const SharedShadowNode &parentShadowNode, - const SharedShadowNode &childShadowNode) const { - SystraceSection s("UIManager::appendChild"); - - auto &componentDescriptor = - componentDescriptorRegistry_->at(parentShadowNode->getComponentHandle()); - componentDescriptor.appendChild(parentShadowNode, childShadowNode); -} - -void UIManager::completeSurface( - SurfaceId surfaceId, - const SharedShadowNodeUnsharedList &rootChildren) const { - SystraceSection s("UIManager::completeSurface"); - - if (delegate_) { - delegate_->uiManagerDidFinishTransaction( - surfaceId, rootChildren, getTime()); - } -} - -void UIManager::setNativeProps( - const SharedShadowNode &shadowNode, - const RawProps &rawProps) const { - SystraceSection s("UIManager::setNativeProps"); - - long startCommitTime = getTime(); - - auto &componentDescriptor = - componentDescriptorRegistry_->at(shadowNode->getComponentHandle()); - auto props = componentDescriptor.cloneProps(shadowNode->getProps(), rawProps); - auto newShadowNode = shadowNode->clone(ShadowNodeFragment{.props = props}); - - shadowTreeRegistry_->visit( - shadowNode->getRootTag(), [&](const ShadowTree &shadowTree) { - shadowTree.tryCommit( - [&](const SharedRootShadowNode &oldRootShadowNode) { - return oldRootShadowNode->clone(shadowNode, newShadowNode); - }, - startCommitTime); - }); -} - -LayoutMetrics UIManager::getRelativeLayoutMetrics( - const ShadowNode &shadowNode, - const ShadowNode *ancestorShadowNode) const { - SystraceSection s("UIManager::getRelativeLayoutMetrics"); - - long startCommitTime = getTime(); - - if (!ancestorShadowNode) { - shadowTreeRegistry_->visit( - shadowNode.getRootTag(), [&](const ShadowTree &shadowTree) { - shadowTree.tryCommit( - [&](const SharedRootShadowNode &oldRootShadowNode) { - ancestorShadowNode = oldRootShadowNode.get(); - return nullptr; - }, - startCommitTime); - }); - } - - auto layoutableShadowNode = - dynamic_cast(&shadowNode); - auto layoutableAncestorShadowNode = - dynamic_cast(ancestorShadowNode); - - if (!layoutableShadowNode || !layoutableAncestorShadowNode) { - return EmptyLayoutMetrics; - } - - return layoutableShadowNode->getRelativeLayoutMetrics( - *layoutableAncestorShadowNode); -} - -void UIManager::setShadowTreeRegistry(ShadowTreeRegistry *shadowTreeRegistry) { - shadowTreeRegistry_ = shadowTreeRegistry; -} - -void UIManager::setComponentDescriptorRegistry( - const SharedComponentDescriptorRegistry &componentDescriptorRegistry) { - componentDescriptorRegistry_ = componentDescriptorRegistry; -} - -void UIManager::setDelegate(UIManagerDelegate *delegate) { - delegate_ = delegate; -} - -UIManagerDelegate *UIManager::getDelegate() { - return delegate_; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UIManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UIManager.h deleted file mode 100644 index c39be133..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UIManager.h +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2004-present Facebook. All Rights Reserved. - -#pragma once - -#include -#include -#include - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class UIManager { - public: - void setShadowTreeRegistry(ShadowTreeRegistry *shadowTreeRegistry); - - void setComponentDescriptorRegistry( - const SharedComponentDescriptorRegistry &componentDescriptorRegistry); - - /* - * Sets and gets the UIManager's delegate. - * The delegate is stored as a raw pointer, so the owner must null - * the pointer before being destroyed. - */ - void setDelegate(UIManagerDelegate *delegate); - UIManagerDelegate *getDelegate(); - - private: - friend class UIManagerBinding; - - SharedShadowNode createNode( - Tag tag, - const std::string &name, - SurfaceId surfaceId, - const RawProps &props, - SharedEventTarget eventTarget) const; - - SharedShadowNode cloneNode( - const SharedShadowNode &shadowNode, - const SharedShadowNodeSharedList &children = nullptr, - const RawProps *rawProps = nullptr) const; - - void appendChild( - const SharedShadowNode &parentShadowNode, - const SharedShadowNode &childShadowNode) const; - - void completeSurface( - SurfaceId surfaceId, - const SharedShadowNodeUnsharedList &rootChildren) const; - - void setNativeProps( - const SharedShadowNode &shadowNode, - const RawProps &rawProps) const; - - /* - * Returns layout metrics of given `shadowNode` relative to - * `ancestorShadowNode` (relative to the root node in case if provided - * `ancestorShadowNode` is nullptr). - */ - LayoutMetrics getRelativeLayoutMetrics( - const ShadowNode &shadowNode, - const ShadowNode *ancestorShadowNode) const; - - ShadowTreeRegistry *shadowTreeRegistry_; - SharedComponentDescriptorRegistry componentDescriptorRegistry_; - UIManagerDelegate *delegate_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UIManagerBinding.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UIManagerBinding.cpp deleted file mode 100644 index 7fb8af5f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UIManagerBinding.cpp +++ /dev/null @@ -1,338 +0,0 @@ -// Copyright 2004-present Facebook. All Rights Reserved. - -#include "UIManagerBinding.h" - -#include - -#include - -namespace facebook { -namespace react { - -static jsi::Object getModule( - jsi::Runtime &runtime, - const std::string &moduleName) { - auto batchedBridge = - runtime.global().getPropertyAsObject(runtime, "__fbBatchedBridge"); - auto getCallableModule = - batchedBridge.getPropertyAsFunction(runtime, "getCallableModule"); - auto module = getCallableModule - .callWithThis( - runtime, - batchedBridge, - {jsi::String::createFromUtf8(runtime, moduleName)}) - .asObject(runtime); - return module; -} - -void UIManagerBinding::install( - jsi::Runtime &runtime, - std::shared_ptr uiManagerBinding) { - auto uiManagerModuleName = "nativeFabricUIManager"; - auto object = jsi::Object::createFromHostObject(runtime, uiManagerBinding); - runtime.global().setProperty(runtime, uiManagerModuleName, std::move(object)); -} - -UIManagerBinding::UIManagerBinding(std::unique_ptr uiManager) - : uiManager_(std::move(uiManager)) {} - -void UIManagerBinding::startSurface( - jsi::Runtime &runtime, - SurfaceId surfaceId, - const std::string &moduleName, - const folly::dynamic &initalProps) const { - folly::dynamic parameters = folly::dynamic::object(); - parameters["rootTag"] = surfaceId; - parameters["initialProps"] = initalProps; - - auto module = getModule(runtime, "AppRegistry"); - auto method = module.getPropertyAsFunction(runtime, "runApplication"); - - method.callWithThis( - runtime, - module, - {jsi::String::createFromUtf8(runtime, moduleName), - jsi::valueFromDynamic(runtime, parameters)}); -} - -void UIManagerBinding::stopSurface(jsi::Runtime &runtime, SurfaceId surfaceId) - const { - auto module = getModule(runtime, "ReactFabric"); - auto method = module.getPropertyAsFunction(runtime, "unmountComponentAtNode"); - - method.callWithThis(runtime, module, {jsi::Value{surfaceId}}); -} - -void UIManagerBinding::dispatchEvent( - jsi::Runtime &runtime, - const EventTarget *eventTarget, - const std::string &type, - const ValueFactory &payloadFactory) const { - SystraceSection s("UIManagerBinding::dispatchEvent"); - - auto payload = payloadFactory(runtime); - - auto instanceHandle = eventTarget - ? [&]() { - auto instanceHandle = eventTarget->getInstanceHandle(runtime); - if (instanceHandle.isUndefined()) { - return jsi::Value::null(); - } - - // Mixing `target` into `payload`. - assert(payload.isObject()); - payload.asObject(runtime).setProperty(runtime, "target", eventTarget->getTag()); - return instanceHandle; - }() - : jsi::Value::null(); - - auto &eventHandlerWrapper = - static_cast(*eventHandler_); - - eventHandlerWrapper.callback.call( - runtime, - {std::move(instanceHandle), - jsi::String::createFromUtf8(runtime, type), - std::move(payload)}); -} - -void UIManagerBinding::invalidate() const { - uiManager_->setShadowTreeRegistry(nullptr); - uiManager_->setDelegate(nullptr); -} - -jsi::Value UIManagerBinding::get( - jsi::Runtime &runtime, - const jsi::PropNameID &name) { - auto methodName = name.utf8(runtime); - auto &uiManager = *uiManager_; - - // Semantic: Creates a new node with given pieces. - if (methodName == "createNode") { - return jsi::Function::createFromHostFunction( - runtime, - name, - 5, - [&uiManager]( - jsi::Runtime &runtime, - const jsi::Value &thisValue, - const jsi::Value *arguments, - size_t count) -> jsi::Value { - return valueFromShadowNode( - runtime, - uiManager.createNode( - tagFromValue(runtime, arguments[0]), - componentNameFromValue(runtime, arguments[1]), - surfaceIdFromValue(runtime, arguments[2]), - RawProps(runtime, arguments[3]), - eventTargetFromValue(runtime, arguments[4], arguments[0]))); - }); - } - - // Semantic: Clones the node with *same* props and *same* children. - if (methodName == "cloneNode") { - return jsi::Function::createFromHostFunction( - runtime, - name, - 1, - [&uiManager]( - jsi::Runtime &runtime, - const jsi::Value &thisValue, - const jsi::Value *arguments, - size_t count) -> jsi::Value { - return valueFromShadowNode( - runtime, - uiManager.cloneNode(shadowNodeFromValue(runtime, arguments[0]))); - }); - } - - // Semantic: Clones the node with *same* props and *empty* children. - if (methodName == "cloneNodeWithNewChildren") { - return jsi::Function::createFromHostFunction( - runtime, - name, - 1, - [&uiManager]( - jsi::Runtime &runtime, - const jsi::Value &thisValue, - const jsi::Value *arguments, - size_t count) -> jsi::Value { - return valueFromShadowNode( - runtime, - uiManager.cloneNode( - shadowNodeFromValue(runtime, arguments[0]), - ShadowNode::emptySharedShadowNodeSharedList())); - }); - } - - // Semantic: Clones the node with *given* props and *same* children. - if (methodName == "cloneNodeWithNewProps") { - return jsi::Function::createFromHostFunction( - runtime, - name, - 2, - [&uiManager]( - jsi::Runtime &runtime, - const jsi::Value &thisValue, - const jsi::Value *arguments, - size_t count) -> jsi::Value { - const auto &rawProps = RawProps(runtime, arguments[1]); - return valueFromShadowNode( - runtime, - uiManager.cloneNode( - shadowNodeFromValue(runtime, arguments[0]), - nullptr, - &rawProps)); - }); - } - - // Semantic: Clones the node with *given* props and *empty* children. - if (methodName == "cloneNodeWithNewChildrenAndProps") { - return jsi::Function::createFromHostFunction( - runtime, - name, - 2, - [&uiManager]( - jsi::Runtime &runtime, - const jsi::Value &thisValue, - const jsi::Value *arguments, - size_t count) -> jsi::Value { - const auto &rawProps = RawProps(runtime, arguments[1]); - return valueFromShadowNode( - runtime, - uiManager.cloneNode( - shadowNodeFromValue(runtime, arguments[0]), - ShadowNode::emptySharedShadowNodeSharedList(), - &rawProps)); - }); - } - - if (methodName == "appendChild") { - return jsi::Function::createFromHostFunction( - runtime, - name, - 2, - [&uiManager]( - jsi::Runtime &runtime, - const jsi::Value &thisValue, - const jsi::Value *arguments, - size_t count) -> jsi::Value { - uiManager.appendChild( - shadowNodeFromValue(runtime, arguments[0]), - shadowNodeFromValue(runtime, arguments[1])); - return jsi::Value::undefined(); - }); - } - - if (methodName == "createChildSet") { - return jsi::Function::createFromHostFunction( - runtime, - name, - 1, - [](jsi::Runtime &runtime, - const jsi::Value &thisValue, - const jsi::Value *arguments, - size_t count) -> jsi::Value { - auto shadowNodeList = - std::make_shared(SharedShadowNodeList({})); - return valueFromShadowNodeList(runtime, shadowNodeList); - }); - } - - if (methodName == "appendChildToSet") { - return jsi::Function::createFromHostFunction( - runtime, - name, - 2, - [](jsi::Runtime &runtime, - const jsi::Value &thisValue, - const jsi::Value *arguments, - size_t count) -> jsi::Value { - auto shadowNodeList = shadowNodeListFromValue(runtime, arguments[0]); - auto shadowNode = shadowNodeFromValue(runtime, arguments[1]); - shadowNodeList->push_back(shadowNode); - return jsi::Value::undefined(); - }); - } - - if (methodName == "completeRoot") { - return jsi::Function::createFromHostFunction( - runtime, - name, - 2, - [&uiManager]( - jsi::Runtime &runtime, - const jsi::Value &thisValue, - const jsi::Value *arguments, - size_t count) -> jsi::Value { - uiManager.completeSurface( - surfaceIdFromValue(runtime, arguments[0]), - shadowNodeListFromValue(runtime, arguments[1])); - return jsi::Value::undefined(); - }); - } - - if (methodName == "registerEventHandler") { - return jsi::Function::createFromHostFunction( - runtime, - name, - 1, - [this]( - jsi::Runtime &runtime, - const jsi::Value &thisValue, - const jsi::Value *arguments, - size_t count) -> jsi::Value { - auto eventHandler = - arguments[0].getObject(runtime).getFunction(runtime); - eventHandler_ = - std::make_unique(std::move(eventHandler)); - return jsi::Value::undefined(); - }); - } - - if (methodName == "getRelativeLayoutMetrics") { - return jsi::Function::createFromHostFunction( - runtime, - name, - 2, - [&uiManager]( - jsi::Runtime &runtime, - const jsi::Value &thisValue, - const jsi::Value *arguments, - size_t count) -> jsi::Value { - auto layoutMetrics = uiManager.getRelativeLayoutMetrics( - *shadowNodeFromValue(runtime, arguments[0]), - shadowNodeFromValue(runtime, arguments[1]).get()); - auto frame = layoutMetrics.frame; - auto result = jsi::Object(runtime); - result.setProperty(runtime, "left", frame.origin.x); - result.setProperty(runtime, "top", frame.origin.y); - result.setProperty(runtime, "width", frame.size.width); - result.setProperty(runtime, "height", frame.size.height); - return result; - }); - } - - if (methodName == "setNativeProps") { - return jsi::Function::createFromHostFunction( - runtime, - name, - 2, - [&uiManager]( - jsi::Runtime &runtime, - const jsi::Value &thisValue, - const jsi::Value *arguments, - size_t count) -> jsi::Value { - uiManager.setNativeProps( - shadowNodeFromValue(runtime, arguments[0]), - RawProps(runtime, arguments[1])); - - return jsi::Value::undefined(); - }); - } - - return jsi::Value::undefined(); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UIManagerBinding.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UIManagerBinding.h deleted file mode 100644 index 1c95c6e1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UIManagerBinding.h +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2004-present Facebook. All Rights Reserved. - -#pragma once - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -/* - * Exposes UIManager to JavaScript realm. - */ -class UIManagerBinding : public jsi::HostObject { - public: - /* - * Installs UIManagerBinding into JavaSctipt runtime. - * Thread synchronization must be enforced externally. - */ - static void install( - jsi::Runtime &runtime, - std::shared_ptr uiManagerBinding); - - UIManagerBinding(std::unique_ptr uiManager); - - /* - * Starts React Native Surface with given id, moduleName, and props. - * Thread synchronization must be enforced externally. - */ - void startSurface( - jsi::Runtime &runtime, - SurfaceId surfaceId, - const std::string &moduleName, - const folly::dynamic &initalProps) const; - - /* - * Stops React Native Surface with given id. - * Thread synchronization must be enforced externally. - */ - void stopSurface(jsi::Runtime &runtime, SurfaceId surfaceId) const; - - /* - * Delivers raw event data to JavaScript. - * Thread synchronization must be enforced externally. - */ - void dispatchEvent( - jsi::Runtime &runtime, - const EventTarget *eventTarget, - const std::string &type, - const ValueFactory &payloadFactory) const; - - /* - * Invalidates the binding and underlying UIManager. - * Allows to save some resources and prevents UIManager's delegate to be - * called. - * Calling public methods of this class after calling this method is UB. - * Can be called on any thread. - */ - void invalidate() const; - - /* - * `jsi::HostObject` specific overloads. - */ - jsi::Value get(jsi::Runtime &runtime, const jsi::PropNameID &name) override; - - private: - std::unique_ptr uiManager_; - std::unique_ptr eventHandler_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UIManagerDelegate.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UIManagerDelegate.h deleted file mode 100644 index b2841b58..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UIManagerDelegate.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -/* - * Abstract class for UIManager's delegate. - */ -class UIManagerDelegate { - public: - /* - * Called right after the new/updated Shadow Node tree is constructed. - * The tree is not layed out and not sealed at this time. - */ - virtual void uiManagerDidFinishTransaction( - SurfaceId surfaceId, - const SharedShadowNodeUnsharedList &rootChildNodes, - long startCommitTime) = 0; - - /* - * Called each time when UIManager constructs a new Shadow Node. Receiver - * maight use this to preluminary optimistically allocate a new native view - * instances. - */ - virtual void uiManagerDidCreateShadowNode( - const SharedShadowNode &shadowNode) = 0; - - virtual ~UIManagerDelegate() noexcept = default; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UITemplateProcessor.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UITemplateProcessor.cpp deleted file mode 100644 index 4a245fa2..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UITemplateProcessor.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "UITemplateProcessor.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -bool constexpr DEBUG_FLY = false; - -struct RBCContext { - const Tag rootTag; - const std::vector &nodes; - const std::vector ®isters; - const ComponentDescriptorRegistry &componentDescriptorRegistry; - const NativeModuleRegistry &nativeModuleRegistry; -}; - -// TODO: use RBCContext instead of all the separate arguments. -SharedShadowNode UITemplateProcessor::runCommand( - const folly::dynamic &command, - Tag rootTag, - std::vector &nodes, - std::vector ®isters, - const ComponentDescriptorRegistry &componentDescriptorRegistry, - const NativeModuleRegistry &nativeModuleRegistry, - const std::shared_ptr reactNativeConfig) { - const std::string &opcode = command[0].asString(); - const int tagOffset = 420000; - // TODO: change to integer codes and a switch statement - if (opcode == "createNode") { - int tag = command[1].asInt(); - const auto &type = command[2].asString(); - const auto parentTag = command[3].asInt(); - const auto &props = command[4]; - nodes[tag] = componentDescriptorRegistry.createNode( - tag + tagOffset, type, rootTag, props, nullptr); - if (parentTag > -1) { // parentTag == -1 indicates root node - auto parentShadowNode = nodes[parentTag]; - const SharedComponentDescriptor &componentDescriptor = - componentDescriptorRegistry[parentShadowNode]; - componentDescriptor->appendChild(parentShadowNode, nodes[tag]); - } - } else if (opcode == "returnRoot") { - LOG(INFO) - << "(stop) UITemplateProcessor inject serialized 'server rendered' view tree"; - return nodes[command[1].asInt()]; - } else if (opcode == "loadNativeBool") { - int registerNumber = command[1].asInt(); - std::string param = command[4][0].asString(); - registers[registerNumber] = reactNativeConfig->getBool(param); - } else if (opcode == "conditional") { - int registerNumber = command[1].asInt(); - auto conditionDynamic = registers[registerNumber]; - if (conditionDynamic.isNull()) { - // TODO: provide original command or command line? - auto err = std::runtime_error( - "register " + command[1].asString() + " wasn't loaded before access"); - throw err; - } else if (conditionDynamic.type() != folly::dynamic::BOOL) { - // TODO: provide original command or command line? - auto err = std::runtime_error( - "register " + command[1].asString() + " had type '" + - conditionDynamic.typeName() + - "' but needs to be 'boolean' for conditionals"); - throw err; - } - const auto &nextCommands = - conditionDynamic.asBool() ? command[2] : command[3]; - for (const auto &nextCommand : nextCommands) { - runCommand( - nextCommand, - rootTag, - nodes, - registers, - componentDescriptorRegistry, - nativeModuleRegistry, - reactNativeConfig); - } - } else { - throw std::runtime_error("Unsupported opcode: " + command[0].asString()); - } - return nullptr; -} - -SharedShadowNode UITemplateProcessor::buildShadowTree( - const std::string &jsonStr, - Tag rootTag, - const folly::dynamic ¶ms, - const ComponentDescriptorRegistry &componentDescriptorRegistry, - const NativeModuleRegistry &nativeModuleRegistry, - const std::shared_ptr reactNativeConfig) { - LOG(INFO) - << "(strt) UITemplateProcessor inject hardcoded 'server rendered' view tree"; - - std::string content = jsonStr; - for (const auto ¶m : params.items()) { - const auto &key = param.first.asString(); - size_t start_pos = content.find(key); - if (start_pos != std::string::npos) { - content.replace(start_pos, key.length(), param.second.asString()); - } - } - auto parsed = folly::parseJson(content); - auto commands = parsed["commands"]; - std::vector nodes(commands.size() * 2); - std::vector registers(32); - for (const auto &command : commands) { - try { - if (DEBUG_FLY) { - LOG(INFO) << "try to run command " << folly::toJson(command); - } - auto ret = runCommand( - command, - rootTag, - nodes, - registers, - componentDescriptorRegistry, - nativeModuleRegistry, - reactNativeConfig); - if (ret != nullptr) { - return ret; - } - } catch (const std::exception &e) { - LOG(ERROR) << " >>> Exception <<< running previous command '" - << folly::toJson(command) << "': '" << e.what() << "'"; - } - } - LOG(ERROR) << "react ui template missing returnRoot command :("; - throw std::runtime_error( - "Missing returnRoot command in template content:\n" + content); - return SharedShadowNode{}; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UITemplateProcessor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UITemplateProcessor.h deleted file mode 100644 index d3ad9c3f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/UITemplateProcessor.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -// Temporary NativeModuleRegistry definition -using NativeModuleCallFn = - std::function; - -class NativeModuleRegistry { - public: - void registerModule( - const std::string &moduleName, - NativeModuleCallFn callFn) { - modules_.emplace(moduleName, callFn); - } - - folly::dynamic call( - const std::string &moduleName, - const std::string &methodName, - const folly::dynamic &args) const { - return modules_.at(moduleName)(methodName, args); - } - - private: - std::unordered_map modules_; -}; - -class UITemplateProcessor { - public: - static SharedShadowNode buildShadowTree( - const std::string &jsonStr, - int rootTag, - const folly::dynamic ¶ms, - const ComponentDescriptorRegistry &componentDescriptorRegistry, - const NativeModuleRegistry &nativeModuleRegistry, - const std::shared_ptr reactNativeConfig); - - private: - static SharedShadowNode runCommand( - const folly::dynamic &command, - Tag rootTag, - std::vector &nodes, - std::vector ®isters, - const ComponentDescriptorRegistry &componentDescriptorRegistry, - const NativeModuleRegistry &nativeModuleRegistry, - const std::shared_ptr reactNativeConfig); -}; -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/primitives.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/primitives.h deleted file mode 100644 index 549d541f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/primitives.h +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2004-present Facebook. All Rights Reserved. - -#pragma once - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -using RuntimeExecutor = std::function &&callback)>; - -struct EventHandlerWrapper : public EventHandler { - EventHandlerWrapper(jsi::Function eventHandler) - : callback(std::move(eventHandler)) {} - - jsi::Function callback; -}; - -struct ShadowNodeWrapper : public jsi::HostObject { - ShadowNodeWrapper(SharedShadowNode shadowNode) - : shadowNode(std::move(shadowNode)) {} - - SharedShadowNode shadowNode; -}; - -struct ShadowNodeListWrapper : public jsi::HostObject { - ShadowNodeListWrapper(SharedShadowNodeUnsharedList shadowNodeList) - : shadowNodeList(shadowNodeList) {} - - SharedShadowNodeUnsharedList shadowNodeList; -}; - -inline static SharedShadowNode shadowNodeFromValue( - jsi::Runtime &runtime, - const jsi::Value &value) { - return value.getObject(runtime) - .getHostObject(runtime) - ->shadowNode; -} - -inline static jsi::Value valueFromShadowNode( - jsi::Runtime &runtime, - const SharedShadowNode &shadowNode) { - return jsi::Object::createFromHostObject( - runtime, std::make_shared(shadowNode)); -} - -inline static SharedShadowNodeUnsharedList shadowNodeListFromValue( - jsi::Runtime &runtime, - const jsi::Value &value) { - return value.getObject(runtime) - .getHostObject(runtime) - ->shadowNodeList; -} - -inline static jsi::Value valueFromShadowNodeList( - jsi::Runtime &runtime, - const SharedShadowNodeUnsharedList &shadowNodeList) { - return jsi::Object::createFromHostObject( - runtime, std::make_unique(shadowNodeList)); -} - -inline static SharedEventTarget eventTargetFromValue( - jsi::Runtime &runtime, - const jsi::Value &eventTargetValue, - const jsi::Value &tagValue) { - return std::make_shared( - runtime, eventTargetValue, tagValue.getNumber()); -} - -inline static Tag tagFromValue(jsi::Runtime &runtime, const jsi::Value &value) { - return (Tag)value.getNumber(); -} - -inline static SurfaceId surfaceIdFromValue( - jsi::Runtime &runtime, - const jsi::Value &value) { - return (SurfaceId)value.getNumber(); -} - -inline static ComponentName componentNameFromValue( - jsi::Runtime &runtime, - const jsi::Value &value) { - return value.getString(runtime).utf8(runtime); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/tests/FabricUIManagerTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/tests/FabricUIManagerTest.cpp deleted file mode 100644 index 59dbbab0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/tests/FabricUIManagerTest.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include -#include - -using namespace facebook::react; - -TEST(UIManagerTest, testSomething) { - // TODO -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/tests/UITemplateProcessorTest.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/tests/UITemplateProcessorTest.cpp deleted file mode 100644 index a546f766..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/fabric/uimanager/tests/UITemplateProcessorTest.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include -#include -#include - -using namespace facebook::react; - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -// TODO (T29441913): Codegen this app-specific implementation. -ComponentRegistryFactory getDefaultComponentRegistryFactory() { - return [](const SharedEventDispatcher &eventDispatcher, - const SharedContextContainer &contextContainer) { - auto registry = std::make_shared(); - registry->registerComponentDescriptor( - std::make_shared(eventDispatcher)); - registry->registerComponentDescriptor( - std::make_shared( - eventDispatcher, contextContainer)); - registry->registerComponentDescriptor( - std::make_shared(eventDispatcher)); - registry->registerComponentDescriptor( - std::make_shared( - eventDispatcher, contextContainer)); - registry->registerComponentDescriptor( - std::make_shared(eventDispatcher)); - registry->registerComponentDescriptor( - std::make_shared(eventDispatcher)); - registry->registerComponentDescriptor( - std::make_shared( - eventDispatcher)); - return registry; - }; -} - -bool mockSimpleTestValue_; - -NativeModuleRegistry buildNativeModuleRegistry(); - -NativeModuleRegistry buildNativeModuleRegistry() { - NativeModuleRegistry nMR; - nMR.registerModule( - "MobileConfig", - [&](const std::string &methodName, const folly::dynamic &args) { - return mockSimpleTestValue_; - }); - return nMR; -} - -class MockReactNativeConfig : public ReactNativeConfig { - public: - MockReactNativeConfig() {} - bool getBool(const std::string ¶m) const override { - return mockSimpleTestValue_; - } - - std::string getString(const std::string ¶m) const override { - return ""; - } - - int64_t getInt64(const std::string ¶m) const override { - return 0; - } - - double getDouble(const std::string ¶m) const override { - return 0.0; - } -}; - -std::shared_ptr mockReactNativeConfig_ = - std::make_shared(); - -} // namespace react -} // namespace facebook - -TEST(UITemplateProcessorTest, testSimpleBytecode) { - auto surfaceId = 11; - auto componentDescriptorRegistry = - getDefaultComponentRegistryFactory()(nullptr, nullptr); - auto nativeModuleRegistry = buildNativeModuleRegistry(); - - auto bytecode = R"delim({"version":0.1,"commands":[ - ["createNode",2,"RCTView",-1,{"opacity": 0.5, "testId": "root"}], - ["createNode",4,"RCTView",2,{"testId": "child"}], - ["returnRoot",2] - ]})delim"; - - mockSimpleTestValue_ = true; - - auto root1 = UITemplateProcessor::buildShadowTree( - bytecode, - surfaceId, - folly::dynamic::object(), - *componentDescriptorRegistry, - nativeModuleRegistry, - mockReactNativeConfig_); -#ifndef NDEBUG - LOG(INFO) << std::endl << root1->getDebugDescription(); -#endif - auto props1 = std::dynamic_pointer_cast(root1->getProps()); - ASSERT_NEAR(props1->opacity, 0.5, 0.001); - ASSERT_STREQ(props1->testId.c_str(), "root"); - auto children1 = root1->getChildren(); - ASSERT_EQ(children1.size(), 1); - auto child_props1 = - std::dynamic_pointer_cast(children1.at(0)->getProps()); - ASSERT_STREQ(child_props1->testId.c_str(), "child"); -} - -TEST(UITemplateProcessorTest, testConditionalBytecode) { - auto surfaceId = 11; - auto componentDescriptorRegistry = - getDefaultComponentRegistryFactory()(nullptr, nullptr); - auto nativeModuleRegistry = buildNativeModuleRegistry(); - - auto bytecode = R"delim({"version":0.1,"commands":[ - ["createNode",2,"RCTView",-1,{"testId": "root"}], - ["loadNativeBool",1,"MobileConfig","getBool",["qe:simple_test"]], - ["conditional",1, - [["createNode",4,"RCTView",2,{"testId": "cond_true"}]], - [["createNode",4,"RCTView",2,{"testId": "cond_false"}]] - ], - ["returnRoot",2] - ]})delim"; - - mockSimpleTestValue_ = true; - - auto root1 = UITemplateProcessor::buildShadowTree( - bytecode, - surfaceId, - folly::dynamic::object(), - *componentDescriptorRegistry, - nativeModuleRegistry, - mockReactNativeConfig_); -#ifndef NDEBUG - LOG(INFO) << std::endl << root1->getDebugDescription(); -#endif - auto props1 = std::dynamic_pointer_cast(root1->getProps()); - ASSERT_STREQ(props1->testId.c_str(), "root"); - auto children1 = root1->getChildren(); - ASSERT_EQ(children1.size(), 1); - auto child_props1 = - std::dynamic_pointer_cast(children1.at(0)->getProps()); - ASSERT_STREQ(child_props1->testId.c_str(), "cond_true"); - - mockSimpleTestValue_ = false; - - auto root2 = UITemplateProcessor::buildShadowTree( - bytecode, - surfaceId, - folly::dynamic::object(), - *componentDescriptorRegistry, - nativeModuleRegistry, - mockReactNativeConfig_); - auto child_props2 = std::dynamic_pointer_cast( - root2->getChildren().at(0)->getProps()); - ASSERT_STREQ(child_props2->testId.c_str(), "cond_false"); -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/Android.mk b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/Android.mk deleted file mode 100644 index 4e650d9c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/Android.mk +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := jsi - -LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) - -LOCAL_C_INCLUDES += $(LOCAL_PATH)/.. -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) - -LOCAL_CFLAGS := -fexceptions -frtti -O3 -LOCAL_SHARED_LIBRARIES := libfolly_json libjsc glog - -include $(BUILD_STATIC_LIBRARY) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/BUCK deleted file mode 100644 index 871ea598..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/BUCK +++ /dev/null @@ -1,110 +0,0 @@ -# BUILD FILE SYNTAX: SKYLARK - -load("//tools/build_defs/oss:rn_defs.bzl", "react_native_xplat_dep", "rn_xplat_cxx_library") - -rn_xplat_cxx_library( - name = "jsi", - srcs = [ - "jsi.cpp", - ], - header_namespace = "jsi", - exported_headers = [ - "instrumentation.h", - "jsi.h", - "jsi-inl.h", - ], - compiler_flags = [ - "-O3", - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - "-Werror", - "-Wextra", - "-Wcast-qual", - "-Wdelete-non-virtual-dtor", - "-Wwrite-strings", - ], - cxx_compiler_flags = [ - "-Wglobal-constructors", - "-Wmissing-prototypes", - ], - fbobjc_compiler_flags = [ - "-Wglobal-constructors", - "-Wmissing-prototypes", - ], - visibility = ["PUBLIC"], -) - -rn_xplat_cxx_library( - name = "JSIDynamic", - srcs = [ - "JSIDynamic.cpp", - ], - header_namespace = "jsi", - exported_headers = [ - "JSIDynamic.h", - ], - compiler_flags = [ - "-fexceptions", - "-frtti", - ], - fbobjc_force_static = True, - visibility = [ - "PUBLIC", - ], - xcode_public_headers_symlinks = True, - deps = [ - "xplat//folly:molly", - react_native_xplat_dep("jsi:jsi"), - ], -) - -rn_xplat_cxx_library( - name = "JSCRuntime", - srcs = [ - "JSCRuntime.cpp", - ], - header_namespace = "jsi", - exported_headers = [ - "JSCRuntime.h", - ], - cxx_exported_platform_linker_flags = [ - ( - "macosx-x86_64", - [ - "-framework", - "JavaScriptCore", - ], - ), - ], - cxx_platform_deps = [ - ( - "^(linux|gcc|platform)", - [ - "xplat//jsc:jsc", - ], - ), - ], - fbandroid_compiler_flags = [ - "-fexceptions", - "-frtti", - "-O3", - ], - fbandroid_deps = [ - "xplat//jsc:jsc", - ], - fbobjc_compiler_flags = [ - "-Os", - ], - fbobjc_frameworks = [ - "$SDKROOT/System/Library/Frameworks/JavaScriptCore.framework", - ], - visibility = ["PUBLIC"], - xplat_mangled_args = { - "soname": "libjscjsi.$(ext)", - }, - exported_deps = [ - react_native_xplat_dep("jsi:jsi"), - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/JSCRuntime.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/JSCRuntime.cpp deleted file mode 100644 index 6656eee7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/JSCRuntime.cpp +++ /dev/null @@ -1,1230 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the - // LICENSE file in the root directory of this source tree. - -#include "JSCRuntime.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace jsc { - -namespace detail { -class ArgsConverter; -} // namespace detail - -class JSCRuntime; - -struct Lock { - void lock(const jsc::JSCRuntime&) const {} - void unlock(const jsc::JSCRuntime&) const {} -}; - -class JSCRuntime : public jsi::Runtime { - public: - // Creates new context in new context group - JSCRuntime(); - // Retains ctx - JSCRuntime(JSGlobalContextRef ctx); - ~JSCRuntime(); - - void evaluateJavaScript( - std::unique_ptr buffer, - const std::string& sourceURL) override; - jsi::Object global() override; - - std::string description() override; - - bool isInspectable() override; - - void setDescription(const std::string& desc); - - // Please don't use the following two functions, only exposed for - // integration efforts. - JSGlobalContextRef getContext() { - return ctx_; - } - - // JSValueRef->JSValue (needs make.*Value so it must be member function) - jsi::Value createValue(JSValueRef value) const; - - // Value->JSValueRef (similar to above) - JSValueRef valueRef(const jsi::Value& value); - - protected: - friend class detail::ArgsConverter; - class JSCStringValue final : public PointerValue { -#ifndef NDEBUG - JSCStringValue(JSStringRef str, std::atomic& counter); -#else - JSCStringValue(JSStringRef str); -#endif - void invalidate() override; - - JSStringRef str_; -#ifndef NDEBUG - std::atomic& counter_; -#endif - protected: - friend class JSCRuntime; - }; - - class JSCObjectValue final : public PointerValue { - JSCObjectValue( - JSGlobalContextRef ctx, - const std::atomic& ctxInvalid, - JSObjectRef obj -#ifndef NDEBUG - , - std::atomic& counter -#endif - ); - - void invalidate() override; - - JSGlobalContextRef ctx_; - const std::atomic& ctxInvalid_; - JSObjectRef obj_; -#ifndef NDEBUG - std::atomic& counter_; -#endif - protected: - friend class JSCRuntime; - }; - - PointerValue* cloneString(const Runtime::PointerValue* pv) override; - PointerValue* cloneObject(const Runtime::PointerValue* pv) override; - PointerValue* clonePropNameID(const Runtime::PointerValue* pv) override; - - jsi::PropNameID createPropNameIDFromAscii(const char* str, size_t length) - override; - jsi::PropNameID createPropNameIDFromUtf8(const uint8_t* utf8, size_t length) - override; - jsi::PropNameID createPropNameIDFromString(const jsi::String& str) override; - std::string utf8(const jsi::PropNameID&) override; - bool compare(const jsi::PropNameID&, const jsi::PropNameID&) override; - - jsi::String createStringFromAscii(const char* str, size_t length) override; - jsi::String createStringFromUtf8(const uint8_t* utf8, size_t length) override; - std::string utf8(const jsi::String&) override; - - jsi::Object createObject() override; - jsi::Object createObject(std::shared_ptr ho) override; - virtual std::shared_ptr getHostObject( - const jsi::Object&) override; - jsi::HostFunctionType& getHostFunction(const jsi::Function&) override; - - jsi::Value getProperty(const jsi::Object&, const jsi::String& name) override; - jsi::Value getProperty(const jsi::Object&, const jsi::PropNameID& name) - override; - bool hasProperty(const jsi::Object&, const jsi::String& name) override; - bool hasProperty(const jsi::Object&, const jsi::PropNameID& name) override; - void setPropertyValue( - jsi::Object&, - const jsi::String& name, - const jsi::Value& value) override; - void setPropertyValue( - jsi::Object&, - const jsi::PropNameID& name, - const jsi::Value& value) override; - bool isArray(const jsi::Object&) const override; - bool isArrayBuffer(const jsi::Object&) const override; - bool isFunction(const jsi::Object&) const override; - bool isHostObject(const jsi::Object&) const override; - bool isHostFunction(const jsi::Function&) const override; - jsi::Array getPropertyNames(const jsi::Object&) override; - - jsi::WeakObject createWeakObject(const jsi::Object&) override; - jsi::Value lockWeakObject(const jsi::WeakObject&) override; - - jsi::Array createArray(size_t length) override; - size_t size(const jsi::Array&) override; - size_t size(const jsi::ArrayBuffer&) override; - uint8_t* data(const jsi::ArrayBuffer&) override; - jsi::Value getValueAtIndex(const jsi::Array&, size_t i) override; - void setValueAtIndexImpl(jsi::Array&, size_t i, const jsi::Value& value) - override; - - jsi::Function createFunctionFromHostFunction( - const jsi::PropNameID& name, - unsigned int paramCount, - jsi::HostFunctionType func) override; - jsi::Value call( - const jsi::Function&, - const jsi::Value& jsThis, - const jsi::Value* args, - size_t count) override; - jsi::Value callAsConstructor( - const jsi::Function&, - const jsi::Value* args, - size_t count) override; - - bool strictEquals(const jsi::String& a, const jsi::String& b) const override; - bool strictEquals(const jsi::Object& a, const jsi::Object& b) const override; - bool instanceOf(const jsi::Object& o, const jsi::Function& f) override; - - private: - // Basically convenience casts - static JSStringRef stringRef(const jsi::String& str); - static JSStringRef stringRef(const jsi::PropNameID& sym); - static JSObjectRef objectRef(const jsi::Object& obj); - - // Factory methods for creating String/Object - jsi::String createString(JSStringRef stringRef) const; - jsi::PropNameID createPropNameID(JSStringRef stringRef); - jsi::Object createObject(JSObjectRef objectRef) const; - - // Used by factory methods and clone methods - jsi::Runtime::PointerValue* makeStringValue(JSStringRef str) const; - jsi::Runtime::PointerValue* makeObjectValue(JSObjectRef obj) const; - - void checkException(JSValueRef exc); - void checkException(JSValueRef res, JSValueRef exc); - void checkException(JSValueRef exc, const char* msg); - void checkException(JSValueRef res, JSValueRef exc, const char* msg); - - JSGlobalContextRef ctx_; - std::atomic ctxInvalid_; - std::string desc_; -#ifndef NDEBUG - mutable std::atomic objectCounter_; - mutable std::atomic stringCounter_; -#endif -}; - -#ifndef __has_builtin -#define __has_builtin(x) 0 -#endif - -#if __has_builtin(__builtin_expect) || defined(__GNUC__) -#define JSC_LIKELY(EXPR) __builtin_expect((bool)(EXPR), true) -#define JSC_UNLIKELY(EXPR) __builtin_expect((bool)(EXPR), false) -#else -#define JSC_LIKELY(EXPR) (EXPR) -#define JSC_UNLIKELY(EXPR) (EXPR) -#endif - -#define JSC_ASSERT(x) \ - do { \ - if (JSC_UNLIKELY(!!(x))) { \ - abort(); \ - } \ - } while (0) - -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) -// This takes care of watch and tvos (due to backwards compatibility in -// Availability.h -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0 -#define _JSC_FAST_IS_ARRAY -#endif -#endif -#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11 -// Only one of these should be set for a build. If somehow that's not -// true, this will be a compile-time error and it can be resolved when -// we understand why. -#define _JSC_FAST_IS_ARRAY -#endif -#endif - -// JSStringRef utilities -namespace { -std::string JSStringToSTLString(JSStringRef str) { - size_t maxBytes = JSStringGetMaximumUTF8CStringSize(str); - std::vector buffer(maxBytes); - JSStringGetUTF8CString(str, buffer.data(), maxBytes); - return std::string(buffer.data()); -} - -JSStringRef getLengthString() { - static JSStringRef length = JSStringCreateWithUTF8CString("length"); - return length; -} - -JSStringRef getNameString() { - static JSStringRef name = JSStringCreateWithUTF8CString("name"); - return name; -} - -JSStringRef getFunctionString() { - static JSStringRef func = JSStringCreateWithUTF8CString("Function"); - return func; -} - -#if !defined(_JSC_FAST_IS_ARRAY) -JSStringRef getArrayString() { - static JSStringRef array = JSStringCreateWithUTF8CString("Array"); - return array; -} - -JSStringRef getIsArrayString() { - static JSStringRef isArray = JSStringCreateWithUTF8CString("isArray"); - return isArray; -} -#endif -} // namespace - -// std::string utility -namespace { -std::string to_string(void* value) { - std::ostringstream ss; - ss << value; - return ss.str(); -} -} // namespace - -JSCRuntime::JSCRuntime() - : JSCRuntime(JSGlobalContextCreateInGroup(nullptr, nullptr)) { - JSGlobalContextRelease(ctx_); -} - -JSCRuntime::JSCRuntime(JSGlobalContextRef ctx) - : ctx_(JSGlobalContextRetain(ctx)), - ctxInvalid_(false) -#ifndef NDEBUG - , - objectCounter_(0), - stringCounter_(0) -#endif -{ -} - -JSCRuntime::~JSCRuntime() { - // On shutting down and cleaning up: when JSC is actually torn down, - // it calls JSC::Heap::lastChanceToFinalize internally which - // finalizes anything left over. But at this point, - // JSValueUnprotect() can no longer be called. We use an - // atomic to avoid unsafe unprotects happening after shutdown - // has started. - ctxInvalid_ = true; - JSGlobalContextRelease(ctx_); -#ifndef NDEBUG - assert( - objectCounter_ == 0 && "JSCRuntime destroyed with a dangling API object"); - assert( - stringCounter_ == 0 && "JSCRuntime destroyed with a dangling API string"); -#endif -} - -void JSCRuntime::evaluateJavaScript( - std::unique_ptr buffer, - const std::string& sourceURL) { - std::string tmp( - reinterpret_cast(buffer->data()), buffer->size()); - JSStringRef sourceRef = JSStringCreateWithUTF8CString(tmp.c_str()); - JSStringRef sourceURLRef = nullptr; - if (!sourceURL.empty()) { - sourceURLRef = JSStringCreateWithUTF8CString(sourceURL.c_str()); - } - JSValueRef exc = nullptr; - JSValueRef res = - JSEvaluateScript(ctx_, sourceRef, nullptr, sourceURLRef, 0, &exc); - JSStringRelease(sourceRef); - if (sourceURLRef) { - JSStringRelease(sourceURLRef); - } - checkException(res, exc); -} - -jsi::Object JSCRuntime::global() { - return createObject(JSContextGetGlobalObject(ctx_)); -} - -std::string JSCRuntime::description() { - if (desc_.empty()) { - desc_ = std::string(""; - } - return desc_; -} - -bool JSCRuntime::isInspectable() { - return false; -} - -#ifndef NDEBUG -JSCRuntime::JSCStringValue::JSCStringValue( - JSStringRef str, - std::atomic& counter) - : str_(JSStringRetain(str)), counter_(counter) { - // Since std::atomic returns a copy instead of a reference when calling - // operator+= we must do this explicitly in the constructor - counter_ += 1; -} -#else -JSCRuntime::JSCStringValue::JSCStringValue(JSStringRef str) - : str_(JSStringRetain(str)) { -} -#endif - -void JSCRuntime::JSCStringValue::invalidate() { - // These JSC{String,Object}Value objects are implicitly owned by the - // {String,Object} objects, thus when a String/Object is destructed - // the JSC{String,Object}Value should be released. -#ifndef NDEBUG - counter_ -= 1; -#endif - JSStringRelease(str_); - // Angery reaccs only - delete this; -} - -JSCRuntime::JSCObjectValue::JSCObjectValue( - JSGlobalContextRef ctx, - const std::atomic& ctxInvalid, - JSObjectRef obj -#ifndef NDEBUG - , - std::atomic& counter -#endif - ) - : ctx_(ctx), - ctxInvalid_(ctxInvalid), - obj_(obj) -#ifndef NDEBUG - , - counter_(counter) -#endif -{ - JSValueProtect(ctx_, obj_); -#ifndef NDEBUG - counter_ += 1; -#endif -} - -void JSCRuntime::JSCObjectValue::invalidate() { -#ifndef NDEBUG - counter_ -= 1; -#endif - // When shutting down the VM, if there is a HostObject which - // contains or otherwise owns a jsi::Object, then the final GC will - // finalize the HostObject, leading to a call to invalidate(). But - // at that point, making calls to JSValueUnprotect will crash. - // It is up to the application to make sure that any other calls to - // invalidate() happen before VM destruction; see the comment on - // jsi::Runtime. - // - // Another potential concern here is that in the non-shutdown case, - // if a HostObject is GCd, JSValueUnprotect will be called from the - // JSC finalizer. The documentation warns against this: "You must - // not call any function that may cause a garbage collection or an - // allocation of a garbage collected object from within a - // JSObjectFinalizeCallback. This includes all functions that have a - // JSContextRef parameter." However, an audit of the source code for - // JSValueUnprotect in late 2018 shows that it cannot cause - // allocation or a GC, and further, this code has not changed in - // about two years. In the future, we may choose to reintroduce the - // mechanism previously used here which uses a separate thread for - // JSValueUnprotect, in order to conform to the documented API, but - // use the "unsafe" synchronous version on iOS 11 and earlier. - - if (!ctxInvalid_) { - JSValueUnprotect(ctx_, obj_); - } - delete this; -} - -jsi::Runtime::PointerValue* JSCRuntime::cloneString( - const jsi::Runtime::PointerValue* pv) { - if (!pv) { - return nullptr; - } - const JSCStringValue* string = static_cast(pv); - return makeStringValue(string->str_); -} - -jsi::Runtime::PointerValue* JSCRuntime::cloneObject( - const jsi::Runtime::PointerValue* pv) { - if (!pv) { - return nullptr; - } - const JSCObjectValue* object = static_cast(pv); - assert( - object->ctx_ == ctx_ && - "Don't try to clone an object backed by a different Runtime"); - return makeObjectValue(object->obj_); -} - -jsi::Runtime::PointerValue* JSCRuntime::clonePropNameID( - const jsi::Runtime::PointerValue* pv) { - if (!pv) { - return nullptr; - } - const JSCStringValue* string = static_cast(pv); - return makeStringValue(string->str_); -} - -jsi::PropNameID JSCRuntime::createPropNameIDFromAscii( - const char* str, - size_t length) { - // For system JSC this must is identical to a string - std::string tmp(str, length); - JSStringRef strRef = JSStringCreateWithUTF8CString(tmp.c_str()); - auto res = createPropNameID(strRef); - JSStringRelease(strRef); - return res; -} - -jsi::PropNameID JSCRuntime::createPropNameIDFromUtf8( - const uint8_t* utf8, - size_t length) { - std::string tmp(reinterpret_cast(utf8), length); - JSStringRef strRef = JSStringCreateWithUTF8CString(tmp.c_str()); - auto res = createPropNameID(strRef); - JSStringRelease(strRef); - return res; -} - -jsi::PropNameID JSCRuntime::createPropNameIDFromString(const jsi::String& str) { - return createPropNameID(stringRef(str)); -} - -std::string JSCRuntime::utf8(const jsi::PropNameID& sym) { - return JSStringToSTLString(stringRef(sym)); -} - -bool JSCRuntime::compare(const jsi::PropNameID& a, const jsi::PropNameID& b) { - return JSStringIsEqual(stringRef(a), stringRef(b)); -} - -jsi::String JSCRuntime::createStringFromAscii(const char* str, size_t length) { - // Yes we end up double casting for semantic reasons (UTF8 contains ASCII, - // not the other way around) - return this->createStringFromUtf8( - reinterpret_cast(str), length); -} - -jsi::String JSCRuntime::createStringFromUtf8( - const uint8_t* str, - size_t length) { - std::string tmp(reinterpret_cast(str), length); - JSStringRef stringRef = JSStringCreateWithUTF8CString(tmp.c_str()); - return createString(stringRef); -} - -std::string JSCRuntime::utf8(const jsi::String& str) { - return JSStringToSTLString(stringRef(str)); -} - -jsi::Object JSCRuntime::createObject() { - return createObject(static_cast(nullptr)); -} - -// HostObject details -namespace detail { -struct HostObjectProxyBase { - HostObjectProxyBase( - JSCRuntime& rt, - const std::shared_ptr& sho) - : runtime(rt), hostObject(sho) {} - - JSCRuntime& runtime; - std::shared_ptr hostObject; -}; -} // namespace detail - -namespace { -std::once_flag hostObjectClassOnceFlag; -JSClassRef hostObjectClass{}; -} // namespace - -jsi::Object JSCRuntime::createObject(std::shared_ptr ho) { - struct HostObjectProxy : public detail::HostObjectProxyBase { - static JSValueRef getProperty( - JSContextRef ctx, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) { - auto proxy = static_cast(JSObjectGetPrivate(object)); - auto& rt = proxy->runtime; - jsi::PropNameID sym = rt.createPropNameID(propertyName); - jsi::Value ret; - try { - ret = proxy->hostObject->get(rt, sym); - } catch (const jsi::JSError& error) { - *exception = rt.valueRef(error.value()); - return JSValueMakeUndefined(ctx); - } catch (const std::exception& ex) { - auto excValue = - rt.global() - .getPropertyAsFunction(rt, "Error") - .call( - rt, - std::string("Exception in HostObject::get: ") + ex.what()); - *exception = rt.valueRef(excValue); - return JSValueMakeUndefined(ctx); - } catch (...) { - auto excValue = - rt.global() - .getPropertyAsFunction(rt, "Error") - .call(rt, "Exception in HostObject::get: "); - *exception = rt.valueRef(excValue); - return JSValueMakeUndefined(ctx); - } - return rt.valueRef(ret); - } - - #define JSC_UNUSED(x) (void) (x); - - static bool setProperty( - JSContextRef ctx, - JSObjectRef object, - JSStringRef propName, - JSValueRef value, - JSValueRef* exception) { - JSC_UNUSED(ctx); - auto proxy = static_cast(JSObjectGetPrivate(object)); - auto& rt = proxy->runtime; - jsi::PropNameID sym = rt.createPropNameID(propName); - try { - proxy->hostObject->set(rt, sym, rt.createValue(value)); - } catch (const jsi::JSError& error) { - *exception = rt.valueRef(error.value()); - return false; - } catch (const std::exception& ex) { - auto excValue = - rt.global() - .getPropertyAsFunction(rt, "Error") - .call( - rt, - std::string("Exception in HostObject::set: ") + ex.what()); - *exception = rt.valueRef(excValue); - return false; - } catch (...) { - auto excValue = - rt.global() - .getPropertyAsFunction(rt, "Error") - .call(rt, "Exception in HostObject::set: "); - *exception = rt.valueRef(excValue); - return false; - } - return true; - } - - // JSC does not provide means to communicate errors from this callback, - // so the error handling strategy is very brutal - we'll just crash - // due to noexcept. - static void getPropertyNames( - JSContextRef ctx, - JSObjectRef object, - JSPropertyNameAccumulatorRef propertyNames) noexcept { - JSC_UNUSED(ctx); - auto proxy = static_cast(JSObjectGetPrivate(object)); - auto& rt = proxy->runtime; - auto names = proxy->hostObject->getPropertyNames(rt); - for (auto& name : names) { - JSPropertyNameAccumulatorAddName(propertyNames, stringRef(name)); - } - } - - #undef JSC_UNUSED - - static void finalize(JSObjectRef obj) { - auto hostObject = static_cast(JSObjectGetPrivate(obj)); - JSObjectSetPrivate(obj, nullptr); - delete hostObject; - } - - using HostObjectProxyBase::HostObjectProxyBase; - }; - - std::call_once(hostObjectClassOnceFlag, []() { - JSClassDefinition hostObjectClassDef = kJSClassDefinitionEmpty; - hostObjectClassDef.version = 0; - hostObjectClassDef.attributes = kJSClassAttributeNoAutomaticPrototype; - hostObjectClassDef.finalize = HostObjectProxy::finalize; - hostObjectClassDef.getProperty = HostObjectProxy::getProperty; - hostObjectClassDef.setProperty = HostObjectProxy::setProperty; - hostObjectClassDef.getPropertyNames = HostObjectProxy::getPropertyNames; - hostObjectClass = JSClassCreate(&hostObjectClassDef); - }); - - JSObjectRef obj = - JSObjectMake(ctx_, hostObjectClass, new HostObjectProxy(*this, ho)); - return createObject(obj); -} - -std::shared_ptr JSCRuntime::getHostObject( - const jsi::Object& obj) { - // We are guarenteed at this point to have isHostObject(obj) == true - // so the private data should be HostObjectMetadata - JSObjectRef object = objectRef(obj); - auto metadata = - static_cast(JSObjectGetPrivate(object)); - assert(metadata); - return metadata->hostObject; -} - -jsi::Value JSCRuntime::getProperty( - const jsi::Object& obj, - const jsi::String& name) { - JSObjectRef objRef = objectRef(obj); - JSValueRef exc = nullptr; - JSValueRef res = JSObjectGetProperty(ctx_, objRef, stringRef(name), &exc); - checkException(exc); - return createValue(res); -} - -jsi::Value JSCRuntime::getProperty( - const jsi::Object& obj, - const jsi::PropNameID& name) { - JSObjectRef objRef = objectRef(obj); - JSValueRef exc = nullptr; - JSValueRef res = JSObjectGetProperty(ctx_, objRef, stringRef(name), &exc); - checkException(exc); - return createValue(res); -} - -bool JSCRuntime::hasProperty(const jsi::Object& obj, const jsi::String& name) { - JSObjectRef objRef = objectRef(obj); - return JSObjectHasProperty(ctx_, objRef, stringRef(name)); -} - -bool JSCRuntime::hasProperty( - const jsi::Object& obj, - const jsi::PropNameID& name) { - JSObjectRef objRef = objectRef(obj); - return JSObjectHasProperty(ctx_, objRef, stringRef(name)); -} - -void JSCRuntime::setPropertyValue( - jsi::Object& object, - const jsi::PropNameID& name, - const jsi::Value& value) { - JSValueRef exc = nullptr; - JSObjectSetProperty( - ctx_, - objectRef(object), - stringRef(name), - valueRef(value), - kJSPropertyAttributeNone, - &exc); - checkException(exc); -} - -void JSCRuntime::setPropertyValue( - jsi::Object& object, - const jsi::String& name, - const jsi::Value& value) { - JSValueRef exc = nullptr; - JSObjectSetProperty( - ctx_, - objectRef(object), - stringRef(name), - valueRef(value), - kJSPropertyAttributeNone, - &exc); - checkException(exc); -} - -bool JSCRuntime::isArray(const jsi::Object& obj) const { -#if !defined(_JSC_FAST_IS_ARRAY) - JSObjectRef global = JSContextGetGlobalObject(ctx_); - JSStringRef arrayString = getArrayString(); - JSValueRef exc = nullptr; - JSValueRef arrayCtorValue = - JSObjectGetProperty(ctx_, global, arrayString, &exc); - JSC_ASSERT(exc); - JSObjectRef arrayCtor = JSValueToObject(ctx_, arrayCtorValue, &exc); - JSC_ASSERT(exc); - JSStringRef isArrayString = getIsArrayString(); - JSValueRef isArrayValue = - JSObjectGetProperty(ctx_, arrayCtor, isArrayString, &exc); - JSC_ASSERT(exc); - JSObjectRef isArray = JSValueToObject(ctx_, isArrayValue, &exc); - JSC_ASSERT(exc); - JSValueRef arg = objectRef(obj); - JSValueRef result = - JSObjectCallAsFunction(ctx_, isArray, nullptr, 1, &arg, &exc); - JSC_ASSERT(exc); - return JSValueToBoolean(ctx_, result); -#else - return JSValueIsArray(ctx_, objectRef(obj)); -#endif -} - -bool JSCRuntime::isArrayBuffer(const jsi::Object& /*obj*/) const { - // TODO: T23270523 - This would fail on builds that use our custom JSC - // auto typedArrayType = JSValueGetTypedArrayType(ctx_, objectRef(obj), - // nullptr); return typedArrayType == kJSTypedArrayTypeArrayBuffer; - throw std::runtime_error("Unsupported"); -} - -uint8_t* JSCRuntime::data(const jsi::ArrayBuffer& /*obj*/) { - // TODO: T23270523 - This would fail on builds that use our custom JSC - // return static_cast( - // JSObjectGetArrayBufferBytesPtr(ctx_, objectRef(obj), nullptr)); - throw std::runtime_error("Unsupported"); -} - -size_t JSCRuntime::size(const jsi::ArrayBuffer& /*obj*/) { - // TODO: T23270523 - This would fail on builds that use our custom JSC - // return JSObjectGetArrayBufferByteLength(ctx_, objectRef(obj), nullptr); - throw std::runtime_error("Unsupported"); -} - -bool JSCRuntime::isFunction(const jsi::Object& obj) const { - return JSObjectIsFunction(ctx_, objectRef(obj)); -} - -bool JSCRuntime::isHostObject(const jsi::Object& obj) const { - auto cls = hostObjectClass; - return cls != nullptr && JSValueIsObjectOfClass(ctx_, objectRef(obj), cls); -} - -// Very expensive -jsi::Array JSCRuntime::getPropertyNames(const jsi::Object& obj) { - JSPropertyNameArrayRef names = - JSObjectCopyPropertyNames(ctx_, objectRef(obj)); - size_t len = JSPropertyNameArrayGetCount(names); - // Would be better if we could create an array with explicit elements - auto result = createArray(len); - for (size_t i = 0; i < len; i++) { - JSStringRef str = JSPropertyNameArrayGetNameAtIndex(names, i); - result.setValueAtIndex(*this, i, createString(str)); - } - JSPropertyNameArrayRelease(names); - return result; -} - -jsi::WeakObject JSCRuntime::createWeakObject(const jsi::Object&) { - throw std::logic_error("Not implemented"); -} - -jsi::Value JSCRuntime::lockWeakObject(const jsi::WeakObject&) { - throw std::logic_error("Not implemented"); -} - -jsi::Array JSCRuntime::createArray(size_t length) { - JSValueRef exc = nullptr; - JSObjectRef obj = JSObjectMakeArray(ctx_, 0, nullptr, &exc); - checkException(obj, exc); - JSObjectSetProperty( - ctx_, - obj, - getLengthString(), - JSValueMakeNumber(ctx_, static_cast(length)), - 0, - &exc); - checkException(exc); - return createObject(obj).getArray(*this); -} - -size_t JSCRuntime::size(const jsi::Array& arr) { - return static_cast( - getProperty(arr, createPropNameID(getLengthString())).getNumber()); -} - -jsi::Value JSCRuntime::getValueAtIndex(const jsi::Array& arr, size_t i) { - JSValueRef exc = nullptr; - auto res = JSObjectGetPropertyAtIndex(ctx_, objectRef(arr), (int)i, &exc); - checkException(exc); - return createValue(res); -} - -void JSCRuntime::setValueAtIndexImpl( - jsi::Array& arr, - size_t i, - const jsi::Value& value) { - JSValueRef exc = nullptr; - JSObjectSetPropertyAtIndex(ctx_, objectRef(arr), (int)i, valueRef(value), &exc); - checkException(exc); -} - -namespace { -std::once_flag hostFunctionClassOnceFlag; -JSClassRef hostFunctionClass{}; - -class HostFunctionProxy { - public: - HostFunctionProxy(jsi::HostFunctionType hostFunction) - : hostFunction_(hostFunction) {} - - jsi::HostFunctionType& getHostFunction() { - return hostFunction_; - } - - protected: - jsi::HostFunctionType hostFunction_; -}; -} // namespace - -jsi::Function JSCRuntime::createFunctionFromHostFunction( - const jsi::PropNameID& name, - unsigned int paramCount, - jsi::HostFunctionType func) { - class HostFunctionMetadata : public HostFunctionProxy { - public: - static void initialize(JSContextRef ctx, JSObjectRef object) { - // We need to set up the prototype chain properly here. In theory we - // could set func.prototype.prototype = Function.prototype to get the - // same result. Not sure which approach is better. - HostFunctionMetadata* metadata = - static_cast(JSObjectGetPrivate(object)); - - JSValueRef exc = nullptr; - JSObjectSetProperty( - ctx, - object, - getLengthString(), - JSValueMakeNumber(ctx, metadata->argCount), - kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | - kJSPropertyAttributeDontDelete, - &exc); - if (exc) { - // Silently fail to set length - exc = nullptr; - } - - JSStringRef name = nullptr; - std::swap(metadata->name, name); - JSObjectSetProperty( - ctx, - object, - getNameString(), - JSValueMakeString(ctx, name), - kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | - kJSPropertyAttributeDontDelete, - &exc); - JSStringRelease(name); - if (exc) { - // Silently fail to set name - exc = nullptr; - } - - JSObjectRef global = JSContextGetGlobalObject(ctx); - JSValueRef value = - JSObjectGetProperty(ctx, global, getFunctionString(), &exc); - // If we don't have Function then something bad is going on. - if (JSC_UNLIKELY(exc)) { - abort(); - } - JSObjectRef funcCtor = JSValueToObject(ctx, value, &exc); - if (!funcCtor) { - // We can't do anything if Function is not an object - return; - } - JSValueRef funcProto = JSObjectGetPrototype(ctx, funcCtor); - JSObjectSetPrototype(ctx, object, funcProto); - } - - static JSValueRef makeError(JSCRuntime& rt, const std::string& desc) { - jsi::Value value = - rt.global().getPropertyAsFunction(rt, "Error").call(rt, desc); - return rt.valueRef(value); - } - - static JSValueRef call( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - HostFunctionMetadata* metadata = - static_cast(JSObjectGetPrivate(function)); - JSCRuntime& rt = *(metadata->runtime); - const unsigned maxStackArgCount = 8; - jsi::Value stackArgs[maxStackArgCount]; - std::unique_ptr heapArgs; - jsi::Value* args; - if (argumentCount > maxStackArgCount) { - heapArgs = std::make_unique(argumentCount); - for (size_t i = 0; i < argumentCount; i++) { - heapArgs[i] = rt.createValue(arguments[i]); - } - args = heapArgs.get(); - } else { - for (size_t i = 0; i < argumentCount; i++) { - stackArgs[i] = rt.createValue(arguments[i]); - } - args = stackArgs; - } - JSValueRef res; - jsi::Value thisVal(rt.createObject(thisObject)); - try { - res = rt.valueRef( - metadata->hostFunction_(rt, thisVal, args, argumentCount)); - } catch (const jsi::JSError& error) { - *exception = rt.valueRef(error.value()); - res = JSValueMakeUndefined(ctx); - } catch (const std::exception& ex) { - std::string exceptionString("Exception in HostFunction: "); - exceptionString += ex.what(); - *exception = makeError(rt, exceptionString); - res = JSValueMakeUndefined(ctx); - } catch (...) { - std::string exceptionString("Exception in HostFunction: "); - *exception = makeError(rt, exceptionString); - res = JSValueMakeUndefined(ctx); - } - return res; - } - - static void finalize(JSObjectRef object) { - HostFunctionMetadata* metadata = - static_cast(JSObjectGetPrivate(object)); - JSObjectSetPrivate(object, nullptr); - delete metadata; - } - - HostFunctionMetadata( - JSCRuntime* rt, - jsi::HostFunctionType hf, - unsigned ac, - JSStringRef n) - : HostFunctionProxy(hf), - runtime(rt), - argCount(ac), - name(JSStringRetain(n)) {} - - JSCRuntime* runtime; - unsigned argCount; - JSStringRef name; - }; - - std::call_once(hostFunctionClassOnceFlag, []() { - JSClassDefinition functionClass = kJSClassDefinitionEmpty; - functionClass.version = 0; - functionClass.attributes = kJSClassAttributeNoAutomaticPrototype; - functionClass.initialize = HostFunctionMetadata::initialize; - functionClass.finalize = HostFunctionMetadata::finalize; - functionClass.callAsFunction = HostFunctionMetadata::call; - - hostFunctionClass = JSClassCreate(&functionClass); - }); - - JSObjectRef funcRef = JSObjectMake( - ctx_, - hostFunctionClass, - new HostFunctionMetadata(this, func, paramCount, stringRef(name))); - return createObject(funcRef).getFunction(*this); -} - -namespace detail { - -class ArgsConverter { - public: - ArgsConverter(JSCRuntime& rt, const jsi::Value* args, size_t count) { - JSValueRef* destination = inline_; - if (count > maxStackArgs) { - outOfLine_ = std::make_unique(count); - destination = outOfLine_.get(); - } - - for (size_t i = 0; i < count; ++i) { - destination[i] = rt.valueRef(args[i]); - } - } - - operator JSValueRef*() { - return outOfLine_ ? outOfLine_.get() : inline_; - } - - private: - constexpr static unsigned maxStackArgs = 8; - JSValueRef inline_[maxStackArgs]; - std::unique_ptr outOfLine_; -}; -} // namespace detail - -bool JSCRuntime::isHostFunction(const jsi::Function& obj) const { - auto cls = hostFunctionClass; - return cls != nullptr && JSValueIsObjectOfClass(ctx_, objectRef(obj), cls); -} - -jsi::HostFunctionType& JSCRuntime::getHostFunction(const jsi::Function& obj) { - // We know that isHostFunction(obj) is true here, so its safe to proceed - auto proxy = - static_cast(JSObjectGetPrivate(objectRef(obj))); - return proxy->getHostFunction(); -} - -jsi::Value JSCRuntime::call( - const jsi::Function& f, - const jsi::Value& jsThis, - const jsi::Value* args, - size_t count) { - JSValueRef exc = nullptr; - auto res = JSObjectCallAsFunction( - ctx_, - objectRef(f), - jsThis.isUndefined() ? nullptr : objectRef(jsThis.getObject(*this)), - count, - detail::ArgsConverter(*this, args, count), - &exc); - checkException(exc); - return createValue(res); -} - -jsi::Value JSCRuntime::callAsConstructor( - const jsi::Function& f, - const jsi::Value* args, - size_t count) { - JSValueRef exc = nullptr; - auto res = JSObjectCallAsConstructor( - ctx_, - objectRef(f), - count, - detail::ArgsConverter(*this, args, count), - &exc); - checkException(exc); - return createValue(res); -} - -bool JSCRuntime::strictEquals(const jsi::String& a, const jsi::String& b) - const { - return JSStringIsEqual(stringRef(a), stringRef(b)); -} - -bool JSCRuntime::strictEquals(const jsi::Object& a, const jsi::Object& b) - const { - return objectRef(a) == objectRef(b); -} - -bool JSCRuntime::instanceOf(const jsi::Object& o, const jsi::Function& f) { - JSValueRef exc = nullptr; - bool res = - JSValueIsInstanceOfConstructor(ctx_, objectRef(o), objectRef(f), &exc); - checkException(exc); - return res; -} - -namespace { -JSStringRef getEmptyString() { - static JSStringRef empty = JSStringCreateWithUTF8CString(""); - return empty; -} -} // namespace - -jsi::Runtime::PointerValue* JSCRuntime::makeStringValue( - JSStringRef stringRef) const { - if (!stringRef) { - stringRef = getEmptyString(); - } -#ifndef NDEBUG - return new JSCStringValue(stringRef, stringCounter_); -#else - return new JSCStringValue(stringRef); -#endif -} - -jsi::String JSCRuntime::createString(JSStringRef str) const { - return make(makeStringValue(str)); -} - -jsi::PropNameID JSCRuntime::createPropNameID(JSStringRef str) { - return make(makeStringValue(str)); -} - -jsi::Runtime::PointerValue* JSCRuntime::makeObjectValue( - JSObjectRef objectRef) const { - if (!objectRef) { - objectRef = JSObjectMake(ctx_, nullptr, nullptr); - } -#ifndef NDEBUG - return new JSCObjectValue(ctx_, ctxInvalid_, objectRef, objectCounter_); -#else - return new JSCObjectValue(ctx_, ctxInvalid_, objectRef); -#endif -} - -jsi::Object JSCRuntime::createObject(JSObjectRef obj) const { - return make(makeObjectValue(obj)); -} - -jsi::Value JSCRuntime::createValue(JSValueRef value) const { - if (JSValueIsNumber(ctx_, value)) { - return jsi::Value(JSValueToNumber(ctx_, value, nullptr)); - } else if (JSValueIsBoolean(ctx_, value)) { - return jsi::Value(JSValueToBoolean(ctx_, value)); - } else if (JSValueIsNull(ctx_, value)) { - return jsi::Value(nullptr); - } else if (JSValueIsUndefined(ctx_, value)) { - return jsi::Value(); - } else if (JSValueIsString(ctx_, value)) { - JSStringRef str = JSValueToStringCopy(ctx_, value, nullptr); - auto result = jsi::Value(createString(str)); - JSStringRelease(str); - return result; - } else if (JSValueIsObject(ctx_, value)) { - JSObjectRef objRef = JSValueToObject(ctx_, value, nullptr); - return jsi::Value(createObject(objRef)); - } else { - // WHAT ARE YOU - abort(); - } -} - -JSValueRef JSCRuntime::valueRef(const jsi::Value& value) { - // I would rather switch on value.kind_ - if (value.isUndefined()) { - return JSValueMakeUndefined(ctx_); - } else if (value.isNull()) { - return JSValueMakeNull(ctx_); - } else if (value.isBool()) { - return JSValueMakeBoolean(ctx_, value.getBool()); - } else if (value.isNumber()) { - return JSValueMakeNumber(ctx_, value.getNumber()); - } else if (value.isString()) { - return JSValueMakeString(ctx_, stringRef(value.getString(*this))); - } else if (value.isObject()) { - return objectRef(value.getObject(*this)); - } else { - // What are you? - abort(); - } -} - -JSStringRef JSCRuntime::stringRef(const jsi::String& str) { - return static_cast(getPointerValue(str))->str_; -} - -JSStringRef JSCRuntime::stringRef(const jsi::PropNameID& sym) { - return static_cast(getPointerValue(sym))->str_; -} - -JSObjectRef JSCRuntime::objectRef(const jsi::Object& obj) { - return static_cast(getPointerValue(obj))->obj_; -} - -void JSCRuntime::checkException(JSValueRef exc) { - if (JSC_UNLIKELY(exc)) { - throw jsi::JSError(*this, createValue(exc)); - } -} - -void JSCRuntime::checkException(JSValueRef res, JSValueRef exc) { - if (JSC_UNLIKELY(!res)) { - throw jsi::JSError(*this, createValue(exc)); - } -} - -void JSCRuntime::checkException(JSValueRef exc, const char* msg) { - if (JSC_UNLIKELY(exc)) { - throw jsi::JSError(std::string(msg), *this, createValue(exc)); - } -} - -void JSCRuntime::checkException( - JSValueRef res, - JSValueRef exc, - const char* msg) { - if (JSC_UNLIKELY(!res)) { - throw jsi::JSError(std::string(msg), *this, createValue(exc)); - } -} - -std::unique_ptr makeJSCRuntime() { - return std::make_unique(); -} - -} // namespace jsc -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/JSCRuntime.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/JSCRuntime.h deleted file mode 100644 index f8329896..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/JSCRuntime.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the - // LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include - -namespace facebook { -namespace jsc { - -std::unique_ptr makeJSCRuntime(); - -} // namespace jsc -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/JSIDynamic.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/JSIDynamic.cpp deleted file mode 100644 index eab0b4ac..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/JSIDynamic.cpp +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the - // LICENSE file in the root directory of this source tree. - -#include "JSIDynamic.h" - -#include -#include - -using namespace facebook::jsi; - -namespace facebook { -namespace jsi { - -Value valueFromDynamic(Runtime& runtime, const folly::dynamic& dyn) { - switch (dyn.type()) { - case folly::dynamic::NULLT: - return Value::null(); - case folly::dynamic::ARRAY: { - Array ret = Array(runtime, dyn.size()); - for (size_t i = 0; i < dyn.size(); ++i) { - ret.setValueAtIndex(runtime, i, valueFromDynamic(runtime, dyn[i])); - } - return std::move(ret); - } - case folly::dynamic::BOOL: - return dyn.getBool(); - case folly::dynamic::DOUBLE: - return dyn.getDouble(); - case folly::dynamic::INT64: - // Can't use asDouble() here. If the int64 value is too bit to be - // represented precisely as a double, folly will throw an - // exception. - return (double)dyn.getInt(); - case folly::dynamic::OBJECT: { - Object ret(runtime); - for (const auto& element : dyn.items()) { - Value value = valueFromDynamic(runtime, element.second); - if (element.first.isNumber() || element.first.isString()) { - ret.setProperty(runtime, element.first.asString().c_str(), value); - } - } - return std::move(ret); - } - case folly::dynamic::STRING: - return String::createFromUtf8(runtime, dyn.getString()); - } - CHECK(false); -} - -folly::dynamic dynamicFromValue(Runtime& runtime, const Value& value) { - if (value.isUndefined() || value.isNull()) { - return nullptr; - } else if (value.isBool()) { - return value.getBool(); - } else if (value.isNumber()) { - return value.getNumber(); - } else if (value.isString()) { - return value.getString(runtime).utf8(runtime); - } else { - Object obj = value.getObject(runtime); - if (obj.isArray(runtime)) { - Array array = obj.getArray(runtime); - folly::dynamic ret = folly::dynamic::array(); - for (size_t i = 0; i < array.size(runtime); ++i) { - ret.push_back(dynamicFromValue(runtime, array.getValueAtIndex(runtime, i))); - } - return ret; - } else if (obj.isFunction(runtime)) { - throw JSError(runtime, "JS Functions are not convertible to dynamic"); - } else { - folly::dynamic ret = folly::dynamic::object(); - Array names = obj.getPropertyNames(runtime); - for (size_t i = 0; i < names.size(runtime); ++i) { - String name = names.getValueAtIndex(runtime, i).getString(runtime); - Value prop = obj.getProperty(runtime, name); - if (prop.isUndefined()) { - continue; - } - // The JSC conversion uses JSON.stringify, which substitutes - // null for a function, so we do the same here. Just dropping - // the pair might also work, but would require more testing. - if (prop.isObject() && prop.getObject(runtime).isFunction(runtime)) { - prop = Value::null(); - } - ret.insert( - name.utf8(runtime), dynamicFromValue(runtime, std::move(prop))); - } - return ret; - } - } -} - -} -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/JSIDynamic.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/JSIDynamic.h deleted file mode 100644 index b6f7bee6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/JSIDynamic.h +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the - // LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include - -namespace facebook { -namespace jsi { - -facebook::jsi::Value valueFromDynamic( - facebook::jsi::Runtime& runtime, const folly::dynamic& dyn); - -folly::dynamic dynamicFromValue(facebook::jsi::Runtime& runtime, - const facebook::jsi::Value& value); - -} -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/instrumentation.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/instrumentation.h deleted file mode 100644 index 188af4a3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/instrumentation.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the - // LICENSE file in the root directory of this source tree. - -#pragma once - -#include - -#include - -namespace facebook { -namespace jsi { - -/// Methods for starting and collecting instrumentation, an \c Instrumentation -/// instance is associated with a particular \c Runtime instance, which it -/// controls the instrumentation of. -class Instrumentation { - public: - virtual ~Instrumentation() = default; - - /// Returns GC statistics as a JSON-encoded string, with an object containing - /// "type" and "version" fields outermost. "type" is a string, unique to a - /// particular implementation of \c jsi::Instrumentation, and "version" is a - /// number to indicate any revision to that implementation and its output - /// format. - /// - /// \pre This call can only be made on the instrumentation instance of a - /// runtime initialised to collect GC statistics. - /// - /// \post All cumulative measurements mentioned in the output are accumulated - /// across the entire lifetime of the Runtime. - /// - /// \return the GC statistics collected so far, as a JSON-encoded string. - virtual std::string getRecordedGCStats() = 0; - - /// Request statistics about the current state of the runtime's heap. This - /// function can be called at any time, and should produce information that is - /// correct at the instant it is called (i.e, not stale). - /// - /// \return a jsi Value containing whichever statistics the runtime supports - /// for its heap. - virtual Value getHeapInfo(bool includeExpensive) = 0; - - /// perform a full garbage collection - virtual void collectGarbage() = 0; - - /// Captures the heap to a file - /// - /// \param path to save the heap capture - /// - /// \param compact Whether the JSON should be compact or pretty - /// - /// \return true iff the heap capture succeeded - virtual bool createSnapshotToFile(const std::string& path, bool compact) = 0; - - /// Write a trace of bridge traffic to the given file name. - virtual void writeBridgeTrafficTraceToFile( - const std::string& fileName) const = 0; - - /// Write basic block profile trace to the given file name. - virtual void writeBasicBlockProfileTraceToFile( - const std::string& fileName) const = 0; - - /// Enable sampling profiler. - virtual void enableSamplingProfiler() const = 0; - - /// Dump sampled stack trace to the given file name. - virtual void dumpSampledTraceToFile(const std::string& fileName) const = 0; - - /// Dump external profiler symbols to the given file name. - virtual void dumpProfilerSymbolsToFile(const std::string& fileName) const = 0; -}; - -} // namespace jsi -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/jsi-inl.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/jsi-inl.h deleted file mode 100644 index 58c7ea44..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/jsi-inl.h +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the - // LICENSE file in the root directory of this source tree. - -#pragma once - -namespace facebook { -namespace jsi { -namespace detail { - -inline Value toValue(Runtime&, std::nullptr_t) { - return Value::null(); -} -inline Value toValue(Runtime&, bool b) { - return Value(b); -} -inline Value toValue(Runtime&, double d) { - return Value(d); -} -inline Value toValue(Runtime&, int i) { - return Value(i); -} -inline Value toValue(Runtime& runtime, const char* str) { - return String::createFromAscii(runtime, str); -} -inline Value toValue(Runtime& runtime, const std::string& str) { - return String::createFromAscii(runtime, str); -} -template -inline Value toValue(Runtime& runtime, const T& other) { - static_assert( - std::is_base_of::value, - "This type cannot be converted to Value"); - return Value(runtime, other); -} -inline Value toValue(Runtime& runtime, const Value& value) { - return Value(runtime, value); -} -inline Value&& toValue(Runtime&, Value&& value) { - return std::move(value); -} - -inline PropNameID toPropNameID(Runtime& runtime, const char* name) { - return PropNameID::forAscii(runtime, name); -} -inline PropNameID toPropNameID(Runtime& runtime, const std::string& name) { - return PropNameID::forUtf8(runtime, name); -} -inline PropNameID&& toPropNameID(Runtime&, PropNameID&& name) { - return std::move(name); -} - -void throwJSError(Runtime&, const char* msg); - -} // namespace detail - -template -inline T Runtime::make(Runtime::PointerValue* pv) { - return T(pv); -} - -inline const Runtime::PointerValue* Runtime::getPointerValue( - const jsi::Pointer& pointer) { - return pointer.ptr_; -} - -inline const Runtime::PointerValue* Runtime::getPointerValue( - const jsi::Value& value) { - return value.data_.pointer.ptr_; -} - -inline Value Object::getProperty(Runtime& runtime, const char* name) const { - return getProperty(runtime, String::createFromAscii(runtime, name)); -} - -inline Value Object::getProperty(Runtime& runtime, const String& name) const { - return runtime.getProperty(*this, name); -} - -inline Value Object::getProperty(Runtime& runtime, const PropNameID& name) - const { - return runtime.getProperty(*this, name); -} - -inline bool Object::hasProperty(Runtime& runtime, const char* name) const { - return hasProperty(runtime, String::createFromAscii(runtime, name)); -} - -inline bool Object::hasProperty(Runtime& runtime, const String& name) const { - return runtime.hasProperty(*this, name); -} - -inline bool Object::hasProperty(Runtime& runtime, const PropNameID& name) - const { - return runtime.hasProperty(*this, name); -} - -template -void Object::setProperty(Runtime& runtime, const char* name, T&& value) { - setProperty( - runtime, String::createFromAscii(runtime, name), std::forward(value)); -} - -template -void Object::setProperty(Runtime& runtime, const String& name, T&& value) { - setPropertyValue( - runtime, name, detail::toValue(runtime, std::forward(value))); -} - -template -void Object::setProperty(Runtime& runtime, const PropNameID& name, T&& value) { - setPropertyValue( - runtime, name, detail::toValue(runtime, std::forward(value))); -} - -inline Array Object::getArray(Runtime& runtime) const& { - assert(runtime.isArray(*this)); - (void)runtime; // when assert is disabled we need to mark this as used - return Array(runtime.cloneObject(ptr_)); -} - -inline Array Object::getArray(Runtime& runtime) && { - assert(runtime.isArray(*this)); - (void)runtime; // when assert is disabled we need to mark this as used - Runtime::PointerValue* value = ptr_; - ptr_ = nullptr; - return Array(value); -} - -inline ArrayBuffer Object::getArrayBuffer(Runtime& runtime) const& { - assert(runtime.isArrayBuffer(*this)); - (void)runtime; // when assert is disabled we need to mark this as used - return ArrayBuffer(runtime.cloneObject(ptr_)); -} - -inline ArrayBuffer Object::getArrayBuffer(Runtime& runtime) && { - assert(runtime.isArrayBuffer(*this)); - (void)runtime; // when assert is disabled we need to mark this as used - Runtime::PointerValue* value = ptr_; - ptr_ = nullptr; - return ArrayBuffer(value); -} - -inline Function Object::getFunction(Runtime& runtime) const& { - assert(runtime.isFunction(*this)); - return Function(runtime.cloneObject(ptr_)); -} - -inline Function Object::getFunction(Runtime& runtime) && { - assert(runtime.isFunction(*this)); - (void)runtime; // when assert is disabled we need to mark this as used - Runtime::PointerValue* value = ptr_; - ptr_ = nullptr; - return Function(value); -} - -template -inline bool Object::isHostObject(Runtime& runtime) const { - return runtime.isHostObject(*this) && - std::dynamic_pointer_cast(runtime.getHostObject(*this)); -} - -template <> -inline bool Object::isHostObject(Runtime& runtime) const { - return runtime.isHostObject(*this); -} - -template -inline std::shared_ptr Object::getHostObject(Runtime& runtime) const { - assert(isHostObject(runtime)); - return std::static_pointer_cast(runtime.getHostObject(*this)); -} - -template -inline std::shared_ptr Object::asHostObject(Runtime& runtime) const { - if (!isHostObject(runtime)) { - detail::throwJSError(runtime, "Object is not a HostObject of desired type"); - } - return std::static_pointer_cast(runtime.getHostObject(*this)); -} - -template <> -inline std::shared_ptr Object::getHostObject( - Runtime& runtime) const { - assert(runtime.isHostObject(*this)); - return runtime.getHostObject(*this); -} - -inline Array Object::getPropertyNames(Runtime& runtime) const { - return runtime.getPropertyNames(*this); -} - -inline Value WeakObject::lock(Runtime& runtime) { - return runtime.lockWeakObject(*this); -} - -template -void Array::setValueAtIndex(Runtime& runtime, size_t i, T&& value) { - setValueAtIndexImpl( - runtime, i, detail::toValue(runtime, std::forward(value))); -} - -inline Value Array::getValueAtIndex(Runtime& runtime, size_t i) const { - return runtime.getValueAtIndex(*this, i); -} - -inline Function Function::createFromHostFunction( - Runtime& runtime, - const jsi::PropNameID& name, - unsigned int paramCount, - jsi::HostFunctionType func) { - return runtime.createFunctionFromHostFunction( - name, paramCount, std::move(func)); -} - -inline Value Function::call(Runtime& runtime, const Value* args, size_t count) - const { - return runtime.call(*this, Value::undefined(), args, count); -} - -inline Value Function::call(Runtime& runtime, std::initializer_list args) - const { - return call(runtime, args.begin(), args.size()); -} - -template -inline Value Function::call(Runtime& runtime, Args&&... args) const { - // A more awesome version of this would be able to create raw values - // which can be used directly as HermesValues, instead of having to - // wrap the args in Values and hvFromValue on each to unwrap them. - // But this will do for now. - return call(runtime, {detail::toValue(runtime, std::forward(args))...}); -} - -inline Value Function::callWithThis( - Runtime& runtime, - const Object& jsThis, - const Value* args, - size_t count) const { - return runtime.call(*this, Value(runtime, jsThis), args, count); -} - -inline Value Function::callWithThis( - Runtime& runtime, - const Object& jsThis, - std::initializer_list args) const { - return callWithThis(runtime, jsThis, args.begin(), args.size()); -} - -template -inline Value Function::callWithThis( - Runtime& runtime, - const Object& jsThis, - Args&&... args) const { - // A more awesome version of this would be able to create raw values - // which can be used directly as HermesValues, instead of having to - // wrap the args in Values and hvFromValue on each to unwrap them. - // But this will do for now. - return callWithThis( - runtime, jsThis, {detail::toValue(runtime, std::forward(args))...}); -} - -template -inline Array Array::createWithElements(Runtime& runtime, Args&&... args) { - return createWithElements( - runtime, {detail::toValue(runtime, std::forward(args))...}); -} - -template -inline std::vector PropNameID::names( - Runtime& runtime, - Args&&... args) { - return names({detail::toPropNameID(runtime, std::forward(args))...}); -} - -template -inline std::vector PropNameID::names( - PropNameID(&&propertyNames)[N]) { - std::vector result; - result.reserve(N); - for (auto& name : propertyNames) { - result.push_back(std::move(name)); - } - return result; -} - -inline Value Function::callAsConstructor( - Runtime& runtime, - const Value* args, - size_t count) const { - return runtime.callAsConstructor(*this, args, count); -} - -inline Value Function::callAsConstructor( - Runtime& runtime, - std::initializer_list args) const { - return callAsConstructor(runtime, args.begin(), args.size()); -} - -template -inline Value Function::callAsConstructor(Runtime& runtime, Args&&... args) - const { - return callAsConstructor( - runtime, {detail::toValue(runtime, std::forward(args))...}); -} - -} // namespace jsi -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/jsi.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/jsi.cpp deleted file mode 100644 index a7ddd277..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/jsi.cpp +++ /dev/null @@ -1,353 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the - // LICENSE file in the root directory of this source tree. - -#include -#include -#include -#include - -#include -#include - -namespace facebook { -namespace jsi { - -namespace detail { - -void throwJSError(Runtime& rt, const char* msg) { - throw JSError(rt, msg); -} - -} // namespace detail - -Buffer::~Buffer() {} - -Value HostObject::get(Runtime&, const PropNameID&) { - return Value(); -} - -void HostObject::set(Runtime& rt, const PropNameID& name, const Value&) { - std::string msg("TypeError: Cannot assign to property '"); - msg += name.utf8(rt); - msg += "' on HostObject with default setter"; - throw JSError(rt, msg); -} - -HostObject::~HostObject() {} - -Runtime::~Runtime() {} - -Instrumentation& Runtime::instrumentation() { - class NoInstrumentation : public Instrumentation { - std::string getRecordedGCStats() override { - return ""; - } - - Value getHeapInfo(bool) override { - return Value::undefined(); - } - - void collectGarbage() override {} - - bool createSnapshotToFile(const std::string&, bool) override { - return false; - } - - void writeBridgeTrafficTraceToFile(const std::string&) const override { - std::abort(); - } - - void writeBasicBlockProfileTraceToFile(const std::string&) const override { - std::abort(); - } - - void enableSamplingProfiler() const override { - std::abort(); - } - - void dumpSampledTraceToFile(const std::string&) const override { - std::abort(); - } - - void dumpProfilerSymbolsToFile(const std::string&) const override { - std::abort(); - } - }; - - static NoInstrumentation sharedInstance; - return sharedInstance; -} - -Pointer& Pointer::operator=(Pointer&& other) { - if (ptr_) { - ptr_->invalidate(); - } - ptr_ = other.ptr_; - other.ptr_ = nullptr; - return *this; -} - -Object Object::getPropertyAsObject(Runtime& runtime, const char* name) const { - Value v = getProperty(runtime, name); - - if (!v.isObject()) { - throw JSError( - runtime, - std::string("getPropertyAsObject: property '") + name + - "' is not an Object"); - } - - return v.getObject(runtime); -} - -Function Object::getPropertyAsFunction(Runtime& runtime, const char* name) - const { - Object obj = getPropertyAsObject(runtime, name); - if (!obj.isFunction(runtime)) { - throw JSError( - runtime, - std::string("getPropertyAsFunction: property '") + name + - "' is not a Function"); - }; - - Runtime::PointerValue* value = obj.ptr_; - obj.ptr_ = nullptr; - return Function(value); -} - -Array Object::asArray(Runtime& runtime) const& { - if (!isArray(runtime)) { - throw JSError(runtime, "Object is not an array"); - } - return getArray(runtime); -} - -Array Object::asArray(Runtime& runtime) && { - if (!isArray(runtime)) { - throw JSError(runtime, "Object is not an array"); - } - return std::move(*this).getArray(runtime); -} - -Function Object::asFunction(Runtime& runtime) const& { - if (!isFunction(runtime)) { - throw JSError(runtime, "Object is not a function"); - } - return getFunction(runtime); -} - -Function Object::asFunction(Runtime& runtime) && { - if (!isFunction(runtime)) { - throw JSError(runtime, "Object is not a function"); - } - return std::move(*this).getFunction(runtime); -} - -Value::Value(Value&& other) : Value(other.kind_) { - if (kind_ == BooleanKind) { - data_.boolean = other.data_.boolean; - } else if (kind_ == NumberKind) { - data_.number = other.data_.number; - } else if (kind_ >= PointerKind) { - new (&data_.pointer) Pointer(std::move(other.data_.pointer)); - } - // when the other's dtor runs, nothing will happen. - other.kind_ = UndefinedKind; -} - -Value::Value(Runtime& runtime, const Value& other) : Value(other.kind_) { - // data_ is uninitialized, so use placement new to create non-POD - // types in it. Any other kind of initialization will call a dtor - // first, which is incorrect. - if (kind_ == BooleanKind) { - data_.boolean = other.data_.boolean; - } else if (kind_ == NumberKind) { - data_.number = other.data_.number; - } else if (kind_ == StringKind) { - new (&data_.pointer) Pointer(runtime.cloneString(other.data_.pointer.ptr_)); - } else if (kind_ >= ObjectKind) { - new (&data_.pointer) Pointer(runtime.cloneObject(other.data_.pointer.ptr_)); - } -} - -Value::~Value() { - if (kind_ >= PointerKind) { - data_.pointer.~Pointer(); - } -} - -Value Value::createFromJsonUtf8( - Runtime& runtime, - const uint8_t* json, - size_t length) { - Function parseJson = runtime.global() - .getPropertyAsObject(runtime, "JSON") - .getPropertyAsFunction(runtime, "parse"); - return parseJson.call(runtime, String::createFromUtf8(runtime, json, length)); -} - -bool Value::strictEquals(Runtime& runtime, const Value& a, const Value& b) { - if (a.kind_ != b.kind_) { - return false; - } - switch (a.kind_) { - case UndefinedKind: - case NullKind: - return true; - case BooleanKind: - return a.data_.boolean == b.data_.boolean; - case NumberKind: - return a.data_.number == b.data_.number; - case StringKind: - return runtime.strictEquals( - static_cast(a.data_.pointer), - static_cast(b.data_.pointer)); - case ObjectKind: - return runtime.strictEquals( - static_cast(a.data_.pointer), - static_cast(b.data_.pointer)); - } - return false; -} - -double Value::asNumber() const { - if (!isNumber()) { - throw JSINativeException("Value is not an Object"); - } - - return getNumber(); -} - -Object Value::asObject(Runtime& runtime) const& { - if (!isObject()) { - throw JSError(runtime, "Value is not an Object"); - } - - return getObject(runtime); -} - -Object Value::asObject(Runtime& rt) && { - if (!isObject()) { - throw JSError(rt, "Value is not an Object"); - } - auto ptr = data_.pointer.ptr_; - data_.pointer.ptr_ = nullptr; - return static_cast(ptr); -} - -String Value::asString(Runtime& rt) const& { - if (!isString()) { - throw JSError(rt, "Value is not a String"); - } - - return getString(rt); -} - -String Value::asString(Runtime& rt) && { - if (!isString()) { - throw JSError(rt, "Value is not a String"); - } - - return std::move(*this).getString(rt); -} - -String Value::toString(Runtime& runtime) const { - Function toString = runtime.global().getPropertyAsFunction(runtime, "String"); - return toString.call(runtime, *this).getString(runtime); -} - -Array Array::createWithElements( - Runtime& rt, - std::initializer_list elements) { - Array result(rt, elements.size()); - size_t index = 0; - for (const auto& element : elements) { - result.setValueAtIndex(rt, index++, element); - } - return result; -} - -std::vector HostObject::getPropertyNames(Runtime&) { - return {}; -} - -Runtime::ScopeState* Runtime::pushScope() { - return nullptr; -} - -void Runtime::popScope(ScopeState*) {} - -JSError::JSError(Runtime& rt, Value&& value) { - setValue(rt, std::move(value)); -} - -JSError::JSError(Runtime& rt, std::string msg) : message_(std::move(msg)) { - try { - setValue( - rt, rt.global().getPropertyAsFunction(rt, "Error").call(rt, message_)); - } catch (...) { - setValue(rt, Value()); - } -} - -JSError::JSError(Runtime& rt, std::string msg, std::string stack) - : message_(std::move(msg)), stack_(std::move(stack)) { - try { - Object e(rt); - e.setProperty(rt, "message", String::createFromUtf8(rt, message_)); - e.setProperty(rt, "stack", String::createFromUtf8(rt, stack_)); - setValue(rt, std::move(e)); - } catch (...) { - setValue(rt, Value()); - } -} - -JSError::JSError(std::string what, Runtime& rt, Value&& value) - : JSIException(std::move(what)) { - setValue(rt, std::move(value)); -} - -void JSError::setValue(Runtime& rt, Value&& value) { - value_ = std::make_shared(std::move(value)); - - try { - if ((message_.empty() || stack_.empty()) && value_->isObject()) { - auto obj = value_->getObject(rt); - - if (message_.empty()) { - jsi::Value message = obj.getProperty(rt, "message"); - if (!message.isUndefined()) { - message_ = message.toString(rt).utf8(rt); - } - } - - if (stack_.empty()) { - jsi::Value stack = obj.getProperty(rt, "stack"); - if (!stack.isUndefined()) { - stack_ = stack.toString(rt).utf8(rt); - } - } - } - - if (message_.empty()) { - message_ = value_->toString(rt).utf8(rt); - } - - if (stack_.empty()) { - stack_ = "no stack"; - } - - if (what_.empty()) { - what_ = message_ + "\n\n" + stack_; - } - } catch (...) { - message_ = "[Exception caught creating message string]"; - stack_ = "[Exception caught creating stack string]"; - what_ = "[Exception caught getting value fields]"; - } -} - -} // namespace jsi -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/jsi.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/jsi.h deleted file mode 100644 index 405c3cc1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsi/jsi.h +++ /dev/null @@ -1,1162 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -#ifndef JSI_EXPORT -#ifdef _MSC_VER -#define JSI_EXPORT -#else -#define JSI_EXPORT __attribute__((visibility("default"))) -#endif -#endif - -class FBJSRuntime; -namespace facebook { -namespace jsi { - -namespace detail { - -template -class ThreadSafeRuntimeImpl; -} - -class Buffer { - public: - virtual ~Buffer(); - virtual size_t size() const = 0; - virtual const uint8_t* data() const = 0; -}; - -class StringBuffer : public Buffer { - public: - StringBuffer(std::string s) : s_(std::move(s)) {} - size_t size() const override { - return s_.size(); - } - const uint8_t* data() const override { - return reinterpret_cast(s_.data()); - } - - private: - std::string s_; -}; - -class Runtime; -class Pointer; -class PropNameID; -class String; -class Object; -class WeakObject; -class Array; -class ArrayBuffer; -class Function; -class Value; -class Instrumentation; -class Scope; -class JSIException; -class JSError; - -/// A function which has this type can be registered as a function -/// callable from JavaScript using Function::createFromHostFunction(). -/// When the function is called, args will point to the arguments, and -/// count will indicate how many arguments are passed. The function -/// can return a Value to the caller, or throw an exception. If a C++ -/// exception is thrown, a JS Error will be created and thrown into -/// JS; if the C++ exception extends std::exception, the Error's -/// message will be whatever what() returns. Note that it is undefined whether -/// HostFunctions may or may not be called in strict mode; that is `thisVal` -/// can be any value - it will not necessarily be coerced to an object or -/// or set to the global object. -using HostFunctionType = std::function< - Value(Runtime& rt, const Value& thisVal, const Value* args, size_t count)>; - -/// An object which implements this interface can be registered as an -/// Object with the JS runtime. -class JSI_EXPORT HostObject { - public: - // The C++ object's dtor will be called when the GC finalizes this - // object. (This may be as late as when the Runtime is shut down.) - // You have no control over which thread it is called on. This will - // be called from inside the GC, so it is unsafe to do any VM - // operations which require a Runtime&. Derived classes' dtors - // should also avoid doing anything expensive. Calling the dtor on - // a jsi object is explicitly ok. If you want to do JS operations, - // or any nontrivial work, you should add it to a work queue, and - // manage it externally. - virtual ~HostObject(); - - // When JS wants a property with a given name from the HostObject, - // it will call this method. If it throws an exception, the call - // will throw a JS \c Error object. By default this returns undefined. - // \return the value for the property. - virtual Value get(Runtime&, const PropNameID& name); - - // When JS wants to set a property with a given name on the HostObject, - // it will call this method. If it throws an exception, the call will - // throw a JS \c Error object. By default this throws a type error exception - // mimicking the behavior of a frozen object in strict mode. - virtual void set(Runtime&, const PropNameID& name, const Value& value); - - // When JS wants a list of property names for the HostObject, it will - // call this method. If it throws an exception, the call will thow a - // JS \c Error object. The default implementation returns empty vector. - virtual std::vector getPropertyNames(Runtime& rt); -}; - -/// Represents a JS runtime. Movable, but not copyable. Note that -/// this object may not be thread-aware, but cannot be used safely from -/// multiple threads at once. The application is responsible for -/// ensuring that it is used safely. This could mean using the -/// Runtime from a single thread, using a mutex, doing all work on a -/// serial queue, etc. This restriction applies to the methods of -/// this class, and any method in the API which take a Runtime& as an -/// argument. Destructors (all but ~Scope), operators, or other methods -/// which do not take Runtime& as an argument are safe to call from any -/// thread, but it is still forbidden to make write operations on a single -/// instance of any class from more than one thread. In addition, to -/// make shutdown safe, destruction of objects associated with the Runtime -/// must be destroyed before the Runtime is destroyed, or from the -/// destructor of a managed HostObject or HostFunction. Informally, this -/// means that the main source of unsafe behavior is to hold a jsi object -/// in a non-Runtime-managed object, and not clean it up before the Runtime -/// is shut down. If your lifecycle is such that avoiding this is hard, -/// you will probably need to do use your own locks. -class Runtime { - public: - virtual ~Runtime(); - - /// Evaluates the given JavaScript \c buffer. \c sourceURL is used - /// to annotate the stack trace if there is an exception. The - /// contents may be utf8-encoded JS source code, or binary bytcode - /// whose format is specific to the implementation. If the input - /// format is unknown, or evaluation causes an error, a JSIException - /// will be thrown. - virtual void evaluateJavaScript( - std::unique_ptr buffer, - const std::string& sourceURL) = 0; - /// \return the global object - virtual Object global() = 0; - - /// \return a short printable description of the instance. This - /// should only be used by logging, debugging, and other - /// developer-facing callers. - virtual std::string description() = 0; - - /// \return whether or not the underlying runtime supports debugging via the - /// Chrome remote debugging protocol. - /// - /// NOTE: the API for determining whether a runtime is debuggable and - /// registering a runtime with the debugger is still in flux, so please don't - /// use this API unless you know what you're doing. - virtual bool isInspectable() = 0; - - /// \return an interface to extract metrics from this \c Runtime. The default - /// implementation of this function returns an \c Instrumentation instance - /// which returns no metrics. - virtual Instrumentation& instrumentation(); - - protected: - friend class Pointer; - friend class PropNameID; - friend class String; - friend class Object; - friend class WeakObject; - friend class Array; - friend class ArrayBuffer; - friend class Function; - friend class Value; - friend class Scope; - friend class JSError; - - // Potential optimization: avoid the cloneFoo() virtual dispatch, - // and instead just fix the number of fields, and copy them, since - // in practice they are trivially copyable. Sufficient use of - // rvalue arguments/methods would also reduce the number of clones. - - struct PointerValue { - virtual void invalidate() = 0; - - protected: - ~PointerValue() = default; - }; - - virtual PointerValue* cloneString(const Runtime::PointerValue* pv) = 0; - virtual PointerValue* cloneObject(const Runtime::PointerValue* pv) = 0; - virtual PointerValue* clonePropNameID(const Runtime::PointerValue* pv) = 0; - - virtual PropNameID createPropNameIDFromAscii( - const char* str, - size_t length) = 0; - virtual PropNameID createPropNameIDFromUtf8( - const uint8_t* utf8, - size_t length) = 0; - virtual PropNameID createPropNameIDFromString(const String& str) = 0; - virtual std::string utf8(const PropNameID&) = 0; - virtual bool compare(const PropNameID&, const PropNameID&) = 0; - - virtual String createStringFromAscii(const char* str, size_t length) = 0; - virtual String createStringFromUtf8(const uint8_t* utf8, size_t length) = 0; - virtual std::string utf8(const String&) = 0; - - virtual Object createObject() = 0; - virtual Object createObject(std::shared_ptr ho) = 0; - virtual std::shared_ptr getHostObject(const jsi::Object&) = 0; - virtual HostFunctionType& getHostFunction(const jsi::Function&) = 0; - - virtual Value getProperty(const Object&, const PropNameID& name) = 0; - virtual Value getProperty(const Object&, const String& name) = 0; - virtual bool hasProperty(const Object&, const PropNameID& name) = 0; - virtual bool hasProperty(const Object&, const String& name) = 0; - virtual void - setPropertyValue(Object&, const PropNameID& name, const Value& value) = 0; - virtual void - setPropertyValue(Object&, const String& name, const Value& value) = 0; - - virtual bool isArray(const Object&) const = 0; - virtual bool isArrayBuffer(const Object&) const = 0; - virtual bool isFunction(const Object&) const = 0; - virtual bool isHostObject(const jsi::Object&) const = 0; - virtual bool isHostFunction(const jsi::Function&) const = 0; - virtual Array getPropertyNames(const Object&) = 0; - - virtual WeakObject createWeakObject(const Object&) = 0; - virtual Value lockWeakObject(const WeakObject&) = 0; - - virtual Array createArray(size_t length) = 0; - virtual size_t size(const Array&) = 0; - virtual size_t size(const ArrayBuffer&) = 0; - virtual uint8_t* data(const ArrayBuffer&) = 0; - virtual Value getValueAtIndex(const Array&, size_t i) = 0; - virtual void setValueAtIndexImpl(Array&, size_t i, const Value& value) = 0; - - virtual Function createFunctionFromHostFunction( - const PropNameID& name, - unsigned int paramCount, - HostFunctionType func) = 0; - virtual Value call( - const Function&, - const Value& jsThis, - const Value* args, - size_t count) = 0; - virtual Value - callAsConstructor(const Function&, const Value* args, size_t count) = 0; - - // Private data for managing scopes. - struct ScopeState; - virtual ScopeState* pushScope(); - virtual void popScope(ScopeState*); - - virtual bool strictEquals(const String& a, const String& b) const = 0; - virtual bool strictEquals(const Object& a, const Object& b) const = 0; - - virtual bool instanceOf(const Object& o, const Function& f) = 0; - - // These exist so derived classes can access the private parts of - // Value, String, and Object, which are all friends of Runtime. - template - static T make(PointerValue* pv); - static const PointerValue* getPointerValue(const Pointer& pointer); - static const PointerValue* getPointerValue(const Value& value); - - // TODO T25594389: think harder about this friend declaration (and - // it's forward decl above) - template - friend class detail::ThreadSafeRuntimeImpl; - friend class ::FBJSRuntime; -}; - -// Base class for pointer-storing types. -class Pointer { - protected: - explicit Pointer(Pointer&& other) : ptr_(other.ptr_) { - other.ptr_ = nullptr; - } - - ~Pointer() { - if (ptr_) { - ptr_->invalidate(); - } - } - - Pointer& operator=(Pointer&& other); - - friend class Runtime; - friend class Value; - - explicit Pointer(Runtime::PointerValue* ptr) : ptr_(ptr) {} - - typename Runtime::PointerValue* ptr_; -}; - -/// Represents something that can be a JS property key. Movable, not copyable. -class PropNameID : public Pointer { - public: - using Pointer::Pointer; - - PropNameID(Runtime &runtime, const PropNameID &other) - : Pointer(runtime.clonePropNameID(other.ptr_)) {} - - PropNameID(PropNameID&& other) = default; - PropNameID& operator=(PropNameID&& other) = default; - - /// Create a JS property name id from ascii values. The data is - /// copied. - static PropNameID forAscii(Runtime& runtime, const char* str, size_t length) { - return runtime.createPropNameIDFromAscii(str, length); - } - - /// Create a property name id from a nul-terminated C ascii name. The data is - /// copied. - static PropNameID forAscii(Runtime& runtime, const char* str) { - return forAscii(runtime, str, strlen(str)); - } - - /// Create a PropNameID from a C++ string. The string is copied. - static PropNameID forAscii(Runtime& runtime, const std::string& str) { - return forAscii(runtime, str.c_str(), str.size()); - } - - /// Create a PropNameID from utf8 values. The data is copied. - static PropNameID - forUtf8(Runtime& runtime, const uint8_t* utf8, size_t length) { - return runtime.createPropNameIDFromUtf8(utf8, length); - } - - /// Create a PropNameID from utf8-encoded octets stored in a - /// std::string. The string data is transformed and copied. - static PropNameID forUtf8(Runtime& runtime, const std::string& utf8) { - return runtime.createPropNameIDFromUtf8( - reinterpret_cast(utf8.data()), utf8.size()); - } - - /// Create a PropNameID from a JS string. - static PropNameID forString(Runtime& runtime, const jsi::String& str) { - return runtime.createPropNameIDFromString(str); - } - - // Creates a vector of PropNameIDs constructed from given arguments. - template - static std::vector names(Runtime& runtime, Args&&... args); - - // Creates a vector of given PropNameIDs. - template - static std::vector names(PropNameID(&&propertyNames)[N]); - - /// Copies the data in a PropNameID as utf8 into a C++ string. - std::string utf8(Runtime& runtime) const { - return runtime.utf8(*this); - } - - static bool compare( - Runtime& runtime, - const jsi::PropNameID& a, - const jsi::PropNameID& b) { - return runtime.compare(a, b); - } - - friend class Runtime; - friend class Value; -}; - -/// Represents a JS String. Movable, not copyable. -class String : public Pointer { - public: - using Pointer::Pointer; - - String(String&& other) = default; - String& operator=(String&& other) = default; - - /// Create a JS string from ascii values. The string data is - /// copied. - static String - createFromAscii(Runtime& runtime, const char* str, size_t length) { - return runtime.createStringFromAscii(str, length); - } - - /// Create a JS string from a nul-terminated C ascii string. The - /// string data is copied. - static String createFromAscii(Runtime& runtime, const char* str) { - return createFromAscii(runtime, str, strlen(str)); - } - - /// Create a JS string from a C++ string. The string data is - /// copied. - static String createFromAscii(Runtime& runtime, const std::string& str) { - return createFromAscii(runtime, str.c_str(), str.size()); - } - - /// Create a JS string from utf8-encoded octets. The string data is - /// transformed and copied. - static String - createFromUtf8(Runtime& runtime, const uint8_t* utf8, size_t length) { - return runtime.createStringFromUtf8(utf8, length); - } - - /// Create a JS string from utf8-encoded octets stored in a - /// std::string. The string data is transformed and copied. - static String createFromUtf8(Runtime& runtime, const std::string& utf8) { - return runtime.createStringFromUtf8( - reinterpret_cast(utf8.data()), utf8.length()); - } - - /// \return whether a and b contain the same characters. - static bool strictEquals(Runtime& runtime, const String& a, const String& b) { - return runtime.strictEquals(a, b); - } - - /// Copies the data in a JS string as utf8 into a C++ string. - std::string utf8(Runtime& runtime) const { - return runtime.utf8(*this); - } - - friend class Runtime; - friend class Value; -}; - -class Array; -class Function; - -/// Represents a JS Object. Movable, not copyable. -class Object : public Pointer { - public: - using Pointer::Pointer; - - Object(Object&& other) = default; - Object& operator=(Object&& other) = default; - - /// Creates a new Object instance, like '{}' in JS. - Object(Runtime& runtime) : Object(runtime.createObject()) {} - - static Object createFromHostObject( - Runtime& runtime, - std::shared_ptr ho) { - return runtime.createObject(ho); - } - - /// \return whether this and \c obj are the same JSObject or not. - static bool strictEquals(Runtime& runtime, const Object& a, const Object& b) { - return runtime.strictEquals(a, b); - } - - /// \return the result of `this instanceOf ctor` in JS. - bool instanceOf(Runtime& rt, const Function& ctor) { - return rt.instanceOf(*this, ctor); - } - - /// \return the property of the object with the given ascii name. - /// If the name isn't a property on the object, returns the - /// undefined value. - Value getProperty(Runtime& runtime, const char* name) const; - - /// \return the property of the object with the String name. - /// If the name isn't a property on the object, returns the - /// undefined value. - Value getProperty(Runtime& runtime, const String& name) const; - - /// \return the property of the object with the given JS PropNameID - /// name. If the name isn't a property on the object, returns the - /// undefined value. - Value getProperty(Runtime& runtime, const PropNameID& name) const; - - /// \return true if and only if the object has a property with the - /// given ascii name. - bool hasProperty(Runtime& runtime, const char* name) const; - - /// \return true if and only if the object has a property with the - /// given String name. - bool hasProperty(Runtime& runtime, const String& name) const; - - /// \return true if and only if the object has a property with the - /// given PropNameID name. - bool hasProperty(Runtime& runtime, const PropNameID& name) const; - - /// Sets the property value from a Value or anything which can be - /// used to make one: nullptr_t, bool, double, int, const char*, - /// String, or Object. - template - void setProperty(Runtime& runtime, const char* name, T&& value); - - /// Sets the property value from a Value or anything which can be - /// used to make one: nullptr_t, bool, double, int, const char*, - /// String, or Object. - template - void setProperty(Runtime& runtime, const String& name, T&& value); - - /// Sets the property value from a Value or anything which can be - /// used to make one: nullptr_t, bool, double, int, const char*, - /// String, or Object. - template - void setProperty(Runtime& runtime, const PropNameID& name, T&& value); - - /// \return true iff JS \c Array.isArray() would return \c true. If - /// so, then \c getArray() will succeed. - bool isArray(Runtime& runtime) const { - return runtime.isArray(*this); - } - - /// \return true iff the Object is an ArrayBuffer. If so, then \c - /// getArrayBuffer() will succeed. - bool isArrayBuffer(Runtime& runtime) const { - return runtime.isArrayBuffer(*this); - } - - /// \return true iff the Object is callable. If so, then \c - /// getFunction will succeed. - bool isFunction(Runtime& runtime) const { - return runtime.isFunction(*this); - } - - /// \return true iff the Object was initialized with \c createFromHostObject - /// and the HostObject passed is of type \c T. If returns \c true then - /// \c getHostObject will succeed. - template - bool isHostObject(Runtime& runtime) const; - - /// \return an Array instance which refers to the same underlying - /// object. If \c isArray() would return false, this will assert. - Array getArray(Runtime& runtime) const&; - - /// \return an Array instance which refers to the same underlying - /// object. If \c isArray() would return false, this will assert. - Array getArray(Runtime& runtime) &&; - - /// \return an Array instance which refers to the same underlying - /// object. If \c isArray() would return false, this will throw - /// JSIException. - Array asArray(Runtime& runtime) const&; - - /// \return an Array instance which refers to the same underlying - /// object. If \c isArray() would return false, this will throw - /// JSIException. - Array asArray(Runtime& runtime) &&; - - /// \return an ArrayBuffer instance which refers to the same underlying - /// object. If \c isArrayBuffer() would return false, this will assert. - ArrayBuffer getArrayBuffer(Runtime& runtime) const&; - - /// \return an ArrayBuffer instance which refers to the same underlying - /// object. If \c isArrayBuffer() would return false, this will assert. - ArrayBuffer getArrayBuffer(Runtime& runtime) &&; - - /// \return a Function instance which refers to the same underlying - /// object. If \c isFunction() would return false, this will assert. - Function getFunction(Runtime& runtime) const&; - - /// \return a Function instance which refers to the same underlying - /// object. If \c isFunction() would return false, this will assert. - Function getFunction(Runtime& runtime) &&; - - /// \return a Function instance which refers to the same underlying - /// object. If \c isFunction() would return false, this will throw - /// JSIException. - Function asFunction(Runtime& runtime) const&; - - /// \return a Function instance which refers to the same underlying - /// object. If \c isFunction() would return false, this will throw - /// JSIException. - Function asFunction(Runtime& runtime) &&; - - /// \return a shared_ptr which refers to the same underlying - /// \c HostObject that was used to create this object. If \c isHostObject - /// is false, this will assert. Note that this does a type check and will - /// assert if the underlying HostObject isn't of type \c T - template - std::shared_ptr getHostObject(Runtime& runtime) const; - - /// \return a shared_ptr which refers to the same underlying - /// \c HostObject that was used to crete this object. If \c isHostObject - /// is false, this will throw. - template - std::shared_ptr asHostObject(Runtime& runtime) const; - - /// \return same as \c getProperty(name).asObject(), except with - /// a better exception message. - Object getPropertyAsObject(Runtime& runtime, const char* name) const; - - /// \return similar to \c - /// getProperty(name).getObject().getFunction(), except it will - /// throw JSIException instead of asserting if the property is - /// not an object, or the object is not callable. - Function getPropertyAsFunction(Runtime& runtime, const char* name) const; - - /// \return an Array consisting of all enumerable property names in - /// the object and its prototype chain. All values in the return - /// will be isString(). (This is probably not optimal, but it - /// works. I only need it in one place.) - Array getPropertyNames(Runtime& runtime) const; - - protected: - void - setPropertyValue(Runtime& runtime, const String& name, const Value& value) { - return runtime.setPropertyValue(*this, name, value); - } - - void setPropertyValue( - Runtime& runtime, - const PropNameID& name, - const Value& value) { - return runtime.setPropertyValue(*this, name, value); - } - - friend class Runtime; - friend class Value; -}; - -/// Represents a weak reference to a JS Object. If the only reference -/// to an Object are these, the object is eligible for GC. Method -/// names are inspired by C++ weak_ptr. Movable, not copyable. -class WeakObject : public Pointer { - public: - using Pointer::Pointer; - - WeakObject(WeakObject&& other) = default; - WeakObject& operator=(WeakObject&& other) = default; - - /// Create a WeakObject from an Object. - WeakObject(Runtime& runtime, const Object& o) - : WeakObject(runtime.createWeakObject(o)) {} - - /// \return a Value representing the underlying Object if it is still valid; - /// otherwise returns \c undefined. Note that this method has nothing to do - /// with threads or concurrency. The name is based on std::weak_ptr::lock() - /// which serves a similar purpose. - Value lock(Runtime& runtime); - - friend class Runtime; -}; - -/// Represents a JS Object which can be efficiently used as an array -/// with integral indices. -class Array : public Object { - public: - Array(Array&&) = default; - /// Creates a new Array instance, with \c length undefined elements. - Array(Runtime& runtime, size_t length) : Array(runtime.createArray(length)) {} - - Array& operator=(Array&&) = default; - - /// \return the size of the Array, according to its length property. - /// (C++ naming convention) - size_t size(Runtime& runtime) const { - return runtime.size(*this); - } - - /// \return the size of the Array, according to its length property. - /// (JS naming convention) - size_t length(Runtime& runtime) const { - return size(runtime); - } - - /// \return the property of the array at index \c i. If there is no - /// such property, returns the undefined value. If \c i is out of - /// range [ 0..\c length ] throws a JSIException. - Value getValueAtIndex(Runtime& runtime, size_t i) const; - - /// Sets the property of the array at index \c i. The argument - /// value behaves as with Object::setProperty(). If \c i is out of - /// range [ 0..\c length ] throws a JSIException. - template - void setValueAtIndex(Runtime& runtime, size_t i, T&& value); - - /// There is no current API for changing the size of an array once - /// created. We'll probably need that eventually. - - /// Creates a new Array instance from provided values - template - static Array createWithElements(Runtime&, Args&&... args); - - /// Creates a new Array instance from intitializer list. - static Array createWithElements( - Runtime& runtime, - std::initializer_list elements); - - private: - friend class Object; - friend class Value; - - void setValueAtIndexImpl(Runtime& runtime, size_t i, const Value& value) { - return runtime.setValueAtIndexImpl(*this, i, value); - } - - Array(Runtime::PointerValue* value) : Object(value) {} -}; - -/// Represents a JSArrayBuffer -class ArrayBuffer : public Object { - public: - ArrayBuffer(ArrayBuffer&&) = default; - ArrayBuffer& operator=(ArrayBuffer&&) = default; - - /// \return the size of the ArrayBuffer, according to its byteLength property. - /// (C++ naming convention) - size_t size(Runtime& runtime) const { - return runtime.size(*this); - } - - size_t length(Runtime& runtime) const { - return runtime.size(*this); - } - - uint8_t* data(Runtime& runtime) { - return runtime.data(*this); - } - - private: - friend class Object; - friend class Value; - - ArrayBuffer(Runtime::PointerValue* value) : Object(value) {} -}; - -/// Represents a JS Object which is guaranteed to be Callable. -class Function : public Object { - public: - Function(Function&&) = default; - Function& operator=(Function&&) = default; - - /// Create a function which, when invoked, calls C++ code. If the - /// function throws an exception, a JS Error will be created and - /// thrown. - /// \param name the name property for the function. - /// \param paramCount the length property for the function, which - /// may not be the number of arguments the function is passed. - static Function createFromHostFunction( - Runtime& runtime, - const jsi::PropNameID& name, - unsigned int paramCount, - jsi::HostFunctionType func); - - /// Calls the function with \c count \c args. The \c this value of - /// the JS function will be undefined. - Value call(Runtime& runtime, const Value* args, size_t count) const; - - /// Calls the function with a \c std::initializer_list of Value - /// arguments. The \c this value of the JS function will be - /// undefined. - Value call(Runtime& runtime, std::initializer_list args) const; - - /// Calls the function with any number of arguments similarly to - /// Object::setProperty(). The \c this value of the JS function - /// will be undefined. - template - Value call(Runtime& runtime, Args&&... args) const; - - /// Calls the function with \c count \c args and \c jsThis value passed - /// as this value. - Value callWithThis( - Runtime& Runtime, - const Object& jsThis, - const Value* args, - size_t count) const; - - /// Calls the function with a \c std::initializer_list of Value - /// arguments. The \c this value of the JS function will be - /// undefined. - Value callWithThis( - Runtime& runtime, - const Object& jsThis, - std::initializer_list args) const; - - /// Calls the function with any number of arguments similarly to - /// Object::setProperty(). The \c this value of the JS function - /// will be undefined. - template - Value callWithThis(Runtime& runtime, const Object& jsThis, Args&&... args) - const; - - /// Calls the function as a constructor with \c count \c args. Equivalent - /// to calling `new Func` where `Func` is the js function reqresented by - /// this. - Value callAsConstructor(Runtime& runtime, const Value* args, size_t count) - const; - - /// Same as above `callAsConstructor`, except use an initializer_list to - /// supply the arguments. - Value callAsConstructor(Runtime& runtime, std::initializer_list args) - const; - - /// Same as above `callAsConstructor`, but automatically converts/wraps - /// any argument with a jsi Value. - template - Value callAsConstructor(Runtime& runtime, Args&&... args) const; - - /// Returns whether this was created with Function::createFromHostFunction. - /// If true then you can use getHostFunction to get the underlying - /// HostFunctionType. - bool isHostFunction(Runtime& runtime) const { - return runtime.isHostFunction(*this); - } - - /// Returns the underlying HostFunctionType iff isHostFunction returns true - /// and asserts otherwise. You can use this to use std::function<>::target - /// to get the object that was passed to create the HostFunctionType. - /// - /// Note: The reference returned is borrowed from the JS object underlying - /// \c this, and thus only lasts as long as the object underlying - /// \c this does. - HostFunctionType& getHostFunction(Runtime& runtime) const { - assert(isHostFunction(runtime)); - return runtime.getHostFunction(*this); - } - - private: - friend class Object; - friend class Value; - - Function(Runtime::PointerValue* value) : Object(value) {} -}; - -/// Represents any JS Value (undefined, null, boolean, number, string, -/// or object). Movable, or explicitly copyable (has no copy ctor). -class Value { - public: - /// Default ctor creates an \c undefined JS value. - Value() : Value(UndefinedKind) {} - - /// Creates a \c null JS value. - /* implicit */ Value(std::nullptr_t) : kind_(NullKind) {} - - /// Creates a boolean JS value. - /* implicit */ Value(bool b) : Value(BooleanKind) { - data_.boolean = b; - } - - /// Creates a number JS value. - /* implicit */ Value(double d) : Value(NumberKind) { - data_.number = d; - } - - /// Creates a number JS value. - /* implicit */ Value(int i) : Value(NumberKind) { - data_.number = i; - } - - /// Moves a String or Object rvalue into a new JS value. - template - /* implicit */ Value(T&& other) : Value(kindOf(other)) { - static_assert( - std::is_base_of::value || std::is_base_of::value, - "Value cannot be implictly move-constructed from this type"); - new (&data_.pointer) T(std::move(other)); - } - - /// Value("foo") will treat foo as a bool. This makes doing that a - /// compile error. - template - Value(const char*) { - static_assert( - !std::is_same::value, - "Value cannot be constructed directly from const char*"); - } - - Value(Value&& value); - - /// Copies a String lvalue into a new JS value. - Value(Runtime& runtime, const String& str) : Value(StringKind) { - new (&data_.pointer) String(runtime.cloneString(str.ptr_)); - } - - /// Copies a Object lvalue into a new JS value. - Value(Runtime& runtime, const Object& obj) : Value(ObjectKind) { - new (&data_.pointer) Object(runtime.cloneObject(obj.ptr_)); - } - - /// Creates a JS value from another Value lvalue. - Value(Runtime& runtime, const Value& value); - - /// Value(rt, "foo") will treat foo as a bool. This makes doing - /// that a compile error. - template - Value(Runtime&, const char*) { - static_assert( - !std::is_same::value, - "Value cannot be constructed directly from const char*"); - } - - ~Value(); - // \return the undefined \c Value. - static Value undefined() { - return Value(); - } - - // \return the null \c Value. - static Value null() { - return Value(nullptr); - } - - // \return a \c Value created from a utf8-encoded JSON string. - static Value - createFromJsonUtf8(Runtime& runtime, const uint8_t* json, size_t length); - - /// \return according to the SameValue algorithm see more here: - // https://www.ecma-international.org/ecma-262/5.1/#sec-11.9.4 - static bool strictEquals(Runtime& runtime, const Value& a, const Value& b); - - Value& operator=(Value&& other) { - this->~Value(); - new (this) Value(std::move(other)); - return *this; - } - - bool isUndefined() const { - return kind_ == UndefinedKind; - } - - bool isNull() const { - return kind_ == NullKind; - } - - bool isBool() const { - return kind_ == BooleanKind; - } - - bool isNumber() const { - return kind_ == NumberKind; - } - - bool isString() const { - return kind_ == StringKind; - } - - bool isObject() const { - return kind_ == ObjectKind; - } - - /// \return the boolean value, or asserts if not a boolean. - bool getBool() const { - assert(isBool()); - return data_.boolean; - } - - /// \return the number value, or asserts if not a number. - double getNumber() const { - assert(isNumber()); - return data_.number; - } - - /// \return the number value, or throws JSIException if not a - /// number. - double asNumber() const; - - /// \return the String value, or asserts if not a string. - String getString(Runtime& runtime) const& { - assert(isString()); - return String(runtime.cloneString(data_.pointer.ptr_)); - } - - /// \return the String value, or asserts if not a string. - /// Can be used on rvalue references to avoid cloning more strings. - String getString(Runtime&) && { - assert(isString()); - auto ptr = data_.pointer.ptr_; - data_.pointer.ptr_ = nullptr; - return static_cast(ptr); - } - - String asString(Runtime& runtime) const&; - String asString(Runtime& runtime) &&; - - /// \return the Object value, or asserts if not an object. - Object getObject(Runtime& runtime) const& { - assert(isObject()); - return Object(runtime.cloneObject(data_.pointer.ptr_)); - } - - /// \return the Object value, or asserts if not an object. - /// Can be used on rvalue references to avoid cloning more objects. - Object getObject(Runtime&) && { - assert(isObject()); - auto ptr = data_.pointer.ptr_; - data_.pointer.ptr_ = nullptr; - return static_cast(ptr); - } - - /// \return the Object value, or throws JSIException if not an - /// object. - Object asObject(Runtime& runtime) const&; - Object asObject(Runtime& runtime) &&; - - // \return a String like JS .toString() would do. - String toString(Runtime& runtime) const; - - private: - friend class Runtime; - - enum ValueKind { - UndefinedKind, - NullKind, - BooleanKind, - NumberKind, - StringKind, - ObjectKind, - PointerKind = StringKind, - }; - - union Data { - // Value's ctor and dtor will manage the lifecycle of the contained Data. - Data() { - static_assert( - sizeof(Data) == sizeof(uint64_t), - "Value data should fit in a 64-bit register"); - } - ~Data() {} - - // scalars - bool boolean; - double number; - // pointers - Pointer pointer; // String, Object, Array, Function - }; - - Value(ValueKind kind) : kind_(kind) {} - - constexpr static ValueKind kindOf(const String&) { - return StringKind; - } - constexpr static ValueKind kindOf(const Object&) { - return ObjectKind; - } - - ValueKind kind_; - Data data_; - - // In the future: Value becomes NaN-boxed. In the Hermes impl, if - // the object contains a PinnedHermesValue, we need to be able to - // get a pointer to it; this can be casted from 'this'. In the JSC - // impl, we need to be able to convert the boxed value into a JSC - // ref. This can be done by casting this, deferencing it to get a - // number, doing some bit masks, and then casting again into the - // desired JSC ref type. -}; - -/// Not movable and not copyable RAII marker advising the underlying -/// JavaScript VM to track resources allocated since creation until -/// destruction so that they can be recycled eagerly when the Scope -/// goes out of scope instead of floating in the air until the next -/// garbage collection or any other delayed release occurs. -/// -/// This API should be treated only as advice, implementations can -/// choose to ignore the fact that Scopes are created or destroyed. -/// -/// This class is an exception to the rule allowing destructors to be -/// called without proper synchronization (see Runtime documentation). -/// The whole point of this class is to enable all sorts of clean ups -/// when the destructor is called and this proper synchronization is -/// required at that time. -/// -/// Instances of this class are intended to be created as automatic stack -/// variables in which case destructor calls don't require any additional -/// locking, provided that the lock (if any) is managed with RAII helpers. -class Scope { - public: - explicit Scope(Runtime& rt) : rt_(rt), prv_(rt.pushScope()) {} - ~Scope() { - rt_.popScope(prv_); - }; - - Scope(const Scope&) = delete; - Scope(Scope&&) = delete; - - Scope& operator=(const Scope&) = delete; - Scope& operator=(Scope&&) = delete; - - template - static auto callInNewScope(Runtime& rt, F f) -> decltype(f()) { - Scope s(rt); - return f(); - } - - private: - Runtime& rt_; - Runtime::ScopeState* prv_; -}; - -/// Base class for jsi exceptions -class JSIException : public std::exception { - protected: - JSIException(){}; - JSIException(std::string what) : what_(std::move(what)){}; - - public: - virtual const char* what() const noexcept override { - return what_.c_str(); - } - - protected: - std::string what_; -}; - -/// This exception will be thrown by API functions on errors not related to -/// JavaScript execution. -class JSINativeException : public JSIException { - public: - JSINativeException(std::string what) : JSIException(std::move(what)) {} -}; - -/// This exception will be thrown by API functions whenever a JS -/// operation causes an exception as described by the spec, or as -/// otherwise described. -class JSError : public JSIException { - public: - /// Creates a JSError referring to provided \c value - JSError(Runtime& r, Value&& value); - - /// Creates a JSError referring to new \c Error instance capturing current - /// JavaScript stack. The error message property is set to given \c message. - JSError(Runtime& rt, std::string message); - - /// Creates a JSError referring to new \c Error instance capturing current - /// JavaScript stack. The error message property is set to given \c message. - JSError(Runtime& rt, const char* message) - : JSError(rt, std::string(message)){}; - - /// Creates a JSError referring to a JavaScript Object having message and - /// stack properties set to provided values. - JSError(Runtime& rt, std::string message, std::string stack); - - /// Creates a JSError referring to provided value and what string - /// set to provided message. This argument order is a bit weird, - /// but necessary to avoid ambiguity with the above. - JSError(std::string what, Runtime& rt, Value&& value); - - const std::string& getStack() const { - return stack_; - } - - const std::string& getMessage() const { - return message_; - } - - const jsi::Value& value() const { - assert(value_); - return *value_; - } - - private: - // This initializes the value_ member and does some other - // validation, so it must be called by every branch through the - // constructors. - void setValue(Runtime& rt, Value&& value); - - // This needs to be on the heap, because throw requires the object - // be copyable, and Value is not. - std::shared_ptr value_; - std::string message_; - std::string stack_; -}; - -} // namespace jsi -} // namespace facebook - -#include diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsiexecutor/Android.mk b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsiexecutor/Android.mk deleted file mode 100644 index c6bb6012..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsiexecutor/Android.mk +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := jsireact - -LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/jsireact/*.cpp) - -LOCAL_C_INCLUDES := $(LOCAL_PATH) -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) - -LOCAL_CFLAGS := -fexceptions -frtti -O3 - -LOCAL_STATIC_LIBRARIES := libjsi reactnative -LOCAL_SHARED_LIBRARIES := libfolly_json glog - -include $(BUILD_STATIC_LIBRARY) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsiexecutor/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsiexecutor/BUCK deleted file mode 100644 index 9850db4d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsiexecutor/BUCK +++ /dev/null @@ -1,41 +0,0 @@ -load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "APPLE", "cxx_library", "react_native_xplat_dep", "react_native_xplat_target") - -cxx_library( - name = "jsiexecutor", - srcs = [ - "jsireact/JSIExecutor.cpp", - "jsireact/JSINativeModules.cpp", - ], - header_namespace = "", - exported_headers = { - "jsireact/JSIExecutor.h": "jsireact/JSIExecutor.h", - "jsireact/JSINativeModules.h": "jsireact/JSINativeModules.h", - }, - compiler_flags = [ - "-fexceptions", - "-frtti", - ], - fbandroid_deps = [ - "xplat//folly:molly", - "xplat//third-party/glog:glog", - "xplat//third-party/linker_lib:atomic", - ], - fbobjc_force_static = True, - fbobjc_header_path_prefix = "", - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - visibility = [ - "PUBLIC", - ], - xcode_public_headers_symlinks = True, - deps = [ - "xplat//fbsystrace:fbsystrace", - react_native_xplat_dep("jsi:jsi"), - react_native_xplat_dep("jsi:JSIDynamic"), - react_native_xplat_target("cxxreact:bridge"), - react_native_xplat_target("cxxreact:jsbigstring"), - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp deleted file mode 100644 index 15414107..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp +++ /dev/null @@ -1,390 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the - // LICENSE file in the root directory of this source tree. - -#include "jsireact/JSIExecutor.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -using namespace facebook::jsi; - -namespace facebook { -namespace react { - -class JSIExecutor::NativeModuleProxy : public jsi::HostObject { - public: - NativeModuleProxy(JSIExecutor& executor) : executor_(executor) {} - - Value get(Runtime& rt, const PropNameID& name) override { - if (name.utf8(rt) == "name") { - return jsi::String::createFromAscii(rt, "NativeModules"); - } - - return executor_.nativeModules_.getModule(rt, name); - } - - void set(Runtime&, const PropNameID&, const Value&) override { - throw std::runtime_error( - "Unable to put on NativeModules: Operation unsupported"); - } - - private: - JSIExecutor& executor_; -}; - -namespace { - -// basename_r isn't in all iOS SDKs, so use this simple version instead. -std::string simpleBasename(const std::string& path) { - size_t pos = path.rfind("/"); - return (pos != std::string::npos) ? path.substr(pos) : path; -} - -} // namespace - -JSIExecutor::JSIExecutor( - std::shared_ptr runtime, - std::shared_ptr delegate, - Logger logger, - const JSIScopedTimeoutInvoker& scopedTimeoutInvoker, - RuntimeInstaller runtimeInstaller) - : runtime_(runtime), - delegate_(delegate), - nativeModules_(delegate ? delegate->getModuleRegistry() : nullptr), - logger_(logger), - scopedTimeoutInvoker_(scopedTimeoutInvoker), - runtimeInstaller_(runtimeInstaller) { - runtime_->global().setProperty( - *runtime, "__jsiExecutorDescription", runtime->description()); -} - -void JSIExecutor::loadApplicationScript( - std::unique_ptr script, - std::string sourceURL) { - SystraceSection s("JSIExecutor::loadApplicationScript"); - - // TODO: check for and use precompiled HBC - - runtime_->global().setProperty( - *runtime_, - "nativeModuleProxy", - Object::createFromHostObject( - *runtime_, std::make_shared(*this))); - - runtime_->global().setProperty( - *runtime_, - "nativeFlushQueueImmediate", - Function::createFromHostFunction( - *runtime_, - PropNameID::forAscii(*runtime_, "nativeFlushQueueImmediate"), - 1, - [this]( - jsi::Runtime&, - const jsi::Value&, - const jsi::Value* args, - size_t count) { - if (count != 1) { - throw std::invalid_argument( - "nativeFlushQueueImmediate arg count must be 1"); - } - callNativeModules(args[0], false); - return Value::undefined(); - })); - - runtime_->global().setProperty( - *runtime_, - "nativeCallSyncHook", - Function::createFromHostFunction( - *runtime_, - PropNameID::forAscii(*runtime_, "nativeCallSyncHook"), - 1, - [this]( - jsi::Runtime&, - const jsi::Value&, - const jsi::Value* args, - size_t count) { return nativeCallSyncHook(args, count); })); - - if (logger_) { - // Only inject the logging function if it was supplied by the caller. - runtime_->global().setProperty( - *runtime_, - "nativeLoggingHook", - Function::createFromHostFunction( - *runtime_, - PropNameID::forAscii(*runtime_, "nativeLoggingHook"), - 2, - [this]( - jsi::Runtime&, - const jsi::Value&, - const jsi::Value* args, - size_t count) { - if (count != 2) { - throw std::invalid_argument( - "nativeLoggingHook takes 2 arguments"); - } - logger_( - args[0].asString(*runtime_).utf8(*runtime_), - folly::to(args[1].asNumber())); - return Value::undefined(); - })); - } - - if (runtimeInstaller_) { - runtimeInstaller_(*runtime_); - } - - bool hasLogger(ReactMarker::logTaggedMarker); - std::string scriptName = simpleBasename(sourceURL); - if (hasLogger) { - ReactMarker::logTaggedMarker( - ReactMarker::RUN_JS_BUNDLE_START, scriptName.c_str()); - } - runtime_->evaluateJavaScript( - std::make_unique(std::move(script)), sourceURL); - flush(); - if (hasLogger) { - ReactMarker::logMarker(ReactMarker::CREATE_REACT_CONTEXT_STOP); - ReactMarker::logTaggedMarker( - ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str()); - } -} - -void JSIExecutor::setBundleRegistry(std::unique_ptr r) { - if (!bundleRegistry_) { - runtime_->global().setProperty( - *runtime_, - "nativeRequire", - Function::createFromHostFunction( - *runtime_, - PropNameID::forAscii(*runtime_, "nativeRequire"), - 2, - [this]( - Runtime& rt, - const facebook::jsi::Value&, - const facebook::jsi::Value* args, - size_t count) { return nativeRequire(args, count); })); - } - bundleRegistry_ = std::move(r); -} - -void JSIExecutor::registerBundle( - uint32_t bundleId, - const std::string& bundlePath) { - const auto tag = folly::to(bundleId); - ReactMarker::logTaggedMarker( - ReactMarker::REGISTER_JS_SEGMENT_START, tag.c_str()); - if (bundleRegistry_) { - bundleRegistry_->registerBundle(bundleId, bundlePath); - } else { - auto script = JSBigFileString::fromPath(bundlePath); - runtime_->evaluateJavaScript( - std::make_unique(std::move(script)), - JSExecutor::getSyntheticBundlePath(bundleId, bundlePath)); - } - ReactMarker::logTaggedMarker( - ReactMarker::REGISTER_JS_SEGMENT_STOP, tag.c_str()); -} - -void JSIExecutor::callFunction( - const std::string& moduleId, - const std::string& methodId, - const folly::dynamic& arguments) { - SystraceSection s( - "JSIExecutor::callFunction", "moduleId", moduleId, "methodId", methodId); - if (!callFunctionReturnFlushedQueue_) { - bindBridge(); - } - - // Construct the error message producer in case this times out. - // This is executed on a background thread, so it must capture its parameters - // by value. - auto errorProducer = [=] { - std::stringstream ss; - ss << "moduleID: " << moduleId << " methodID: " << methodId - << " arguments: " << folly::toJson(arguments); - return ss.str(); - }; - - Value ret = Value::undefined(); - try { - scopedTimeoutInvoker_( - [&] { - ret = callFunctionReturnFlushedQueue_->call( - *runtime_, - moduleId, - methodId, - valueFromDynamic(*runtime_, arguments)); - }, - std::move(errorProducer)); - } catch (...) { - std::throw_with_nested( - std::runtime_error("Error calling " + moduleId + "." + methodId)); - } - - callNativeModules(ret, true); -} - -void JSIExecutor::invokeCallback( - const double callbackId, - const folly::dynamic& arguments) { - SystraceSection s("JSIExecutor::invokeCallback", "callbackId", callbackId); - if (!invokeCallbackAndReturnFlushedQueue_) { - bindBridge(); - } - Value ret; - try { - ret = invokeCallbackAndReturnFlushedQueue_->call( - *runtime_, callbackId, valueFromDynamic(*runtime_, arguments)); - } catch (...) { - std::throw_with_nested(std::runtime_error( - folly::to("Error invoking callback ", callbackId))); - } - - callNativeModules(ret, true); -} - -void JSIExecutor::setGlobalVariable( - std::string propName, - std::unique_ptr jsonValue) { - SystraceSection s("JSIExecutor::setGlobalVariable", "propName", propName); - runtime_->global().setProperty( - *runtime_, - propName.c_str(), - Value::createFromJsonUtf8( - *runtime_, - reinterpret_cast(jsonValue->c_str()), - jsonValue->size())); -} - -std::string JSIExecutor::getDescription() { - return "JSI " + runtime_->description(); -} - -void* JSIExecutor::getJavaScriptContext() { - return runtime_.get(); -} - -bool JSIExecutor::isInspectable() { - return runtime_->isInspectable(); -} - -void JSIExecutor::bindBridge() { - std::call_once(bindFlag_, [this] { - SystraceSection s("JSIExecutor::bindBridge (once)"); - Value batchedBridgeValue = - runtime_->global().getProperty(*runtime_, "__fbBatchedBridge"); - if (batchedBridgeValue.isUndefined()) { - Function requireBatchedBridge = runtime_->global().getPropertyAsFunction( - *runtime_, "__fbRequireBatchedBridge"); - batchedBridgeValue = requireBatchedBridge.call(*runtime_); - if (batchedBridgeValue.isUndefined()) { - throw JSINativeException( - "Could not get BatchedBridge, make sure your bundle is packaged correctly"); - } - } - - Object batchedBridge = batchedBridgeValue.asObject(*runtime_); - callFunctionReturnFlushedQueue_ = batchedBridge.getPropertyAsFunction( - *runtime_, "callFunctionReturnFlushedQueue"); - invokeCallbackAndReturnFlushedQueue_ = batchedBridge.getPropertyAsFunction( - *runtime_, "invokeCallbackAndReturnFlushedQueue"); - flushedQueue_ = - batchedBridge.getPropertyAsFunction(*runtime_, "flushedQueue"); - callFunctionReturnResultAndFlushedQueue_ = - batchedBridge.getPropertyAsFunction( - *runtime_, "callFunctionReturnResultAndFlushedQueue"); - }); -} - -void JSIExecutor::callNativeModules(const Value& queue, bool isEndOfBatch) { - SystraceSection s("JSIExecutor::callNativeModules"); - // If this fails, you need to pass a fully functional delegate with a - // module registry to the factory/ctor. - CHECK(delegate_) << "Attempting to use native modules without a delegate"; -#if 0 // maybe useful for debugging - std::string json = runtime_->global().getPropertyAsObject(*runtime_, "JSON") - .getPropertyAsFunction(*runtime_, "stringify").call(*runtime_, queue) - .getString(*runtime_).utf8(*runtime_); -#endif - delegate_->callNativeModules( - *this, dynamicFromValue(*runtime_, queue), isEndOfBatch); -} - -void JSIExecutor::flush() { - SystraceSection s("JSIExecutor::flush"); - if (flushedQueue_) { - callNativeModules(flushedQueue_->call(*runtime_), true); - return; - } - - // When a native module is called from JS, BatchedBridge.enqueueNativeCall() - // is invoked. For that to work, require('BatchedBridge') has to be called, - // and when that happens, __fbBatchedBridge is set as a side effect. - Value batchedBridge = - runtime_->global().getProperty(*runtime_, "__fbBatchedBridge"); - // So here, if __fbBatchedBridge doesn't exist, then we know no native calls - // have happened, and we were able to determine this without forcing - // BatchedBridge to be loaded as a side effect. - if (!batchedBridge.isUndefined()) { - // If calls were made, we bind to the JS bridge methods, and use them to - // get the pending queue of native calls. - bindBridge(); - callNativeModules(flushedQueue_->call(*runtime_), true); - } else if (delegate_) { - // If we have a delegate, we need to call it; we pass a null list to - // callNativeModules, since we know there are no native calls, without - // calling into JS again. If no calls were made and there's no delegate, - // nothing happens, which is correct. - callNativeModules(nullptr, true); - } -} - -Value JSIExecutor::nativeRequire(const Value* args, size_t count) { - if (count > 2 || count == 0) { - throw std::invalid_argument("Got wrong number of args"); - } - - uint32_t moduleId = folly::to(args[0].getNumber()); - uint32_t bundleId = count == 2 ? folly::to(args[1].getNumber()) : 0; - auto module = bundleRegistry_->getModule(bundleId, moduleId); - - runtime_->evaluateJavaScript( - std::make_unique(module.code), module.name); - return facebook::jsi::Value(); -} - -Value JSIExecutor::nativeCallSyncHook(const Value* args, size_t count) { - if (count != 3) { - throw std::invalid_argument("nativeCallSyncHook arg count must be 3"); - } - - if (!args[2].asObject(*runtime_).isArray(*runtime_)) { - throw std::invalid_argument( - folly::to("method parameters should be array")); - } - - MethodCallResult result = delegate_->callSerializableNativeHook( - *this, - static_cast(args[0].getNumber()), // moduleId - static_cast(args[1].getNumber()), // methodId - dynamicFromValue(*runtime_, args[2])); // args - - if (!result.hasValue()) { - return Value::undefined(); - } - return valueFromDynamic(*runtime_, result.value()); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h deleted file mode 100644 index 27d3b7dc..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the - // LICENSE file in the root directory of this source tree. - -#pragma once - -#include "JSINativeModules.h" - -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -// A JSIScopedTimeoutInvoker is a trampoline-type function for introducing -// timeouts. Call the TimeoutInvoker with a function to execute, the invokee. -// The TimeoutInvoker will immediately invoke it, synchronously on the same -// thread. If the invokee fails to return after some timeout (private to the -// TimeoutInvoker), a soft error may be reported. -// -// If a soft error is reported, the second parameter errorMessageProducer will -// be invoked to produce an error message, which will be included in the soft -// error report. Note that the errorMessageProducer will be invoked -// asynchronously on a different thread. -// -// The timeout behavior does NOT caues the invokee to aborted. If the invokee -// blocks forever, so will the ScopedTimeoutInvoker (but the soft error may -// still be reported). -// -// The invokee is passed by const ref because it is executed synchronously, but -// the errorMessageProducer is passed by value because it must be copied or -// moved for async execution. -// -// Example usage: -// -// int param = ...; -// timeoutInvoker( -// [&]{ someBigWork(param); }, -// [=] -> std::string { -// return "someBigWork, param " + std::to_string(param); -// }) -// -using JSIScopedTimeoutInvoker = std::function& invokee, - std::function errorMessageProducer)>; - -class BigStringBuffer : public jsi::Buffer { - public: - BigStringBuffer(std::unique_ptr script) - : script_(std::move(script)) {} - - size_t size() const override { - return script_->size(); - } - - const uint8_t* data() const override { - return reinterpret_cast(script_->c_str()); - } - - private: - std::unique_ptr script_; -}; - -class JSIExecutor : public JSExecutor { - public: - using Logger = - std::function; - - using RuntimeInstaller = std::function; - - JSIExecutor( - std::shared_ptr runtime, - std::shared_ptr delegate, - Logger logger, - const JSIScopedTimeoutInvoker& timeoutInvoker, - RuntimeInstaller runtimeInstaller); - void loadApplicationScript( - std::unique_ptr script, - std::string sourceURL) override; - void setBundleRegistry(std::unique_ptr) override; - void registerBundle(uint32_t bundleId, const std::string& bundlePath) - override; - void callFunction( - const std::string& moduleId, - const std::string& methodId, - const folly::dynamic& arguments) override; - void invokeCallback(const double callbackId, const folly::dynamic& arguments) - override; - void setGlobalVariable( - std::string propName, - std::unique_ptr jsonValue) override; - std::string getDescription() override; - void* getJavaScriptContext() override; - bool isInspectable() override; - - // An implementation of JSIScopedTimeoutInvoker that simply runs the - // invokee, with no timeout. - static void defaultTimeoutInvoker( - const std::function& invokee, - std::function errorMessageProducer) { - (void)errorMessageProducer; - invokee(); - } - - private: - class NativeModuleProxy; - - void flush(); - void bindBridge(); - void callNativeModules(const jsi::Value& queue, bool isEndOfBatch); - jsi::Value nativeCallSyncHook(const jsi::Value* args, size_t count); - jsi::Value nativeRequire(const jsi::Value* args, size_t count); - - std::shared_ptr runtime_; - std::shared_ptr delegate_; - JSINativeModules nativeModules_; - std::once_flag bindFlag_; - std::unique_ptr bundleRegistry_; - Logger logger_; - JSIScopedTimeoutInvoker scopedTimeoutInvoker_; - RuntimeInstaller runtimeInstaller_; - - folly::Optional callFunctionReturnFlushedQueue_; - folly::Optional invokeCallbackAndReturnFlushedQueue_; - folly::Optional flushedQueue_; - folly::Optional callFunctionReturnResultAndFlushedQueue_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp deleted file mode 100644 index a15ceb05..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the - // LICENSE file in the root directory of this source tree. - -#include "jsireact/JSINativeModules.h" - -#include - -#include - -#include - -using namespace facebook::jsi; - -namespace facebook { -namespace react { - -JSINativeModules::JSINativeModules( - std::shared_ptr moduleRegistry) - : m_moduleRegistry(std::move(moduleRegistry)) {} - -Value JSINativeModules::getModule(Runtime& rt, const PropNameID& name) { - if (!m_moduleRegistry) { - return nullptr; - } - - std::string moduleName = name.utf8(rt); - - const auto it = m_objects.find(moduleName); - if (it != m_objects.end()) { - return Value(rt, it->second); - } - - auto module = createModule(rt, moduleName); - if (!module.hasValue()) { - // Allow lookup to continue in the objects own properties, which allows for - // overrides of NativeModules - return nullptr; - } - - auto result = - m_objects.emplace(std::move(moduleName), std::move(*module)).first; - return Value(rt, result->second); -} - -void JSINativeModules::reset() { - m_genNativeModuleJS = folly::none; - m_objects.clear(); -} - -folly::Optional JSINativeModules::createModule( - Runtime& rt, - const std::string& name) { - bool hasLogger(ReactMarker::logTaggedMarker); - if (hasLogger) { - ReactMarker::logTaggedMarker( - ReactMarker::NATIVE_MODULE_SETUP_START, name.c_str()); - } - - if (!m_genNativeModuleJS) { - m_genNativeModuleJS = - rt.global().getPropertyAsFunction(rt, "__fbGenNativeModule"); - } - - auto result = m_moduleRegistry->getConfig(name); - if (!result.hasValue()) { - return folly::none; - } - - Value moduleInfo = m_genNativeModuleJS->call( - rt, - valueFromDynamic(rt, result->config), - static_cast(result->index)); - CHECK(!moduleInfo.isNull()) << "Module returned from genNativeModule is null"; - - folly::Optional module( - moduleInfo.asObject(rt).getPropertyAsObject(rt, "module")); - - if (hasLogger) { - ReactMarker::logTaggedMarker( - ReactMarker::NATIVE_MODULE_SETUP_STOP, name.c_str()); - } - - return module; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsiexecutor/jsireact/JSINativeModules.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsiexecutor/jsireact/JSINativeModules.h deleted file mode 100644 index 0f687987..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsiexecutor/jsireact/JSINativeModules.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the - // LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include - -#include -#include -#include - -namespace facebook { -namespace react { - -/** - * Holds and creates JS representations of the modules in ModuleRegistry - */ -class JSINativeModules { - public: - explicit JSINativeModules(std::shared_ptr moduleRegistry); - jsi::Value getModule(jsi::Runtime& rt, const jsi::PropNameID& name); - void reset(); - - private: - folly::Optional m_genNativeModuleJS; - std::shared_ptr m_moduleRegistry; - std::unordered_map m_objects; - - folly::Optional createModule( - jsi::Runtime& rt, - const std::string& name); -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsinspector/Android.mk b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsinspector/Android.mk deleted file mode 100644 index 4ac55536..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsinspector/Android.mk +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := jsinspector - -LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) - -LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) - -LOCAL_CFLAGS += -fexceptions - -include $(BUILD_SHARED_LIBRARY) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsinspector/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsinspector/BUCK deleted file mode 100644 index 7d9baea1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsinspector/BUCK +++ /dev/null @@ -1,37 +0,0 @@ -load("@fbsource//tools/build_defs:glob_defs.bzl", "subdir_glob") -load("//tools/build_defs/oss:rn_defs.bzl", "rn_xplat_cxx_library") - -EXPORTED_HEADERS = [ - "InspectorInterfaces.h", -] - -rn_xplat_cxx_library( - name = "jsinspector", - srcs = glob( - ["*.cpp"], - ), - headers = subdir_glob( - [ - ("", "*.h"), - ], - exclude = EXPORTED_HEADERS, - prefix = "jsinspector", - ), - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", header) - for header in EXPORTED_HEADERS - ], - prefix = "jsinspector", - ), - compiler_flags = [ - "-Wall", - "-fexceptions", - "-std=c++1y", - ], - fbandroid_preferred_linkage = "shared", - visibility = [ - "PUBLIC", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsinspector/InspectorInterfaces.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsinspector/InspectorInterfaces.cpp deleted file mode 100644 index b4f0af30..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsinspector/InspectorInterfaces.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "InspectorInterfaces.h" - -#include -#include -#include - -namespace facebook { -namespace react { - -// pure destructors in C++ are odd. You would think they don't want an -// implementation, but in fact the linker requires one. Define them to be -// empty so that people don't count on them for any particular behaviour. -IDestructible::~IDestructible() {} -ILocalConnection::~ILocalConnection() {} -IRemoteConnection::~IRemoteConnection() {} -IInspector::~IInspector() {} - -namespace { - -class InspectorImpl : public IInspector { - public: - int addPage(const std::string& title, const std::string& vm, ConnectFunc connectFunc) override; - void removePage(int pageId) override; - - std::vector getPages() const override; - std::unique_ptr connect( - int pageId, - std::unique_ptr remote) override; - - private: - mutable std::mutex mutex_; - int nextPageId_{1}; - std::unordered_map> titles_; - std::unordered_map connectFuncs_; -}; - -int InspectorImpl::addPage(const std::string& title, const std::string& vm, ConnectFunc connectFunc) { - std::lock_guard lock(mutex_); - - int pageId = nextPageId_++; - titles_[pageId] = std::make_tuple(title, vm); - connectFuncs_[pageId] = std::move(connectFunc); - - return pageId; -} - -void InspectorImpl::removePage(int pageId) { - std::lock_guard lock(mutex_); - - titles_.erase(pageId); - connectFuncs_.erase(pageId); -} - -std::vector InspectorImpl::getPages() const { - std::lock_guard lock(mutex_); - - std::vector inspectorPages; - for (auto& it : titles_) { - inspectorPages.push_back(InspectorPage{it.first, std::get<0>(it.second), std::get<1>(it.second)}); - } - - return inspectorPages; -} - -std::unique_ptr InspectorImpl::connect( - int pageId, - std::unique_ptr remote) { - IInspector::ConnectFunc connectFunc; - - { - std::lock_guard lock(mutex_); - - auto it = connectFuncs_.find(pageId); - if (it != connectFuncs_.end()) { - connectFunc = it->second; - } - } - - return connectFunc ? connectFunc(std::move(remote)) : nullptr; -} - -} // namespace - -IInspector& getInspectorInstance() { - static InspectorImpl instance; - return instance; -} - -std::unique_ptr makeTestInspectorInstance() { - return std::make_unique(); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsinspector/InspectorInterfaces.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsinspector/InspectorInterfaces.h deleted file mode 100644 index e8b0c942..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/jsinspector/InspectorInterfaces.h +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class IDestructible { - public: - virtual ~IDestructible() = 0; -}; - -struct InspectorPage { - const int id; - const std::string title; - const std::string vm; -}; - -/// IRemoteConnection allows the VM to send debugger messages to the client. -class IRemoteConnection : public IDestructible { - public: - virtual ~IRemoteConnection() = 0; - virtual void onMessage(std::string message) = 0; - virtual void onDisconnect() = 0; -}; - -/// ILocalConnection allows the client to send debugger messages to the VM. -class ILocalConnection : public IDestructible { - public: - virtual ~ILocalConnection() = 0; - virtual void sendMessage(std::string message) = 0; - virtual void disconnect() = 0; -}; - -/// IInspector tracks debuggable JavaScript targets (pages). -class IInspector : public IDestructible { - public: - using ConnectFunc = std::function( - std::unique_ptr)>; - - virtual ~IInspector() = 0; - - /// addPage is called by the VM to add a page to the list of debuggable pages. - virtual int addPage(const std::string& title, const std::string& vm, ConnectFunc connectFunc) = 0; - - /// removePage is called by the VM to remove a page from the list of - /// debuggable pages. - virtual void removePage(int pageId) = 0; - - /// getPages is called by the client to list all debuggable pages. - virtual std::vector getPages() const = 0; - - /// connect is called by the client to initiate a debugging session on the - /// given page. - virtual std::unique_ptr connect( - int pageId, - std::unique_ptr remote) = 0; -}; - -/// getInspectorInstance retrieves the singleton inspector that tracks all -/// debuggable pages in this process. -extern IInspector& getInspectorInstance(); - -/// makeTestInspectorInstance creates an independent inspector instance that -/// should only be used in tests. -extern std::unique_ptr makeTestInspectorInstance(); - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/microprofiler/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/microprofiler/BUCK deleted file mode 100644 index a67104a8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/microprofiler/BUCK +++ /dev/null @@ -1,26 +0,0 @@ -load("//tools/build_defs/oss:rn_defs.bzl", "GLOG_DEP", "cxx_library") - -cxx_library( - name = "microprofiler", - srcs = [ - "MicroProfiler.cpp", - ], - header_namespace = "microprofiler", - exported_headers = [ - "MicroProfiler.h", - ], - compiler_flags = [ - "-Wall", - "-Werror", - "-std=c++11", - "-fexceptions", - "-fno-data-sections", - ], - force_static = True, - visibility = [ - "PUBLIC", - ], - deps = [ - GLOG_DEP, - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/microprofiler/MicroProfiler.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/microprofiler/MicroProfiler.cpp deleted file mode 100644 index f20b3315..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/microprofiler/MicroProfiler.cpp +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include -#include -#include -#include -#include -#include - -#include - -#include "MicroProfiler.h" - -// iOS doesn't support 'thread_local'. If we reimplement this to use pthread_setspecific -// we can get rid of this -#if defined(__APPLE__) -#define MICRO_PROFILER_STUB_IMPLEMENTATION 1 -#elif !defined(MICRO_PROFILER_STUB_IMPLEMENTATION) -#define MICRO_PROFILER_STUB_IMPLEMENTATION 0 -#endif - -namespace facebook { -namespace react { - -#if !MICRO_PROFILER_STUB_IMPLEMENTATION -struct TraceData { - TraceData(); - ~TraceData(); - - void addTime(MicroProfilerName name, uint_fast64_t time, uint_fast32_t internalClockCalls); - - std::thread::id threadId_; - uint_fast64_t startTime_; - std::atomic_uint_fast64_t times_[MicroProfilerName::__LENGTH__] = {}; - std::atomic_uint_fast32_t calls_[MicroProfilerName::__LENGTH__] = {}; - std::atomic_uint_fast32_t childProfileSections_[MicroProfilerName::__LENGTH__] = {}; -}; - -struct ProfilingImpl { - std::mutex mutex_; - std::vector allTraceData_; - bool isProfiling_ = false; - uint_fast64_t startTime_; - uint_fast64_t endTime_; - uint_fast64_t clockOverhead_; - uint_fast64_t profileSectionOverhead_; -}; - -static ProfilingImpl profiling; -thread_local TraceData myTraceData; -thread_local uint_fast32_t profileSections = 0; - -static uint_fast64_t nowNs() { - struct timespec time; - clock_gettime(CLOCK_REALTIME, &time); - return uint_fast64_t(1000000000) * time.tv_sec + time.tv_nsec; -} - -static uint_fast64_t diffNs(uint_fast64_t start, uint_fast64_t end) { - return end - start; -} - -static std::string formatTimeNs(uint_fast64_t timeNs) { - std::ostringstream out; - out.precision(2); - if (timeNs < 1000) { - out << timeNs << "ns"; - } else if (timeNs < 1000000) { - out << timeNs / 1000.0 << "us"; - } else { - out << std::fixed << timeNs / 1000000.0 << "ms"; - } - return out.str(); -} - -MicroProfilerSection::MicroProfilerSection(MicroProfilerName name) : - isProfiling_(profiling.isProfiling_), - name_(name), - startNumProfileSections_(profileSections) { - if (!isProfiling_) { - return; - } - profileSections++; - startTime_ = nowNs(); -} -MicroProfilerSection::~MicroProfilerSection() { - if (!isProfiling_ || !profiling.isProfiling_) { - return; - } - auto endTime = nowNs(); - auto endNumProfileSections = profileSections; - myTraceData.addTime(name_, endTime - startTime_, endNumProfileSections - startNumProfileSections_ - 1); -} - -TraceData::TraceData() : - threadId_(std::this_thread::get_id()) { - std::lock_guard lock(profiling.mutex_); - profiling.allTraceData_.push_back(this); -} - -TraceData::~TraceData() { - std::lock_guard lock(profiling.mutex_); - auto& infos = profiling.allTraceData_; - infos.erase(std::remove(infos.begin(), infos.end(), this), infos.end()); -} - -void TraceData::addTime(MicroProfilerName name, uint_fast64_t time, uint_fast32_t childprofileSections) { - times_[name] += time; - calls_[name]++; - childProfileSections_[name] += childprofileSections; -} - -static void printReport() { - LOG(ERROR) << "======= MICRO PROFILER REPORT ======="; - LOG(ERROR) << "- Total Time: " << formatTimeNs(diffNs(profiling.startTime_, profiling.endTime_)); - LOG(ERROR) << "- Clock Overhead: " << formatTimeNs(profiling.clockOverhead_); - LOG(ERROR) << "- Profiler Section Overhead: " << formatTimeNs(profiling.profileSectionOverhead_); - for (auto info : profiling.allTraceData_) { - LOG(ERROR) << "--- Thread ID 0x" << std::hex << info->threadId_ << " ---"; - for (int i = 0; i < MicroProfilerName::__LENGTH__; i++) { - if (info->times_[i] > 0) { - auto totalTime = info->times_[i].load(); - auto calls = info->calls_[i].load(); - auto clockOverhead = profiling.clockOverhead_ * calls + profiling.profileSectionOverhead_ * info->childProfileSections_[i].load(); - if (totalTime < clockOverhead) { - LOG(ERROR) << "- " << MicroProfiler::profilingNameToString(static_cast(i)) << ": " - << "ERROR: Total time was " << totalTime << "ns but clock overhead was calculated to be " << clockOverhead << "ns!"; - } else { - auto correctedTime = totalTime - clockOverhead; - auto timePerCall = correctedTime / calls; - LOG(ERROR) << "- " << MicroProfiler::profilingNameToString(static_cast(i)) << ": " - << formatTimeNs(correctedTime) << " (" << calls << " calls, " << formatTimeNs(timePerCall) << "/call)"; - } - } - } - } -} - -static void clearProfiling() { - CHECK(!profiling.isProfiling_) << "Trying to clear profiling but profiling was already started!"; - for (auto info : profiling.allTraceData_) { - for (unsigned int i = 0; i < MicroProfilerName::__LENGTH__; i++) { - info->times_[i] = 0; - info->calls_[i] = 0; - info->childProfileSections_[i] = 0; - } - } -} - -static uint_fast64_t calculateClockOverhead() { - int numCalls = 1000000; - uint_fast64_t start = nowNs(); - for (int i = 0; i < numCalls; i++) { - nowNs(); - } - uint_fast64_t end = nowNs(); - return (end - start) / numCalls; -} - -static uint_fast64_t calculateProfileSectionOverhead() { - int numCalls = 1000000; - uint_fast64_t start = nowNs(); - profiling.isProfiling_ = true; - for (int i = 0; i < numCalls; i++) { - MICRO_PROFILER_SECTION(static_cast(0)); - } - uint_fast64_t end = nowNs(); - profiling.isProfiling_ = false; - return (end - start) / numCalls; -} - -void MicroProfiler::startProfiling() { - CHECK(!profiling.isProfiling_) << "Trying to start profiling but profiling was already started!"; - - profiling.clockOverhead_ = calculateClockOverhead(); - profiling.profileSectionOverhead_ = calculateProfileSectionOverhead(); - - std::lock_guard lock(profiling.mutex_); - clearProfiling(); - - profiling.startTime_ = nowNs(); - profiling.isProfiling_ = true; -} - -void MicroProfiler::stopProfiling() { - CHECK(profiling.isProfiling_) << "Trying to stop profiling but profiling hasn't been started!"; - - profiling.isProfiling_ = false; - profiling.endTime_ = nowNs(); - - std::lock_guard lock(profiling.mutex_); - - printReport(); - - clearProfiling(); -} - -bool MicroProfiler::isProfiling() { - return profiling.isProfiling_; -} - -void MicroProfiler::runInternalBenchmark() { - MicroProfiler::startProfiling(); - for (int i = 0; i < 1000000; i++) { - MICRO_PROFILER_SECTION_NAMED(outer, __INTERNAL_BENCHMARK_OUTER); - { - MICRO_PROFILER_SECTION_NAMED(inner, __INTERNAL_BENCHMARK_INNER); - } - } - MicroProfiler::stopProfiling(); -} -#else -void MicroProfiler::startProfiling() { - CHECK(false) << "This platform has a stub implementation of the micro profiler and cannot collect traces"; -} -void MicroProfiler::stopProfiling() { -} -bool MicroProfiler::isProfiling() { - return false; -} -void MicroProfiler::runInternalBenchmark() { -} -#endif - -} } diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/microprofiler/MicroProfiler.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/microprofiler/MicroProfiler.h deleted file mode 100644 index 797ab0df..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/microprofiler/MicroProfiler.h +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include - -// #define WITH_MICRO_PROFILER 1 - -#ifdef WITH_MICRO_PROFILER -#define MICRO_PROFILER_SECTION(name) MicroProfilerSection __b(name) -#define MICRO_PROFILER_SECTION_NAMED(var_name, name) MicroProfilerSection var_name(name) -#else -#define MICRO_PROFILER_SECTION(name) -#define MICRO_PROFILER_SECTION_NAMED(var_name, name) -#endif - -namespace facebook { -namespace react { - -enum MicroProfilerName { - __INTERNAL_BENCHMARK_INNER, - __INTERNAL_BENCHMARK_OUTER, - __LENGTH__, -}; - -/** - * MicroProfiler is a performance profiler for measuring the cumulative impact of - * a large number of small-ish calls. This is normally a problem for standard profilers - * like Systrace because the overhead of the profiler itself skews the timings you - * are able to collect. This is especially a problem when doing nested calls to - * profiled functions, as the parent calls will contain the overhead of their profiling - * plus the overhead of all their childrens' profiling. - * - * MicroProfiler attempts to be low overhead by 1) aggregating timings in memory and - * 2) trying to remove estimated profiling overhead from the returned timings. - * - * To remove estimated overhead, at the beginning of each trace we calculate the - * average cost of profiling a no-op code section, as well as invoking the average - * cost of invoking the system clock. The former is subtracted out for each child - * profiler section that is invoked within a parent profiler section. The latter is - * subtracted from each section, child or not. - * - * After MicroProfiler::stopProfiling() is called, a table of tracing data is emitted - * to glog (which shows up in logcat on Android). - */ -struct MicroProfiler { - static const char* profilingNameToString(MicroProfilerName name) { - switch (name) { - case __INTERNAL_BENCHMARK_INNER: - return "__INTERNAL_BENCHMARK_INNER"; - case __INTERNAL_BENCHMARK_OUTER: - return "__INTERNAL_BENCHMARK_OUTER"; - case __LENGTH__: - throw std::runtime_error("__LENGTH__ has no name"); - default: - throw std::runtime_error("Trying to convert unknown MicroProfilerName to string"); - } - } - - static void startProfiling(); - static void stopProfiling(); - static bool isProfiling(); - static void runInternalBenchmark(); -}; - -class MicroProfilerSection { -public: - MicroProfilerSection(MicroProfilerName name); - ~MicroProfilerSection(); - -private: - bool isProfiling_; - MicroProfilerName name_; - uint_fast64_t startTime_; - uint_fast32_t startNumProfileSections_; -}; - -} } diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/BUCK deleted file mode 100644 index fb0df5a0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/BUCK +++ /dev/null @@ -1,83 +0,0 @@ -load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "OBJC_ARC_PREPROCESSOR_FLAGS", "get_debug_preprocessor_flags", "get_static_library_ios_flags") -load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "APPLE", "react_native_target", "react_native_xplat_target", "rn_xplat_cxx_library", "subdir_glob") - -rn_xplat_cxx_library( - name = "core", - srcs = glob(["*.cpp"]), - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "*.h"), - ], - prefix = "jsireact", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbandroid_deps = [ - react_native_target("jni/react/jni:jni"), - ], - fbandroid_exported_headers = subdir_glob( - [ - ("platform/android", "*.h"), - ], - prefix = "jsireact", - ), - fbandroid_srcs = glob( - [ - "platform/android/**/*.cpp", - ], - ), - fbobjc_compiler_flags = [ - "-Wall", - "-fobjc-arc-exceptions", - ], - fbobjc_inherited_buck_flags = get_static_library_ios_flags(), - fbobjc_preprocessor_flags = OBJC_ARC_PREPROCESSOR_FLAGS + get_debug_preprocessor_flags(), - force_static = True, - ios_deps = [ - "xplat//FBBaseLite:FBBaseLite", - "xplat//js/react-native-github:RCTCxxBridge", - "xplat//js/react-native-github:RCTCxxModule", - "xplat//js/react-native-github:ReactInternal", - ], - ios_exported_headers = subdir_glob( - [ - ("platform/ios", "*.h"), - ], - prefix = "jsireact", - ), - ios_frameworks = [ - "$SDKROOT/System/Library/Frameworks/Foundation.framework", - ], - ios_srcs = glob( - [ - "platform/ios/**/*.cpp", - "platform/ios/**/*.mm", - ], - ), - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - visibility = [ - "PUBLIC", - ], - deps = [ - "xplat//fbsystrace:fbsystrace", - "xplat//folly:headers_only", - "xplat//folly:memory", - "xplat//folly:molly", - "xplat//jsi:JSIDynamic", - "xplat//third-party/glog:glog", - react_native_xplat_target("cxxreact:bridge"), - react_native_xplat_target("cxxreact:module"), - ], - exported_deps = [ - "xplat//jsi:jsi", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/JSCallInvoker.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/JSCallInvoker.cpp deleted file mode 100644 index ec28ce1c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/JSCallInvoker.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "JSCallInvoker.h" - -#include - -namespace facebook { -namespace react { - -JSCallInvoker::JSCallInvoker(std::shared_ptr jsThread) - : jsThread_(jsThread) {} - -void JSCallInvoker::invokeAsync(std::function&& func) { - jsThread_->runOnQueue(std::move(func)); -} - -void JSCallInvoker::invokeSync(std::function&& func) { - jsThread_->runOnQueueSync(std::move(func)); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/JSCallInvoker.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/JSCallInvoker.h deleted file mode 100644 index 1f84bbc0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/JSCallInvoker.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -class MessageQueueThread; - -/** - * A generic native-to-JS call invoker. It guarantees that any calls from any - * thread are queued on the right JS thread. - * - * For now, this is a thin-wrapper around existing MessageQueueThread. Eventually, - * it should be consolidated with Fabric implementation so there's only one - * API to call JS from native, whether synchronously or asynchronously. - */ -class JSCallInvoker { -public: - JSCallInvoker(std::shared_ptr jsThread); - - void invokeAsync(std::function&& func); - void invokeSync(std::function&& func); - -private: - std::shared_ptr jsThread_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/LongLivedObject.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/LongLivedObject.cpp deleted file mode 100644 index c320af72..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/LongLivedObject.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "LongLivedObject.h" - -namespace facebook { -namespace react { - -// LongLivedObjectCollection -LongLivedObjectCollection& LongLivedObjectCollection::get() { - static LongLivedObjectCollection instance; - return instance; -} - -LongLivedObjectCollection::LongLivedObjectCollection() {} - -void LongLivedObjectCollection::add(std::shared_ptr so) { - collection_.insert(so); -} - -void LongLivedObjectCollection::remove(const LongLivedObject *o) { - auto p = collection_.begin(); - for (; p != collection_.end(); p++) { - if (p->get() == o) { - break; - } - } - if (p != collection_.end()) { - collection_.erase(p); - } -} - -void LongLivedObjectCollection::clear() { - collection_.clear(); -} - -// LongLivedObject -LongLivedObject::LongLivedObject() {} - -void LongLivedObject::allowRelease() { - LongLivedObjectCollection::get().remove(this); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/LongLivedObject.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/LongLivedObject.h deleted file mode 100644 index be29af90..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/LongLivedObject.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -/** - * A simple wrapper class that can be registered to a collection that keep it alive for extended period of time. - * This object can be removed from the collection when needed. - * - * The subclass of this class must be created using std::make_shared(). - * After creation, add it to the `LongLivedObjectCollection`. - * When done with the object, call `allowRelease()` to allow the OS to release it. - */ -class LongLivedObject { -public: - void allowRelease(); - -protected: - LongLivedObject(); -}; - -/** - * A singleton collection for the `LongLivedObject`s. - */ -class LongLivedObjectCollection { -public: - static LongLivedObjectCollection& get(); - - LongLivedObjectCollection(LongLivedObjectCollection const&) = delete; - void operator=(LongLivedObjectCollection const&) = delete; - - void add(std::shared_ptr o); - void remove(const LongLivedObject *o); - void clear(); - -private: - LongLivedObjectCollection(); - std::unordered_set> collection_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboCxxModule.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboCxxModule.cpp deleted file mode 100644 index e0953718..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboCxxModule.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "TurboCxxModule.h" - -#include - -#include -#include - -using namespace facebook; -using namespace facebook::xplat::module; - -namespace facebook { -namespace react { - -static CxxModule::Callback makeTurboCxxModuleCallback( - jsi::Runtime &runtime, - std::shared_ptr callbackWrapper) { - return [callbackWrapper](std::vector args) { - callbackWrapper->jsInvoker->invokeAsync([callbackWrapper, args]() { - std::vector innerArgs; - for (auto &a : args) { - innerArgs.push_back(jsi::valueFromDynamic(callbackWrapper->runtime, a)); - } - callbackWrapper->callback.call(callbackWrapper->runtime, (const jsi::Value *)innerArgs.data(), innerArgs.size()); - }); - }; -} - -TurboCxxModule::TurboCxxModule(std::unique_ptr cxxModule, std::shared_ptr jsInvoker) - : TurboModule(cxxModule->getName(), jsInvoker), - cxxMethods_(cxxModule->getMethods()), - cxxModule_(std::move(cxxModule)) {} - -jsi::Value TurboCxxModule::get(jsi::Runtime& runtime, const jsi::PropNameID& propName) { - std::string propNameUtf8 = propName.utf8(runtime); - - if (propNameUtf8 == "getConstants") { - // This is special cased because `getConstants()` is already a part of CxxModule. - return jsi::Function::createFromHostFunction( - runtime, - propName, - 0, - [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) { - jsi::Object result(rt); - auto constants = cxxModule_->getConstants(); - for (auto &pair : constants) { - result.setProperty(rt, pair.first.c_str(), jsi::valueFromDynamic(rt, pair.second)); - } - return result; - }); - } - - for (auto &method : cxxMethods_) { - if (method.name == propNameUtf8) { - return jsi::Function::createFromHostFunction( - runtime, - propName, - 0, - [this, propNameUtf8](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) { - return invokeMethod(rt, VoidKind, propNameUtf8, args, count); - }); - } - } - - throw std::runtime_error("Function '" + propNameUtf8 + "' cannot be found on cxxmodule: " + name_); -} - -jsi::Value TurboCxxModule::invokeMethod( - jsi::Runtime &runtime, - TurboModuleMethodValueKind valueKind, - const std::string &methodName, - const jsi::Value *args, - size_t count) { - - auto it = cxxMethods_.begin(); - for (; it != cxxMethods_.end(); it++) { - auto method = *it; - if (method.name == methodName) { - break; - } - } - - if (it == cxxMethods_.end()) { - throw std::runtime_error("Function '" + methodName + "' cannot be found on cxxmodule: " + name_); - } - - auto method = *it; - - if (method.syncFunc) { - auto innerArgs = folly::dynamic::array(); - for (size_t i = 0; i < count; i++) { - innerArgs.push_back(jsi::dynamicFromValue(runtime, args[i])); - } - return jsi::valueFromDynamic(runtime, method.syncFunc(std::move(innerArgs))); - } else if (method.func && !method.isPromise) { - // Async method. - CxxModule::Callback first; - CxxModule::Callback second; - - if (count < method.callbacks) { - throw std::invalid_argument(folly::to("Expected ", method.callbacks, - " callbacks, but only ", count, " parameters provided")); - } - - if (method.callbacks == 1) { - auto wrapper = std::make_shared(args[count - 1].getObject(runtime).getFunction(runtime), runtime, jsInvoker_); - first = makeTurboCxxModuleCallback(runtime, wrapper); - } else if (method.callbacks == 2) { - auto wrapper1 = std::make_shared(args[count - 2].getObject(runtime).getFunction(runtime), runtime, jsInvoker_); - auto wrapper2 = std::make_shared(args[count - 1].getObject(runtime).getFunction(runtime), runtime, jsInvoker_); - first = makeTurboCxxModuleCallback(runtime, wrapper1); - second = makeTurboCxxModuleCallback(runtime, wrapper2); - } - - auto innerArgs = folly::dynamic::array(); - for (size_t i = 0; i < count - method.callbacks; i++) { - innerArgs.push_back(jsi::dynamicFromValue(runtime, args[i])); - } - - method.func(std::move(innerArgs), first, second); - } else if (method.isPromise) { - return createPromiseAsJSIValue(runtime, [method, args, count, this](jsi::Runtime &rt, std::shared_ptr promise) { - auto resolveWrapper = std::make_shared(promise->resolve_.getFunction(rt), rt, jsInvoker_); - auto rejectWrapper = std::make_shared(promise->reject_.getFunction(rt), rt, jsInvoker_); - CxxModule::Callback resolve = makeTurboCxxModuleCallback(rt, resolveWrapper); - CxxModule::Callback reject = makeTurboCxxModuleCallback(rt, rejectWrapper); - - auto innerArgs = folly::dynamic::array(); - for (size_t i = 0; i < count; i++) { - innerArgs.push_back(jsi::dynamicFromValue(rt, args[i])); - } - - method.func(std::move(innerArgs), resolve, reject); - }); - } - - return jsi::Value::undefined(); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboCxxModule.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboCxxModule.h deleted file mode 100644 index c44ba2a9..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboCxxModule.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -#include - -#include "TurboModule.h" - -namespace facebook { -namespace react { - -/** - * A helper class to convert the legacy CxxModule instance to a TurboModule instance. - * This should be used only for migration purpose (to TurboModule), since it's not very performant - * due to a lot of back-and-forth value conversions between folly::dynamic and jsi::Value. - */ -class JSI_EXPORT TurboCxxModule : public TurboModule { -public: - TurboCxxModule(std::unique_ptr cxxModule, std::shared_ptr jsInvoker); - - virtual facebook::jsi::Value get(facebook::jsi::Runtime& runtime, const facebook::jsi::PropNameID& propName) override; - - virtual jsi::Value invokeMethod( - jsi::Runtime &runtime, - TurboModuleMethodValueKind valueKind, - const std::string &methodName, - const jsi::Value *args, - size_t count) override; - -private: - std::vector cxxMethods_; - std::unique_ptr cxxModule_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboModule.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboModule.cpp deleted file mode 100644 index 06dbdaa6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboModule.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "TurboModule.h" - -using namespace facebook; - -namespace facebook { -namespace react { - -TurboModule::TurboModule(const std::string &name, std::shared_ptr jsInvoker) - : name_(name), - jsInvoker_(jsInvoker) {} - -TurboModule::~TurboModule() { - invalidate(); -} - -void TurboModule::invalidate() {} - -jsi::Value TurboModule::get(jsi::Runtime& runtime, const jsi::PropNameID& propName) { - std::string propNameUtf8 = propName.utf8(runtime); - auto p = methodMap_.find(propNameUtf8); - if (p == methodMap_.end()) { - throw std::runtime_error("Function '" + propNameUtf8 + "' cannot be found on module: " + name_); - } - MethodMetadata meta = p->second; - return jsi::Function::createFromHostFunction( - runtime, - propName, - meta.argCount, - [this, meta](facebook::jsi::Runtime &rt, const facebook::jsi::Value &thisVal, const facebook::jsi::Value *args, size_t count) { - return meta.invoker(rt, *this, args, count); - }); -} - -jsi::Value TurboModule::invokeMethod( - jsi::Runtime &runtime, - TurboModuleMethodValueKind valueKind, - const std::string &methodName, - const jsi::Value *args, - size_t count) { - return jsi::Value::undefined(); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboModule.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboModule.h deleted file mode 100644 index d1691edf..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboModule.h +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -#include - -#include "JSCallInvoker.h" - -namespace facebook { -namespace react { - -/** - * For now, support the same set of return types as existing impl. - * This can be improved to support richer typed objects. - */ -enum TurboModuleMethodValueKind { - VoidKind, - BooleanKind, - NumberKind, - StringKind, - ObjectKind, - ArrayKind, - FunctionKind, - PromiseKind, -}; - -/** - * Base HostObject class for every module to be exposed to JS - */ -class JSI_EXPORT TurboModule : public facebook::jsi::HostObject { -public: - TurboModule(const std::string &name, std::shared_ptr jsInvoker); - virtual ~TurboModule(); - - /** - * Instruct this module to invalidate itself. - */ - virtual void invalidate(); - - virtual facebook::jsi::Value get(facebook::jsi::Runtime& runtime, const facebook::jsi::PropNameID& propName) override; - - /** - * General method invocation mechanism. - * Each subclass decides how the invocation should be, and whether it should be platform-specific. - */ - virtual jsi::Value invokeMethod( - jsi::Runtime &runtime, - TurboModuleMethodValueKind valueKind, - const std::string &methodName, - const jsi::Value *args, - size_t count); - - const std::string name_; - std::shared_ptr jsInvoker_; - -protected: - struct MethodMetadata { - size_t argCount; - facebook::jsi::Value (*invoker)( - facebook::jsi::Runtime& rt, - TurboModule &turboModule, - const facebook::jsi::Value* args, - size_t count); - }; - - std::unordered_map methodMap_; -}; - -/** - * An app/platform-specific provider function to get an instance of a module given a name. - */ -using TurboModuleProviderFunctionType = std::function( - const std::string &name)>; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboModuleBinding.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboModuleBinding.cpp deleted file mode 100644 index 4e93736b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboModuleBinding.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "TurboModuleBinding.h" - -#include - -#include - -using namespace facebook; - -namespace facebook { -namespace react { - -/** - * Public API to install the TurboModule system. - */ -TurboModuleBinding::TurboModuleBinding(const TurboModuleProviderFunctionType &moduleProvider) - : moduleProvider_(moduleProvider) {} - -void TurboModuleBinding::install( - jsi::Runtime &runtime, - std::shared_ptr binding) { - runtime.global().setProperty( - runtime, - "__turboModuleProxy", - jsi::Function::createFromHostFunction( - runtime, - jsi::PropNameID::forAscii(runtime, "__turboModuleProxy"), - 1, - [binding](jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) { - return binding->jsProxy(rt, thisVal, args, count); - })); -} - -void TurboModuleBinding::invalidate() const { - // Nothing for now. -} - -std::shared_ptr TurboModuleBinding::getModule(const std::string &name) { - std::shared_ptr module = nullptr; - { - SystraceSection s("TurboModuleBinding::getModule", "module", name); - module = moduleProvider_(name); - } - return module; -} - -jsi::Value TurboModuleBinding::jsProxy( - jsi::Runtime& runtime, - const jsi::Value& thisVal, - const jsi::Value* args, - size_t count) { - if (count != 1) { - throw std::invalid_argument("TurboModuleBinding::jsProxy arg count must be 1"); - } - std::string moduleName = args[0].getString(runtime).utf8(runtime); - std::shared_ptr module = getModule(moduleName); - - if (module == nullptr) { - return jsi::Value::null(); - } - - return jsi::Object::createFromHostObject(runtime, std::move(module)); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboModuleBinding.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboModuleBinding.h deleted file mode 100644 index 6195dcf3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboModuleBinding.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include -#include - -namespace facebook { -namespace react { - -class JSCallInvoker; - -/** - * Represents the JavaScript binding for the TurboModule system. - */ -class TurboModuleBinding { -public: - /* - * Installs TurboModuleBinding into JavaScript runtime. - * Thread synchronization must be enforced externally. - */ - static void install( - jsi::Runtime &runtime, - std::shared_ptr binding); - - TurboModuleBinding(const TurboModuleProviderFunctionType &moduleProvider); - - /* - * Invalidates the binding. - * Can be called in any thread. - */ - void invalidate() const; - - /** - * Get an TurboModule instance for the given module name. - */ - std::shared_ptr getModule(const std::string &name); - -private: - /** - * A lookup function exposed to JS to get an instance of a TurboModule - * for the given name. - */ - jsi::Value jsProxy( - jsi::Runtime& runtime, - const jsi::Value& thisVal, - const jsi::Value* args, - size_t count); - - TurboModuleProviderFunctionType moduleProvider_; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboModuleUtils.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboModuleUtils.cpp deleted file mode 100644 index f7f53b3b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboModuleUtils.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "TurboModuleUtils.h" - -namespace facebook { -namespace react { - -static jsi::Value deepCopyJSIValue(jsi::Runtime &rt, const jsi::Value &value) { - if (value.isNull()) { - return jsi::Value::null(); - } - - if (value.isBool()) { - return jsi::Value(value.getBool()); - } - - if (value.isNumber()) { - return jsi::Value(value.getNumber()); - } - - if (value.isString()) { - return value.getString(rt); - } - - if (value.isObject()) { - jsi::Object o = value.getObject(rt); - if (o.isArray(rt)) { - return deepCopyJSIArray(rt, o.getArray(rt)); - } - if (o.isFunction(rt)) { - return o.getFunction(rt); - } - return deepCopyJSIObject(rt, o); - } - - return jsi::Value::undefined(); -} - -jsi::Object deepCopyJSIObject(jsi::Runtime &rt, const jsi::Object &obj) { - jsi::Object copy(rt); - jsi::Array propertyNames = obj.getPropertyNames(rt); - size_t size = propertyNames.size(rt); - for (size_t i = 0; i < size; i++) { - jsi::String name = propertyNames.getValueAtIndex(rt, i).getString(rt); - jsi::Value value = obj.getProperty(rt, name); - copy.setProperty(rt, name, deepCopyJSIValue(rt, value)); - } - return copy; -} - -jsi::Array deepCopyJSIArray(jsi::Runtime &rt, const jsi::Array &arr) { - size_t size = arr.size(rt); - jsi::Array copy(rt, size); - for (size_t i = 0; i < size; i++) { - copy.setValueAtIndex(rt, i, deepCopyJSIValue(rt, arr.getValueAtIndex(rt, i))); - } - return copy; -} - -Promise::Promise(jsi::Runtime &rt, jsi::Function resolve, jsi::Function reject) - : runtime_(rt), - resolve_(std::move(resolve)), - reject_(std::move(reject)) {} - -void Promise::resolve(const jsi::Value &result) { - resolve_.call(runtime_, result); -} - -void Promise::reject(const std::string &message) { - jsi::Object error(runtime_); - error.setProperty(runtime_, "message", jsi::String::createFromUtf8(runtime_, message)); - reject_.call(runtime_, error); -} - -jsi::Value createPromiseAsJSIValue(jsi::Runtime &rt, const PromiseSetupFunctionType func) { - jsi::Function JSPromise = rt.global().getPropertyAsFunction(rt, "Promise"); - jsi::Function fn = jsi::Function::createFromHostFunction( - rt, - jsi::PropNameID::forAscii(rt, "fn"), - 2, - [func](jsi::Runtime &rt2, const jsi::Value &thisVal, const jsi::Value *args, size_t count) { - jsi::Function resolve = args[0].getObject(rt2).getFunction(rt2); - jsi::Function reject = args[1].getObject(rt2).getFunction(rt2); - auto wrapper = std::make_shared(rt2, std::move(resolve), std::move(reject)); - func(rt2, wrapper); - return jsi::Value::undefined(); - }); - - return JSPromise.callAsConstructor(rt, fn); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboModuleUtils.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboModuleUtils.h deleted file mode 100644 index 4a71f8e7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/TurboModuleUtils.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include - -#include "JSCallInvoker.h" - -using namespace facebook; - -namespace facebook { -namespace react { - -jsi::Object deepCopyJSIObject(jsi::Runtime &rt, const jsi::Object &obj); -jsi::Array deepCopyJSIArray(jsi::Runtime &rt, const jsi::Array &arr); - -struct Promise { - Promise(jsi::Runtime &rt, jsi::Function resolve, jsi::Function reject); - - void resolve(const jsi::Value &result); - void reject(const std::string &error); - - jsi::Runtime &runtime_; - jsi::Function resolve_; - jsi::Function reject_; -}; - -using PromiseSetupFunctionType = std::function)>; -jsi::Value createPromiseAsJSIValue(jsi::Runtime &rt, const PromiseSetupFunctionType func); - -// Helper for passing jsi::Function arg to other methods. -struct CallbackWrapper { - CallbackWrapper(jsi::Function callback, jsi::Runtime &runtime, std::shared_ptr jsInvoker) - : callback(std::move(callback)), - runtime(runtime), - jsInvoker(jsInvoker) {} - jsi::Function callback; - jsi::Runtime &runtime; - std::shared_ptr jsInvoker; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/platform/android/JavaTurboModule.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/platform/android/JavaTurboModule.cpp deleted file mode 100644 index 35767f04..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/platform/android/JavaTurboModule.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include -#include - -#include -#include - -#include -#import - -#include -#include -#include -#include -#include - -#include "JavaTurboModule.h" - -namespace facebook { -namespace react { - -JavaTurboModule::JavaTurboModule(const std::string &name, jni::global_ref instance, std::shared_ptr jsInvoker) - : TurboModule(name, jsInvoker), instance_(instance) {} - -// fnjni already does this conversion, but since we are using plain JNI, this needs to be done again -// TODO (axe) Reuse existing implementation as needed - the exist in MethodInvoker.cpp -// TODO (axe) If at runtime, JS sends incorrect arguments and this is not typechecked, conversion here will fail. Check for that case (OSS) -std::unique_ptr convertFromJValueArgsToJNIArgs( - JNIEnv *env, - jsi::Runtime &rt, - const jsi::Value *args, - size_t count, - std::shared_ptr jsInvoker - ) { - auto jargs = std::make_unique(count); - for (size_t i = 0; i < count; i++) { - const jsi::Value *arg = &args[i]; - if (arg->isBool()) { - jargs[i].z = arg->getBool(); - } else if (arg->isNumber()) { - jargs[i].d = arg->getNumber(); - } else if (arg->isNull() || arg->isUndefined()) { - // What happens if Java is expecting a bool or a number, and JS sends a null or undefined? - jargs[i].l = nullptr; - } else if (arg->isString()) { - // We are basically creating a whole new string here - // TODO (axe) Is there a way to copy this instead of creating a whole new string ? - jargs[i].l = env->NewStringUTF(arg->getString(rt).utf8(rt).c_str()); - } else if (arg->isObject()) { - auto objectArg = arg->getObject(rt); - // We are currently using folly:dynamic to convert JSON to Writable Map - // TODO (axe) Don't use folly:dynamic, instead construct Java map directly - if (objectArg.isArray(rt)) { - auto dynamicFromValue = jsi::dynamicFromValue(rt, args[i]); - auto jParams = ReadableNativeArray::newObjectCxxArgs(std::move(dynamicFromValue)); - jargs[i].l = jParams.release(); - } else if (objectArg.isFunction(rt)) { - auto wrapper = std::make_shared(objectArg.getFunction(rt), rt, jsInvoker); - std::function fn = [wrapper](folly::dynamic responses){ - if (wrapper == nullptr) { - throw std::runtime_error("callback arg cannot be called more than once"); - } - std::shared_ptr rw = wrapper; - wrapper->jsInvoker->invokeAsync([rw, responses]() { - // TODO (axe) valueFromDynamic already returns a Value array. Don't iterate again - jsi::Value args = jsi::valueFromDynamic(rw->runtime, responses); - auto argsArray = args.getObject(rw->runtime).asArray(rw->runtime); - std::vector result; - for (size_t i = 0; i < argsArray.size(rw->runtime); i++) { - result.emplace_back(rw->runtime, argsArray.getValueAtIndex(rw->runtime, i)); - } - rw->callback.call(rw->runtime, (const jsi::Value *)result.data(), result.size()); - }); - }; - wrapper = nullptr; - // TODO Use our own implementation of callback instead of relying on JCxxCallbackImpl - auto callback = JCxxCallbackImpl::newObjectCxxArgs(fn); - jargs[i].l = callback.release(); - } else { - auto dynamicFromValue = jsi::dynamicFromValue(rt, args[i]); - auto jParams = ReadableNativeMap::createWithContents(std::move(dynamicFromValue)); - jargs[i].l = jParams.release(); - } - } - } - return jargs; -} - -jsi::Value convertFromJMapToValue(JNIEnv *env, jsi::Runtime &rt, jobject arg) { - // We currently use Java Argument.makeNativeMap() method to do this conversion - // This could also be done purely in C++, but iterative over map methods - // but those may end up calling reflection methods anyway - // TODO (axe) Investigate the best way to convert Java Map to Value - static jclass jArguments = env->FindClass("com/facebook/react/bridge/Arguments"); - static jmethodID jMakeNativeMap = env->GetStaticMethodID(jArguments, "makeNativeMap", "(Ljava/util/Map;)Lcom/facebook/react/bridge/WritableNativeMap;"); - auto constants = (jobject) env->CallStaticObjectMethod(jArguments, jMakeNativeMap, arg); - auto jResult = jni::adopt_local(constants); - auto result = jni::static_ref_cast(jResult); - return jsi::valueFromDynamic(rt, result->cthis()->consume()); -} - -jsi::Value JavaTurboModule::get(jsi::Runtime& runtime, const jsi::PropNameID& propName) { - std::string propNameUtf8 = propName.utf8(runtime); - if (propNameUtf8 == "getConstants") { - // This is the special method to get the constants from the module. - // Since `getConstants` in Java only returns a Map, this function takes the map - // and converts it to a WritableMap. - return jsi::Function::createFromHostFunction( - runtime, - propName, - 0, - [this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) { - JNIEnv *env = jni::Environment::current(); - jclass cls = env->FindClass(jClassName_.c_str()); - static jmethodID methodID = env->GetMethodID(cls, "getConstants", "()Ljava/util/Map;"); - auto constantsMap = (jobject) env->CallObjectMethod(instance_.get(), methodID); - if (constantsMap == nullptr) { - return jsi::Value::undefined(); - } - return convertFromJMapToValue(env, rt, constantsMap); - } - ); - } else { - return TurboModule::get(runtime, propName); - } -} - -jsi::Value JavaTurboModule::invokeJavaMethod( - jsi::Runtime &rt, - TurboModuleMethodValueKind valueKind, - const std::string &methodName, - const std::string &methodSignature, - const jsi::Value *args, - size_t count) { - - // We are using JNI directly instead of fbjni since we don't want template functiosn - // when finding methods. - JNIEnv *env = jni::Environment::current(); - // TODO (axe) Memoize this class, so that we don't have to find it for every calls - jclass cls = env->FindClass(jClassName_.c_str()); - - // TODO (axe) Memoize method call, so we don't look it up each time the method is called - jmethodID methodID = env->GetMethodID(cls, methodName.c_str(), methodSignature.c_str()); - - std::unique_ptrjargs = convertFromJValueArgsToJNIArgs(env, rt, args, count, jsInvoker_); - auto instance = instance_.get(); - - switch (valueKind) { - case VoidKind: { - env->CallVoidMethodA(instance, methodID, jargs.get()); - return jsi::Value::undefined(); - } - case BooleanKind: { - return jsi::Value((bool)env->CallBooleanMethodA(instance, methodID, jargs.get())); - } - case NumberKind: { - return jsi::Value((double)env->CallDoubleMethodA(instance, methodID, jargs.get())); - } - case StringKind: { - auto returnString = (jstring) env->CallObjectMethodA(instance, methodID, jargs.get()); - if (returnString == nullptr) { - return jsi::Value::null(); - } - const char *js = env->GetStringUTFChars(returnString, nullptr); - std::string result = js; - env->ReleaseStringUTFChars(returnString, js); - return jsi::Value(rt, jsi::String::createFromUtf8(rt, result)); - } - case ObjectKind: { - auto returnObject = (jobject) env->CallObjectMethodA(instance, methodID, jargs.get()); - if (returnObject == nullptr) { - return jsi::Value::null(); - } - auto jResult = jni::adopt_local(returnObject); - auto result = jni::static_ref_cast(jResult); - return jsi::valueFromDynamic(rt, result->cthis()->consume()); - } - case ArrayKind: { - auto returnObject = (jobject) env->CallObjectMethodA(instance, methodID, jargs.get()); - if (returnObject == nullptr) { - return jsi::Value::null(); - } - auto jResult = jni::adopt_local(returnObject); - auto result = jni::static_ref_cast(jResult); - return jsi::valueFromDynamic(rt, result->cthis()->consume()); - } - default: - throw std::runtime_error("Unable to find method module: " + methodName + "(" + methodSignature + ")" + "in module " + jClassName_); - } -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/platform/android/JavaTurboModule.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/platform/android/JavaTurboModule.h deleted file mode 100644 index 38837618..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/platform/android/JavaTurboModule.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#include -#include -#include - -namespace facebook { -namespace react { - -struct JTurboModule : jni::JavaClass { - static auto constexpr kJavaDescriptor = "Lcom/facebook/react/turbomodule/core/interfaces/TurboModule;"; -}; - -class JSI_EXPORT JavaTurboModule : public TurboModule { -public: - JavaTurboModule(const std::string &name, jni::global_ref instance, std::shared_ptr jsInvoker); - jsi::Value invokeJavaMethod( - jsi::Runtime &runtime, - TurboModuleMethodValueKind valueKind, - const std::string &methodName, - const std::string &methodSignature, - const jsi::Value *args, - size_t count); - - virtual facebook::jsi::Value get(facebook::jsi::Runtime& runtime, const facebook::jsi::PropNameID& propName) override; - -protected: - // TODO (axe) Specify class name as kJavaDescriptor instead of a class variable - std::string jClassName_; -private: - jni::global_ref instance_; - jclass findClass(JNIEnv *env) const; -}; - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/platform/ios/RCTTurboModule.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/platform/ios/RCTTurboModule.h deleted file mode 100644 index 3312b1f8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/platform/ios/RCTTurboModule.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#import -#import -#import -#import -#import - -#define RCT_IS_TURBO_MODULE_CLASS(klass) ((RCTTurboModuleEnabled() && [(klass) conformsToProtocol:@protocol(RCTTurboModule)])) -#define RCT_IS_TURBO_MODULE_INSTANCE(module) RCT_IS_TURBO_MODULE_CLASS([(module) class]) - -namespace facebook { -namespace react { - -/** - * ObjC++ specific TurboModule base class. - */ -class JSI_EXPORT ObjCTurboModule : public TurboModule { -public: - ObjCTurboModule(const std::string &name, id instance, std::shared_ptr jsInvoker); - - virtual jsi::Value invokeMethod( - jsi::Runtime &runtime, - TurboModuleMethodValueKind valueKind, - const std::string &methodName, - const jsi::Value *args, - size_t count) override; - - id instance_; -}; - -} // namespace react -} // namespace facebook - -@protocol RCTTurboModule -@optional -/** - * Used by TurboModules to get access to other TurboModules. - * - * Usage: - * Place `@synthesize turboModuleLookupDelegate = _turboModuleLookupDelegate` - * in the @implementation section of your TurboModule. - */ -@property (nonatomic, weak) id turboModuleLookupDelegate; - -@optional -// This should be required, after migration is done. -- (std::shared_ptr)getTurboModuleWithJsInvoker:(std::shared_ptr)jsInvoker; - -@end - -// TODO: Consolidate this extension with the one in RCTSurfacePresenter. -@interface RCTBridge () - -- (std::shared_ptr)jsMessageThread; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/platform/ios/RCTTurboModule.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/platform/ios/RCTTurboModule.mm deleted file mode 100644 index 97fe2f78..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/platform/ios/RCTTurboModule.mm +++ /dev/null @@ -1,468 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTurboModule.h" - -#import -#import -#import - -#import -#import -#import -#import -#import -#import - -using namespace facebook; - -/** - * All static helper functions are ObjC++ specific. - */ -static jsi::Value convertNSNumberToJSIBoolean(jsi::Runtime &runtime, NSNumber *value) { - return jsi::Value((bool)[value boolValue]); -} - -static jsi::Value convertNSNumberToJSINumber(jsi::Runtime &runtime, NSNumber *value) { - return jsi::Value([value doubleValue]); -} - -static jsi::String convertNSStringToJSIString(jsi::Runtime &runtime, NSString *value) { - return jsi::String::createFromUtf8(runtime, [value UTF8String] ?: ""); -} - -static jsi::Value convertObjCObjectToJSIValue(jsi::Runtime &runtime, id value); -static jsi::Object convertNSDictionaryToJSIObject(jsi::Runtime &runtime, NSDictionary *value) { - jsi::Object result = jsi::Object(runtime); - for (NSString *k in value) { - result.setProperty(runtime, [k UTF8String], convertObjCObjectToJSIValue(runtime, value[k])); - } - return result; -} - -static jsi::Array convertNSArrayToJSIArray(jsi::Runtime &runtime, NSArray *value) { - jsi::Array result = jsi::Array(runtime, value.count); - for (size_t i = 0; i < value.count; i++) { - result.setValueAtIndex(runtime, i, convertObjCObjectToJSIValue(runtime, value[i])); - } - return result; -} - -static std::vector convertNSArrayToStdVector(jsi::Runtime &runtime, NSArray *value) { - std::vector result; - for (size_t i = 0; i < value.count; i++) { - result.emplace_back(convertObjCObjectToJSIValue(runtime, value[i])); - } - return result; -} - -static jsi::Value convertObjCObjectToJSIValue(jsi::Runtime &runtime, id value) { - if ([value isKindOfClass:[NSString class]]) { - return convertNSStringToJSIString(runtime, (NSString *)value); - } else if ([value isKindOfClass:[NSNumber class]]) { - if ([value isKindOfClass:[@YES class]]) { - return convertNSNumberToJSIBoolean(runtime, (NSNumber *)value); - } - return convertNSNumberToJSINumber(runtime, (NSNumber *)value); - } else if ([value isKindOfClass:[NSDictionary class]]) { - return convertNSDictionaryToJSIObject(runtime, (NSDictionary *)value); - } else if ([value isKindOfClass:[NSArray class]]) { - return convertNSArrayToJSIArray(runtime, (NSArray *)value); - } else if (value == (id)kCFNull) { - return jsi::Value::null(); - } - return jsi::Value::undefined(); -} - -static id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, std::shared_ptr jsInvoker); -static NSString *convertJSIStringToNSString(jsi::Runtime &runtime, const jsi::String &value) { - return [NSString stringWithUTF8String:value.utf8(runtime).c_str()]; -} - -static NSArray *convertJSIArrayToNSArray(jsi::Runtime &runtime, const jsi::Array &value, std::shared_ptr jsInvoker) { - size_t size = value.size(runtime); - NSMutableArray *result = [NSMutableArray new]; - for (size_t i = 0; i < size; i++) { - [result addObject:convertJSIValueToObjCObject(runtime, value.getValueAtIndex(runtime, i), jsInvoker) ?: (id)kCFNull]; - } - return [result copy]; -} - -static NSDictionary *convertJSIObjectToNSDictionary(jsi::Runtime &runtime, const jsi::Object &value, std::shared_ptr jsInvoker) { - jsi::Array propertyNames = value.getPropertyNames(runtime); - size_t size = propertyNames.size(runtime); - NSMutableDictionary *result = [NSMutableDictionary new]; - for (size_t i = 0; i < size; i++) { - jsi::String name = propertyNames.getValueAtIndex(runtime, i).getString(runtime); - NSString *k = convertJSIStringToNSString(runtime, name); - id v = convertJSIValueToObjCObject(runtime, value.getProperty(runtime, name), jsInvoker) ?: (id)kCFNull; - result[k] = v; - } - return [result copy]; -} - -static RCTResponseSenderBlock convertJSIFunctionToCallback(jsi::Runtime &runtime, const jsi::Function &value, std::shared_ptr jsInvoker); -static id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, std::shared_ptr jsInvoker) { - if (value.isUndefined() || value.isNull()) { - return nil; - } - if (value.isBool()) { - return @(value.getBool()); - } - if (value.isNumber()) { - return @(value.getNumber()); - } - if (value.isString()) { - return convertJSIStringToNSString(runtime, value.getString(runtime)); - } - if (value.isObject()) { - jsi::Object o = value.getObject(runtime); - if (o.isArray(runtime)) { - return convertJSIArrayToNSArray(runtime, o.getArray(runtime), jsInvoker); - } - if (o.isFunction(runtime)) { - return convertJSIFunctionToCallback(runtime, std::move(o.getFunction(runtime)), jsInvoker); - } - return convertJSIObjectToNSDictionary(runtime, o, jsInvoker); - } - - throw std::runtime_error("Unsupported jsi::jsi::Value kind"); -} - -static RCTResponseSenderBlock convertJSIFunctionToCallback(jsi::Runtime &runtime, const jsi::Function &value, std::shared_ptr jsInvoker) { - __block auto wrapper = std::make_shared(value.getFunction(runtime), runtime, jsInvoker); - return ^(NSArray *responses) { - if (wrapper == nullptr) { - throw std::runtime_error("callback arg cannot be called more than once"); - } - - std::shared_ptr rw = wrapper; - wrapper->jsInvoker->invokeAsync([rw, responses]() { - std::vector args = convertNSArrayToStdVector(rw->runtime, responses); - rw->callback.call(rw->runtime, (const jsi::Value *)args.data(), args.size()); - }); - - // The callback is single-use, so force release it here. - // Doing this also releases the jsi::jsi::Function early, since this block may not get released by ARC for a while, - // because the method invocation isn't guarded with @autoreleasepool. - wrapper = nullptr; - }; -} - -// Helper for creating Promise object. -struct PromiseWrapper : public react::LongLivedObject { - static std::shared_ptr create( - jsi::Function resolve, - jsi::Function reject, - jsi::Runtime &runtime, - std::shared_ptr jsInvoker) { - auto instance = std::make_shared(std::move(resolve), std::move(reject), runtime, jsInvoker); - // This instance needs to live longer than the caller's scope, since the resolve/reject functions may not - // be called immediately. Doing so keeps it alive at least until resolve/reject is called, or when the - // collection is cleared (e.g. when JS reloads). - react::LongLivedObjectCollection::get().add(instance); - return instance; - } - - PromiseWrapper( - jsi::Function resolve, - jsi::Function reject, - jsi::Runtime &runtime, - std::shared_ptr jsInvoker) - : resolveWrapper(std::make_shared(std::move(resolve), runtime, jsInvoker)), - rejectWrapper(std::make_shared(std::move(reject), runtime, jsInvoker)), - runtime(runtime), - jsInvoker(jsInvoker) {} - - RCTPromiseResolveBlock resolveBlock() { - return ^(id result) { - if (resolveWrapper == nullptr) { - throw std::runtime_error("Promise resolve arg cannot be called more than once"); - } - - // Retain the resolveWrapper so that it stays alive inside the lambda. - std::shared_ptr retainedWrapper = resolveWrapper; - jsInvoker->invokeAsync([retainedWrapper, result]() { - jsi::Runtime &rt = retainedWrapper->runtime; - jsi::Value arg = convertObjCObjectToJSIValue(rt, result); - retainedWrapper->callback.call(rt, arg); - }); - - // Prevent future invocation of the same resolve() function. - cleanup(); - }; - } - - RCTPromiseRejectBlock rejectBlock() { - return ^(NSString *code, NSString *message, NSError *error) { - // TODO: There is a chance `this` is no longer valid when this block executes. - if (rejectWrapper == nullptr) { - throw std::runtime_error("Promise reject arg cannot be called more than once"); - } - - // Retain the resolveWrapper so that it stays alive inside the lambda. - std::shared_ptr retainedWrapper = rejectWrapper; - NSDictionary *jsError = RCTJSErrorFromCodeMessageAndNSError(code, message, error); - jsInvoker->invokeAsync([retainedWrapper, jsError]() { - jsi::Runtime &rt = retainedWrapper->runtime; - jsi::Value arg = convertNSDictionaryToJSIObject(rt, jsError); - retainedWrapper->callback.call(rt, arg); - }); - - // Prevent future invocation of the same resolve() function. - cleanup(); - }; - } - - void cleanup() { - resolveWrapper = nullptr; - rejectWrapper = nullptr; - allowRelease(); - } - - // CallbackWrapper is used here instead of just holding on the jsi jsi::Function in order to force release it after either - // the resolve() or the reject() is called. jsi jsi::Function does not support explicit releasing, so we need an extra - // mechanism to control that lifecycle. - std::shared_ptr resolveWrapper; - std::shared_ptr rejectWrapper; - jsi::Runtime &runtime; - std::shared_ptr jsInvoker; -}; - -using PromiseInvocationBlock = void (^)(jsi::Runtime& rt, std::shared_ptr wrapper); -static jsi::Value createPromise(jsi::Runtime &runtime, std::shared_ptr jsInvoker, PromiseInvocationBlock invoke) { - if (!invoke) { - return jsi::Value::undefined(); - } - - jsi::Function Promise = runtime.global().getPropertyAsFunction(runtime, "Promise"); - - // Note: the passed invoke() block is not retained by default, so let's retain it here to help keep it longer. - // Otherwise, there's a risk of it getting released before the promise function below executes. - PromiseInvocationBlock invokeCopy = [invoke copy]; - jsi::Function fn = jsi::Function::createFromHostFunction( - runtime, - jsi::PropNameID::forAscii(runtime, "fn"), - 2, - [invokeCopy, jsInvoker](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) { - if (count != 2) { - throw std::invalid_argument("Promise fn arg count must be 2"); - } - if (!invokeCopy) { - return jsi::Value::undefined(); - } - jsi::Function resolve = args[0].getObject(rt).getFunction(rt); - jsi::Function reject = args[1].getObject(rt).getFunction(rt); - auto wrapper = PromiseWrapper::create(std::move(resolve), std::move(reject), rt, jsInvoker); - invokeCopy(rt, wrapper); - return jsi::Value::undefined(); - }); - - return Promise.callAsConstructor(runtime, fn); -} - -namespace facebook { -namespace react { - -namespace { - -SEL resolveMethodSelector( - TurboModuleMethodValueKind valueKind, - id module, - std::string moduleName, - std::string methodName, - size_t argCount) { - // Assume the instance is properly bound to the right class at this point. - SEL selector = nil; - - // PromiseKind expects 2 additional function args for resolve() and reject() - size_t adjustedCount = valueKind == PromiseKind ? argCount + 2 : argCount; - NSString *baseMethodName = [NSString stringWithUTF8String:methodName.c_str()]; - - if (adjustedCount == 0) { - selector = NSSelectorFromString(baseMethodName); - if (![module respondsToSelector:selector]) { - throw std::runtime_error("Unable to find method: " + methodName + " for module: " + moduleName + ". Make sure the module is installed correctly."); - } - } else if (adjustedCount == 1) { - selector = NSSelectorFromString([NSString stringWithFormat:@"%@:", baseMethodName]); - if (![module respondsToSelector:selector]) { - throw std::runtime_error("Unable to find method: " + methodName + " for module: " + moduleName + ". Make sure the module is installed correctly."); - } - } else { - // TODO: This may be expensive lookup. The codegen output should specify the exact selector name. - unsigned int numberOfMethods; - Method *methods = class_copyMethodList([module class], &numberOfMethods); - if (methods) { - for (unsigned int i = 0; i < numberOfMethods; i++) { - SEL s = method_getName(methods[i]); - if ([NSStringFromSelector(s) hasPrefix:[NSString stringWithFormat:@"%@:", baseMethodName]]) { - selector = s; - break; - } - } - free(methods); - } - if (!selector) { - throw std::runtime_error("Unable to find method: " + methodName + " for module: " + moduleName + ". Make sure the module is installed correctly."); - } - } - - return selector; -} - -NSInvocation *getMethodInvocation( - jsi::Runtime &runtime, - TurboModuleMethodValueKind valueKind, - const id module, - std::shared_ptr jsInvoker, - SEL selector, - const jsi::Value *args, - size_t count) { - NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[[module class] instanceMethodSignatureForSelector:selector]]; - [inv setSelector:selector]; - for (size_t i = 0; i < count; i++) { - const jsi::Value *arg = &args[i]; - if (arg->isBool()) { - bool v = arg->getBool(); - [inv setArgument:(void *)&v atIndex:i + 2]; - } else if (arg->isNumber()) { - double v = arg->getNumber(); - [inv setArgument:(void *)&v atIndex:i + 2]; - } else { - id v = convertJSIValueToObjCObject(runtime, *arg, jsInvoker); - [inv setArgument:(void *)&v atIndex:i + 2]; - } - } - [inv retainArguments]; - return inv; -} - -/** - * Perform method invocation on a specific queue as configured by the module class. - * This serves as a backward-compatible support for RCTBridgeModule's methodQueue API. - * - * In the future: - * - This methodQueue support may be removed for simplicity and consistency with Android. - * - ObjC module methods will be always be called from JS thread. - * They may decide to dispatch to a different queue as needed. - */ -void performMethodInvocation( - jsi::Runtime &runtime, - NSInvocation *inv, - TurboModuleMethodValueKind valueKind, - const id module, - std::shared_ptr jsInvoker, - jsi::Value *result) { - *result = jsi::Value::undefined(); - jsi::Runtime *rt = &runtime; - void (^block)() = ^{ - [inv invokeWithTarget:module]; - - if (valueKind == VoidKind) { - return; - } - - void *rawResult = NULL; - [inv getReturnValue:&rawResult]; - - // TODO: Re-use value conversion logic from existing impl, if possible. - switch (valueKind) { - case BooleanKind: - *result = convertNSNumberToJSIBoolean(*rt, (__bridge NSNumber *)rawResult); - break; - case NumberKind: - *result = convertNSNumberToJSINumber(*rt, (__bridge NSNumber *)rawResult); - break; - case StringKind: - *result = convertNSStringToJSIString(*rt, (__bridge NSString *)rawResult); - break; - case ObjectKind: - *result = convertNSDictionaryToJSIObject(*rt, (__bridge NSDictionary *)rawResult); - break; - case ArrayKind: - *result = convertNSArrayToJSIArray(*rt, (__bridge NSArray *)rawResult); - break; - case FunctionKind: - throw std::runtime_error("doInvokeTurboModuleMethod: FunctionKind is not supported yet."); - case PromiseKind: - throw std::runtime_error("doInvokeTurboModuleMethod: PromiseKind wasn't handled properly."); - case VoidKind: - throw std::runtime_error("doInvokeTurboModuleMethod: VoidKind wasn't handled properly."); - } - }; - - // Backward-compatibility layer for calling module methods on specific queue. - dispatch_queue_t methodQueue = NULL; - if ([module conformsToProtocol:@protocol(RCTBridgeModule)] && [module respondsToSelector:@selector(methodQueue)]) { - methodQueue = [module performSelector:@selector(methodQueue)]; - } - - if (methodQueue == NULL || methodQueue == RCTJSThread) { - // This is the default mode of execution: on JS thread. - block(); - } else if (methodQueue == dispatch_get_main_queue()) { - if (valueKind == VoidKind) { - // Void methods are treated as async for now, so there's no need to block here. - RCTExecuteOnMainQueue(block); - } else { - // This is not ideal, but provides the simplest mechanism for now. - // Eventually, methods should be responsible to queue things up to different queue if they need to. - // TODO: consider adding timer to warn if this method invocation takes too long. - RCTUnsafeExecuteOnMainQueueSync(block); - } - } else { - if (valueKind == VoidKind) { - dispatch_async(methodQueue, block); - } else { - dispatch_sync(methodQueue, block); - } - } -} - -} // namespace - -ObjCTurboModule::ObjCTurboModule( - const std::string &name, - id instance, - std::shared_ptr jsInvoker) - : TurboModule(name, jsInvoker), - instance_(instance) {} - -jsi::Value ObjCTurboModule::invokeMethod( - jsi::Runtime &runtime, - TurboModuleMethodValueKind valueKind, - const std::string &methodName, - const jsi::Value *args, - size_t count) { - SEL selector = resolveMethodSelector(valueKind, instance_, name_, methodName, count); - NSInvocation *inv = getMethodInvocation(runtime, valueKind, instance_, jsInvoker_, selector, args, count); - - if (valueKind == PromiseKind) { - // Promise return type is special cased today, i.e. it needs extra 2 function args for resolve() and reject(), to - // be passed to the actual ObjC++ class method. - return createPromise( - runtime, - jsInvoker_, - ^(jsi::Runtime &rt, std::shared_ptr wrapper) { - RCTPromiseResolveBlock resolveBlock = wrapper->resolveBlock(); - RCTPromiseRejectBlock rejectBlock = wrapper->rejectBlock(); - [inv setArgument:(void *)&resolveBlock atIndex:count + 2]; - [inv setArgument:(void *)&rejectBlock atIndex:count + 3]; - // The return type becomes void in the ObjC side. - jsi::Value result; - performMethodInvocation(rt, inv, VoidKind, instance_, jsInvoker_, &result); - }); - } - - jsi::Value result; - performMethodInvocation(runtime, inv, valueKind, instance_, jsInvoker_, &result); - return result; -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.h deleted file mode 100644 index 7d8d6eaa..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTurboModule.h" - -@protocol RCTTurboModuleManagerDelegate - -// TODO: Move to xplat codegen. -- (std::shared_ptr)getTurboModule:(const std::string &)name - instance:(id)instance - jsInvoker:(std::shared_ptr)jsInvoker; - -@optional - -/** - * Given a module name, return its actual class. If not provided, basic ObjC class lookup is performed. - */ -- (Class)getModuleClassFromName:(const char *)name; - -/** - * Given a module class, provide an instance for it. If not provided, default initializer is used. - */ -- (id)getModuleInstanceFromClass:(Class)moduleClass; - -/** - * Create an instance of a TurboModule without relying on any ObjC++ module instance. - */ -- (std::shared_ptr)getTurboModule:(const std::string &)name - jsInvoker:(std::shared_ptr)jsInvoker; - -@end - -@interface RCTTurboModuleManager : NSObject - -- (instancetype)initWithRuntime:(facebook::jsi::Runtime *)runtime - bridge:(RCTBridge *)bridge - delegate:(id)delegate; - -- (void)installJSBinding; - -- (std::shared_ptr)getModule:(const std::string &)name; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm deleted file mode 100644 index a5fefa05..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm +++ /dev/null @@ -1,274 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTurboModuleManager.h" - -#import - -#import -#import -#import -#import -#import - -using namespace facebook; - -// Fallback lookup since RCT class prefix is sometimes stripped in the existing NativeModule system. -// This will be removed in the future. -static Class getFallbackClassFromName(const char *name) { - Class moduleClass = NSClassFromString([NSString stringWithUTF8String:name]); - if (!moduleClass) { - moduleClass = NSClassFromString([NSString stringWithFormat:@"RCT%s", name]); - } - return moduleClass; -} - -@implementation RCTTurboModuleManager -{ - jsi::Runtime *_runtime; - std::shared_ptr _jsInvoker; - std::shared_ptr _binding; - __weak id _delegate; - __weak RCTBridge *_bridge; - /** - * TODO(rsnara): - * All modules are currently long-lived. - * We need to come up with a mechanism to allow modules to specify whether - * they want to be long-lived or short-lived. - */ - std::unordered_map> _rctTurboModuleCache; - std::unordered_map> _turboModuleCache; -} - -- (instancetype)initWithRuntime:(jsi::Runtime *)runtime - bridge:(RCTBridge *)bridge - delegate:(id)delegate -{ - if (self = [super init]) { - _runtime = runtime; - _jsInvoker = std::make_shared(bridge.jsMessageThread); - _delegate = delegate; - _bridge = bridge; - - // Necessary to allow NativeModules to lookup TurboModules - [bridge setRCTTurboModuleLookupDelegate:self]; - - __weak __typeof(self) weakSelf = self; - - auto moduleProvider = [weakSelf](const std::string &name) -> std::shared_ptr { - if (!weakSelf) { - return nullptr; - } - - __strong __typeof(self) strongSelf = weakSelf; - - /** - * By default, all TurboModules are long-lived. - * Additionally, if a TurboModule with the name `name` isn't found, then we - * trigger an assertion failure. - */ - return [strongSelf provideTurboModule: name.c_str()]; - }; - - _binding = std::make_shared(moduleProvider); - } - return self; -} - -/** - * Given a name for a TurboModule, return a C++ object which is the instance - * of that TurboModule C++ class. This class wraps the TurboModule's ObjC instance. - * If no TurboModule ObjC class exist with the provided name, abort program. - * - * Note: All TurboModule instances are cached, which means they're all long-lived - * (for now). - */ - -- (std::shared_ptr)provideTurboModule:(const char*)moduleName -{ - auto turboModuleLookup = _turboModuleCache.find(moduleName); - if (turboModuleLookup != _turboModuleCache.end()) { - return turboModuleLookup->second; - } - - /** - * Step 1: Look for pure C++ modules. - * Pure C++ modules get priority. - */ - if ([_delegate respondsToSelector:@selector(getTurboModule:jsInvoker:)]) { - auto turboModule = [_delegate getTurboModule:moduleName jsInvoker:_jsInvoker]; - if (turboModule != nullptr) { - _turboModuleCache.insert({moduleName, turboModule}); - return turboModule; - } - } - - /** - * Step 2: Look for platform-specific modules. - */ - id module = [self provideRCTTurboModule:moduleName]; - - // If we request that a TurboModule be created, its respective ObjC class must exist - // If the class doesn't exist, then provideRCTTurboModule returns nil - if (!module) { - return nullptr; - } - - Class moduleClass = [module class]; - - // If RCTTurboModule supports creating its own C++ TurboModule object, - // allow it to do so. - if ([module respondsToSelector:@selector(getTurboModuleWithJsInvoker:)]) { - auto turboModule = [module getTurboModuleWithJsInvoker:_jsInvoker]; - assert(turboModule != nullptr); - _turboModuleCache.insert({moduleName, turboModule}); - return turboModule; - } - - /** - * Step 2c: If the moduleClass is a legacy CxxModule, return a TurboCxxModule instance that - * wraps CxxModule. - */ - if ([moduleClass isSubclassOfClass:RCTCxxModule.class]) { - // Use TurboCxxModule compat class to wrap the CxxModule instance. - // This is only for migration convenience, despite less performant. - auto turboModule = std::make_shared([((RCTCxxModule *)module) createModule], _jsInvoker); - _turboModuleCache.insert({moduleName, turboModule}); - return turboModule; - } - - /** - * Step 2d: Return an exact sub-class of ObjC TurboModule - */ - auto turboModule = [_delegate getTurboModule:moduleName instance:module jsInvoker:_jsInvoker]; - if (turboModule != nullptr) { - _turboModuleCache.insert({moduleName, turboModule}); - } - return turboModule; -} - -/** - * Given a name for a TurboModule, return an ObjC object which is the instance - * of that TurboModule ObjC class. If no TurboModule exist with the provided name, - * return nil. - * - * Note: All TurboModule instances are cached, which means they're all long-lived - * (for now). - */ -- (id)provideRCTTurboModule:(const char*)moduleName -{ - auto rctTurboModuleCacheLookup = _rctTurboModuleCache.find(moduleName); - if (rctTurboModuleCacheLookup != _rctTurboModuleCache.end()) { - return rctTurboModuleCacheLookup->second; - } - - /** - * Step 2a: Resolve platform-specific class. - */ - Class moduleClass; - if ([_delegate respondsToSelector:@selector(getModuleClassFromName:)]) { - moduleClass = [_delegate getModuleClassFromName:moduleName]; - } else { - moduleClass = getFallbackClassFromName(moduleName); - } - - if (![moduleClass conformsToProtocol:@protocol(RCTTurboModule)]) { - return nil; - } - - /** - * Step 2b: Ask hosting application/delegate to instantiate this class - */ - id module = nil; - if ([_delegate respondsToSelector:@selector(getModuleInstanceFromClass:)]) { - module = [_delegate getModuleInstanceFromClass:moduleClass]; - } else { - module = [moduleClass new]; - } - - /** - * It is reasonable for NativeModules to not want/need the bridge. - * In such cases, they won't have `@synthesize bridge = _bridge` in their - * implementation, and a `- (RCTBridge *) bridge { ... }` method won't be - * generated by the ObjC runtime. The property will also not be backed - * by an ivar, which makes writing to it unsafe. Therefore, we check if - * this method exists to know if we can safely set the bridge to the - * NativeModule. - */ - if ([module respondsToSelector:@selector(bridge)] && _bridge) { - /** - * Just because a NativeModule has the `bridge` method, it doesn't mean - * that it has synthesized the bridge in its implementation. Therefore, - * we need to surround the code that sets the bridge to the NativeModule - * inside a try/catch. This catches the cases where the NativeModule - * author specifies a `bridge` method manually. - */ - @try { - /** - * RCTBridgeModule declares the bridge property as readonly. - * Therefore, when authors of NativeModules synthesize the bridge - * via @synthesize bridge = bridge;, the ObjC runtime generates - * only a - (RCTBridge *) bridge: { ... } method. No setter is - * generated, so we have have to rely on the KVC API of ObjC to set - * the bridge property of these NativeModules. - */ - [(id)module setValue:_bridge forKey:@"bridge"]; - } - @catch (NSException *exception) { - RCTLogError(@"%@ has no setter or ivar for its bridge, which is not " - "permitted. You must either @synthesize the bridge property, " - "or provide your own setter method.", RCTBridgeModuleNameForClass(module)); - } - } - - if ([module respondsToSelector:@selector(setTurboModuleLookupDelegate:)]) { - [module setTurboModuleLookupDelegate:self]; - } - - _rctTurboModuleCache.insert({moduleName, module}); - return module; -} - -- (void)installJSBinding -{ - if (!_runtime) { - // jsi::Runtime doesn't exist when attached to Chrome debugger. - return; - } - - react::TurboModuleBinding::install(*_runtime, _binding); -} - -- (std::shared_ptr)getModule:(const std::string &)name -{ - return _binding->getModule(name); -} - -#pragma mark RCTTurboModuleLookupDelegate - -- (id)moduleForName:(const char *)moduleName -{ - return [self moduleForName:moduleName warnOnLookupFailure:YES]; -} - -- (id)moduleForName:(const char *)moduleName warnOnLookupFailure:(BOOL)warnOnLookupFailure -{ - id module = [self provideRCTTurboModule:moduleName]; - - if (warnOnLookupFailure && !module) { - RCTLogError(@"Unable to find module for %@", [NSString stringWithUTF8String:moduleName]); - } - - return module; -} - -- (BOOL)moduleIsInitialized:(const char *)moduleName -{ - return _rctTurboModuleCache.find(std::string(moduleName)) != _rctTurboModuleCache.end(); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/utils/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/utils/BUCK deleted file mode 100644 index d46e8d9e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/utils/BUCK +++ /dev/null @@ -1,27 +0,0 @@ -load("@fbsource//tools/build_defs:glob_defs.bzl", "subdir_glob") -load("//tools/build_defs/oss:rn_defs.bzl", "get_apple_compiler_flags", "rn_xplat_cxx_library") - -CXX_LIBRARY_COMPILER_FLAGS = [ - "-std=c++14", - "-Wall", -] - -rn_xplat_cxx_library( - name = "utils", - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "FloatComparison.h"), - ], - prefix = "react/utils", - ), - compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [ - "-fexceptions", - "-frtti", - ], - fbobjc_compiler_flags = get_apple_compiler_flags(), - force_static = True, - visibility = [ - "PUBLIC", - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/utils/FloatComparison.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/utils/FloatComparison.h deleted file mode 100644 index cb4f2d5d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/utils/FloatComparison.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -namespace facebook { -namespace react { - -inline bool floatEquality (float a, float b, float epsilon = 0.005f) { - return (std::isnan(a) && std::isnan(b)) || (!std::isnan(a) && !std::isnan(b) && fabs(a - b) < epsilon); -} - -} // namespace react -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/Android.mk b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/Android.mk deleted file mode 100644 index f1cd07fc..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/Android.mk +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := yogacore - -LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/yoga/*.cpp) - -LOCAL_C_INCLUDES := $(LOCAL_PATH) -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) - -LOCAL_CFLAGS := -fexceptions -frtti -O3 - -include $(BUILD_STATIC_LIBRARY) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/BUCK b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/BUCK deleted file mode 100644 index 49ac7854..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/BUCK +++ /dev/null @@ -1,20 +0,0 @@ -load("//tools/build_defs/oss:rn_defs.bzl", "cxx_library") - -cxx_library( - name = "yoga", - srcs = glob(["yoga/*.cpp"]), - header_namespace = "", - exported_headers = glob(["yoga/*.h"]), - compiler_flags = [ - "-fno-omit-frame-pointer", - "-fexceptions", - "-Wall", - "-Werror", - "-std=c++1y", - "-O3", - ], - force_static = True, - visibility = ["PUBLIC"], - deps = [ - ], -) diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga.podspec b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga.podspec deleted file mode 100644 index 8da83a2c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga.podspec +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -package = JSON.parse(File.read(File.expand_path('../../package.json', __dir__))) -version = package['version'] - -source = { :git => ENV['INSTALL_YOGA_FROM_LOCATION'] || 'https://github.com/facebook/react-native.git' } -if version == '1000.0.0' - # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. - source[:commit] = `git rev-parse HEAD`.strip -else - source[:tag] = "v#{version}" -end - -Pod::Spec.new do |spec| - spec.name = 'yoga' - spec.version = "#{version}.React" - spec.license = { :type => 'MIT' } - spec.homepage = 'https://facebook.github.io/yoga/' - spec.documentation_url = 'https://facebook.github.io/yoga/docs/api/c/' - - spec.summary = 'Yoga is a cross-platform layout engine which implements Flexbox.' - spec.description = 'Yoga is a cross-platform layout engine enabling maximum collaboration within your team by implementing an API many designers are familiar with, and opening it up to developers across different platforms.' - - spec.authors = 'Facebook' - spec.source = source - - spec.module_name = 'yoga' - spec.requires_arc = false - spec.compiler_flags = [ - '-fno-omit-frame-pointer', - '-fexceptions', - '-Wall', - '-Werror', - '-std=c++1y', - '-fPIC' - ] - - # Pinning to the same version as React.podspec. - spec.platforms = { :ios => "9.0", :tvos => "9.2" } - - # Set this environment variable when *not* using the `:path` option to install the pod. - # E.g. when publishing this spec to a spec repo. - source_files = 'yoga/**/*.{cpp,h}' - source_files = File.join('ReactCommon/yoga', source_files) if ENV['INSTALL_YOGA_WITHOUT_PATH_OPTION'] - spec.source_files = source_files - - header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGValue}.h' - header_files = File.join('ReactCommon/yoga', header_files) if ENV['INSTALL_YOGA_WITHOUT_PATH_OPTION'] - spec.public_header_files = header_files -end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/CompactValue.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/CompactValue.h deleted file mode 100644 index 3cc36a48..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/CompactValue.h +++ /dev/null @@ -1,187 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#pragma once - -#include "YGValue.h" - -#include -#include -#include - -static_assert( - std::numeric_limits::is_iec559, - "facebook::yoga::detail::CompactValue only works with IEEE754 floats"); - -#ifdef YOGA_COMPACT_VALUE_TEST -#define VISIBLE_FOR_TESTING public: -#else -#define VISIBLE_FOR_TESTING private: -#endif - -namespace facebook { -namespace yoga { -namespace detail { - -// This class stores YGValue in 32 bits. -// - The value does not matter for Undefined and Auto. NaNs are used for their -// representation. -// - To differentiate between Point and Percent, one exponent bit is used. -// Supported the range [0x40, 0xbf] (0xbf is inclusive for point, but -// exclusive for percent). -// - Value ranges: -// points: 1.08420217e-19f to 36893485948395847680 -// 0x00000000 0x3fffffff -// percent: 1.08420217e-19f to 18446742974197923840 -// 0x40000000 0x7f7fffff -// - Zero is supported, negative zero is not -// - values outside of the representable range are clamped -class CompactValue { - friend constexpr bool operator==(CompactValue, CompactValue) noexcept; - -public: - static constexpr auto LOWER_BOUND = 1.08420217e-19f; - static constexpr auto UPPER_BOUND_POINT = 36893485948395847680.0f; - static constexpr auto UPPER_BOUND_PERCENT = 18446742974197923840.0f; - - template - static CompactValue of(float value) noexcept { - if (value == 0.0f || (value < LOWER_BOUND && value > -LOWER_BOUND)) { - constexpr auto zero = - Unit == YGUnitPercent ? ZERO_BITS_PERCENT : ZERO_BITS_POINT; - return {Payload{zero}}; - } - - constexpr auto upperBound = - Unit == YGUnitPercent ? UPPER_BOUND_PERCENT : UPPER_BOUND_POINT; - if (value > upperBound || value < -upperBound) { - value = copysignf(upperBound, value); - } - - uint32_t unitBit = Unit == YGUnitPercent ? PERCENT_BIT : 0; - auto data = Payload{value}; - data.repr -= BIAS; - data.repr |= unitBit; - return {data}; - } - - template - static CompactValue ofMaybe(float value) noexcept { - return std::isnan(value) || std::isinf(value) ? ofUndefined() - : of(value); - } - - static constexpr CompactValue ofZero() noexcept { - return CompactValue{Payload{ZERO_BITS_POINT}}; - } - - static constexpr CompactValue ofUndefined() noexcept { - return CompactValue{}; - } - - static constexpr CompactValue ofAuto() noexcept { - return CompactValue{Payload{AUTO_BITS}}; - } - - constexpr CompactValue() noexcept - : payload_(std::numeric_limits::quiet_NaN()) {} - - CompactValue(const YGValue& x) noexcept : payload_(uint32_t{0}) { - switch (x.unit) { - case YGUnitUndefined: - *this = ofUndefined(); - break; - case YGUnitAuto: - *this = ofAuto(); - break; - case YGUnitPoint: - *this = of(x.value); - break; - case YGUnitPercent: - *this = of(x.value); - break; - } - } - - operator YGValue() const noexcept { - switch (payload_.repr) { - case AUTO_BITS: - return YGValueAuto; - case ZERO_BITS_POINT: - return YGValue{0.0f, YGUnitPoint}; - case ZERO_BITS_PERCENT: - return YGValue{0.0f, YGUnitPercent}; - } - - if (std::isnan(payload_.value)) { - return YGValueUndefined; - } - - auto data = payload_; - data.repr &= ~PERCENT_BIT; - data.repr += BIAS; - - return YGValue{data.value, - payload_.repr & 0x40000000 ? YGUnitPercent : YGUnitPoint}; - } - - bool isUndefined() const noexcept { - return ( - payload_.repr != AUTO_BITS && payload_.repr != ZERO_BITS_POINT && - payload_.repr != ZERO_BITS_PERCENT && std::isnan(payload_.value)); - } - - bool isAuto() const noexcept { - return payload_.repr == AUTO_BITS; - } - -private: - union Payload { - float value; - uint32_t repr; - Payload() = delete; - constexpr Payload(uint32_t r) : repr(r) {} - constexpr Payload(float v) : value(v) {} - }; - - static constexpr uint32_t BIAS = 0x20000000; - static constexpr uint32_t PERCENT_BIT = 0x40000000; - - // these are signaling NaNs with specific bit pattern as payload they will be - // silenced whenever going through an FPU operation on ARM + x86 - static constexpr uint32_t AUTO_BITS = 0x7faaaaaa; - static constexpr uint32_t ZERO_BITS_POINT = 0x7f8f0f0f; - static constexpr uint32_t ZERO_BITS_PERCENT = 0x7f80f0f0; - - constexpr CompactValue(Payload data) noexcept : payload_(data) {} - - Payload payload_; - - VISIBLE_FOR_TESTING uint32_t repr() { - return payload_.repr; - } -}; - -template <> -CompactValue CompactValue::of(float) noexcept = delete; -template <> -CompactValue CompactValue::of(float) noexcept = delete; -template <> -CompactValue CompactValue::ofMaybe(float) noexcept = delete; -template <> -CompactValue CompactValue::ofMaybe(float) noexcept = delete; - -constexpr bool operator==(CompactValue a, CompactValue b) noexcept { - return a.payload_.repr == b.payload_.repr; -} - -constexpr bool operator!=(CompactValue a, CompactValue b) noexcept { - return !(a == b); -} - -} // namespace detail -} // namespace yoga -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/Utils.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/Utils.cpp deleted file mode 100644 index 2035fe00..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/Utils.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#include "Utils.h" - -using namespace facebook; - -YGFlexDirection YGFlexDirectionCross( - const YGFlexDirection flexDirection, - const YGDirection direction) { - return YGFlexDirectionIsColumn(flexDirection) - ? YGResolveFlexDirection(YGFlexDirectionRow, direction) - : YGFlexDirectionColumn; -} - -float YGFloatMax(const float a, const float b) { - if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) { - return fmaxf(a, b); - } - return yoga::isUndefined(a) ? b : a; -} - -float YGFloatMin(const float a, const float b) { - if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) { - return fminf(a, b); - } - - return yoga::isUndefined(a) ? b : a; -} - -bool YGValueEqual(const YGValue a, const YGValue b) { - if (a.unit != b.unit) { - return false; - } - - if (a.unit == YGUnitUndefined || - (yoga::isUndefined(a.value) && yoga::isUndefined(b.value))) { - return true; - } - - return fabs(a.value - b.value) < 0.0001f; -} - -bool YGFloatsEqual(const float a, const float b) { - if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) { - return fabs(a - b) < 0.0001f; - } - return yoga::isUndefined(a) && yoga::isUndefined(b); -} - -float YGFloatSanitize(const float val) { - return yoga::isUndefined(val) ? 0 : val; -} - -YGFloatOptional YGFloatOptionalMax(YGFloatOptional op1, YGFloatOptional op2) { - if (op1 >= op2) { - return op1; - } - if (op2 > op1) { - return op2; - } - return op1.isUndefined() ? op2 : op1; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/Utils.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/Utils.h deleted file mode 100644 index a27b62a1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/Utils.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#pragma once -#include "YGNode.h" -#include "Yoga-internal.h" -#include "CompactValue.h" - -// This struct is an helper model to hold the data for step 4 of flexbox algo, -// which is collecting the flex items in a line. -// -// - itemsOnLine: Number of items which can fit in a line considering the -// available Inner dimension, the flex items computed flexbasis and their -// margin. It may be different than the difference between start and end -// indicates because we skip over absolute-positioned items. -// -// - sizeConsumedOnCurrentLine: It is accumulation of the dimensions and margin -// of all the children on the current line. This will be used in order to -// either set the dimensions of the node if none already exist or to compute -// the remaining space left for the flexible children. -// -// - totalFlexGrowFactors: total flex grow factors of flex items which are to be -// layed in the current line -// -// - totalFlexShrinkFactors: total flex shrink factors of flex items which are -// to be layed in the current line -// -// - endOfLineIndex: Its the end index of the last flex item which was examined -// and it may or may not be part of the current line(as it may be absolutely -// positioned or inculding it may have caused to overshoot availableInnerDim) -// -// - relativeChildren: Maintain a vector of the child nodes that can shrink -// and/or grow. - -struct YGCollectFlexItemsRowValues { - uint32_t itemsOnLine; - float sizeConsumedOnCurrentLine; - float totalFlexGrowFactors; - float totalFlexShrinkScaledFactors; - uint32_t endOfLineIndex; - std::vector relativeChildren; - float remainingFreeSpace; - // The size of the mainDim for the row after considering size, padding, margin - // and border of flex items. This is used to calculate maxLineDim after going - // through all the rows to decide on the main axis size of owner. - float mainDim; - // The size of the crossDim for the row after considering size, padding, - // margin and border of flex items. Used for calculating containers crossSize. - float crossDim; -}; - -bool YGValueEqual(const YGValue a, const YGValue b); - -// This custom float equality function returns true if either absolute -// difference between two floats is less than 0.0001f or both are undefined. -bool YGFloatsEqual(const float a, const float b); - -float YGFloatMax(const float a, const float b); - -YGFloatOptional YGFloatOptionalMax( - const YGFloatOptional op1, - const YGFloatOptional op2); - -float YGFloatMin(const float a, const float b); - -// This custom float comparision function compares the array of float with -// YGFloatsEqual, as the default float comparision operator will not work(Look -// at the comments of YGFloatsEqual function). -template -bool YGFloatArrayEqual( - const std::array& val1, - const std::array& val2) { - bool areEqual = true; - for (std::size_t i = 0; i < size && areEqual; ++i) { - areEqual = YGFloatsEqual(val1[i], val2[i]); - } - return areEqual; -} - -// This function returns 0 if YGFloatIsUndefined(val) is true and val otherwise -float YGFloatSanitize(const float val); - -YGFlexDirection YGFlexDirectionCross( - const YGFlexDirection flexDirection, - const YGDirection direction); - -inline bool YGFlexDirectionIsRow(const YGFlexDirection flexDirection) { - return flexDirection == YGFlexDirectionRow || - flexDirection == YGFlexDirectionRowReverse; -} - -inline YGFloatOptional YGResolveValue( - const YGValue value, - const float ownerSize) { - switch (value.unit) { - case YGUnitPoint: - return YGFloatOptional{value.value}; - case YGUnitPercent: - return YGFloatOptional{value.value * ownerSize * 0.01f}; - default: - return YGFloatOptional{}; - } -} - -inline bool YGFlexDirectionIsColumn(const YGFlexDirection flexDirection) { - return flexDirection == YGFlexDirectionColumn || - flexDirection == YGFlexDirectionColumnReverse; -} - -inline YGFlexDirection YGResolveFlexDirection( - const YGFlexDirection flexDirection, - const YGDirection direction) { - if (direction == YGDirectionRTL) { - if (flexDirection == YGFlexDirectionRow) { - return YGFlexDirectionRowReverse; - } else if (flexDirection == YGFlexDirectionRowReverse) { - return YGFlexDirectionRow; - } - } - - return flexDirection; -} - -inline YGFloatOptional YGResolveValueMargin( - yoga::detail::CompactValue value, - const float ownerSize) { - return value.isAuto() ? YGFloatOptional{0} : YGResolveValue(value, ownerSize); -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGConfig.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGConfig.cpp deleted file mode 100644 index 2f73dd9a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGConfig.cpp +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#include "YGConfig.h" - -YGConfig::YGConfig(YGLogger logger) : logger(logger) {} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGConfig.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGConfig.h deleted file mode 100644 index 00415ce9..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGConfig.h +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#pragma once -#include "YGMarker.h" -#include "Yoga-internal.h" -#include "Yoga.h" - -struct YGConfig { - std::array()> - experimentalFeatures = {}; - bool useWebDefaults = false; - bool useLegacyStretchBehaviour = false; - bool shouldDiffLayoutWithoutLegacyStretchBehaviour = false; - bool printTree = false; - float pointScaleFactor = 1.0f; - YGLogger logger; - YGCloneNodeFunc cloneNodeCallback = nullptr; - void* context = nullptr; - YGMarkerCallbacks markerCallbacks = {nullptr, nullptr}; - - YGConfig(YGLogger logger); -}; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGEnums.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGEnums.cpp deleted file mode 100644 index ff4b1307..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGEnums.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#include "YGEnums.h" - -const char* YGAlignToString(const YGAlign value) { - switch (value) { - case YGAlignAuto: - return "auto"; - case YGAlignFlexStart: - return "flex-start"; - case YGAlignCenter: - return "center"; - case YGAlignFlexEnd: - return "flex-end"; - case YGAlignStretch: - return "stretch"; - case YGAlignBaseline: - return "baseline"; - case YGAlignSpaceBetween: - return "space-between"; - case YGAlignSpaceAround: - return "space-around"; - } - return "unknown"; -} - -const char* YGDimensionToString(const YGDimension value) { - switch (value) { - case YGDimensionWidth: - return "width"; - case YGDimensionHeight: - return "height"; - } - return "unknown"; -} - -const char* YGDirectionToString(const YGDirection value) { - switch (value) { - case YGDirectionInherit: - return "inherit"; - case YGDirectionLTR: - return "ltr"; - case YGDirectionRTL: - return "rtl"; - } - return "unknown"; -} - -const char* YGDisplayToString(const YGDisplay value) { - switch (value) { - case YGDisplayFlex: - return "flex"; - case YGDisplayNone: - return "none"; - } - return "unknown"; -} - -const char* YGEdgeToString(const YGEdge value) { - switch (value) { - case YGEdgeLeft: - return "left"; - case YGEdgeTop: - return "top"; - case YGEdgeRight: - return "right"; - case YGEdgeBottom: - return "bottom"; - case YGEdgeStart: - return "start"; - case YGEdgeEnd: - return "end"; - case YGEdgeHorizontal: - return "horizontal"; - case YGEdgeVertical: - return "vertical"; - case YGEdgeAll: - return "all"; - } - return "unknown"; -} - -const char* YGExperimentalFeatureToString(const YGExperimentalFeature value) { - switch (value) { - case YGExperimentalFeatureWebFlexBasis: - return "web-flex-basis"; - } - return "unknown"; -} - -const char* YGFlexDirectionToString(const YGFlexDirection value) { - switch (value) { - case YGFlexDirectionColumn: - return "column"; - case YGFlexDirectionColumnReverse: - return "column-reverse"; - case YGFlexDirectionRow: - return "row"; - case YGFlexDirectionRowReverse: - return "row-reverse"; - } - return "unknown"; -} - -const char* YGJustifyToString(const YGJustify value) { - switch (value) { - case YGJustifyFlexStart: - return "flex-start"; - case YGJustifyCenter: - return "center"; - case YGJustifyFlexEnd: - return "flex-end"; - case YGJustifySpaceBetween: - return "space-between"; - case YGJustifySpaceAround: - return "space-around"; - case YGJustifySpaceEvenly: - return "space-evenly"; - } - return "unknown"; -} - -const char* YGLogLevelToString(const YGLogLevel value) { - switch (value) { - case YGLogLevelError: - return "error"; - case YGLogLevelWarn: - return "warn"; - case YGLogLevelInfo: - return "info"; - case YGLogLevelDebug: - return "debug"; - case YGLogLevelVerbose: - return "verbose"; - case YGLogLevelFatal: - return "fatal"; - } - return "unknown"; -} - -const char* YGMeasureModeToString(const YGMeasureMode value) { - switch (value) { - case YGMeasureModeUndefined: - return "undefined"; - case YGMeasureModeExactly: - return "exactly"; - case YGMeasureModeAtMost: - return "at-most"; - } - return "unknown"; -} - -const char* YGNodeTypeToString(const YGNodeType value) { - switch (value) { - case YGNodeTypeDefault: - return "default"; - case YGNodeTypeText: - return "text"; - } - return "unknown"; -} - -const char* YGOverflowToString(const YGOverflow value) { - switch (value) { - case YGOverflowVisible: - return "visible"; - case YGOverflowHidden: - return "hidden"; - case YGOverflowScroll: - return "scroll"; - } - return "unknown"; -} - -const char* YGPositionTypeToString(const YGPositionType value) { - switch (value) { - case YGPositionTypeRelative: - return "relative"; - case YGPositionTypeAbsolute: - return "absolute"; - } - return "unknown"; -} - -const char* YGPrintOptionsToString(const YGPrintOptions value) { - switch (value) { - case YGPrintOptionsLayout: - return "layout"; - case YGPrintOptionsStyle: - return "style"; - case YGPrintOptionsChildren: - return "children"; - } - return "unknown"; -} - -const char* YGUnitToString(const YGUnit value) { - switch (value) { - case YGUnitUndefined: - return "undefined"; - case YGUnitPoint: - return "point"; - case YGUnitPercent: - return "percent"; - case YGUnitAuto: - return "auto"; - } - return "unknown"; -} - -const char* YGWrapToString(const YGWrap value) { - switch (value) { - case YGWrapNoWrap: - return "no-wrap"; - case YGWrapWrap: - return "wrap"; - case YGWrapWrapReverse: - return "wrap-reverse"; - } - return "unknown"; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGEnums.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGEnums.h deleted file mode 100644 index f06b0e04..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGEnums.h +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#pragma once - -#include "YGMacros.h" - -#ifdef __cplusplus -namespace facebook { -namespace yoga { -namespace enums { - -template -constexpr int count(); // can't use `= delete` due to a defect in clang < 3.9 - -namespace detail { -template -constexpr int n() { - return sizeof...(xs); -} -} // namespace detail - -} // namespace enums -} // namespace yoga -} // namespace facebook -#endif - -#define YG_ENUM_DECL(NAME, ...) \ - typedef YG_ENUM_BEGIN(NAME){__VA_ARGS__} YG_ENUM_END(NAME); \ - WIN_EXPORT const char* NAME##ToString(NAME); - -#ifdef __cplusplus -#define YG_ENUM_SEQ_DECL(NAME, ...) \ - YG_ENUM_DECL(NAME, __VA_ARGS__) \ - YG_EXTERN_C_END \ - namespace facebook { \ - namespace yoga { \ - namespace enums { \ - template <> \ - constexpr int count() { \ - return detail::n<__VA_ARGS__>(); \ - } \ - } \ - } \ - } \ - YG_EXTERN_C_BEGIN -#else -#define YG_ENUM_SEQ_DECL YG_ENUM_DECL -#endif - -YG_EXTERN_C_BEGIN - -YG_ENUM_SEQ_DECL( - YGAlign, - YGAlignAuto, - YGAlignFlexStart, - YGAlignCenter, - YGAlignFlexEnd, - YGAlignStretch, - YGAlignBaseline, - YGAlignSpaceBetween, - YGAlignSpaceAround); - -YG_ENUM_SEQ_DECL(YGDimension, YGDimensionWidth, YGDimensionHeight) - -YG_ENUM_SEQ_DECL( - YGDirection, - YGDirectionInherit, - YGDirectionLTR, - YGDirectionRTL) - -YG_ENUM_SEQ_DECL(YGDisplay, YGDisplayFlex, YGDisplayNone) - -YG_ENUM_SEQ_DECL( - YGEdge, - YGEdgeLeft, - YGEdgeTop, - YGEdgeRight, - YGEdgeBottom, - YGEdgeStart, - YGEdgeEnd, - YGEdgeHorizontal, - YGEdgeVertical, - YGEdgeAll) - -YG_ENUM_SEQ_DECL(YGExperimentalFeature, YGExperimentalFeatureWebFlexBasis) - -YG_ENUM_SEQ_DECL( - YGFlexDirection, - YGFlexDirectionColumn, - YGFlexDirectionColumnReverse, - YGFlexDirectionRow, - YGFlexDirectionRowReverse) - -YG_ENUM_SEQ_DECL( - YGJustify, - YGJustifyFlexStart, - YGJustifyCenter, - YGJustifyFlexEnd, - YGJustifySpaceBetween, - YGJustifySpaceAround, - YGJustifySpaceEvenly) - -YG_ENUM_SEQ_DECL( - YGLogLevel, - YGLogLevelError, - YGLogLevelWarn, - YGLogLevelInfo, - YGLogLevelDebug, - YGLogLevelVerbose, - YGLogLevelFatal) - -YG_ENUM_SEQ_DECL( - YGMeasureMode, - YGMeasureModeUndefined, - YGMeasureModeExactly, - YGMeasureModeAtMost) - -YG_ENUM_SEQ_DECL(YGNodeType, YGNodeTypeDefault, YGNodeTypeText) - -YG_ENUM_SEQ_DECL( - YGOverflow, - YGOverflowVisible, - YGOverflowHidden, - YGOverflowScroll) - -YG_ENUM_SEQ_DECL(YGPositionType, YGPositionTypeRelative, YGPositionTypeAbsolute) - -YG_ENUM_DECL( - YGPrintOptions, - YGPrintOptionsLayout = 1, - YGPrintOptionsStyle = 2, - YGPrintOptionsChildren = 4) - -YG_ENUM_SEQ_DECL( - YGUnit, - YGUnitUndefined, - YGUnitPoint, - YGUnitPercent, - YGUnitAuto) - -YG_ENUM_SEQ_DECL(YGWrap, YGWrapNoWrap, YGWrapWrap, YGWrapWrapReverse) - -YG_EXTERN_C_END - -#undef YG_ENUM_DECL -#undef YG_ENUM_SEQ_DECL diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGFloatOptional.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGFloatOptional.h deleted file mode 100644 index 02d4c856..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGFloatOptional.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#pragma once - -#include -#include -#include "Yoga-internal.h" - -struct YGFloatOptional { -private: - float value_ = std::numeric_limits::quiet_NaN(); - -public: - explicit constexpr YGFloatOptional(float value) : value_(value) {} - constexpr YGFloatOptional() = default; - - // returns the wrapped value, or a value x with YGIsUndefined(x) == true - constexpr float unwrap() const { - return value_; - } - - bool isUndefined() const { - return std::isnan(value_); - } - - YGFloatOptional operator+(YGFloatOptional op) const { - return YGFloatOptional{value_ + op.value_}; - } - bool operator>(YGFloatOptional op) const { - return value_ > op.value_; - } - bool operator<(YGFloatOptional op) const { - return value_ < op.value_; - } - bool operator>=(YGFloatOptional op) const { - return *this > op || *this == op; - } - bool operator<=(YGFloatOptional op) const { - return *this < op || *this == op; - } - bool operator==(YGFloatOptional op) const { - return value_ == op.value_ || (isUndefined() && op.isUndefined()); - } - bool operator!=(YGFloatOptional op) const { - return !(*this == op); - } - - bool operator==(float val) const { - return value_ == val || (isUndefined() && yoga::isUndefined(val)); - } - bool operator!=(float val) const { - return !(*this == val); - } -}; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGLayout.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGLayout.cpp deleted file mode 100644 index 6f55d862..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGLayout.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#include "YGLayout.h" -#include "Utils.h" - -using namespace facebook; - -bool YGLayout::operator==(YGLayout layout) const { - bool isEqual = YGFloatArrayEqual(position, layout.position) && - YGFloatArrayEqual(dimensions, layout.dimensions) && - YGFloatArrayEqual(margin, layout.margin) && - YGFloatArrayEqual(border, layout.border) && - YGFloatArrayEqual(padding, layout.padding) && - direction == layout.direction && hadOverflow == layout.hadOverflow && - lastOwnerDirection == layout.lastOwnerDirection && - nextCachedMeasurementsIndex == layout.nextCachedMeasurementsIndex && - cachedLayout == layout.cachedLayout && - computedFlexBasis == layout.computedFlexBasis; - - for (uint32_t i = 0; i < YG_MAX_CACHED_RESULT_COUNT && isEqual; ++i) { - isEqual = isEqual && cachedMeasurements[i] == layout.cachedMeasurements[i]; - } - - if (!yoga::isUndefined(measuredDimensions[0]) || - !yoga::isUndefined(layout.measuredDimensions[0])) { - isEqual = - isEqual && (measuredDimensions[0] == layout.measuredDimensions[0]); - } - if (!yoga::isUndefined(measuredDimensions[1]) || - !yoga::isUndefined(layout.measuredDimensions[1])) { - isEqual = - isEqual && (measuredDimensions[1] == layout.measuredDimensions[1]); - } - - return isEqual; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGLayout.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGLayout.h deleted file mode 100644 index 4daa28ed..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGLayout.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#pragma once -#include "YGFloatOptional.h" -#include "Yoga-internal.h" - -constexpr std::array kYGDefaultDimensionValues = { - {YGUndefined, YGUndefined}}; - -struct YGLayout { - std::array position = {}; - std::array dimensions = kYGDefaultDimensionValues; - std::array margin = {}; - std::array border = {}; - std::array padding = {}; - YGDirection direction : 2; - bool didUseLegacyFlag : 1; - bool doesLegacyStretchFlagAffectsLayout : 1; - bool hadOverflow : 1; - - uint32_t computedFlexBasisGeneration = 0; - YGFloatOptional computedFlexBasis = {}; - - // Instead of recomputing the entire layout every single time, we cache some - // information to break early when nothing changed - uint32_t generationCount = 0; - YGDirection lastOwnerDirection = (YGDirection) -1; - - uint32_t nextCachedMeasurementsIndex = 0; - std::array - cachedMeasurements = {}; - std::array measuredDimensions = kYGDefaultDimensionValues; - - YGCachedMeasurement cachedLayout = YGCachedMeasurement(); - - YGLayout() - : direction(YGDirectionInherit), - didUseLegacyFlag(false), - doesLegacyStretchFlagAffectsLayout(false), - hadOverflow(false) {} - - bool operator==(YGLayout layout) const; - bool operator!=(YGLayout layout) const { - return !(*this == layout); - } -}; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGMacros.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGMacros.h deleted file mode 100644 index 9c2989ac..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGMacros.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#pragma once - -#ifdef __cplusplus -#define YG_EXTERN_C_BEGIN extern "C" { -#define YG_EXTERN_C_END } -#else -#define YG_EXTERN_C_BEGIN -#define YG_EXTERN_C_END -#endif - -#ifdef _WINDLL -#define WIN_EXPORT __declspec(dllexport) -#else -#define WIN_EXPORT -#endif - -#ifdef NS_ENUM -// Cannot use NSInteger as NSInteger has a different size than int (which is the -// default type of a enum). Therefor when linking the Yoga C library into obj-c -// the header is a missmatch for the Yoga ABI. -#define YG_ENUM_BEGIN(name) NS_ENUM(int, name) -#define YG_ENUM_END(name) -#else -#define YG_ENUM_BEGIN(name) enum name -#define YG_ENUM_END(name) name -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGMarker.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGMarker.cpp deleted file mode 100644 index 21a8d1f6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGMarker.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#include "YGMarker.h" -#include "YGConfig.h" - -void YGConfigSetMarkerCallbacks( - YGConfigRef config, - YGMarkerCallbacks markerCallbacks) { - config->markerCallbacks = markerCallbacks; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGMarker.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGMarker.h deleted file mode 100644 index 25362ff5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGMarker.h +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#pragma once - -#include "YGMacros.h" - -YG_EXTERN_C_BEGIN - -typedef struct YGNode* YGNodeRef; -typedef struct YGConfig* YGConfigRef; - -typedef YG_ENUM_BEGIN(YGMarker){ - YGMarkerLayout, - YGMarkerMeasure, - YGMarkerBaselineFn, -} YG_ENUM_END(YGMarker); - -typedef struct { - int layouts; - int measures; - int maxMeasureCache; - int cachedLayouts; - int cachedMeasures; -} YGMarkerLayoutData; - -typedef struct { - bool _unused; -} YGMarkerNoData; - -typedef union { - YGMarkerLayoutData* layout; - YGMarkerNoData* noData; -} YGMarkerData; - -typedef struct { - // accepts marker type, a node ref, and marker data (depends on marker type) - // can return a handle or id that Yoga will pass to endMarker - void* (*startMarker)(YGMarker, YGNodeRef, YGMarkerData); - // accepts marker type, a node ref, marker data, and marker id as returned by - // startMarker - void (*endMarker)(YGMarker, YGNodeRef, YGMarkerData, void* id); -} YGMarkerCallbacks; - -void YGConfigSetMarkerCallbacks(YGConfigRef, YGMarkerCallbacks); - -YG_EXTERN_C_END - -#ifdef __cplusplus - -namespace facebook { -namespace yoga { -namespace marker { -namespace detail { - -template -struct MarkerData; - -template <> -struct MarkerData { - using type = YGMarkerLayoutData; - static type*& get(YGMarkerData& d) { - return d.layout; - } -}; - -struct NoMarkerData { - using type = YGMarkerNoData; - static type*& get(YGMarkerData& d) { - return d.noData; - } -}; - -template <> -struct MarkerData : NoMarkerData {}; - -template <> -struct MarkerData : NoMarkerData {}; - -} // namespace detail - -template -typename detail::MarkerData::type* data(YGMarkerData d) { - return detail::MarkerData::get(d); -} - -} // namespace marker -} // namespace yoga -} // namespace facebook - -#endif // __cplusplus diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGNode.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGNode.cpp deleted file mode 100644 index 0b7fc3c7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGNode.cpp +++ /dev/null @@ -1,559 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#include "YGNode.h" -#include -#include "CompactValue.h" -#include "Utils.h" - -using namespace facebook; -using facebook::yoga::detail::CompactValue; - -YGFloatOptional YGNode::getLeadingPosition( - const YGFlexDirection axis, - const float axisSize) const { - if (YGFlexDirectionIsRow(axis)) { - auto leadingPosition = YGComputedEdgeValue( - style_.position, YGEdgeStart, CompactValue::ofUndefined()); - if (!leadingPosition.isUndefined()) { - return YGResolveValue(leadingPosition, axisSize); - } - } - - auto leadingPosition = YGComputedEdgeValue( - style_.position, leading[axis], CompactValue::ofUndefined()); - - return leadingPosition.isUndefined() - ? YGFloatOptional{0} - : YGResolveValue(leadingPosition, axisSize); -} - -YGFloatOptional YGNode::getTrailingPosition( - const YGFlexDirection axis, - const float axisSize) const { - if (YGFlexDirectionIsRow(axis)) { - auto trailingPosition = YGComputedEdgeValue( - style_.position, YGEdgeEnd, CompactValue::ofUndefined()); - if (!trailingPosition.isUndefined()) { - return YGResolveValue(trailingPosition, axisSize); - } - } - - auto trailingPosition = YGComputedEdgeValue( - style_.position, trailing[axis], CompactValue::ofUndefined()); - - return trailingPosition.isUndefined() - ? YGFloatOptional{0} - : YGResolveValue(trailingPosition, axisSize); -} - -bool YGNode::isLeadingPositionDefined(const YGFlexDirection axis) const { - return (YGFlexDirectionIsRow(axis) && - !YGComputedEdgeValue( - style_.position, YGEdgeStart, CompactValue::ofUndefined()) - .isUndefined()) || - !YGComputedEdgeValue( - style_.position, leading[axis], CompactValue::ofUndefined()) - .isUndefined(); -} - -bool YGNode::isTrailingPosDefined(const YGFlexDirection axis) const { - return (YGFlexDirectionIsRow(axis) && - !YGComputedEdgeValue( - style_.position, YGEdgeEnd, CompactValue::ofUndefined()) - .isUndefined()) || - !YGComputedEdgeValue( - style_.position, trailing[axis], CompactValue::ofUndefined()) - .isUndefined(); -} - -YGFloatOptional YGNode::getLeadingMargin( - const YGFlexDirection axis, - const float widthSize) const { - if (YGFlexDirectionIsRow(axis) && !style_.margin[YGEdgeStart].isUndefined()) { - return YGResolveValueMargin(style_.margin[YGEdgeStart], widthSize); - } - - return YGResolveValueMargin( - YGComputedEdgeValue(style_.margin, leading[axis], CompactValue::ofZero()), - widthSize); -} - -YGFloatOptional YGNode::getTrailingMargin( - const YGFlexDirection axis, - const float widthSize) const { - if (YGFlexDirectionIsRow(axis) && !style_.margin[YGEdgeEnd].isUndefined()) { - return YGResolveValueMargin(style_.margin[YGEdgeEnd], widthSize); - } - - return YGResolveValueMargin( - YGComputedEdgeValue( - style_.margin, trailing[axis], CompactValue::ofZero()), - widthSize); -} - -YGFloatOptional YGNode::getMarginForAxis( - const YGFlexDirection axis, - const float widthSize) const { - return getLeadingMargin(axis, widthSize) + getTrailingMargin(axis, widthSize); -} - -// Setters - -void YGNode::setMeasureFunc(YGMeasureFunc measureFunc) { - if (measureFunc == nullptr) { - measure_ = nullptr; - // TODO: t18095186 Move nodeType to opt-in function and mark appropriate - // places in Litho - nodeType_ = YGNodeTypeDefault; - } else { - YGAssertWithNode( - this, - children_.size() == 0, - "Cannot set measure function: Nodes with measure functions cannot have " - "children."); - measure_ = measureFunc; - // TODO: t18095186 Move nodeType to opt-in function and mark appropriate - // places in Litho - setNodeType(YGNodeTypeText); - } - - measure_ = measureFunc; -} - -void YGNode::replaceChild(YGNodeRef child, uint32_t index) { - children_[index] = child; -} - -void YGNode::replaceChild(YGNodeRef oldChild, YGNodeRef newChild) { - std::replace(children_.begin(), children_.end(), oldChild, newChild); -} - -void YGNode::insertChild(YGNodeRef child, uint32_t index) { - children_.insert(children_.begin() + index, child); -} - -void YGNode::setDirty(bool isDirty) { - if (isDirty == isDirty_) { - return; - } - isDirty_ = isDirty; - if (isDirty && dirtied_) { - dirtied_(this); - } -} - -bool YGNode::removeChild(YGNodeRef child) { - std::vector::iterator p = - std::find(children_.begin(), children_.end(), child); - if (p != children_.end()) { - children_.erase(p); - return true; - } - return false; -} - -void YGNode::removeChild(uint32_t index) { - children_.erase(children_.begin() + index); -} - -void YGNode::setLayoutDirection(YGDirection direction) { - layout_.direction = direction; -} - -void YGNode::setLayoutMargin(float margin, int index) { - layout_.margin[index] = margin; -} - -void YGNode::setLayoutBorder(float border, int index) { - layout_.border[index] = border; -} - -void YGNode::setLayoutPadding(float padding, int index) { - layout_.padding[index] = padding; -} - -void YGNode::setLayoutLastOwnerDirection(YGDirection direction) { - layout_.lastOwnerDirection = direction; -} - -void YGNode::setLayoutComputedFlexBasis( - const YGFloatOptional computedFlexBasis) { - layout_.computedFlexBasis = computedFlexBasis; -} - -void YGNode::setLayoutPosition(float position, int index) { - layout_.position[index] = position; -} - -void YGNode::setLayoutComputedFlexBasisGeneration( - uint32_t computedFlexBasisGeneration) { - layout_.computedFlexBasisGeneration = computedFlexBasisGeneration; -} - -void YGNode::setLayoutMeasuredDimension(float measuredDimension, int index) { - layout_.measuredDimensions[index] = measuredDimension; -} - -void YGNode::setLayoutHadOverflow(bool hadOverflow) { - layout_.hadOverflow = hadOverflow; -} - -void YGNode::setLayoutDimension(float dimension, int index) { - layout_.dimensions[index] = dimension; -} - -// If both left and right are defined, then use left. Otherwise return +left or -// -right depending on which is defined. -YGFloatOptional YGNode::relativePosition( - const YGFlexDirection axis, - const float axisSize) const { - if (isLeadingPositionDefined(axis)) { - return getLeadingPosition(axis, axisSize); - } - - YGFloatOptional trailingPosition = getTrailingPosition(axis, axisSize); - if (!trailingPosition.isUndefined()) { - trailingPosition = YGFloatOptional{-1 * trailingPosition.unwrap()}; - } - return trailingPosition; -} - -void YGNode::setPosition( - const YGDirection direction, - const float mainSize, - const float crossSize, - const float ownerWidth) { - /* Root nodes should be always layouted as LTR, so we don't return negative - * values. */ - const YGDirection directionRespectingRoot = - owner_ != nullptr ? direction : YGDirectionLTR; - const YGFlexDirection mainAxis = - YGResolveFlexDirection(style_.flexDirection, directionRespectingRoot); - const YGFlexDirection crossAxis = - YGFlexDirectionCross(mainAxis, directionRespectingRoot); - - const YGFloatOptional relativePositionMain = - relativePosition(mainAxis, mainSize); - const YGFloatOptional relativePositionCross = - relativePosition(crossAxis, crossSize); - - setLayoutPosition( - (getLeadingMargin(mainAxis, ownerWidth) + relativePositionMain).unwrap(), - leading[mainAxis]); - setLayoutPosition( - (getTrailingMargin(mainAxis, ownerWidth) + relativePositionMain).unwrap(), - trailing[mainAxis]); - setLayoutPosition( - (getLeadingMargin(crossAxis, ownerWidth) + relativePositionCross) - .unwrap(), - leading[crossAxis]); - setLayoutPosition( - (getTrailingMargin(crossAxis, ownerWidth) + relativePositionCross) - .unwrap(), - trailing[crossAxis]); -} - -YGNode& YGNode::operator=(const YGNode& node) { - if (&node == this) { - return *this; - } - - for (auto child : children_) { - delete child; - } - - context_ = node.getContext(); - print_ = node.getPrintFunc(); - hasNewLayout_ = node.getHasNewLayout(); - nodeType_ = node.getNodeType(); - measure_ = node.getMeasure(); - baseline_ = node.getBaseline(); - dirtied_ = node.getDirtied(); - style_ = node.style_; - layout_ = node.layout_; - lineIndex_ = node.getLineIndex(); - owner_ = node.getOwner(); - children_ = node.getChildren(); - config_ = node.getConfig(); - isDirty_ = node.isDirty(); - resolvedDimensions_ = node.getResolvedDimensions(); - - return *this; -} - -YGValue YGNode::marginLeadingValue(const YGFlexDirection axis) const { - if (YGFlexDirectionIsRow(axis) && !style_.margin[YGEdgeStart].isUndefined()) { - return style_.margin[YGEdgeStart]; - } else { - return style_.margin[leading[axis]]; - } -} - -YGValue YGNode::marginTrailingValue(const YGFlexDirection axis) const { - if (YGFlexDirectionIsRow(axis) && !style_.margin[YGEdgeEnd].isUndefined()) { - return style_.margin[YGEdgeEnd]; - } else { - return style_.margin[trailing[axis]]; - } -} - -YGValue YGNode::resolveFlexBasisPtr() const { - YGValue flexBasis = style_.flexBasis; - if (flexBasis.unit != YGUnitAuto && flexBasis.unit != YGUnitUndefined) { - return flexBasis; - } - if (!style_.flex.isUndefined() && style_.flex.unwrap() > 0.0f) { - return config_->useWebDefaults ? YGValueAuto : YGValueZero; - } - return YGValueAuto; -} - -void YGNode::resolveDimension() { - using namespace yoga; - for (int dim = YGDimensionWidth; dim < enums::count(); dim++) { - if (!getStyle().maxDimensions[dim].isUndefined() && - YGValueEqual( - getStyle().maxDimensions[dim], style_.minDimensions[dim])) { - resolvedDimensions_[dim] = style_.maxDimensions[dim]; - } else { - resolvedDimensions_[dim] = style_.dimensions[dim]; - } - } -} - -YGDirection YGNode::resolveDirection(const YGDirection ownerDirection) { - if (style_.direction == YGDirectionInherit) { - return ownerDirection > YGDirectionInherit ? ownerDirection - : YGDirectionLTR; - } else { - return style_.direction; - } -} - -void YGNode::clearChildren() { - children_.clear(); - children_.shrink_to_fit(); -} - -// Other Methods - -void YGNode::cloneChildrenIfNeeded() { - // YGNodeRemoveChild in yoga.cpp has a forked variant of this algorithm - // optimized for deletions. - - const uint32_t childCount = static_cast(children_.size()); - if (childCount == 0) { - // This is an empty set. Nothing to clone. - return; - } - - const YGNodeRef firstChild = children_.front(); - if (firstChild->getOwner() == this) { - // If the first child has this node as its owner, we assume that it is - // already unique. We can do this because if we have it has a child, that - // means that its owner was at some point cloned which made that subtree - // immutable. We also assume that all its sibling are cloned as well. - return; - } - - const YGCloneNodeFunc cloneNodeCallback = config_->cloneNodeCallback; - for (uint32_t i = 0; i < childCount; ++i) { - const YGNodeRef oldChild = children_[i]; - YGNodeRef newChild = nullptr; - if (cloneNodeCallback) { - newChild = cloneNodeCallback(oldChild, this, i); - } - if (newChild == nullptr) { - newChild = YGNodeClone(oldChild); - } - replaceChild(newChild, i); - newChild->setOwner(this); - } -} - -void YGNode::markDirtyAndPropogate() { - if (!isDirty_) { - setDirty(true); - setLayoutComputedFlexBasis(YGFloatOptional()); - if (owner_) { - owner_->markDirtyAndPropogate(); - } - } -} - -void YGNode::markDirtyAndPropogateDownwards() { - isDirty_ = true; - for_each(children_.begin(), children_.end(), [](YGNodeRef childNode) { - childNode->markDirtyAndPropogateDownwards(); - }); -} - -float YGNode::resolveFlexGrow() { - // Root nodes flexGrow should always be 0 - if (owner_ == nullptr) { - return 0.0; - } - if (!style_.flexGrow.isUndefined()) { - return style_.flexGrow.unwrap(); - } - if (!style_.flex.isUndefined() && style_.flex.unwrap() > 0.0f) { - return style_.flex.unwrap(); - } - return kDefaultFlexGrow; -} - -float YGNode::resolveFlexShrink() { - if (owner_ == nullptr) { - return 0.0; - } - if (!style_.flexShrink.isUndefined()) { - return style_.flexShrink.unwrap(); - } - if (!config_->useWebDefaults && !style_.flex.isUndefined() && - style_.flex.unwrap() < 0.0f) { - return -style_.flex.unwrap(); - } - return config_->useWebDefaults ? kWebDefaultFlexShrink : kDefaultFlexShrink; -} - -bool YGNode::isNodeFlexible() { - return ( - (style_.positionType == YGPositionTypeRelative) && - (resolveFlexGrow() != 0 || resolveFlexShrink() != 0)); -} - -float YGNode::getLeadingBorder(const YGFlexDirection axis) const { - YGValue leadingBorder; - if (YGFlexDirectionIsRow(axis) && !style_.border[YGEdgeStart].isUndefined()) { - leadingBorder = style_.border[YGEdgeStart]; - if (leadingBorder.value >= 0) { - return leadingBorder.value; - } - } - - leadingBorder = - YGComputedEdgeValue(style_.border, leading[axis], CompactValue::ofZero()); - return YGFloatMax(leadingBorder.value, 0.0f); -} - -float YGNode::getTrailingBorder(const YGFlexDirection flexDirection) const { - YGValue trailingBorder; - if (YGFlexDirectionIsRow(flexDirection) && - !style_.border[YGEdgeEnd].isUndefined()) { - trailingBorder = style_.border[YGEdgeEnd]; - if (trailingBorder.value >= 0.0f) { - return trailingBorder.value; - } - } - - trailingBorder = YGComputedEdgeValue( - style_.border, trailing[flexDirection], CompactValue::ofZero()); - return YGFloatMax(trailingBorder.value, 0.0f); -} - -YGFloatOptional YGNode::getLeadingPadding( - const YGFlexDirection axis, - const float widthSize) const { - const YGFloatOptional paddingEdgeStart = - YGResolveValue(style_.padding[YGEdgeStart], widthSize); - if (YGFlexDirectionIsRow(axis) && - !style_.padding[YGEdgeStart].isUndefined() && - !paddingEdgeStart.isUndefined() && paddingEdgeStart.unwrap() >= 0.0f) { - return paddingEdgeStart; - } - - YGFloatOptional resolvedValue = YGResolveValue( - YGComputedEdgeValue( - style_.padding, leading[axis], CompactValue::ofZero()), - widthSize); - return YGFloatOptionalMax(resolvedValue, YGFloatOptional(0.0f)); -} - -YGFloatOptional YGNode::getTrailingPadding( - const YGFlexDirection axis, - const float widthSize) const { - const YGFloatOptional paddingEdgeEnd = - YGResolveValue(style_.padding[YGEdgeEnd], widthSize); - if (YGFlexDirectionIsRow(axis) && paddingEdgeEnd >= YGFloatOptional{0.0f}) { - return paddingEdgeEnd; - } - - YGFloatOptional resolvedValue = YGResolveValue( - YGComputedEdgeValue( - style_.padding, trailing[axis], CompactValue::ofZero()), - widthSize); - - return YGFloatOptionalMax(resolvedValue, YGFloatOptional(0.0f)); -} - -YGFloatOptional YGNode::getLeadingPaddingAndBorder( - const YGFlexDirection axis, - const float widthSize) const { - return getLeadingPadding(axis, widthSize) + - YGFloatOptional(getLeadingBorder(axis)); -} - -YGFloatOptional YGNode::getTrailingPaddingAndBorder( - const YGFlexDirection axis, - const float widthSize) const { - return getTrailingPadding(axis, widthSize) + - YGFloatOptional(getTrailingBorder(axis)); -} - -bool YGNode::didUseLegacyFlag() { - bool didUseLegacyFlag = layout_.didUseLegacyFlag; - if (didUseLegacyFlag) { - return true; - } - for (const auto& child : children_) { - if (child->layout_.didUseLegacyFlag) { - didUseLegacyFlag = true; - break; - } - } - return didUseLegacyFlag; -} - -void YGNode::setAndPropogateUseLegacyFlag(bool useLegacyFlag) { - config_->useLegacyStretchBehaviour = useLegacyFlag; - for_each(children_.begin(), children_.end(), [=](YGNodeRef childNode) { - childNode->getConfig()->useLegacyStretchBehaviour = useLegacyFlag; - }); -} - -void YGNode::setLayoutDoesLegacyFlagAffectsLayout( - bool doesLegacyFlagAffectsLayout) { - layout_.doesLegacyStretchFlagAffectsLayout = doesLegacyFlagAffectsLayout; -} - -void YGNode::setLayoutDidUseLegacyFlag(bool didUseLegacyFlag) { - layout_.didUseLegacyFlag = didUseLegacyFlag; -} - -bool YGNode::isLayoutTreeEqualToNode(const YGNode& node) const { - if (children_.size() != node.children_.size()) { - return false; - } - if (layout_ != node.layout_) { - return false; - } - if (children_.size() == 0) { - return true; - } - - bool isLayoutTreeEqual = true; - YGNodeRef otherNodeChildren = nullptr; - for (std::vector::size_type i = 0; i < children_.size(); ++i) { - otherNodeChildren = node.children_[i]; - isLayoutTreeEqual = - children_[i]->isLayoutTreeEqualToNode(*otherNodeChildren); - if (!isLayoutTreeEqual) { - return false; - } - } - return isLayoutTreeEqual; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGNode.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGNode.h deleted file mode 100644 index ffb01832..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGNode.h +++ /dev/null @@ -1,284 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#pragma once -#include -#include "YGConfig.h" -#include "YGLayout.h" -#include "YGStyle.h" -#include "Yoga-internal.h" - -struct YGNode { -private: - void* context_ = nullptr; - YGPrintFunc print_ = nullptr; - bool hasNewLayout_ : 1; - bool isReferenceBaseline_ : 1; - bool isDirty_ : 1; - YGNodeType nodeType_ : 1; - YGMeasureFunc measure_ = nullptr; - YGBaselineFunc baseline_ = nullptr; - YGDirtiedFunc dirtied_ = nullptr; - YGStyle style_ = {}; - YGLayout layout_ = {}; - uint32_t lineIndex_ = 0; - YGNodeRef owner_ = nullptr; - YGVector children_ = {}; - YGConfigRef config_ = nullptr; - std::array resolvedDimensions_ = { - {YGValueUndefined, YGValueUndefined}}; - - YGFloatOptional relativePosition( - const YGFlexDirection axis, - const float axisSize) const; - -public: - YGNode() - : hasNewLayout_(true), - isReferenceBaseline_(false), - isDirty_(false), - nodeType_(YGNodeTypeDefault) {} - ~YGNode() = default; // cleanup of owner/children relationships in YGNodeFree - explicit YGNode(const YGConfigRef newConfig) : config_(newConfig){}; - YGNode(const YGNode& node) = default; - YGNode& operator=(const YGNode& node); - - // Getters - void* getContext() const { - return context_; - } - - YGPrintFunc getPrintFunc() const { - return print_; - } - - bool getHasNewLayout() const { - return hasNewLayout_; - } - - YGNodeType getNodeType() const { - return nodeType_; - } - - YGMeasureFunc getMeasure() const { - return measure_; - } - - YGBaselineFunc getBaseline() const { - return baseline_; - } - - YGDirtiedFunc getDirtied() const { - return dirtied_; - } - - // For Performance reasons passing as reference. - YGStyle& getStyle() { - return style_; - } - - const YGStyle& getStyle() const { - return style_; - } - - // For Performance reasons passing as reference. - YGLayout& getLayout() { - return layout_; - } - - const YGLayout& getLayout() const { - return layout_; - } - - uint32_t getLineIndex() const { - return lineIndex_; - } - - bool isReferenceBaseline() { - return isReferenceBaseline_; - } - - // returns the YGNodeRef that owns this YGNode. An owner is used to identify - // the YogaTree that a YGNode belongs to. This method will return the parent - // of the YGNode when a YGNode only belongs to one YogaTree or nullptr when - // the YGNode is shared between two or more YogaTrees. - YGNodeRef getOwner() const { - return owner_; - } - - // Deprecated, use getOwner() instead. - YGNodeRef getParent() const { - return getOwner(); - } - - const YGVector& getChildren() const { - return children_; - } - - YGNodeRef getChild(uint32_t index) const { - return children_.at(index); - } - - YGConfigRef getConfig() const { - return config_; - } - - bool isDirty() const { - return isDirty_; - } - - std::array getResolvedDimensions() const { - return resolvedDimensions_; - } - - YGValue getResolvedDimension(int index) const { - return resolvedDimensions_[index]; - } - - // Methods related to positions, margin, padding and border - YGFloatOptional getLeadingPosition( - const YGFlexDirection axis, - const float axisSize) const; - bool isLeadingPositionDefined(const YGFlexDirection axis) const; - bool isTrailingPosDefined(const YGFlexDirection axis) const; - YGFloatOptional getTrailingPosition( - const YGFlexDirection axis, - const float axisSize) const; - YGFloatOptional getLeadingMargin( - const YGFlexDirection axis, - const float widthSize) const; - YGFloatOptional getTrailingMargin( - const YGFlexDirection axis, - const float widthSize) const; - float getLeadingBorder(const YGFlexDirection flexDirection) const; - float getTrailingBorder(const YGFlexDirection flexDirection) const; - YGFloatOptional getLeadingPadding( - const YGFlexDirection axis, - const float widthSize) const; - YGFloatOptional getTrailingPadding( - const YGFlexDirection axis, - const float widthSize) const; - YGFloatOptional getLeadingPaddingAndBorder( - const YGFlexDirection axis, - const float widthSize) const; - YGFloatOptional getTrailingPaddingAndBorder( - const YGFlexDirection axis, - const float widthSize) const; - YGFloatOptional getMarginForAxis( - const YGFlexDirection axis, - const float widthSize) const; - // Setters - - void setContext(void* context) { - context_ = context; - } - - void setPrintFunc(YGPrintFunc printFunc) { - print_ = printFunc; - } - - void setHasNewLayout(bool hasNewLayout) { - hasNewLayout_ = hasNewLayout; - } - - void setNodeType(YGNodeType nodeType) { - nodeType_ = nodeType; - } - - void setStyleFlexDirection(YGFlexDirection direction) { - style_.flexDirection = direction; - } - - void setStyleAlignContent(YGAlign alignContent) { - style_.alignContent = alignContent; - } - - void setMeasureFunc(YGMeasureFunc measureFunc); - - void setBaseLineFunc(YGBaselineFunc baseLineFunc) { - baseline_ = baseLineFunc; - } - - void setDirtiedFunc(YGDirtiedFunc dirtiedFunc) { - dirtied_ = dirtiedFunc; - } - - void setStyle(const YGStyle& style) { - style_ = style; - } - - void setLayout(const YGLayout& layout) { - layout_ = layout; - } - - void setLineIndex(uint32_t lineIndex) { - lineIndex_ = lineIndex; - } - - void setIsReferenceBaseline(bool isReferenceBaseline) { - isReferenceBaseline_ = isReferenceBaseline; - } - - void setOwner(YGNodeRef owner) { - owner_ = owner; - } - - void setChildren(const YGVector& children) { - children_ = children; - } - - // TODO: rvalue override for setChildren - - void setConfig(YGConfigRef config) { - config_ = config; - } - - void setDirty(bool isDirty); - void setLayoutLastOwnerDirection(YGDirection direction); - void setLayoutComputedFlexBasis(const YGFloatOptional computedFlexBasis); - void setLayoutComputedFlexBasisGeneration( - uint32_t computedFlexBasisGeneration); - void setLayoutMeasuredDimension(float measuredDimension, int index); - void setLayoutHadOverflow(bool hadOverflow); - void setLayoutDimension(float dimension, int index); - void setLayoutDirection(YGDirection direction); - void setLayoutMargin(float margin, int index); - void setLayoutBorder(float border, int index); - void setLayoutPadding(float padding, int index); - void setLayoutPosition(float position, int index); - void setPosition( - const YGDirection direction, - const float mainSize, - const float crossSize, - const float ownerWidth); - void setAndPropogateUseLegacyFlag(bool useLegacyFlag); - void setLayoutDoesLegacyFlagAffectsLayout(bool doesLegacyFlagAffectsLayout); - void setLayoutDidUseLegacyFlag(bool didUseLegacyFlag); - void markDirtyAndPropogateDownwards(); - - // Other methods - YGValue marginLeadingValue(const YGFlexDirection axis) const; - YGValue marginTrailingValue(const YGFlexDirection axis) const; - YGValue resolveFlexBasisPtr() const; - void resolveDimension(); - YGDirection resolveDirection(const YGDirection ownerDirection); - void clearChildren(); - /// Replaces the occurrences of oldChild with newChild - void replaceChild(YGNodeRef oldChild, YGNodeRef newChild); - void replaceChild(YGNodeRef child, uint32_t index); - void insertChild(YGNodeRef child, uint32_t index); - /// Removes the first occurrence of child - bool removeChild(YGNodeRef child); - void removeChild(uint32_t index); - - void cloneChildrenIfNeeded(); - void markDirtyAndPropogate(); - float resolveFlexGrow(); - float resolveFlexShrink(); - bool isNodeFlexible(); - bool didUseLegacyFlag(); - bool isLayoutTreeEqualToNode(const YGNode& node) const; -}; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGNodePrint.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGNodePrint.cpp deleted file mode 100644 index 4e02deee..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGNodePrint.cpp +++ /dev/null @@ -1,235 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#include "YGNodePrint.h" -#include -#include "YGEnums.h" -#include "YGNode.h" -#include "Yoga-internal.h" - -namespace facebook { -namespace yoga { -typedef std::string string; - -static void indent(string& base, uint32_t level) { - for (uint32_t i = 0; i < level; ++i) { - base.append(" "); - } -} - -static bool areFourValuesEqual(const YGStyle::Edges& four) { - return YGValueEqual(four[0], four[1]) && YGValueEqual(four[0], four[2]) && - YGValueEqual(four[0], four[3]); -} - -static void appendFormatedString(string& str, const char* fmt, ...) { - va_list args; - va_start(args, fmt); - va_list argsCopy; - va_copy(argsCopy, args); - std::vector buf(1 + vsnprintf(NULL, 0, fmt, args)); - va_end(args); - vsnprintf(buf.data(), buf.size(), fmt, argsCopy); - va_end(argsCopy); - string result = string(buf.begin(), buf.end() - 1); - str.append(result); -} - -static void appendFloatOptionalIfDefined( - string& base, - const string key, - const YGFloatOptional num) { - if (!num.isUndefined()) { - appendFormatedString(base, "%s: %g; ", key.c_str(), num.unwrap()); - } -} - -static void appendNumberIfNotUndefined( - string& base, - const string key, - const YGValue number) { - if (number.unit != YGUnitUndefined) { - if (number.unit == YGUnitAuto) { - base.append(key + ": auto; "); - } else { - string unit = number.unit == YGUnitPoint ? "px" : "%%"; - appendFormatedString( - base, "%s: %g%s; ", key.c_str(), number.value, unit.c_str()); - } - } -} - -static void appendNumberIfNotAuto( - string& base, - const string& key, - const YGValue number) { - if (number.unit != YGUnitAuto) { - appendNumberIfNotUndefined(base, key, number); - } -} - -static void appendNumberIfNotZero( - string& base, - const string& str, - const YGValue number) { - if (number.unit == YGUnitAuto) { - base.append(str + ": auto; "); - } else if (!YGFloatsEqual(number.value, 0)) { - appendNumberIfNotUndefined(base, str, number); - } -} - -static void appendEdges( - string& base, - const string& key, - const YGStyle::Edges& edges) { - if (areFourValuesEqual(edges)) { - appendNumberIfNotZero(base, key, edges[YGEdgeLeft]); - } else { - for (int edge = YGEdgeLeft; edge != YGEdgeAll; ++edge) { - string str = key + "-" + YGEdgeToString(static_cast(edge)); - appendNumberIfNotZero(base, str, edges[edge]); - } - } -} - -static void appendEdgeIfNotUndefined( - string& base, - const string& str, - const YGStyle::Edges& edges, - const YGEdge edge) { - appendNumberIfNotUndefined( - base, - str, - YGComputedEdgeValue(edges, edge, detail::CompactValue::ofUndefined())); -} - -void YGNodeToString( - std::string& str, - YGNodeRef node, - YGPrintOptions options, - uint32_t level) { - indent(str, level); - appendFormatedString(str, "
getPrintFunc() != nullptr) { - node->getPrintFunc()(node); - } - - if (options & YGPrintOptionsLayout) { - appendFormatedString(str, "layout=\""); - appendFormatedString( - str, "width: %g; ", node->getLayout().dimensions[YGDimensionWidth]); - appendFormatedString( - str, "height: %g; ", node->getLayout().dimensions[YGDimensionHeight]); - appendFormatedString( - str, "top: %g; ", node->getLayout().position[YGEdgeTop]); - appendFormatedString( - str, "left: %g;", node->getLayout().position[YGEdgeLeft]); - appendFormatedString(str, "\" "); - } - - if (options & YGPrintOptionsStyle) { - appendFormatedString(str, "style=\""); - if (node->getStyle().flexDirection != YGNode().getStyle().flexDirection) { - appendFormatedString( - str, - "flex-direction: %s; ", - YGFlexDirectionToString(node->getStyle().flexDirection)); - } - if (node->getStyle().justifyContent != YGNode().getStyle().justifyContent) { - appendFormatedString( - str, - "justify-content: %s; ", - YGJustifyToString(node->getStyle().justifyContent)); - } - if (node->getStyle().alignItems != YGNode().getStyle().alignItems) { - appendFormatedString( - str, - "align-items: %s; ", - YGAlignToString(node->getStyle().alignItems)); - } - if (node->getStyle().alignContent != YGNode().getStyle().alignContent) { - appendFormatedString( - str, - "align-content: %s; ", - YGAlignToString(node->getStyle().alignContent)); - } - if (node->getStyle().alignSelf != YGNode().getStyle().alignSelf) { - appendFormatedString( - str, "align-self: %s; ", YGAlignToString(node->getStyle().alignSelf)); - } - appendFloatOptionalIfDefined(str, "flex-grow", node->getStyle().flexGrow); - appendFloatOptionalIfDefined( - str, "flex-shrink", node->getStyle().flexShrink); - appendNumberIfNotAuto(str, "flex-basis", node->getStyle().flexBasis); - appendFloatOptionalIfDefined(str, "flex", node->getStyle().flex); - - if (node->getStyle().flexWrap != YGNode().getStyle().flexWrap) { - appendFormatedString( - str, "flexWrap: %s; ", YGWrapToString(node->getStyle().flexWrap)); - } - - if (node->getStyle().overflow != YGNode().getStyle().overflow) { - appendFormatedString( - str, "overflow: %s; ", YGOverflowToString(node->getStyle().overflow)); - } - - if (node->getStyle().display != YGNode().getStyle().display) { - appendFormatedString( - str, "display: %s; ", YGDisplayToString(node->getStyle().display)); - } - appendEdges(str, "margin", node->getStyle().margin); - appendEdges(str, "padding", node->getStyle().padding); - appendEdges(str, "border", node->getStyle().border); - - appendNumberIfNotAuto( - str, "width", node->getStyle().dimensions[YGDimensionWidth]); - appendNumberIfNotAuto( - str, "height", node->getStyle().dimensions[YGDimensionHeight]); - appendNumberIfNotAuto( - str, "max-width", node->getStyle().maxDimensions[YGDimensionWidth]); - appendNumberIfNotAuto( - str, "max-height", node->getStyle().maxDimensions[YGDimensionHeight]); - appendNumberIfNotAuto( - str, "min-width", node->getStyle().minDimensions[YGDimensionWidth]); - appendNumberIfNotAuto( - str, "min-height", node->getStyle().minDimensions[YGDimensionHeight]); - - if (node->getStyle().positionType != YGNode().getStyle().positionType) { - appendFormatedString( - str, - "position: %s; ", - YGPositionTypeToString(node->getStyle().positionType)); - } - - appendEdgeIfNotUndefined( - str, "left", node->getStyle().position, YGEdgeLeft); - appendEdgeIfNotUndefined( - str, "right", node->getStyle().position, YGEdgeRight); - appendEdgeIfNotUndefined(str, "top", node->getStyle().position, YGEdgeTop); - appendEdgeIfNotUndefined( - str, "bottom", node->getStyle().position, YGEdgeBottom); - appendFormatedString(str, "\" "); - - if (node->getMeasure() != nullptr) { - appendFormatedString(str, "has-custom-measure=\"true\""); - } - } - appendFormatedString(str, ">"); - - const uint32_t childCount = static_cast(node->getChildren().size()); - if (options & YGPrintOptionsChildren && childCount > 0) { - for (uint32_t i = 0; i < childCount; i++) { - appendFormatedString(str, "\n"); - YGNodeToString(str, YGNodeGetChild(node, i), options, level + 1); - } - appendFormatedString(str, "\n"); - indent(str, level); - } - appendFormatedString(str, "
"); -} -} // namespace yoga -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGNodePrint.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGNodePrint.h deleted file mode 100644 index 9615bf8e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGNodePrint.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#pragma once -#include - -#include "Yoga.h" - -namespace facebook { -namespace yoga { - -void YGNodeToString( - std::string& str, - YGNodeRef node, - YGPrintOptions options, - uint32_t level); - -} // namespace yoga -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGStyle.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGStyle.cpp deleted file mode 100644 index d9956363..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGStyle.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#include "YGStyle.h" - -// Yoga specific properties, not compatible with flexbox specification -bool operator==(const YGStyle& lhs, const YGStyle& rhs) { - bool areNonFloatValuesEqual = lhs.direction == rhs.direction && - lhs.flexDirection == rhs.flexDirection && - lhs.justifyContent == rhs.justifyContent && - lhs.alignContent == rhs.alignContent && - lhs.alignItems == rhs.alignItems && lhs.alignSelf == rhs.alignSelf && - lhs.positionType == rhs.positionType && lhs.flexWrap == rhs.flexWrap && - lhs.overflow == rhs.overflow && lhs.display == rhs.display && - YGValueEqual(lhs.flexBasis, rhs.flexBasis) && lhs.margin == rhs.margin && - lhs.position == rhs.position && lhs.padding == rhs.padding && - lhs.border == rhs.border && lhs.dimensions == rhs.dimensions && - lhs.minDimensions == rhs.minDimensions && - lhs.maxDimensions == rhs.maxDimensions; - - areNonFloatValuesEqual = areNonFloatValuesEqual && - lhs.flex.isUndefined() == rhs.flex.isUndefined(); - if (areNonFloatValuesEqual && !lhs.flex.isUndefined() && - !rhs.flex.isUndefined()) { - areNonFloatValuesEqual = areNonFloatValuesEqual && lhs.flex == rhs.flex; - } - - areNonFloatValuesEqual = areNonFloatValuesEqual && - lhs.flexGrow.isUndefined() == rhs.flexGrow.isUndefined(); - if (areNonFloatValuesEqual && !lhs.flexGrow.isUndefined()) { - areNonFloatValuesEqual = - areNonFloatValuesEqual && lhs.flexGrow == rhs.flexGrow; - } - - areNonFloatValuesEqual = areNonFloatValuesEqual && - lhs.flexShrink.isUndefined() == rhs.flexShrink.isUndefined(); - if (areNonFloatValuesEqual && !rhs.flexShrink.isUndefined()) { - areNonFloatValuesEqual = - areNonFloatValuesEqual && lhs.flexShrink == rhs.flexShrink; - } - - if (!(lhs.aspectRatio.isUndefined() && rhs.aspectRatio.isUndefined())) { - areNonFloatValuesEqual = - areNonFloatValuesEqual && lhs.aspectRatio == rhs.aspectRatio; - } - - return areNonFloatValuesEqual; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGStyle.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGStyle.h deleted file mode 100644 index 7e93502a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGStyle.h +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#pragma once -#include -#include -#include -#include "CompactValue.h" -#include "YGEnums.h" -#include "YGFloatOptional.h" -#include "Yoga-internal.h" -#include "Yoga.h" - -#if !defined(ENUM_BITFIELDS_NOT_SUPPORTED) -#define BITFIELD_ENUM_SIZED(num) : num -#else -#define BITFIELD_ENUM_SIZED(num) -#endif - -struct YGStyle { -private: - using CompactValue = facebook::yoga::detail::CompactValue; - -public: - using Dimensions = facebook::yoga::detail::Values<2>; - using Edges = - facebook::yoga::detail::Values()>; - - /* Some platforms don't support enum bitfields, - so please use BITFIELD_ENUM_SIZED(BITS_COUNT) */ - YGDirection direction BITFIELD_ENUM_SIZED(2); - YGFlexDirection flexDirection BITFIELD_ENUM_SIZED(2); - YGJustify justifyContent BITFIELD_ENUM_SIZED(3); - YGAlign alignContent BITFIELD_ENUM_SIZED(3); - YGAlign alignItems BITFIELD_ENUM_SIZED(3); - YGAlign alignSelf BITFIELD_ENUM_SIZED(3); - YGPositionType positionType BITFIELD_ENUM_SIZED(1); - YGWrap flexWrap BITFIELD_ENUM_SIZED(2); - YGOverflow overflow BITFIELD_ENUM_SIZED(2); - YGDisplay display BITFIELD_ENUM_SIZED(1); - YGFloatOptional flex = {}; - YGFloatOptional flexGrow = {}; - YGFloatOptional flexShrink = {}; - CompactValue flexBasis = CompactValue::ofAuto(); - Edges margin = {}; - Edges position = {}; - Edges padding = {}; - Edges border = {}; - Dimensions dimensions{CompactValue::ofAuto()}; - Dimensions minDimensions = {}; - Dimensions maxDimensions = {}; - // Yoga specific properties, not compatible with flexbox specification - YGFloatOptional aspectRatio = {}; - - YGStyle() - : direction(YGDirectionInherit), - flexDirection(YGFlexDirectionColumn), - justifyContent(YGJustifyFlexStart), - alignContent(YGAlignFlexStart), - alignItems(YGAlignStretch), - alignSelf(YGAlignAuto), - positionType(YGPositionTypeRelative), - flexWrap(YGWrapNoWrap), - overflow(YGOverflowVisible), - display(YGDisplayFlex) {} - ~YGStyle() = default; -}; - -bool operator==(const YGStyle& lhs, const YGStyle& rhs); -inline bool operator!=(const YGStyle& lhs, const YGStyle& rhs) { - return !(lhs == rhs); -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGValue.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGValue.cpp deleted file mode 100644 index fcdd0c69..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGValue.cpp +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#include "YGValue.h" - -const YGValue YGValueZero = {0, YGUnitPoint}; -const YGValue YGValueUndefined = {YGUndefined, YGUnitUndefined}; -const YGValue YGValueAuto = {YGUndefined, YGUnitAuto}; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGValue.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGValue.h deleted file mode 100644 index 170047ea..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/YGValue.h +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#pragma once - -#include -#include "YGEnums.h" -#include "YGMacros.h" - -YG_EXTERN_C_BEGIN - -// Not defined in MSVC++ -#ifndef NAN -static const uint32_t __nan = 0x7fc00000; -#define NAN (*(const float*) __nan) -#endif - -#define YGUndefined NAN - -typedef struct YGValue { - float value; - YGUnit unit; -} YGValue; - -extern const YGValue YGValueAuto; -extern const YGValue YGValueUndefined; -extern const YGValue YGValueZero; - -YG_EXTERN_C_END - -#ifdef __cplusplus - -inline bool operator==(const YGValue& lhs, const YGValue& rhs) { - if (lhs.unit != rhs.unit) { - return false; - } - - switch (lhs.unit) { - case YGUnitUndefined: - case YGUnitAuto: - return true; - case YGUnitPoint: - case YGUnitPercent: - return lhs.value == rhs.value; - } - - return false; -} - -inline bool operator!=(const YGValue& lhs, const YGValue& rhs) { - return !(lhs == rhs); -} - -inline YGValue operator-(const YGValue& value) { - return {-value.value, value.unit}; -} - -namespace facebook { -namespace yoga { -namespace literals { - -inline YGValue operator"" _pt(long double value) { - return YGValue{static_cast(value), YGUnitPoint}; -} -inline YGValue operator"" _pt(unsigned long long value) { - return operator"" _pt(static_cast(value)); -} - -inline YGValue operator"" _percent(long double value) { - return YGValue{static_cast(value), YGUnitPercent}; -} -inline YGValue operator"" _percent(unsigned long long value) { - return operator"" _percent(static_cast(value)); -} - -} // namespace literals -} // namespace yoga -} // namespace facebook - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/Yoga-internal.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/Yoga-internal.h deleted file mode 100644 index 1932cf1a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/Yoga-internal.h +++ /dev/null @@ -1,155 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#pragma once -#include -#include -#include -#include -#include "CompactValue.h" -#include "Yoga.h" - -using YGVector = std::vector; - -YG_EXTERN_C_BEGIN - -WIN_EXPORT float YGRoundValueToPixelGrid( - const float value, - const float pointScaleFactor, - const bool forceCeil, - const bool forceFloor); - -YG_EXTERN_C_END - -namespace facebook { -namespace yoga { - -inline bool isUndefined(float value) { - return std::isnan(value); -} - -} // namespace yoga -} // namespace facebook - -using namespace facebook; - -extern const std::array trailing; -extern const std::array leading; -extern bool YGValueEqual(const YGValue a, const YGValue b); -extern const YGValue YGValueUndefined; -extern const YGValue YGValueAuto; -extern const YGValue YGValueZero; - -struct YGCachedMeasurement { - float availableWidth; - float availableHeight; - YGMeasureMode widthMeasureMode; - YGMeasureMode heightMeasureMode; - - float computedWidth; - float computedHeight; - - YGCachedMeasurement() - : availableWidth(0), - availableHeight(0), - widthMeasureMode((YGMeasureMode) -1), - heightMeasureMode((YGMeasureMode) -1), - computedWidth(-1), - computedHeight(-1) {} - - bool operator==(YGCachedMeasurement measurement) const { - bool isEqual = widthMeasureMode == measurement.widthMeasureMode && - heightMeasureMode == measurement.heightMeasureMode; - - if (!yoga::isUndefined(availableWidth) || - !yoga::isUndefined(measurement.availableWidth)) { - isEqual = isEqual && availableWidth == measurement.availableWidth; - } - if (!yoga::isUndefined(availableHeight) || - !yoga::isUndefined(measurement.availableHeight)) { - isEqual = isEqual && availableHeight == measurement.availableHeight; - } - if (!yoga::isUndefined(computedWidth) || - !yoga::isUndefined(measurement.computedWidth)) { - isEqual = isEqual && computedWidth == measurement.computedWidth; - } - if (!yoga::isUndefined(computedHeight) || - !yoga::isUndefined(measurement.computedHeight)) { - isEqual = isEqual && computedHeight == measurement.computedHeight; - } - - return isEqual; - } -}; - -// This value was chosen based on empiracle data. Even the most complicated -// layouts should not require more than 16 entries to fit within the cache. -#define YG_MAX_CACHED_RESULT_COUNT 16 - -namespace facebook { -namespace yoga { -namespace detail { - -template -class Values { -private: - std::array values_; - -public: - Values() = default; - explicit Values(const YGValue& defaultValue) noexcept { - values_.fill(defaultValue); - } - - const CompactValue& operator[](size_t i) const noexcept { - return values_[i]; - } - CompactValue& operator[](size_t i) noexcept { - return values_[i]; - } - - template - YGValue get() const noexcept { - return std::get(values_); - } - - template - void set(YGValue& value) noexcept { - std::get(values_) = value; - } - - template - void set(YGValue&& value) noexcept { - set(value); - } - - bool operator==(const Values& other) const noexcept { - for (size_t i = 0; i < Size; ++i) { - if (values_[i] != other.values_[i]) { - return false; - } - } - return true; - } - - Values& operator=(const Values& other) = default; -}; - -} // namespace detail -} // namespace yoga -} // namespace facebook - -static const float kDefaultFlexGrow = 0.0f; -static const float kDefaultFlexShrink = 0.0f; -static const float kWebDefaultFlexShrink = 1.0f; - -extern bool YGFloatsEqual(const float a, const float b); -extern bool YGValueEqual(const YGValue a, const YGValue b); -extern facebook::yoga::detail::CompactValue YGComputedEdgeValue( - const facebook::yoga::detail::Values< - facebook::yoga::enums::count()>& edges, - YGEdge edge, - facebook::yoga::detail::CompactValue defaultValue); diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/Yoga.cpp b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/Yoga.cpp deleted file mode 100644 index 3f65092b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/Yoga.cpp +++ /dev/null @@ -1,4315 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#include "Yoga.h" -#include -#include -#include -#include "Utils.h" -#include "YGNode.h" -#include "YGNodePrint.h" -#include "Yoga-internal.h" -#include "instrumentation.h" -#ifdef _MSC_VER -#include - -/* define fmaxf if < VC12 */ -#if _MSC_VER < 1800 -__forceinline const float fmaxf(const float a, const float b) { - return (a > b) ? a : b; -} -#endif -#endif - -using namespace facebook::yoga; - -#ifdef ANDROID -static int YGAndroidLog( - const YGConfigRef config, - const YGNodeRef node, - YGLogLevel level, - const char* format, - va_list args); -#else -static int YGDefaultLog( - const YGConfigRef config, - const YGNodeRef node, - YGLogLevel level, - const char* format, - va_list args); -#endif - -#ifdef ANDROID -#include -static int YGAndroidLog( - const YGConfigRef config, - const YGNodeRef node, - YGLogLevel level, - const char* format, - va_list args) { - int androidLevel = YGLogLevelDebug; - switch (level) { - case YGLogLevelFatal: - androidLevel = ANDROID_LOG_FATAL; - break; - case YGLogLevelError: - androidLevel = ANDROID_LOG_ERROR; - break; - case YGLogLevelWarn: - androidLevel = ANDROID_LOG_WARN; - break; - case YGLogLevelInfo: - androidLevel = ANDROID_LOG_INFO; - break; - case YGLogLevelDebug: - androidLevel = ANDROID_LOG_DEBUG; - break; - case YGLogLevelVerbose: - androidLevel = ANDROID_LOG_VERBOSE; - break; - } - const int result = __android_log_vprint(androidLevel, "yoga", format, args); - return result; -} -#else -#define YG_UNUSED(x) (void) (x); - -static int YGDefaultLog( - const YGConfigRef config, - const YGNodeRef node, - YGLogLevel level, - const char* format, - va_list args) { - YG_UNUSED(config); - YG_UNUSED(node); - switch (level) { - case YGLogLevelError: - case YGLogLevelFatal: - return vfprintf(stderr, format, args); - case YGLogLevelWarn: - case YGLogLevelInfo: - case YGLogLevelDebug: - case YGLogLevelVerbose: - default: - return vprintf(format, args); - } -} - -#undef YG_UNUSED -#endif - -bool YGFloatIsUndefined(const float value) { - return facebook::yoga::isUndefined(value); -} - -detail::CompactValue YGComputedEdgeValue( - const YGStyle::Edges& edges, - YGEdge edge, - detail::CompactValue defaultValue) { - if (!edges[edge].isUndefined()) { - return edges[edge]; - } - - if ((edge == YGEdgeTop || edge == YGEdgeBottom) && - !edges[YGEdgeVertical].isUndefined()) { - return edges[YGEdgeVertical]; - } - - if ((edge == YGEdgeLeft || edge == YGEdgeRight || edge == YGEdgeStart || - edge == YGEdgeEnd) && - !edges[YGEdgeHorizontal].isUndefined()) { - return edges[YGEdgeHorizontal]; - } - - if (!edges[YGEdgeAll].isUndefined()) { - return edges[YGEdgeAll]; - } - - if (edge == YGEdgeStart || edge == YGEdgeEnd) { - return detail::CompactValue::ofUndefined(); - } - - return defaultValue; -} - -void* YGNodeGetContext(YGNodeRef node) { - return node->getContext(); -} - -void YGNodeSetContext(YGNodeRef node, void* context) { - return node->setContext(context); -} - -YGMeasureFunc YGNodeGetMeasureFunc(YGNodeRef node) { - return node->getMeasure(); -} - -void YGNodeSetMeasureFunc(YGNodeRef node, YGMeasureFunc measureFunc) { - node->setMeasureFunc(measureFunc); -} - -YGBaselineFunc YGNodeGetBaselineFunc(YGNodeRef node) { - return node->getBaseline(); -} - -void YGNodeSetBaselineFunc(YGNodeRef node, YGBaselineFunc baselineFunc) { - node->setBaseLineFunc(baselineFunc); -} - -YGDirtiedFunc YGNodeGetDirtiedFunc(YGNodeRef node) { - return node->getDirtied(); -} - -void YGNodeSetDirtiedFunc(YGNodeRef node, YGDirtiedFunc dirtiedFunc) { - node->setDirtiedFunc(dirtiedFunc); -} - -YGPrintFunc YGNodeGetPrintFunc(YGNodeRef node) { - return node->getPrintFunc(); -} - -void YGNodeSetPrintFunc(YGNodeRef node, YGPrintFunc printFunc) { - node->setPrintFunc(printFunc); -} - -bool YGNodeGetHasNewLayout(YGNodeRef node) { - return node->getHasNewLayout(); -} - -void YGConfigSetPrintTreeFlag(YGConfigRef config, bool enabled) { - config->printTree = enabled; -} - -void YGNodeSetHasNewLayout(YGNodeRef node, bool hasNewLayout) { - node->setHasNewLayout(hasNewLayout); -} - -YGNodeType YGNodeGetNodeType(YGNodeRef node) { - return node->getNodeType(); -} - -void YGNodeSetNodeType(YGNodeRef node, YGNodeType nodeType) { - return node->setNodeType(nodeType); -} - -bool YGNodeIsDirty(YGNodeRef node) { - return node->isDirty(); -} - -bool YGNodeLayoutGetDidUseLegacyFlag(const YGNodeRef node) { - return node->didUseLegacyFlag(); -} - -void YGNodeMarkDirtyAndPropogateToDescendants(const YGNodeRef node) { - return node->markDirtyAndPropogateDownwards(); -} - -int32_t gNodeInstanceCount = 0; -int32_t gConfigInstanceCount = 0; - -WIN_EXPORT YGNodeRef YGNodeNewWithConfig(const YGConfigRef config) { - const YGNodeRef node = new YGNode(); - YGAssertWithConfig( - config, node != nullptr, "Could not allocate memory for node"); - gNodeInstanceCount++; - - if (config->useWebDefaults) { - node->setStyleFlexDirection(YGFlexDirectionRow); - node->setStyleAlignContent(YGAlignStretch); - } - node->setConfig(config); - return node; -} - -YGConfigRef YGConfigGetDefault() { - static YGConfigRef defaultConfig = YGConfigNew(); - return defaultConfig; -} - -YGNodeRef YGNodeNew(void) { - return YGNodeNewWithConfig(YGConfigGetDefault()); -} - -YGNodeRef YGNodeClone(YGNodeRef oldNode) { - YGNodeRef node = new YGNode(*oldNode); - YGAssertWithConfig( - oldNode->getConfig(), - node != nullptr, - "Could not allocate memory for node"); - gNodeInstanceCount++; - node->setOwner(nullptr); - return node; -} - -static YGConfigRef YGConfigClone(const YGConfig& oldConfig) { - const YGConfigRef config = new YGConfig(oldConfig); - YGAssert(config != nullptr, "Could not allocate memory for config"); - if (config == nullptr) { - abort(); - } - gConfigInstanceCount++; - return config; -} - -static YGNodeRef YGNodeDeepClone(YGNodeRef oldNode) { - YGNodeRef node = YGNodeClone(oldNode); - YGVector vec = YGVector(); - vec.reserve(oldNode->getChildren().size()); - YGNodeRef childNode = nullptr; - for (auto* item : oldNode->getChildren()) { - childNode = YGNodeDeepClone(item); - childNode->setOwner(node); - vec.push_back(childNode); - } - node->setChildren(vec); - - if (oldNode->getConfig() != nullptr) { - node->setConfig(YGConfigClone(*(oldNode->getConfig()))); - } - - return node; -} - -void YGNodeFree(const YGNodeRef node) { - if (YGNodeRef owner = node->getOwner()) { - owner->removeChild(node); - node->setOwner(nullptr); - } - - const uint32_t childCount = YGNodeGetChildCount(node); - for (uint32_t i = 0; i < childCount; i++) { - const YGNodeRef child = YGNodeGetChild(node, i); - child->setOwner(nullptr); - } - - node->clearChildren(); - delete node; - gNodeInstanceCount--; -} - -static void YGConfigFreeRecursive(const YGNodeRef root) { - if (root->getConfig() != nullptr) { - gConfigInstanceCount--; - delete root->getConfig(); - } - // Delete configs recursively for childrens - for (auto* child : root->getChildren()) { - YGConfigFreeRecursive(child); - } -} - -void YGNodeFreeRecursiveWithCleanupFunc( - const YGNodeRef root, - YGNodeCleanupFunc cleanup) { - while (YGNodeGetChildCount(root) > 0) { - const YGNodeRef child = YGNodeGetChild(root, 0); - if (child->getOwner() != root) { - // Don't free shared nodes that we don't own. - break; - } - YGNodeRemoveChild(root, child); - YGNodeFreeRecursive(child); - } - if (cleanup != nullptr) { - cleanup(root); - } - YGNodeFree(root); -} - -void YGNodeFreeRecursive(const YGNodeRef root) { - return YGNodeFreeRecursiveWithCleanupFunc(root, nullptr); -} - -void YGNodeReset(const YGNodeRef node) { - YGAssertWithNode( - node, - YGNodeGetChildCount(node) == 0, - "Cannot reset a node which still has children attached"); - YGAssertWithNode( - node, - node->getOwner() == nullptr, - "Cannot reset a node still attached to a owner"); - - node->clearChildren(); - - const YGConfigRef config = node->getConfig(); - *node = YGNode(); - if (config->useWebDefaults) { - node->setStyleFlexDirection(YGFlexDirectionRow); - node->setStyleAlignContent(YGAlignStretch); - } - node->setConfig(config); -} - -int32_t YGNodeGetInstanceCount(void) { - return gNodeInstanceCount; -} - -int32_t YGConfigGetInstanceCount(void) { - return gConfigInstanceCount; -} - -YGConfigRef YGConfigNew(void) { -#ifdef ANDROID - const YGConfigRef config = new YGConfig(YGAndroidLog); -#else - const YGConfigRef config = new YGConfig(YGDefaultLog); -#endif - gConfigInstanceCount++; - return config; -} - -void YGConfigFree(const YGConfigRef config) { - delete config; - gConfigInstanceCount--; -} - -void YGConfigCopy(const YGConfigRef dest, const YGConfigRef src) { - memcpy(dest, src, sizeof(YGConfig)); -} - -void YGNodeSetIsReferenceBaseline(YGNodeRef node, bool isReferenceBaseline) { - if (node->isReferenceBaseline() != isReferenceBaseline) { - node->setIsReferenceBaseline(isReferenceBaseline); - node->markDirtyAndPropogate(); - } -} - -bool YGNodeIsReferenceBaseline(YGNodeRef node) { - return node->isReferenceBaseline(); -} - -void YGNodeInsertChild( - const YGNodeRef node, - const YGNodeRef child, - const uint32_t index) { - YGAssertWithNode( - node, - child->getOwner() == nullptr, - "Child already has a owner, it must be removed first."); - - YGAssertWithNode( - node, - node->getMeasure() == nullptr, - "Cannot add child: Nodes with measure functions cannot have children."); - - node->cloneChildrenIfNeeded(); - node->insertChild(child, index); - YGNodeRef owner = child->getOwner() ? nullptr : node; - child->setOwner(owner); - node->markDirtyAndPropogate(); -} - -void YGNodeRemoveChild(const YGNodeRef owner, const YGNodeRef excludedChild) { - // This algorithm is a forked variant from cloneChildrenIfNeeded in YGNode - // that excludes a child. - const uint32_t childCount = YGNodeGetChildCount(owner); - - if (childCount == 0) { - // This is an empty set. Nothing to remove. - return; - } - const YGNodeRef firstChild = YGNodeGetChild(owner, 0); - if (firstChild->getOwner() == owner) { - // If the first child has this node as its owner, we assume that it is - // already unique. We can now try to delete a child in this list. - if (owner->removeChild(excludedChild)) { - excludedChild->setLayout( - YGNode().getLayout()); // layout is no longer valid - excludedChild->setOwner(nullptr); - owner->markDirtyAndPropogate(); - } - return; - } - // Otherwise we have to clone the node list except for the child we're trying - // to delete. We don't want to simply clone all children, because then the - // host will need to free the clone of the child that was just deleted. - const YGCloneNodeFunc cloneNodeCallback = - owner->getConfig()->cloneNodeCallback; - uint32_t nextInsertIndex = 0; - for (uint32_t i = 0; i < childCount; i++) { - const YGNodeRef oldChild = owner->getChild(i); - if (excludedChild == oldChild) { - // Ignore the deleted child. Don't reset its layout or owner since it is - // still valid in the other owner. However, since this owner has now - // changed, we need to mark it as dirty. - owner->markDirtyAndPropogate(); - continue; - } - YGNodeRef newChild = nullptr; - if (cloneNodeCallback) { - newChild = cloneNodeCallback(oldChild, owner, nextInsertIndex); - } - if (newChild == nullptr) { - newChild = YGNodeClone(oldChild); - } - owner->replaceChild(newChild, nextInsertIndex); - newChild->setOwner(owner); - - nextInsertIndex++; - } - while (nextInsertIndex < childCount) { - owner->removeChild(nextInsertIndex); - nextInsertIndex++; - } -} - -void YGNodeRemoveAllChildren(const YGNodeRef owner) { - const uint32_t childCount = YGNodeGetChildCount(owner); - if (childCount == 0) { - // This is an empty set already. Nothing to do. - return; - } - const YGNodeRef firstChild = YGNodeGetChild(owner, 0); - if (firstChild->getOwner() == owner) { - // If the first child has this node as its owner, we assume that this child - // set is unique. - for (uint32_t i = 0; i < childCount; i++) { - const YGNodeRef oldChild = YGNodeGetChild(owner, i); - oldChild->setLayout(YGNode().getLayout()); // layout is no longer valid - oldChild->setOwner(nullptr); - } - owner->clearChildren(); - owner->markDirtyAndPropogate(); - return; - } - // Otherwise, we are not the owner of the child set. We don't have to do - // anything to clear it. - owner->setChildren(YGVector()); - owner->markDirtyAndPropogate(); -} - -static void YGNodeSetChildrenInternal( - YGNodeRef const owner, - const std::vector& children) { - if (!owner) { - return; - } - if (children.size() == 0) { - if (YGNodeGetChildCount(owner) > 0) { - for (YGNodeRef const child : owner->getChildren()) { - child->setLayout(YGLayout()); - child->setOwner(nullptr); - } - owner->setChildren(YGVector()); - owner->markDirtyAndPropogate(); - } - } else { - if (YGNodeGetChildCount(owner) > 0) { - for (YGNodeRef const oldChild : owner->getChildren()) { - // Our new children may have nodes in common with the old children. We - // don't reset these common nodes. - if (std::find(children.begin(), children.end(), oldChild) == - children.end()) { - oldChild->setLayout(YGLayout()); - oldChild->setOwner(nullptr); - } - } - } - owner->setChildren(children); - for (YGNodeRef child : children) { - child->setOwner(owner); - } - owner->markDirtyAndPropogate(); - } -} - -void YGNodeSetChildren( - YGNodeRef const owner, - const YGNodeRef c[], - const uint32_t count) { - const YGVector children = {c, c + count}; - YGNodeSetChildrenInternal(owner, children); -} - -void YGNodeSetChildren( - YGNodeRef const owner, - const std::vector& children) { - YGNodeSetChildrenInternal(owner, children); -} - -YGNodeRef YGNodeGetChild(const YGNodeRef node, const uint32_t index) { - if (index < node->getChildren().size()) { - return node->getChild(index); - } - return nullptr; -} - -uint32_t YGNodeGetChildCount(const YGNodeRef node) { - return static_cast(node->getChildren().size()); -} - -YGNodeRef YGNodeGetOwner(const YGNodeRef node) { - return node->getOwner(); -} - -YGNodeRef YGNodeGetParent(const YGNodeRef node) { - return node->getOwner(); -} - -void YGNodeMarkDirty(const YGNodeRef node) { - YGAssertWithNode( - node, - node->getMeasure() != nullptr, - "Only leaf nodes with custom measure functions" - "should manually mark themselves as dirty"); - - node->markDirtyAndPropogate(); -} - -void YGNodeCopyStyle(const YGNodeRef dstNode, const YGNodeRef srcNode) { - if (!(dstNode->getStyle() == srcNode->getStyle())) { - dstNode->setStyle(srcNode->getStyle()); - dstNode->markDirtyAndPropogate(); - } -} - -float YGNodeStyleGetFlexGrow(const YGNodeRef node) { - return node->getStyle().flexGrow.isUndefined() - ? kDefaultFlexGrow - : node->getStyle().flexGrow.unwrap(); -} - -float YGNodeStyleGetFlexShrink(const YGNodeRef node) { - return node->getStyle().flexShrink.isUndefined() - ? (node->getConfig()->useWebDefaults ? kWebDefaultFlexShrink - : kDefaultFlexShrink) - : node->getStyle().flexShrink.unwrap(); -} - -namespace { - -struct Value { - template - static detail::CompactValue create(float value) { - return detail::CompactValue::ofMaybe(value); - } -}; - -template <> -inline detail::CompactValue Value::create(float) { - return detail::CompactValue::ofUndefined(); -} - -template <> -inline detail::CompactValue Value::create(float) { - return detail::CompactValue::ofAuto(); -} - -template -struct DimensionProp { - template - static YGValue get(YGNodeRef node) { - YGValue value = (node->getStyle().*P)[idx]; - if (value.unit == YGUnitUndefined || value.unit == YGUnitAuto) { - value.value = YGUndefined; - } - return value; - } - - template - static void set(YGNodeRef node, float newValue) { - auto value = Value::create(newValue); - if ((node->getStyle().*P)[idx] != value) { - (node->getStyle().*P)[idx] = value; - node->markDirtyAndPropogate(); - } - } -}; - -} // namespace - -#define YG_NODE_STYLE_PROPERTY_SETTER_UNIT_AUTO_IMPL( \ - type, name, paramName, instanceName) \ - void YGNodeStyleSet##name(const YGNodeRef node, const type paramName) { \ - auto value = detail::CompactValue::ofMaybe(paramName); \ - if (node->getStyle().instanceName != value) { \ - node->getStyle().instanceName = value; \ - node->markDirtyAndPropogate(); \ - } \ - } \ - \ - void YGNodeStyleSet##name##Percent( \ - const YGNodeRef node, const type paramName) { \ - auto value = detail::CompactValue::ofMaybe(paramName); \ - if (node->getStyle().instanceName != value) { \ - node->getStyle().instanceName = value; \ - node->markDirtyAndPropogate(); \ - } \ - } \ - \ - void YGNodeStyleSet##name##Auto(const YGNodeRef node) { \ - if (node->getStyle().instanceName != detail::CompactValue::ofAuto()) { \ - node->getStyle().instanceName = detail::CompactValue::ofAuto(); \ - node->markDirtyAndPropogate(); \ - } \ - } - -#define YG_NODE_STYLE_PROPERTY_UNIT_AUTO_IMPL( \ - type, name, paramName, instanceName) \ - YG_NODE_STYLE_PROPERTY_SETTER_UNIT_AUTO_IMPL( \ - float, name, paramName, instanceName) \ - \ - type YGNodeStyleGet##name(const YGNodeRef node) { \ - YGValue value = node->getStyle().instanceName; \ - if (value.unit == YGUnitUndefined || value.unit == YGUnitAuto) { \ - value.value = YGUndefined; \ - } \ - return value; \ - } - -#define YG_NODE_STYLE_EDGE_PROPERTY_UNIT_AUTO_IMPL(type, name, instanceName) \ - void YGNodeStyleSet##name##Auto(const YGNodeRef node, const YGEdge edge) { \ - if (node->getStyle().instanceName[edge] != \ - detail::CompactValue::ofAuto()) { \ - node->getStyle().instanceName[edge] = detail::CompactValue::ofAuto(); \ - node->markDirtyAndPropogate(); \ - } \ - } - -#define YG_NODE_STYLE_EDGE_PROPERTY_UNIT_IMPL( \ - type, name, paramName, instanceName) \ - void YGNodeStyleSet##name( \ - const YGNodeRef node, const YGEdge edge, const float paramName) { \ - auto value = detail::CompactValue::ofMaybe(paramName); \ - if (node->getStyle().instanceName[edge] != value) { \ - node->getStyle().instanceName[edge] = value; \ - node->markDirtyAndPropogate(); \ - } \ - } \ - \ - void YGNodeStyleSet##name##Percent( \ - const YGNodeRef node, const YGEdge edge, const float paramName) { \ - auto value = detail::CompactValue::ofMaybe(paramName); \ - if (node->getStyle().instanceName[edge] != value) { \ - node->getStyle().instanceName[edge] = value; \ - node->markDirtyAndPropogate(); \ - } \ - } \ - \ - type YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge) { \ - YGValue value = node->getStyle().instanceName[edge]; \ - if (value.unit == YGUnitUndefined || value.unit == YGUnitAuto) { \ - value.value = YGUndefined; \ - } \ - return value; \ - } - -#define YG_NODE_LAYOUT_PROPERTY_IMPL(type, name, instanceName) \ - type YGNodeLayoutGet##name(const YGNodeRef node) { \ - return node->getLayout().instanceName; \ - } - -#define YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(type, name, instanceName) \ - type YGNodeLayoutGet##name(const YGNodeRef node, const YGEdge edge) { \ - YGAssertWithNode( \ - node, \ - edge <= YGEdgeEnd, \ - "Cannot get layout properties of multi-edge shorthands"); \ - \ - if (edge == YGEdgeLeft) { \ - if (node->getLayout().direction == YGDirectionRTL) { \ - return node->getLayout().instanceName[YGEdgeEnd]; \ - } else { \ - return node->getLayout().instanceName[YGEdgeStart]; \ - } \ - } \ - \ - if (edge == YGEdgeRight) { \ - if (node->getLayout().direction == YGDirectionRTL) { \ - return node->getLayout().instanceName[YGEdgeStart]; \ - } else { \ - return node->getLayout().instanceName[YGEdgeEnd]; \ - } \ - } \ - \ - return node->getLayout().instanceName[edge]; \ - } - -#define YG_NODE_STYLE_SET(node, property, value) \ - if (node->getStyle().property != value) { \ - node->getStyle().property = value; \ - node->markDirtyAndPropogate(); \ - } - -void YGNodeStyleSetDirection(const YGNodeRef node, const YGDirection value) { - YG_NODE_STYLE_SET(node, direction, value); -} -YGDirection YGNodeStyleGetDirection(const YGNodeRef node) { - return node->getStyle().direction; -} - -void YGNodeStyleSetFlexDirection( - const YGNodeRef node, - const YGFlexDirection flexDirection) { - YG_NODE_STYLE_SET(node, flexDirection, flexDirection); -} -YGFlexDirection YGNodeStyleGetFlexDirection(const YGNodeRef node) { - return node->getStyle().flexDirection; -} - -void YGNodeStyleSetJustifyContent( - const YGNodeRef node, - const YGJustify justifyContent) { - YG_NODE_STYLE_SET(node, justifyContent, justifyContent); -} -YGJustify YGNodeStyleGetJustifyContent(const YGNodeRef node) { - return node->getStyle().justifyContent; -} - -void YGNodeStyleSetAlignContent( - const YGNodeRef node, - const YGAlign alignContent) { - YG_NODE_STYLE_SET(node, alignContent, alignContent); -} -YGAlign YGNodeStyleGetAlignContent(const YGNodeRef node) { - return node->getStyle().alignContent; -} - -void YGNodeStyleSetAlignItems(const YGNodeRef node, const YGAlign alignItems) { - YG_NODE_STYLE_SET(node, alignItems, alignItems); -} -YGAlign YGNodeStyleGetAlignItems(const YGNodeRef node) { - return node->getStyle().alignItems; -} - -void YGNodeStyleSetAlignSelf(const YGNodeRef node, const YGAlign alignSelf) { - YG_NODE_STYLE_SET(node, alignSelf, alignSelf); -} -YGAlign YGNodeStyleGetAlignSelf(const YGNodeRef node) { - return node->getStyle().alignSelf; -} - -void YGNodeStyleSetPositionType( - const YGNodeRef node, - const YGPositionType positionType) { - YG_NODE_STYLE_SET(node, positionType, positionType); -} -YGPositionType YGNodeStyleGetPositionType(const YGNodeRef node) { - return node->getStyle().positionType; -} - -void YGNodeStyleSetFlexWrap(const YGNodeRef node, const YGWrap flexWrap) { - YG_NODE_STYLE_SET(node, flexWrap, flexWrap); -} -YGWrap YGNodeStyleGetFlexWrap(const YGNodeRef node) { - return node->getStyle().flexWrap; -} - -void YGNodeStyleSetOverflow(const YGNodeRef node, const YGOverflow overflow) { - YG_NODE_STYLE_SET(node, overflow, overflow); -} -YGOverflow YGNodeStyleGetOverflow(const YGNodeRef node) { - return node->getStyle().overflow; -} - -void YGNodeStyleSetDisplay(const YGNodeRef node, const YGDisplay display) { - YG_NODE_STYLE_SET(node, display, display); -} -YGDisplay YGNodeStyleGetDisplay(const YGNodeRef node) { - return node->getStyle().display; -} - -// TODO(T26792433): Change the API to accept YGFloatOptional. -void YGNodeStyleSetFlex(const YGNodeRef node, const float flex) { - if (node->getStyle().flex != flex) { - node->getStyle().flex = - YGFloatIsUndefined(flex) ? YGFloatOptional() : YGFloatOptional(flex); - node->markDirtyAndPropogate(); - } -} - -// TODO(T26792433): Change the API to accept YGFloatOptional. -float YGNodeStyleGetFlex(const YGNodeRef node) { - return node->getStyle().flex.isUndefined() ? YGUndefined - : node->getStyle().flex.unwrap(); -} - -// TODO(T26792433): Change the API to accept YGFloatOptional. -void YGNodeStyleSetFlexGrow(const YGNodeRef node, const float flexGrow) { - if (node->getStyle().flexGrow != flexGrow) { - node->getStyle().flexGrow = YGFloatIsUndefined(flexGrow) - ? YGFloatOptional() - : YGFloatOptional(flexGrow); - node->markDirtyAndPropogate(); - } -} - -// TODO(T26792433): Change the API to accept YGFloatOptional. -void YGNodeStyleSetFlexShrink(const YGNodeRef node, const float flexShrink) { - if (node->getStyle().flexShrink != flexShrink) { - node->getStyle().flexShrink = YGFloatIsUndefined(flexShrink) - ? YGFloatOptional() - : YGFloatOptional(flexShrink); - node->markDirtyAndPropogate(); - } -} - -YGValue YGNodeStyleGetFlexBasis(const YGNodeRef node) { - YGValue flexBasis = node->getStyle().flexBasis; - if (flexBasis.unit == YGUnitUndefined || flexBasis.unit == YGUnitAuto) { - // TODO(T26792433): Get rid off the use of YGUndefined at client side - flexBasis.value = YGUndefined; - } - return flexBasis; -} - -void YGNodeStyleSetFlexBasis(const YGNodeRef node, const float flexBasis) { - auto value = detail::CompactValue::ofMaybe(flexBasis); - if (node->getStyle().flexBasis != value) { - node->getStyle().flexBasis = value; - node->markDirtyAndPropogate(); - } -} - -void YGNodeStyleSetFlexBasisPercent( - const YGNodeRef node, - const float flexBasisPercent) { - auto value = detail::CompactValue::ofMaybe(flexBasisPercent); - if (node->getStyle().flexBasis != value) { - node->getStyle().flexBasis = value; - node->markDirtyAndPropogate(); - } -} - -void YGNodeStyleSetFlexBasisAuto(const YGNodeRef node) { - if (node->getStyle().flexBasis != detail::CompactValue::ofAuto()) { - node->getStyle().flexBasis = detail::CompactValue::ofAuto(); - node->markDirtyAndPropogate(); - } -} - -YG_NODE_STYLE_EDGE_PROPERTY_UNIT_IMPL(YGValue, Position, position, position); -YG_NODE_STYLE_EDGE_PROPERTY_UNIT_IMPL(YGValue, Margin, margin, margin); -YG_NODE_STYLE_EDGE_PROPERTY_UNIT_AUTO_IMPL(YGValue, Margin, margin); -YG_NODE_STYLE_EDGE_PROPERTY_UNIT_IMPL(YGValue, Padding, padding, padding); - -// TODO(T26792433): Change the API to accept YGFloatOptional. -void YGNodeStyleSetBorder( - const YGNodeRef node, - const YGEdge edge, - const float border) { - auto value = detail::CompactValue::ofMaybe(border); - if (node->getStyle().border[edge] != value) { - node->getStyle().border[edge] = value; - node->markDirtyAndPropogate(); - } -} - -float YGNodeStyleGetBorder(const YGNodeRef node, const YGEdge edge) { - if (node->getStyle().border[edge].isUndefined() || - node->getStyle().border[edge].isAuto()) { - // TODO(T26792433): Rather than returning YGUndefined, change the api to - // return YGFloatOptional. - return YGUndefined; - } - - auto border = (YGValue) node->getStyle().border[edge]; - return border.value; -} - -// Yoga specific properties, not compatible with flexbox specification - -// TODO(T26792433): Change the API to accept YGFloatOptional. -float YGNodeStyleGetAspectRatio(const YGNodeRef node) { - const YGFloatOptional op = node->getStyle().aspectRatio; - return op.isUndefined() ? YGUndefined : op.unwrap(); -} - -// TODO(T26792433): Change the API to accept YGFloatOptional. -void YGNodeStyleSetAspectRatio(const YGNodeRef node, const float aspectRatio) { - if (node->getStyle().aspectRatio != aspectRatio) { - node->getStyle().aspectRatio = YGFloatOptional(aspectRatio); - node->markDirtyAndPropogate(); - } -} - -YG_NODE_STYLE_PROPERTY_UNIT_AUTO_IMPL( - YGValue, - Width, - width, - dimensions[YGDimensionWidth]); -YG_NODE_STYLE_PROPERTY_UNIT_AUTO_IMPL( - YGValue, - Height, - height, - dimensions[YGDimensionHeight]); - -void YGNodeStyleSetMinWidth(const YGNodeRef node, const float minWidth) { - DimensionProp<&YGStyle::minDimensions>::set( - node, minWidth); -} -void YGNodeStyleSetMinWidthPercent(const YGNodeRef node, const float minWidth) { - DimensionProp<&YGStyle::minDimensions>::set( - node, minWidth); -} -YGValue YGNodeStyleGetMinWidth(const YGNodeRef node) { - return DimensionProp<&YGStyle::minDimensions>::get(node); -}; - -void YGNodeStyleSetMinHeight(const YGNodeRef node, const float minHeight) { - DimensionProp<&YGStyle::minDimensions>::set( - node, minHeight); -} -void YGNodeStyleSetMinHeightPercent( - const YGNodeRef node, - const float minHeight) { - DimensionProp<&YGStyle::minDimensions>::set( - node, minHeight); -} -YGValue YGNodeStyleGetMinHeight(const YGNodeRef node) { - return DimensionProp<&YGStyle::minDimensions>::get(node); -}; - -void YGNodeStyleSetMaxWidth(const YGNodeRef node, const float maxWidth) { - DimensionProp<&YGStyle::maxDimensions>::set( - node, maxWidth); -} -void YGNodeStyleSetMaxWidthPercent(const YGNodeRef node, const float maxWidth) { - DimensionProp<&YGStyle::maxDimensions>::set( - node, maxWidth); -} -YGValue YGNodeStyleGetMaxWidth(const YGNodeRef node) { - return DimensionProp<&YGStyle::maxDimensions>::get(node); -}; - -void YGNodeStyleSetMaxHeight(const YGNodeRef node, const float maxHeight) { - DimensionProp<&YGStyle::maxDimensions>::set( - node, maxHeight); -} -void YGNodeStyleSetMaxHeightPercent( - const YGNodeRef node, - const float maxHeight) { - DimensionProp<&YGStyle::maxDimensions>::set( - node, maxHeight); -} -YGValue YGNodeStyleGetMaxHeight(const YGNodeRef node) { - return DimensionProp<&YGStyle::maxDimensions>::get(node); -}; - -YG_NODE_LAYOUT_PROPERTY_IMPL(float, Left, position[YGEdgeLeft]); -YG_NODE_LAYOUT_PROPERTY_IMPL(float, Top, position[YGEdgeTop]); -YG_NODE_LAYOUT_PROPERTY_IMPL(float, Right, position[YGEdgeRight]); -YG_NODE_LAYOUT_PROPERTY_IMPL(float, Bottom, position[YGEdgeBottom]); -YG_NODE_LAYOUT_PROPERTY_IMPL(float, Width, dimensions[YGDimensionWidth]); -YG_NODE_LAYOUT_PROPERTY_IMPL(float, Height, dimensions[YGDimensionHeight]); -YG_NODE_LAYOUT_PROPERTY_IMPL(YGDirection, Direction, direction); -YG_NODE_LAYOUT_PROPERTY_IMPL(bool, HadOverflow, hadOverflow); - -YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Margin, margin); -YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Border, border); -YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Padding, padding); - -bool YGNodeLayoutGetDidLegacyStretchFlagAffectLayout(const YGNodeRef node) { - return node->getLayout().doesLegacyStretchFlagAffectsLayout; -} - -uint32_t gCurrentGenerationCount = 0; - -bool YGLayoutNodeInternal( - const YGNodeRef node, - const float availableWidth, - const float availableHeight, - const YGDirection ownerDirection, - const YGMeasureMode widthMeasureMode, - const YGMeasureMode heightMeasureMode, - const float ownerWidth, - const float ownerHeight, - const bool performLayout, - const char* reason, - const YGConfigRef config, - YGMarkerLayoutData& layoutMarkerData); - -static void YGNodePrintInternal( - const YGNodeRef node, - const YGPrintOptions options) { - std::string str; - facebook::yoga::YGNodeToString(str, node, options, 0); - YGLog(node, YGLogLevelDebug, str.c_str()); -} - -void YGNodePrint(const YGNodeRef node, const YGPrintOptions options) { - YGNodePrintInternal(node, options); -} - -const std::array leading = { - {YGEdgeTop, YGEdgeBottom, YGEdgeLeft, YGEdgeRight}}; - -const std::array trailing = { - {YGEdgeBottom, YGEdgeTop, YGEdgeRight, YGEdgeLeft}}; -static const std::array pos = {{ - YGEdgeTop, - YGEdgeBottom, - YGEdgeLeft, - YGEdgeRight, -}}; - -static const std::array dim = { - {YGDimensionHeight, YGDimensionHeight, YGDimensionWidth, YGDimensionWidth}}; - -static inline float YGNodePaddingAndBorderForAxis( - const YGNodeRef node, - const YGFlexDirection axis, - const float widthSize) { - return (node->getLeadingPaddingAndBorder(axis, widthSize) + - node->getTrailingPaddingAndBorder(axis, widthSize)) - .unwrap(); -} - -static inline YGAlign YGNodeAlignItem( - const YGNodeRef node, - const YGNodeRef child) { - const YGAlign align = child->getStyle().alignSelf == YGAlignAuto - ? node->getStyle().alignItems - : child->getStyle().alignSelf; - if (align == YGAlignBaseline && - YGFlexDirectionIsColumn(node->getStyle().flexDirection)) { - return YGAlignFlexStart; - } - return align; -} - -static float YGBaseline(const YGNodeRef node) { - if (node->getBaseline() != nullptr) { - const float baseline = marker::MarkerSection::wrap( - node, - node->getBaseline(), - node, - node->getLayout().measuredDimensions[YGDimensionWidth], - node->getLayout().measuredDimensions[YGDimensionHeight]); - YGAssertWithNode( - node, - !YGFloatIsUndefined(baseline), - "Expect custom baseline function to not return NaN"); - return baseline; - } - - YGNodeRef baselineChild = nullptr; - const uint32_t childCount = YGNodeGetChildCount(node); - for (uint32_t i = 0; i < childCount; i++) { - const YGNodeRef child = YGNodeGetChild(node, i); - if (child->getLineIndex() > 0) { - break; - } - if (child->getStyle().positionType == YGPositionTypeAbsolute) { - continue; - } - if (YGNodeAlignItem(node, child) == YGAlignBaseline || - child->isReferenceBaseline()) { - baselineChild = child; - break; - } - - if (baselineChild == nullptr) { - baselineChild = child; - } - } - - if (baselineChild == nullptr) { - return node->getLayout().measuredDimensions[YGDimensionHeight]; - } - - const float baseline = YGBaseline(baselineChild); - return baseline + baselineChild->getLayout().position[YGEdgeTop]; -} - -static bool YGIsBaselineLayout(const YGNodeRef node) { - if (YGFlexDirectionIsColumn(node->getStyle().flexDirection)) { - return false; - } - if (node->getStyle().alignItems == YGAlignBaseline) { - return true; - } - const uint32_t childCount = YGNodeGetChildCount(node); - for (uint32_t i = 0; i < childCount; i++) { - const YGNodeRef child = YGNodeGetChild(node, i); - if (child->getStyle().positionType == YGPositionTypeRelative && - child->getStyle().alignSelf == YGAlignBaseline) { - return true; - } - } - - return false; -} - -static inline float YGNodeDimWithMargin( - const YGNodeRef node, - const YGFlexDirection axis, - const float widthSize) { - return node->getLayout().measuredDimensions[dim[axis]] + - (node->getLeadingMargin(axis, widthSize) + - node->getTrailingMargin(axis, widthSize)) - .unwrap(); -} - -static inline bool YGNodeIsStyleDimDefined( - const YGNodeRef node, - const YGFlexDirection axis, - const float ownerSize) { - bool isUndefined = - YGFloatIsUndefined(node->getResolvedDimension(dim[axis]).value); - return !( - node->getResolvedDimension(dim[axis]).unit == YGUnitAuto || - node->getResolvedDimension(dim[axis]).unit == YGUnitUndefined || - (node->getResolvedDimension(dim[axis]).unit == YGUnitPoint && - !isUndefined && node->getResolvedDimension(dim[axis]).value < 0.0f) || - (node->getResolvedDimension(dim[axis]).unit == YGUnitPercent && - !isUndefined && - (node->getResolvedDimension(dim[axis]).value < 0.0f || - YGFloatIsUndefined(ownerSize)))); -} - -static inline bool YGNodeIsLayoutDimDefined( - const YGNodeRef node, - const YGFlexDirection axis) { - const float value = node->getLayout().measuredDimensions[dim[axis]]; - return !YGFloatIsUndefined(value) && value >= 0.0f; -} - -static YGFloatOptional YGNodeBoundAxisWithinMinAndMax( - const YGNodeRef node, - const YGFlexDirection axis, - const YGFloatOptional value, - const float axisSize) { - YGFloatOptional min; - YGFloatOptional max; - - if (YGFlexDirectionIsColumn(axis)) { - min = YGResolveValue( - node->getStyle().minDimensions[YGDimensionHeight], axisSize); - max = YGResolveValue( - node->getStyle().maxDimensions[YGDimensionHeight], axisSize); - } else if (YGFlexDirectionIsRow(axis)) { - min = YGResolveValue( - node->getStyle().minDimensions[YGDimensionWidth], axisSize); - max = YGResolveValue( - node->getStyle().maxDimensions[YGDimensionWidth], axisSize); - } - - if (max >= YGFloatOptional{0} && value > max) { - return max; - } - - if (min >= YGFloatOptional{0} && value < min) { - return min; - } - - return value; -} - -// Like YGNodeBoundAxisWithinMinAndMax but also ensures that the value doesn't -// go below the padding and border amount. -static inline float YGNodeBoundAxis( - const YGNodeRef node, - const YGFlexDirection axis, - const float value, - const float axisSize, - const float widthSize) { - return YGFloatMax( - YGNodeBoundAxisWithinMinAndMax( - node, axis, YGFloatOptional{value}, axisSize) - .unwrap(), - YGNodePaddingAndBorderForAxis(node, axis, widthSize)); -} - -static void YGNodeSetChildTrailingPosition( - const YGNodeRef node, - const YGNodeRef child, - const YGFlexDirection axis) { - const float size = child->getLayout().measuredDimensions[dim[axis]]; - child->setLayoutPosition( - node->getLayout().measuredDimensions[dim[axis]] - size - - child->getLayout().position[pos[axis]], - trailing[axis]); -} - -static void YGConstrainMaxSizeForMode( - const YGNodeRef node, - const enum YGFlexDirection axis, - const float ownerAxisSize, - const float ownerWidth, - YGMeasureMode* mode, - float* size) { - const YGFloatOptional maxSize = - YGResolveValue(node->getStyle().maxDimensions[dim[axis]], ownerAxisSize) + - YGFloatOptional(node->getMarginForAxis(axis, ownerWidth)); - switch (*mode) { - case YGMeasureModeExactly: - case YGMeasureModeAtMost: - *size = (maxSize.isUndefined() || *size < maxSize.unwrap()) - ? *size - : maxSize.unwrap(); - break; - case YGMeasureModeUndefined: - if (!maxSize.isUndefined()) { - *mode = YGMeasureModeAtMost; - *size = maxSize.unwrap(); - } - break; - } -} - -static void YGNodeComputeFlexBasisForChild( - const YGNodeRef node, - const YGNodeRef child, - const float width, - const YGMeasureMode widthMode, - const float height, - const float ownerWidth, - const float ownerHeight, - const YGMeasureMode heightMode, - const YGDirection direction, - const YGConfigRef config, - YGMarkerLayoutData& layoutMarkerData) { - const YGFlexDirection mainAxis = - YGResolveFlexDirection(node->getStyle().flexDirection, direction); - const bool isMainAxisRow = YGFlexDirectionIsRow(mainAxis); - const float mainAxisSize = isMainAxisRow ? width : height; - const float mainAxisownerSize = isMainAxisRow ? ownerWidth : ownerHeight; - - float childWidth; - float childHeight; - YGMeasureMode childWidthMeasureMode; - YGMeasureMode childHeightMeasureMode; - - const YGFloatOptional resolvedFlexBasis = - YGResolveValue(child->resolveFlexBasisPtr(), mainAxisownerSize); - const bool isRowStyleDimDefined = - YGNodeIsStyleDimDefined(child, YGFlexDirectionRow, ownerWidth); - const bool isColumnStyleDimDefined = - YGNodeIsStyleDimDefined(child, YGFlexDirectionColumn, ownerHeight); - - if (!resolvedFlexBasis.isUndefined() && !YGFloatIsUndefined(mainAxisSize)) { - if (child->getLayout().computedFlexBasis.isUndefined() || - (YGConfigIsExperimentalFeatureEnabled( - child->getConfig(), YGExperimentalFeatureWebFlexBasis) && - child->getLayout().computedFlexBasisGeneration != - gCurrentGenerationCount)) { - const YGFloatOptional paddingAndBorder = YGFloatOptional( - YGNodePaddingAndBorderForAxis(child, mainAxis, ownerWidth)); - child->setLayoutComputedFlexBasis( - YGFloatOptionalMax(resolvedFlexBasis, paddingAndBorder)); - } - } else if (isMainAxisRow && isRowStyleDimDefined) { - // The width is definite, so use that as the flex basis. - const YGFloatOptional paddingAndBorder = YGFloatOptional( - YGNodePaddingAndBorderForAxis(child, YGFlexDirectionRow, ownerWidth)); - - child->setLayoutComputedFlexBasis(YGFloatOptionalMax( - YGResolveValue( - child->getResolvedDimension(YGDimensionWidth), ownerWidth), - paddingAndBorder)); - } else if (!isMainAxisRow && isColumnStyleDimDefined) { - // The height is definite, so use that as the flex basis. - const YGFloatOptional paddingAndBorder = - YGFloatOptional(YGNodePaddingAndBorderForAxis( - child, YGFlexDirectionColumn, ownerWidth)); - child->setLayoutComputedFlexBasis(YGFloatOptionalMax( - YGResolveValue( - child->getResolvedDimension(YGDimensionHeight), ownerHeight), - paddingAndBorder)); - } else { - // Compute the flex basis and hypothetical main size (i.e. the clamped flex - // basis). - childWidth = YGUndefined; - childHeight = YGUndefined; - childWidthMeasureMode = YGMeasureModeUndefined; - childHeightMeasureMode = YGMeasureModeUndefined; - - auto marginRow = - child->getMarginForAxis(YGFlexDirectionRow, ownerWidth).unwrap(); - auto marginColumn = - child->getMarginForAxis(YGFlexDirectionColumn, ownerWidth).unwrap(); - - if (isRowStyleDimDefined) { - childWidth = - YGResolveValue( - child->getResolvedDimension(YGDimensionWidth), ownerWidth) - .unwrap() + - marginRow; - childWidthMeasureMode = YGMeasureModeExactly; - } - if (isColumnStyleDimDefined) { - childHeight = - YGResolveValue( - child->getResolvedDimension(YGDimensionHeight), ownerHeight) - .unwrap() + - marginColumn; - childHeightMeasureMode = YGMeasureModeExactly; - } - - // The W3C spec doesn't say anything about the 'overflow' property, but all - // major browsers appear to implement the following logic. - if ((!isMainAxisRow && node->getStyle().overflow == YGOverflowScroll) || - node->getStyle().overflow != YGOverflowScroll) { - if (YGFloatIsUndefined(childWidth) && !YGFloatIsUndefined(width)) { - childWidth = width; - childWidthMeasureMode = YGMeasureModeAtMost; - } - } - - if ((isMainAxisRow && node->getStyle().overflow == YGOverflowScroll) || - node->getStyle().overflow != YGOverflowScroll) { - if (YGFloatIsUndefined(childHeight) && !YGFloatIsUndefined(height)) { - childHeight = height; - childHeightMeasureMode = YGMeasureModeAtMost; - } - } - - if (!child->getStyle().aspectRatio.isUndefined()) { - if (!isMainAxisRow && childWidthMeasureMode == YGMeasureModeExactly) { - childHeight = marginColumn + - (childWidth - marginRow) / child->getStyle().aspectRatio.unwrap(); - childHeightMeasureMode = YGMeasureModeExactly; - } else if ( - isMainAxisRow && childHeightMeasureMode == YGMeasureModeExactly) { - childWidth = marginRow + - (childHeight - marginColumn) * - child->getStyle().aspectRatio.unwrap(); - childWidthMeasureMode = YGMeasureModeExactly; - } - } - - // If child has no defined size in the cross axis and is set to stretch, set - // the cross axis to be measured exactly with the available inner width - - const bool hasExactWidth = - !YGFloatIsUndefined(width) && widthMode == YGMeasureModeExactly; - const bool childWidthStretch = - YGNodeAlignItem(node, child) == YGAlignStretch && - childWidthMeasureMode != YGMeasureModeExactly; - if (!isMainAxisRow && !isRowStyleDimDefined && hasExactWidth && - childWidthStretch) { - childWidth = width; - childWidthMeasureMode = YGMeasureModeExactly; - if (!child->getStyle().aspectRatio.isUndefined()) { - childHeight = - (childWidth - marginRow) / child->getStyle().aspectRatio.unwrap(); - childHeightMeasureMode = YGMeasureModeExactly; - } - } - - const bool hasExactHeight = - !YGFloatIsUndefined(height) && heightMode == YGMeasureModeExactly; - const bool childHeightStretch = - YGNodeAlignItem(node, child) == YGAlignStretch && - childHeightMeasureMode != YGMeasureModeExactly; - if (isMainAxisRow && !isColumnStyleDimDefined && hasExactHeight && - childHeightStretch) { - childHeight = height; - childHeightMeasureMode = YGMeasureModeExactly; - - if (!child->getStyle().aspectRatio.isUndefined()) { - childWidth = (childHeight - marginColumn) * - child->getStyle().aspectRatio.unwrap(); - childWidthMeasureMode = YGMeasureModeExactly; - } - } - - YGConstrainMaxSizeForMode( - child, - YGFlexDirectionRow, - ownerWidth, - ownerWidth, - &childWidthMeasureMode, - &childWidth); - YGConstrainMaxSizeForMode( - child, - YGFlexDirectionColumn, - ownerHeight, - ownerWidth, - &childHeightMeasureMode, - &childHeight); - - // Measure the child - YGLayoutNodeInternal( - child, - childWidth, - childHeight, - direction, - childWidthMeasureMode, - childHeightMeasureMode, - ownerWidth, - ownerHeight, - false, - "measure", - config, - layoutMarkerData); - - child->setLayoutComputedFlexBasis(YGFloatOptional(YGFloatMax( - child->getLayout().measuredDimensions[dim[mainAxis]], - YGNodePaddingAndBorderForAxis(child, mainAxis, ownerWidth)))); - } - child->setLayoutComputedFlexBasisGeneration(gCurrentGenerationCount); -} - -static void YGNodeAbsoluteLayoutChild( - const YGNodeRef node, - const YGNodeRef child, - const float width, - const YGMeasureMode widthMode, - const float height, - const YGDirection direction, - const YGConfigRef config, - YGMarkerLayoutData& layoutMarkerData) { - const YGFlexDirection mainAxis = - YGResolveFlexDirection(node->getStyle().flexDirection, direction); - const YGFlexDirection crossAxis = YGFlexDirectionCross(mainAxis, direction); - const bool isMainAxisRow = YGFlexDirectionIsRow(mainAxis); - - float childWidth = YGUndefined; - float childHeight = YGUndefined; - YGMeasureMode childWidthMeasureMode = YGMeasureModeUndefined; - YGMeasureMode childHeightMeasureMode = YGMeasureModeUndefined; - - auto marginRow = child->getMarginForAxis(YGFlexDirectionRow, width).unwrap(); - auto marginColumn = - child->getMarginForAxis(YGFlexDirectionColumn, width).unwrap(); - - if (YGNodeIsStyleDimDefined(child, YGFlexDirectionRow, width)) { - childWidth = - YGResolveValue(child->getResolvedDimension(YGDimensionWidth), width) - .unwrap() + - marginRow; - } else { - // If the child doesn't have a specified width, compute the width based on - // the left/right offsets if they're defined. - if (child->isLeadingPositionDefined(YGFlexDirectionRow) && - child->isTrailingPosDefined(YGFlexDirectionRow)) { - childWidth = node->getLayout().measuredDimensions[YGDimensionWidth] - - (node->getLeadingBorder(YGFlexDirectionRow) + - node->getTrailingBorder(YGFlexDirectionRow)) - - (child->getLeadingPosition(YGFlexDirectionRow, width) + - child->getTrailingPosition(YGFlexDirectionRow, width)) - .unwrap(); - childWidth = - YGNodeBoundAxis(child, YGFlexDirectionRow, childWidth, width, width); - } - } - - if (YGNodeIsStyleDimDefined(child, YGFlexDirectionColumn, height)) { - childHeight = - YGResolveValue(child->getResolvedDimension(YGDimensionHeight), height) - .unwrap() + - marginColumn; - } else { - // If the child doesn't have a specified height, compute the height based on - // the top/bottom offsets if they're defined. - if (child->isLeadingPositionDefined(YGFlexDirectionColumn) && - child->isTrailingPosDefined(YGFlexDirectionColumn)) { - childHeight = node->getLayout().measuredDimensions[YGDimensionHeight] - - (node->getLeadingBorder(YGFlexDirectionColumn) + - node->getTrailingBorder(YGFlexDirectionColumn)) - - (child->getLeadingPosition(YGFlexDirectionColumn, height) + - child->getTrailingPosition(YGFlexDirectionColumn, height)) - .unwrap(); - childHeight = YGNodeBoundAxis( - child, YGFlexDirectionColumn, childHeight, height, width); - } - } - - // Exactly one dimension needs to be defined for us to be able to do aspect - // ratio calculation. One dimension being the anchor and the other being - // flexible. - if (YGFloatIsUndefined(childWidth) ^ YGFloatIsUndefined(childHeight)) { - if (!child->getStyle().aspectRatio.isUndefined()) { - if (YGFloatIsUndefined(childWidth)) { - childWidth = marginRow + - (childHeight - marginColumn) * - child->getStyle().aspectRatio.unwrap(); - } else if (YGFloatIsUndefined(childHeight)) { - childHeight = marginColumn + - (childWidth - marginRow) / child->getStyle().aspectRatio.unwrap(); - } - } - } - - // If we're still missing one or the other dimension, measure the content. - if (YGFloatIsUndefined(childWidth) || YGFloatIsUndefined(childHeight)) { - childWidthMeasureMode = YGFloatIsUndefined(childWidth) - ? YGMeasureModeUndefined - : YGMeasureModeExactly; - childHeightMeasureMode = YGFloatIsUndefined(childHeight) - ? YGMeasureModeUndefined - : YGMeasureModeExactly; - - // If the size of the owner is defined then try to constrain the absolute - // child to that size as well. This allows text within the absolute child to - // wrap to the size of its owner. This is the same behavior as many browsers - // implement. - if (!isMainAxisRow && YGFloatIsUndefined(childWidth) && - widthMode != YGMeasureModeUndefined && !YGFloatIsUndefined(width) && - width > 0) { - childWidth = width; - childWidthMeasureMode = YGMeasureModeAtMost; - } - - YGLayoutNodeInternal( - child, - childWidth, - childHeight, - direction, - childWidthMeasureMode, - childHeightMeasureMode, - childWidth, - childHeight, - false, - "abs-measure", - config, - layoutMarkerData); - childWidth = child->getLayout().measuredDimensions[YGDimensionWidth] + - child->getMarginForAxis(YGFlexDirectionRow, width).unwrap(); - childHeight = child->getLayout().measuredDimensions[YGDimensionHeight] + - child->getMarginForAxis(YGFlexDirectionColumn, width).unwrap(); - } - - YGLayoutNodeInternal( - child, - childWidth, - childHeight, - direction, - YGMeasureModeExactly, - YGMeasureModeExactly, - childWidth, - childHeight, - true, - "abs-layout", - config, - layoutMarkerData); - - if (child->isTrailingPosDefined(mainAxis) && - !child->isLeadingPositionDefined(mainAxis)) { - child->setLayoutPosition( - node->getLayout().measuredDimensions[dim[mainAxis]] - - child->getLayout().measuredDimensions[dim[mainAxis]] - - node->getTrailingBorder(mainAxis) - - child->getTrailingMargin(mainAxis, width).unwrap() - - child->getTrailingPosition(mainAxis, isMainAxisRow ? width : height) - .unwrap(), - leading[mainAxis]); - } else if ( - !child->isLeadingPositionDefined(mainAxis) && - node->getStyle().justifyContent == YGJustifyCenter) { - child->setLayoutPosition( - (node->getLayout().measuredDimensions[dim[mainAxis]] - - child->getLayout().measuredDimensions[dim[mainAxis]]) / - 2.0f, - leading[mainAxis]); - } else if ( - !child->isLeadingPositionDefined(mainAxis) && - node->getStyle().justifyContent == YGJustifyFlexEnd) { - child->setLayoutPosition( - (node->getLayout().measuredDimensions[dim[mainAxis]] - - child->getLayout().measuredDimensions[dim[mainAxis]]), - leading[mainAxis]); - } - - if (child->isTrailingPosDefined(crossAxis) && - !child->isLeadingPositionDefined(crossAxis)) { - child->setLayoutPosition( - node->getLayout().measuredDimensions[dim[crossAxis]] - - child->getLayout().measuredDimensions[dim[crossAxis]] - - node->getTrailingBorder(crossAxis) - - child->getTrailingMargin(crossAxis, width).unwrap() - - child - ->getTrailingPosition(crossAxis, isMainAxisRow ? height : width) - .unwrap(), - leading[crossAxis]); - - } else if ( - !child->isLeadingPositionDefined(crossAxis) && - YGNodeAlignItem(node, child) == YGAlignCenter) { - child->setLayoutPosition( - (node->getLayout().measuredDimensions[dim[crossAxis]] - - child->getLayout().measuredDimensions[dim[crossAxis]]) / - 2.0f, - leading[crossAxis]); - } else if ( - !child->isLeadingPositionDefined(crossAxis) && - ((YGNodeAlignItem(node, child) == YGAlignFlexEnd) ^ - (node->getStyle().flexWrap == YGWrapWrapReverse))) { - child->setLayoutPosition( - (node->getLayout().measuredDimensions[dim[crossAxis]] - - child->getLayout().measuredDimensions[dim[crossAxis]]), - leading[crossAxis]); - } -} - -static void YGNodeWithMeasureFuncSetMeasuredDimensions( - const YGNodeRef node, - const float availableWidth, - const float availableHeight, - const YGMeasureMode widthMeasureMode, - const YGMeasureMode heightMeasureMode, - const float ownerWidth, - const float ownerHeight) { - YGAssertWithNode( - node, - node->getMeasure() != nullptr, - "Expected node to have custom measure function"); - - const float paddingAndBorderAxisRow = - YGNodePaddingAndBorderForAxis(node, YGFlexDirectionRow, availableWidth); - const float paddingAndBorderAxisColumn = YGNodePaddingAndBorderForAxis( - node, YGFlexDirectionColumn, availableWidth); - const float marginAxisRow = - node->getMarginForAxis(YGFlexDirectionRow, availableWidth).unwrap(); - const float marginAxisColumn = - node->getMarginForAxis(YGFlexDirectionColumn, availableWidth).unwrap(); - - // We want to make sure we don't call measure with negative size - const float innerWidth = YGFloatIsUndefined(availableWidth) - ? availableWidth - : YGFloatMax(0, availableWidth - marginAxisRow - paddingAndBorderAxisRow); - const float innerHeight = YGFloatIsUndefined(availableHeight) - ? availableHeight - : YGFloatMax( - 0, availableHeight - marginAxisColumn - paddingAndBorderAxisColumn); - - if (widthMeasureMode == YGMeasureModeExactly && - heightMeasureMode == YGMeasureModeExactly) { - // Don't bother sizing the text if both dimensions are already defined. - node->setLayoutMeasuredDimension( - YGNodeBoundAxis( - node, - YGFlexDirectionRow, - availableWidth - marginAxisRow, - ownerWidth, - ownerWidth), - YGDimensionWidth); - node->setLayoutMeasuredDimension( - YGNodeBoundAxis( - node, - YGFlexDirectionColumn, - availableHeight - marginAxisColumn, - ownerHeight, - ownerWidth), - YGDimensionHeight); - } else { - // Measure the text under the current constraints. - const YGSize measuredSize = marker::MarkerSection::wrap( - node, - node->getMeasure(), - node, - innerWidth, - widthMeasureMode, - innerHeight, - heightMeasureMode); - - node->setLayoutMeasuredDimension( - YGNodeBoundAxis( - node, - YGFlexDirectionRow, - (widthMeasureMode == YGMeasureModeUndefined || - widthMeasureMode == YGMeasureModeAtMost) - ? measuredSize.width + paddingAndBorderAxisRow - : availableWidth - marginAxisRow, - ownerWidth, - ownerWidth), - YGDimensionWidth); - - node->setLayoutMeasuredDimension( - YGNodeBoundAxis( - node, - YGFlexDirectionColumn, - (heightMeasureMode == YGMeasureModeUndefined || - heightMeasureMode == YGMeasureModeAtMost) - ? measuredSize.height + paddingAndBorderAxisColumn - : availableHeight - marginAxisColumn, - ownerHeight, - ownerWidth), - YGDimensionHeight); - } -} - -// For nodes with no children, use the available values if they were provided, -// or the minimum size as indicated by the padding and border sizes. -static void YGNodeEmptyContainerSetMeasuredDimensions( - const YGNodeRef node, - const float availableWidth, - const float availableHeight, - const YGMeasureMode widthMeasureMode, - const YGMeasureMode heightMeasureMode, - const float ownerWidth, - const float ownerHeight) { - const float paddingAndBorderAxisRow = - YGNodePaddingAndBorderForAxis(node, YGFlexDirectionRow, ownerWidth); - const float paddingAndBorderAxisColumn = - YGNodePaddingAndBorderForAxis(node, YGFlexDirectionColumn, ownerWidth); - const float marginAxisRow = - node->getMarginForAxis(YGFlexDirectionRow, ownerWidth).unwrap(); - const float marginAxisColumn = - node->getMarginForAxis(YGFlexDirectionColumn, ownerWidth).unwrap(); - - node->setLayoutMeasuredDimension( - YGNodeBoundAxis( - node, - YGFlexDirectionRow, - (widthMeasureMode == YGMeasureModeUndefined || - widthMeasureMode == YGMeasureModeAtMost) - ? paddingAndBorderAxisRow - : availableWidth - marginAxisRow, - ownerWidth, - ownerWidth), - YGDimensionWidth); - - node->setLayoutMeasuredDimension( - YGNodeBoundAxis( - node, - YGFlexDirectionColumn, - (heightMeasureMode == YGMeasureModeUndefined || - heightMeasureMode == YGMeasureModeAtMost) - ? paddingAndBorderAxisColumn - : availableHeight - marginAxisColumn, - ownerHeight, - ownerWidth), - YGDimensionHeight); -} - -static bool YGNodeFixedSizeSetMeasuredDimensions( - const YGNodeRef node, - const float availableWidth, - const float availableHeight, - const YGMeasureMode widthMeasureMode, - const YGMeasureMode heightMeasureMode, - const float ownerWidth, - const float ownerHeight) { - if ((!YGFloatIsUndefined(availableWidth) && - widthMeasureMode == YGMeasureModeAtMost && availableWidth <= 0.0f) || - (!YGFloatIsUndefined(availableHeight) && - heightMeasureMode == YGMeasureModeAtMost && availableHeight <= 0.0f) || - (widthMeasureMode == YGMeasureModeExactly && - heightMeasureMode == YGMeasureModeExactly)) { - auto marginAxisColumn = - node->getMarginForAxis(YGFlexDirectionColumn, ownerWidth).unwrap(); - auto marginAxisRow = - node->getMarginForAxis(YGFlexDirectionRow, ownerWidth).unwrap(); - - node->setLayoutMeasuredDimension( - YGNodeBoundAxis( - node, - YGFlexDirectionRow, - YGFloatIsUndefined(availableWidth) || - (widthMeasureMode == YGMeasureModeAtMost && - availableWidth < 0.0f) - ? 0.0f - : availableWidth - marginAxisRow, - ownerWidth, - ownerWidth), - YGDimensionWidth); - - node->setLayoutMeasuredDimension( - YGNodeBoundAxis( - node, - YGFlexDirectionColumn, - YGFloatIsUndefined(availableHeight) || - (heightMeasureMode == YGMeasureModeAtMost && - availableHeight < 0.0f) - ? 0.0f - : availableHeight - marginAxisColumn, - ownerHeight, - ownerWidth), - YGDimensionHeight); - return true; - } - - return false; -} - -static void YGZeroOutLayoutRecursivly(const YGNodeRef node) { - node->getLayout() = {}; - node->setLayoutDimension(0, 0); - node->setLayoutDimension(0, 1); - node->setHasNewLayout(true); - node->cloneChildrenIfNeeded(); - const uint32_t childCount = YGNodeGetChildCount(node); - for (uint32_t i = 0; i < childCount; i++) { - const YGNodeRef child = node->getChild(i); - YGZeroOutLayoutRecursivly(child); - } -} - -static float YGNodeCalculateAvailableInnerDim( - const YGNodeRef node, - YGFlexDirection axis, - float availableDim, - float ownerDim) { - YGFlexDirection direction = - YGFlexDirectionIsRow(axis) ? YGFlexDirectionRow : YGFlexDirectionColumn; - YGDimension dimension = - YGFlexDirectionIsRow(axis) ? YGDimensionWidth : YGDimensionHeight; - - const float margin = node->getMarginForAxis(direction, ownerDim).unwrap(); - const float paddingAndBorder = - YGNodePaddingAndBorderForAxis(node, direction, ownerDim); - - float availableInnerDim = availableDim - margin - paddingAndBorder; - // Max dimension overrides predefined dimension value; Min dimension in turn - // overrides both of the above - if (!YGFloatIsUndefined(availableInnerDim)) { - // We want to make sure our available height does not violate min and max - // constraints - const YGFloatOptional minDimensionOptional = - YGResolveValue(node->getStyle().minDimensions[dimension], ownerDim); - const float minInnerDim = minDimensionOptional.isUndefined() - ? 0.0f - : minDimensionOptional.unwrap() - paddingAndBorder; - - const YGFloatOptional maxDimensionOptional = - YGResolveValue(node->getStyle().maxDimensions[dimension], ownerDim); - - const float maxInnerDim = maxDimensionOptional.isUndefined() - ? FLT_MAX - : maxDimensionOptional.unwrap() - paddingAndBorder; - availableInnerDim = - YGFloatMax(YGFloatMin(availableInnerDim, maxInnerDim), minInnerDim); - } - - return availableInnerDim; -} - -static float YGNodeComputeFlexBasisForChildren( - const YGNodeRef node, - const float availableInnerWidth, - const float availableInnerHeight, - YGMeasureMode widthMeasureMode, - YGMeasureMode heightMeasureMode, - YGDirection direction, - YGFlexDirection mainAxis, - const YGConfigRef config, - bool performLayout, - YGMarkerLayoutData& layoutMarkerData) { - float totalOuterFlexBasis = 0.0f; - YGNodeRef singleFlexChild = nullptr; - YGVector children = node->getChildren(); - YGMeasureMode measureModeMainDim = - YGFlexDirectionIsRow(mainAxis) ? widthMeasureMode : heightMeasureMode; - // If there is only one child with flexGrow + flexShrink it means we can set - // the computedFlexBasis to 0 instead of measuring and shrinking / flexing the - // child to exactly match the remaining space - if (measureModeMainDim == YGMeasureModeExactly) { - for (auto child : children) { - if (child->isNodeFlexible()) { - if (singleFlexChild != nullptr || - YGFloatsEqual(child->resolveFlexGrow(), 0.0f) || - YGFloatsEqual(child->resolveFlexShrink(), 0.0f)) { - // There is already a flexible child, or this flexible child doesn't - // have flexGrow and flexShrink, abort - singleFlexChild = nullptr; - break; - } else { - singleFlexChild = child; - } - } - } - } - - for (auto child : children) { - child->resolveDimension(); - if (child->getStyle().display == YGDisplayNone) { - YGZeroOutLayoutRecursivly(child); - child->setHasNewLayout(true); - child->setDirty(false); - continue; - } - if (performLayout) { - // Set the initial position (relative to the owner). - const YGDirection childDirection = child->resolveDirection(direction); - const float mainDim = YGFlexDirectionIsRow(mainAxis) - ? availableInnerWidth - : availableInnerHeight; - const float crossDim = YGFlexDirectionIsRow(mainAxis) - ? availableInnerHeight - : availableInnerWidth; - child->setPosition( - childDirection, mainDim, crossDim, availableInnerWidth); - } - - if (child->getStyle().positionType == YGPositionTypeAbsolute) { - continue; - } - if (child == singleFlexChild) { - child->setLayoutComputedFlexBasisGeneration(gCurrentGenerationCount); - child->setLayoutComputedFlexBasis(YGFloatOptional(0)); - } else { - YGNodeComputeFlexBasisForChild( - node, - child, - availableInnerWidth, - widthMeasureMode, - availableInnerHeight, - availableInnerWidth, - availableInnerHeight, - heightMeasureMode, - direction, - config, - layoutMarkerData); - } - - totalOuterFlexBasis += - (child->getLayout().computedFlexBasis + - child->getMarginForAxis(mainAxis, availableInnerWidth)) - .unwrap(); - } - - return totalOuterFlexBasis; -} - -// This function assumes that all the children of node have their -// computedFlexBasis properly computed(To do this use -// YGNodeComputeFlexBasisForChildren function). This function calculates -// YGCollectFlexItemsRowMeasurement -static YGCollectFlexItemsRowValues YGCalculateCollectFlexItemsRowValues( - const YGNodeRef& node, - const YGDirection ownerDirection, - const float mainAxisownerSize, - const float availableInnerWidth, - const float availableInnerMainDim, - const uint32_t startOfLineIndex, - const uint32_t lineCount) { - YGCollectFlexItemsRowValues flexAlgoRowMeasurement = {}; - flexAlgoRowMeasurement.relativeChildren.reserve(node->getChildren().size()); - - float sizeConsumedOnCurrentLineIncludingMinConstraint = 0; - const YGFlexDirection mainAxis = YGResolveFlexDirection( - node->getStyle().flexDirection, node->resolveDirection(ownerDirection)); - const bool isNodeFlexWrap = node->getStyle().flexWrap != YGWrapNoWrap; - - // Add items to the current line until it's full or we run out of items. - uint32_t endOfLineIndex = startOfLineIndex; - for (; endOfLineIndex < node->getChildren().size(); endOfLineIndex++) { - const YGNodeRef child = node->getChild(endOfLineIndex); - if (child->getStyle().display == YGDisplayNone || - child->getStyle().positionType == YGPositionTypeAbsolute) { - continue; - } - child->setLineIndex(lineCount); - const float childMarginMainAxis = - child->getMarginForAxis(mainAxis, availableInnerWidth).unwrap(); - const float flexBasisWithMinAndMaxConstraints = - YGNodeBoundAxisWithinMinAndMax( - child, - mainAxis, - child->getLayout().computedFlexBasis, - mainAxisownerSize) - .unwrap(); - - // If this is a multi-line flow and this item pushes us over the available - // size, we've hit the end of the current line. Break out of the loop and - // lay out the current line. - if (sizeConsumedOnCurrentLineIncludingMinConstraint + - flexBasisWithMinAndMaxConstraints + childMarginMainAxis > - availableInnerMainDim && - isNodeFlexWrap && flexAlgoRowMeasurement.itemsOnLine > 0) { - break; - } - - sizeConsumedOnCurrentLineIncludingMinConstraint += - flexBasisWithMinAndMaxConstraints + childMarginMainAxis; - flexAlgoRowMeasurement.sizeConsumedOnCurrentLine += - flexBasisWithMinAndMaxConstraints + childMarginMainAxis; - flexAlgoRowMeasurement.itemsOnLine++; - - if (child->isNodeFlexible()) { - flexAlgoRowMeasurement.totalFlexGrowFactors += child->resolveFlexGrow(); - - // Unlike the grow factor, the shrink factor is scaled relative to the - // child dimension. - flexAlgoRowMeasurement.totalFlexShrinkScaledFactors += - -child->resolveFlexShrink() * - child->getLayout().computedFlexBasis.unwrap(); - } - - flexAlgoRowMeasurement.relativeChildren.push_back(child); - } - - // The total flex factor needs to be floored to 1. - if (flexAlgoRowMeasurement.totalFlexGrowFactors > 0 && - flexAlgoRowMeasurement.totalFlexGrowFactors < 1) { - flexAlgoRowMeasurement.totalFlexGrowFactors = 1; - } - - // The total flex shrink factor needs to be floored to 1. - if (flexAlgoRowMeasurement.totalFlexShrinkScaledFactors > 0 && - flexAlgoRowMeasurement.totalFlexShrinkScaledFactors < 1) { - flexAlgoRowMeasurement.totalFlexShrinkScaledFactors = 1; - } - flexAlgoRowMeasurement.endOfLineIndex = endOfLineIndex; - return flexAlgoRowMeasurement; -} - -// It distributes the free space to the flexible items and ensures that the size -// of the flex items abide the min and max constraints. At the end of this -// function the child nodes would have proper size. Prior using this function -// please ensure that YGDistributeFreeSpaceFirstPass is called. -static float YGDistributeFreeSpaceSecondPass( - YGCollectFlexItemsRowValues& collectedFlexItemsValues, - const YGNodeRef node, - const YGFlexDirection mainAxis, - const YGFlexDirection crossAxis, - const float mainAxisownerSize, - const float availableInnerMainDim, - const float availableInnerCrossDim, - const float availableInnerWidth, - const float availableInnerHeight, - const bool flexBasisOverflows, - const YGMeasureMode measureModeCrossDim, - const bool performLayout, - const YGConfigRef config, - YGMarkerLayoutData& layoutMarkerData) { - float childFlexBasis = 0; - float flexShrinkScaledFactor = 0; - float flexGrowFactor = 0; - float deltaFreeSpace = 0; - const bool isMainAxisRow = YGFlexDirectionIsRow(mainAxis); - const bool isNodeFlexWrap = node->getStyle().flexWrap != YGWrapNoWrap; - - for (auto currentRelativeChild : collectedFlexItemsValues.relativeChildren) { - childFlexBasis = YGNodeBoundAxisWithinMinAndMax( - currentRelativeChild, - mainAxis, - currentRelativeChild->getLayout().computedFlexBasis, - mainAxisownerSize) - .unwrap(); - float updatedMainSize = childFlexBasis; - - if (!YGFloatIsUndefined(collectedFlexItemsValues.remainingFreeSpace) && - collectedFlexItemsValues.remainingFreeSpace < 0) { - flexShrinkScaledFactor = - -currentRelativeChild->resolveFlexShrink() * childFlexBasis; - // Is this child able to shrink? - if (flexShrinkScaledFactor != 0) { - float childSize; - - if (!YGFloatIsUndefined( - collectedFlexItemsValues.totalFlexShrinkScaledFactors) && - collectedFlexItemsValues.totalFlexShrinkScaledFactors == 0) { - childSize = childFlexBasis + flexShrinkScaledFactor; - } else { - childSize = childFlexBasis + - (collectedFlexItemsValues.remainingFreeSpace / - collectedFlexItemsValues.totalFlexShrinkScaledFactors) * - flexShrinkScaledFactor; - } - - updatedMainSize = YGNodeBoundAxis( - currentRelativeChild, - mainAxis, - childSize, - availableInnerMainDim, - availableInnerWidth); - } - } else if ( - !YGFloatIsUndefined(collectedFlexItemsValues.remainingFreeSpace) && - collectedFlexItemsValues.remainingFreeSpace > 0) { - flexGrowFactor = currentRelativeChild->resolveFlexGrow(); - - // Is this child able to grow? - if (!YGFloatIsUndefined(flexGrowFactor) && flexGrowFactor != 0) { - updatedMainSize = YGNodeBoundAxis( - currentRelativeChild, - mainAxis, - childFlexBasis + - collectedFlexItemsValues.remainingFreeSpace / - collectedFlexItemsValues.totalFlexGrowFactors * - flexGrowFactor, - availableInnerMainDim, - availableInnerWidth); - } - } - - deltaFreeSpace += updatedMainSize - childFlexBasis; - - const float marginMain = - currentRelativeChild->getMarginForAxis(mainAxis, availableInnerWidth) - .unwrap(); - const float marginCross = - currentRelativeChild->getMarginForAxis(crossAxis, availableInnerWidth) - .unwrap(); - - float childCrossSize; - float childMainSize = updatedMainSize + marginMain; - YGMeasureMode childCrossMeasureMode; - YGMeasureMode childMainMeasureMode = YGMeasureModeExactly; - - if (!currentRelativeChild->getStyle().aspectRatio.isUndefined()) { - childCrossSize = isMainAxisRow ? (childMainSize - marginMain) / - currentRelativeChild->getStyle().aspectRatio.unwrap() - : (childMainSize - marginMain) * - currentRelativeChild->getStyle().aspectRatio.unwrap(); - childCrossMeasureMode = YGMeasureModeExactly; - - childCrossSize += marginCross; - } else if ( - !YGFloatIsUndefined(availableInnerCrossDim) && - !YGNodeIsStyleDimDefined( - currentRelativeChild, crossAxis, availableInnerCrossDim) && - measureModeCrossDim == YGMeasureModeExactly && - !(isNodeFlexWrap && flexBasisOverflows) && - YGNodeAlignItem(node, currentRelativeChild) == YGAlignStretch && - currentRelativeChild->marginLeadingValue(crossAxis).unit != - YGUnitAuto && - currentRelativeChild->marginTrailingValue(crossAxis).unit != - YGUnitAuto) { - childCrossSize = availableInnerCrossDim; - childCrossMeasureMode = YGMeasureModeExactly; - } else if (!YGNodeIsStyleDimDefined( - currentRelativeChild, crossAxis, availableInnerCrossDim)) { - childCrossSize = availableInnerCrossDim; - childCrossMeasureMode = YGFloatIsUndefined(childCrossSize) - ? YGMeasureModeUndefined - : YGMeasureModeAtMost; - } else { - childCrossSize = - YGResolveValue( - currentRelativeChild->getResolvedDimension(dim[crossAxis]), - availableInnerCrossDim) - .unwrap() + - marginCross; - const bool isLoosePercentageMeasurement = - currentRelativeChild->getResolvedDimension(dim[crossAxis]).unit == - YGUnitPercent && - measureModeCrossDim != YGMeasureModeExactly; - childCrossMeasureMode = - YGFloatIsUndefined(childCrossSize) || isLoosePercentageMeasurement - ? YGMeasureModeUndefined - : YGMeasureModeExactly; - } - - YGConstrainMaxSizeForMode( - currentRelativeChild, - mainAxis, - availableInnerMainDim, - availableInnerWidth, - &childMainMeasureMode, - &childMainSize); - YGConstrainMaxSizeForMode( - currentRelativeChild, - crossAxis, - availableInnerCrossDim, - availableInnerWidth, - &childCrossMeasureMode, - &childCrossSize); - - const bool requiresStretchLayout = - !YGNodeIsStyleDimDefined( - currentRelativeChild, crossAxis, availableInnerCrossDim) && - YGNodeAlignItem(node, currentRelativeChild) == YGAlignStretch && - currentRelativeChild->marginLeadingValue(crossAxis).unit != - YGUnitAuto && - currentRelativeChild->marginTrailingValue(crossAxis).unit != YGUnitAuto; - - const float childWidth = isMainAxisRow ? childMainSize : childCrossSize; - const float childHeight = !isMainAxisRow ? childMainSize : childCrossSize; - - const YGMeasureMode childWidthMeasureMode = - isMainAxisRow ? childMainMeasureMode : childCrossMeasureMode; - const YGMeasureMode childHeightMeasureMode = - !isMainAxisRow ? childMainMeasureMode : childCrossMeasureMode; - - // Recursively call the layout algorithm for this child with the updated - // main size. - YGLayoutNodeInternal( - currentRelativeChild, - childWidth, - childHeight, - node->getLayout().direction, - childWidthMeasureMode, - childHeightMeasureMode, - availableInnerWidth, - availableInnerHeight, - performLayout && !requiresStretchLayout, - "flex", - config, - layoutMarkerData); - node->setLayoutHadOverflow( - node->getLayout().hadOverflow | - currentRelativeChild->getLayout().hadOverflow); - } - return deltaFreeSpace; -} - -// It distributes the free space to the flexible items.For those flexible items -// whose min and max constraints are triggered, those flex item's clamped size -// is removed from the remaingfreespace. -static void YGDistributeFreeSpaceFirstPass( - YGCollectFlexItemsRowValues& collectedFlexItemsValues, - const YGFlexDirection mainAxis, - const float mainAxisownerSize, - const float availableInnerMainDim, - const float availableInnerWidth) { - float flexShrinkScaledFactor = 0; - float flexGrowFactor = 0; - float baseMainSize = 0; - float boundMainSize = 0; - float deltaFreeSpace = 0; - - for (auto currentRelativeChild : collectedFlexItemsValues.relativeChildren) { - float childFlexBasis = - YGNodeBoundAxisWithinMinAndMax( - currentRelativeChild, - mainAxis, - currentRelativeChild->getLayout().computedFlexBasis, - mainAxisownerSize) - .unwrap(); - - if (collectedFlexItemsValues.remainingFreeSpace < 0) { - flexShrinkScaledFactor = - -currentRelativeChild->resolveFlexShrink() * childFlexBasis; - - // Is this child able to shrink? - if (!YGFloatIsUndefined(flexShrinkScaledFactor) && - flexShrinkScaledFactor != 0) { - baseMainSize = childFlexBasis + - collectedFlexItemsValues.remainingFreeSpace / - collectedFlexItemsValues.totalFlexShrinkScaledFactors * - flexShrinkScaledFactor; - boundMainSize = YGNodeBoundAxis( - currentRelativeChild, - mainAxis, - baseMainSize, - availableInnerMainDim, - availableInnerWidth); - if (!YGFloatIsUndefined(baseMainSize) && - !YGFloatIsUndefined(boundMainSize) && - baseMainSize != boundMainSize) { - // By excluding this item's size and flex factor from remaining, this - // item's min/max constraints should also trigger in the second pass - // resulting in the item's size calculation being identical in the - // first and second passes. - deltaFreeSpace += boundMainSize - childFlexBasis; - collectedFlexItemsValues.totalFlexShrinkScaledFactors -= - flexShrinkScaledFactor; - } - } - } else if ( - !YGFloatIsUndefined(collectedFlexItemsValues.remainingFreeSpace) && - collectedFlexItemsValues.remainingFreeSpace > 0) { - flexGrowFactor = currentRelativeChild->resolveFlexGrow(); - - // Is this child able to grow? - if (!YGFloatIsUndefined(flexGrowFactor) && flexGrowFactor != 0) { - baseMainSize = childFlexBasis + - collectedFlexItemsValues.remainingFreeSpace / - collectedFlexItemsValues.totalFlexGrowFactors * flexGrowFactor; - boundMainSize = YGNodeBoundAxis( - currentRelativeChild, - mainAxis, - baseMainSize, - availableInnerMainDim, - availableInnerWidth); - - if (!YGFloatIsUndefined(baseMainSize) && - !YGFloatIsUndefined(boundMainSize) && - baseMainSize != boundMainSize) { - // By excluding this item's size and flex factor from remaining, this - // item's min/max constraints should also trigger in the second pass - // resulting in the item's size calculation being identical in the - // first and second passes. - deltaFreeSpace += boundMainSize - childFlexBasis; - collectedFlexItemsValues.totalFlexGrowFactors -= flexGrowFactor; - } - } - } - } - collectedFlexItemsValues.remainingFreeSpace -= deltaFreeSpace; -} - -// Do two passes over the flex items to figure out how to distribute the -// remaining space. -// -// The first pass finds the items whose min/max constraints trigger, freezes -// them at those sizes, and excludes those sizes from the remaining space. -// -// The second pass sets the size of each flexible item. It distributes the -// remaining space amongst the items whose min/max constraints didn't trigger in -// the first pass. For the other items, it sets their sizes by forcing their -// min/max constraints to trigger again. -// -// This two pass approach for resolving min/max constraints deviates from the -// spec. The spec -// (https://www.w3.org/TR/CSS-flexbox-1/#resolve-flexible-lengths) describes a -// process that needs to be repeated a variable number of times. The algorithm -// implemented here won't handle all cases but it was simpler to implement and -// it mitigates performance concerns because we know exactly how many passes -// it'll do. -// -// At the end of this function the child nodes would have the proper size -// assigned to them. -// -static void YGResolveFlexibleLength( - const YGNodeRef node, - YGCollectFlexItemsRowValues& collectedFlexItemsValues, - const YGFlexDirection mainAxis, - const YGFlexDirection crossAxis, - const float mainAxisownerSize, - const float availableInnerMainDim, - const float availableInnerCrossDim, - const float availableInnerWidth, - const float availableInnerHeight, - const bool flexBasisOverflows, - const YGMeasureMode measureModeCrossDim, - const bool performLayout, - const YGConfigRef config, - YGMarkerLayoutData& layoutMarkerData) { - const float originalFreeSpace = collectedFlexItemsValues.remainingFreeSpace; - // First pass: detect the flex items whose min/max constraints trigger - YGDistributeFreeSpaceFirstPass( - collectedFlexItemsValues, - mainAxis, - mainAxisownerSize, - availableInnerMainDim, - availableInnerWidth); - - // Second pass: resolve the sizes of the flexible items - const float distributedFreeSpace = YGDistributeFreeSpaceSecondPass( - collectedFlexItemsValues, - node, - mainAxis, - crossAxis, - mainAxisownerSize, - availableInnerMainDim, - availableInnerCrossDim, - availableInnerWidth, - availableInnerHeight, - flexBasisOverflows, - measureModeCrossDim, - performLayout, - config, - layoutMarkerData); - - collectedFlexItemsValues.remainingFreeSpace = - originalFreeSpace - distributedFreeSpace; -} - -static void YGJustifyMainAxis( - const YGNodeRef node, - YGCollectFlexItemsRowValues& collectedFlexItemsValues, - const uint32_t startOfLineIndex, - const YGFlexDirection mainAxis, - const YGFlexDirection crossAxis, - const YGMeasureMode measureModeMainDim, - const YGMeasureMode measureModeCrossDim, - const float mainAxisownerSize, - const float ownerWidth, - const float availableInnerMainDim, - const float availableInnerCrossDim, - const float availableInnerWidth, - const bool performLayout) { - const YGStyle& style = node->getStyle(); - const float leadingPaddingAndBorderMain = - node->getLeadingPaddingAndBorder(mainAxis, ownerWidth).unwrap(); - const float trailingPaddingAndBorderMain = - node->getTrailingPaddingAndBorder(mainAxis, ownerWidth).unwrap(); - // If we are using "at most" rules in the main axis, make sure that - // remainingFreeSpace is 0 when min main dimension is not given - if (measureModeMainDim == YGMeasureModeAtMost && - collectedFlexItemsValues.remainingFreeSpace > 0) { - if (!style.minDimensions[dim[mainAxis]].isUndefined() && - !YGResolveValue(style.minDimensions[dim[mainAxis]], mainAxisownerSize) - .isUndefined()) { - // This condition makes sure that if the size of main dimension(after - // considering child nodes main dim, leading and trailing padding etc) - // falls below min dimension, then the remainingFreeSpace is reassigned - // considering the min dimension - - // `minAvailableMainDim` denotes minimum available space in which child - // can be laid out, it will exclude space consumed by padding and border. - const float minAvailableMainDim = - YGResolveValue(style.minDimensions[dim[mainAxis]], mainAxisownerSize) - .unwrap() - - leadingPaddingAndBorderMain - trailingPaddingAndBorderMain; - const float occupiedSpaceByChildNodes = - availableInnerMainDim - collectedFlexItemsValues.remainingFreeSpace; - collectedFlexItemsValues.remainingFreeSpace = - YGFloatMax(0, minAvailableMainDim - occupiedSpaceByChildNodes); - } else { - collectedFlexItemsValues.remainingFreeSpace = 0; - } - } - - int numberOfAutoMarginsOnCurrentLine = 0; - for (uint32_t i = startOfLineIndex; - i < collectedFlexItemsValues.endOfLineIndex; - i++) { - const YGNodeRef child = node->getChild(i); - if (child->getStyle().positionType == YGPositionTypeRelative) { - if (child->marginLeadingValue(mainAxis).unit == YGUnitAuto) { - numberOfAutoMarginsOnCurrentLine++; - } - if (child->marginTrailingValue(mainAxis).unit == YGUnitAuto) { - numberOfAutoMarginsOnCurrentLine++; - } - } - } - - // In order to position the elements in the main axis, we have two controls. - // The space between the beginning and the first element and the space between - // each two elements. - float leadingMainDim = 0; - float betweenMainDim = 0; - const YGJustify justifyContent = node->getStyle().justifyContent; - - if (numberOfAutoMarginsOnCurrentLine == 0) { - switch (justifyContent) { - case YGJustifyCenter: - leadingMainDim = collectedFlexItemsValues.remainingFreeSpace / 2; - break; - case YGJustifyFlexEnd: - leadingMainDim = collectedFlexItemsValues.remainingFreeSpace; - break; - case YGJustifySpaceBetween: - if (collectedFlexItemsValues.itemsOnLine > 1) { - betweenMainDim = - YGFloatMax(collectedFlexItemsValues.remainingFreeSpace, 0) / - (collectedFlexItemsValues.itemsOnLine - 1); - } else { - betweenMainDim = 0; - } - break; - case YGJustifySpaceEvenly: - // Space is distributed evenly across all elements - betweenMainDim = collectedFlexItemsValues.remainingFreeSpace / - (collectedFlexItemsValues.itemsOnLine + 1); - leadingMainDim = betweenMainDim; - break; - case YGJustifySpaceAround: - // Space on the edges is half of the space between elements - betweenMainDim = collectedFlexItemsValues.remainingFreeSpace / - collectedFlexItemsValues.itemsOnLine; - leadingMainDim = betweenMainDim / 2; - break; - case YGJustifyFlexStart: - break; - } - } - - collectedFlexItemsValues.mainDim = - leadingPaddingAndBorderMain + leadingMainDim; - collectedFlexItemsValues.crossDim = 0; - - float maxAscentForCurrentLine = 0; - float maxDescentForCurrentLine = 0; - bool isNodeBaselineLayout = YGIsBaselineLayout(node); - for (uint32_t i = startOfLineIndex; - i < collectedFlexItemsValues.endOfLineIndex; - i++) { - const YGNodeRef child = node->getChild(i); - const YGStyle& childStyle = child->getStyle(); - const YGLayout childLayout = child->getLayout(); - if (childStyle.display == YGDisplayNone) { - continue; - } - if (childStyle.positionType == YGPositionTypeAbsolute && - child->isLeadingPositionDefined(mainAxis)) { - if (performLayout) { - // In case the child is position absolute and has left/top being - // defined, we override the position to whatever the user said (and - // margin/border). - child->setLayoutPosition( - child->getLeadingPosition(mainAxis, availableInnerMainDim) - .unwrap() + - node->getLeadingBorder(mainAxis) + - child->getLeadingMargin(mainAxis, availableInnerWidth).unwrap(), - pos[mainAxis]); - } - } else { - // Now that we placed the element, we need to update the variables. - // We need to do that only for relative elements. Absolute elements do not - // take part in that phase. - if (childStyle.positionType == YGPositionTypeRelative) { - if (child->marginLeadingValue(mainAxis).unit == YGUnitAuto) { - collectedFlexItemsValues.mainDim += - collectedFlexItemsValues.remainingFreeSpace / - numberOfAutoMarginsOnCurrentLine; - } - - if (performLayout) { - child->setLayoutPosition( - childLayout.position[pos[mainAxis]] + - collectedFlexItemsValues.mainDim, - pos[mainAxis]); - } - - if (child->marginTrailingValue(mainAxis).unit == YGUnitAuto) { - collectedFlexItemsValues.mainDim += - collectedFlexItemsValues.remainingFreeSpace / - numberOfAutoMarginsOnCurrentLine; - } - bool canSkipFlex = - !performLayout && measureModeCrossDim == YGMeasureModeExactly; - if (canSkipFlex) { - // If we skipped the flex step, then we can't rely on the measuredDims - // because they weren't computed. This means we can't call - // YGNodeDimWithMargin. - collectedFlexItemsValues.mainDim += betweenMainDim + - child->getMarginForAxis(mainAxis, availableInnerWidth).unwrap() + - childLayout.computedFlexBasis.unwrap(); - collectedFlexItemsValues.crossDim = availableInnerCrossDim; - } else { - // The main dimension is the sum of all the elements dimension plus - // the spacing. - collectedFlexItemsValues.mainDim += betweenMainDim + - YGNodeDimWithMargin(child, mainAxis, availableInnerWidth); - - if (isNodeBaselineLayout) { - // If the child is baseline aligned then the cross dimension is - // calculated by adding maxAscent and maxDescent from the baseline. - const float ascent = YGBaseline(child) + - child - ->getLeadingMargin( - YGFlexDirectionColumn, availableInnerWidth) - .unwrap(); - const float descent = - child->getLayout().measuredDimensions[YGDimensionHeight] + - child - ->getMarginForAxis( - YGFlexDirectionColumn, availableInnerWidth) - .unwrap() - - ascent; - - maxAscentForCurrentLine = - YGFloatMax(maxAscentForCurrentLine, ascent); - maxDescentForCurrentLine = - YGFloatMax(maxDescentForCurrentLine, descent); - } else { - // The cross dimension is the max of the elements dimension since - // there can only be one element in that cross dimension in the case - // when the items are not baseline aligned - collectedFlexItemsValues.crossDim = YGFloatMax( - collectedFlexItemsValues.crossDim, - YGNodeDimWithMargin(child, crossAxis, availableInnerWidth)); - } - } - } else if (performLayout) { - child->setLayoutPosition( - childLayout.position[pos[mainAxis]] + - node->getLeadingBorder(mainAxis) + leadingMainDim, - pos[mainAxis]); - } - } - } - collectedFlexItemsValues.mainDim += trailingPaddingAndBorderMain; - - if (isNodeBaselineLayout) { - collectedFlexItemsValues.crossDim = - maxAscentForCurrentLine + maxDescentForCurrentLine; - } -} - -// -// This is the main routine that implements a subset of the flexbox layout -// algorithm described in the W3C CSS documentation: -// https://www.w3.org/TR/CSS3-flexbox/. -// -// Limitations of this algorithm, compared to the full standard: -// * Display property is always assumed to be 'flex' except for Text nodes, -// which are assumed to be 'inline-flex'. -// * The 'zIndex' property (or any form of z ordering) is not supported. Nodes -// are stacked in document order. -// * The 'order' property is not supported. The order of flex items is always -// defined by document order. -// * The 'visibility' property is always assumed to be 'visible'. Values of -// 'collapse' and 'hidden' are not supported. -// * There is no support for forced breaks. -// * It does not support vertical inline directions (top-to-bottom or -// bottom-to-top text). -// -// Deviations from standard: -// * Section 4.5 of the spec indicates that all flex items have a default -// minimum main size. For text blocks, for example, this is the width of the -// widest word. Calculating the minimum width is expensive, so we forego it -// and assume a default minimum main size of 0. -// * Min/Max sizes in the main axis are not honored when resolving flexible -// lengths. -// * The spec indicates that the default value for 'flexDirection' is 'row', -// but the algorithm below assumes a default of 'column'. -// -// Input parameters: -// - node: current node to be sized and layed out -// - availableWidth & availableHeight: available size to be used for sizing -// the node or YGUndefined if the size is not available; interpretation -// depends on layout flags -// - ownerDirection: the inline (text) direction within the owner -// (left-to-right or right-to-left) -// - widthMeasureMode: indicates the sizing rules for the width (see below -// for explanation) -// - heightMeasureMode: indicates the sizing rules for the height (see below -// for explanation) -// - performLayout: specifies whether the caller is interested in just the -// dimensions of the node or it requires the entire node and its subtree to -// be layed out (with final positions) -// -// Details: -// This routine is called recursively to lay out subtrees of flexbox -// elements. It uses the information in node.style, which is treated as a -// read-only input. It is responsible for setting the layout.direction and -// layout.measuredDimensions fields for the input node as well as the -// layout.position and layout.lineIndex fields for its child nodes. The -// layout.measuredDimensions field includes any border or padding for the -// node but does not include margins. -// -// The spec describes four different layout modes: "fill available", "max -// content", "min content", and "fit content". Of these, we don't use "min -// content" because we don't support default minimum main sizes (see above -// for details). Each of our measure modes maps to a layout mode from the -// spec (https://www.w3.org/TR/CSS3-sizing/#terms): -// - YGMeasureModeUndefined: max content -// - YGMeasureModeExactly: fill available -// - YGMeasureModeAtMost: fit content -// -// When calling YGNodelayoutImpl and YGLayoutNodeInternal, if the caller -// passes an available size of undefined then it must also pass a measure -// mode of YGMeasureModeUndefined in that dimension. -// -static void YGNodelayoutImpl( - const YGNodeRef node, - const float availableWidth, - const float availableHeight, - const YGDirection ownerDirection, - const YGMeasureMode widthMeasureMode, - const YGMeasureMode heightMeasureMode, - const float ownerWidth, - const float ownerHeight, - const bool performLayout, - const YGConfigRef config, - YGMarkerLayoutData& layoutMarkerData) { - YGAssertWithNode( - node, - YGFloatIsUndefined(availableWidth) - ? widthMeasureMode == YGMeasureModeUndefined - : true, - "availableWidth is indefinite so widthMeasureMode must be " - "YGMeasureModeUndefined"); - YGAssertWithNode( - node, - YGFloatIsUndefined(availableHeight) - ? heightMeasureMode == YGMeasureModeUndefined - : true, - "availableHeight is indefinite so heightMeasureMode must be " - "YGMeasureModeUndefined"); - - (performLayout ? layoutMarkerData.layouts : layoutMarkerData.measures) += 1; - - // Set the resolved resolution in the node's layout. - const YGDirection direction = node->resolveDirection(ownerDirection); - node->setLayoutDirection(direction); - - const YGFlexDirection flexRowDirection = - YGResolveFlexDirection(YGFlexDirectionRow, direction); - const YGFlexDirection flexColumnDirection = - YGResolveFlexDirection(YGFlexDirectionColumn, direction); - - node->setLayoutMargin( - node->getLeadingMargin(flexRowDirection, ownerWidth).unwrap(), - YGEdgeStart); - node->setLayoutMargin( - node->getTrailingMargin(flexRowDirection, ownerWidth).unwrap(), - YGEdgeEnd); - node->setLayoutMargin( - node->getLeadingMargin(flexColumnDirection, ownerWidth).unwrap(), - YGEdgeTop); - node->setLayoutMargin( - node->getTrailingMargin(flexColumnDirection, ownerWidth).unwrap(), - YGEdgeBottom); - - node->setLayoutBorder(node->getLeadingBorder(flexRowDirection), YGEdgeStart); - node->setLayoutBorder(node->getTrailingBorder(flexRowDirection), YGEdgeEnd); - node->setLayoutBorder(node->getLeadingBorder(flexColumnDirection), YGEdgeTop); - node->setLayoutBorder( - node->getTrailingBorder(flexColumnDirection), YGEdgeBottom); - - node->setLayoutPadding( - node->getLeadingPadding(flexRowDirection, ownerWidth).unwrap(), - YGEdgeStart); - node->setLayoutPadding( - node->getTrailingPadding(flexRowDirection, ownerWidth).unwrap(), - YGEdgeEnd); - node->setLayoutPadding( - node->getLeadingPadding(flexColumnDirection, ownerWidth).unwrap(), - YGEdgeTop); - node->setLayoutPadding( - node->getTrailingPadding(flexColumnDirection, ownerWidth).unwrap(), - YGEdgeBottom); - - if (node->getMeasure() != nullptr) { - YGNodeWithMeasureFuncSetMeasuredDimensions( - node, - availableWidth, - availableHeight, - widthMeasureMode, - heightMeasureMode, - ownerWidth, - ownerHeight); - return; - } - - const uint32_t childCount = YGNodeGetChildCount(node); - if (childCount == 0) { - YGNodeEmptyContainerSetMeasuredDimensions( - node, - availableWidth, - availableHeight, - widthMeasureMode, - heightMeasureMode, - ownerWidth, - ownerHeight); - return; - } - - // If we're not being asked to perform a full layout we can skip the algorithm - // if we already know the size - if (!performLayout && - YGNodeFixedSizeSetMeasuredDimensions( - node, - availableWidth, - availableHeight, - widthMeasureMode, - heightMeasureMode, - ownerWidth, - ownerHeight)) { - return; - } - - // At this point we know we're going to perform work. Ensure that each child - // has a mutable copy. - node->cloneChildrenIfNeeded(); - // Reset layout flags, as they could have changed. - node->setLayoutHadOverflow(false); - - // STEP 1: CALCULATE VALUES FOR REMAINDER OF ALGORITHM - const YGFlexDirection mainAxis = - YGResolveFlexDirection(node->getStyle().flexDirection, direction); - const YGFlexDirection crossAxis = YGFlexDirectionCross(mainAxis, direction); - const bool isMainAxisRow = YGFlexDirectionIsRow(mainAxis); - const bool isNodeFlexWrap = node->getStyle().flexWrap != YGWrapNoWrap; - - const float mainAxisownerSize = isMainAxisRow ? ownerWidth : ownerHeight; - const float crossAxisownerSize = isMainAxisRow ? ownerHeight : ownerWidth; - - const float leadingPaddingAndBorderCross = - node->getLeadingPaddingAndBorder(crossAxis, ownerWidth).unwrap(); - const float paddingAndBorderAxisMain = - YGNodePaddingAndBorderForAxis(node, mainAxis, ownerWidth); - const float paddingAndBorderAxisCross = - YGNodePaddingAndBorderForAxis(node, crossAxis, ownerWidth); - - YGMeasureMode measureModeMainDim = - isMainAxisRow ? widthMeasureMode : heightMeasureMode; - YGMeasureMode measureModeCrossDim = - isMainAxisRow ? heightMeasureMode : widthMeasureMode; - - const float paddingAndBorderAxisRow = - isMainAxisRow ? paddingAndBorderAxisMain : paddingAndBorderAxisCross; - const float paddingAndBorderAxisColumn = - isMainAxisRow ? paddingAndBorderAxisCross : paddingAndBorderAxisMain; - - const float marginAxisRow = - node->getMarginForAxis(YGFlexDirectionRow, ownerWidth).unwrap(); - const float marginAxisColumn = - node->getMarginForAxis(YGFlexDirectionColumn, ownerWidth).unwrap(); - - const float minInnerWidth = - YGResolveValue( - node->getStyle().minDimensions[YGDimensionWidth], ownerWidth) - .unwrap() - - paddingAndBorderAxisRow; - const float maxInnerWidth = - YGResolveValue( - node->getStyle().maxDimensions[YGDimensionWidth], ownerWidth) - .unwrap() - - paddingAndBorderAxisRow; - const float minInnerHeight = - YGResolveValue( - node->getStyle().minDimensions[YGDimensionHeight], ownerHeight) - .unwrap() - - paddingAndBorderAxisColumn; - const float maxInnerHeight = - YGResolveValue( - node->getStyle().maxDimensions[YGDimensionHeight], ownerHeight) - .unwrap() - - paddingAndBorderAxisColumn; - - const float minInnerMainDim = isMainAxisRow ? minInnerWidth : minInnerHeight; - const float maxInnerMainDim = isMainAxisRow ? maxInnerWidth : maxInnerHeight; - - // STEP 2: DETERMINE AVAILABLE SIZE IN MAIN AND CROSS DIRECTIONS - - float availableInnerWidth = YGNodeCalculateAvailableInnerDim( - node, YGFlexDirectionRow, availableWidth, ownerWidth); - float availableInnerHeight = YGNodeCalculateAvailableInnerDim( - node, YGFlexDirectionColumn, availableHeight, ownerHeight); - - float availableInnerMainDim = - isMainAxisRow ? availableInnerWidth : availableInnerHeight; - const float availableInnerCrossDim = - isMainAxisRow ? availableInnerHeight : availableInnerWidth; - - // STEP 3: DETERMINE FLEX BASIS FOR EACH ITEM - - float totalOuterFlexBasis = YGNodeComputeFlexBasisForChildren( - node, - availableInnerWidth, - availableInnerHeight, - widthMeasureMode, - heightMeasureMode, - direction, - mainAxis, - config, - performLayout, - layoutMarkerData); - - const bool flexBasisOverflows = measureModeMainDim == YGMeasureModeUndefined - ? false - : totalOuterFlexBasis > availableInnerMainDim; - if (isNodeFlexWrap && flexBasisOverflows && - measureModeMainDim == YGMeasureModeAtMost) { - measureModeMainDim = YGMeasureModeExactly; - } - // STEP 4: COLLECT FLEX ITEMS INTO FLEX LINES - - // Indexes of children that represent the first and last items in the line. - uint32_t startOfLineIndex = 0; - uint32_t endOfLineIndex = 0; - - // Number of lines. - uint32_t lineCount = 0; - - // Accumulated cross dimensions of all lines so far. - float totalLineCrossDim = 0; - - // Max main dimension of all the lines. - float maxLineMainDim = 0; - YGCollectFlexItemsRowValues collectedFlexItemsValues; - for (; endOfLineIndex < childCount; - lineCount++, startOfLineIndex = endOfLineIndex) { - collectedFlexItemsValues = YGCalculateCollectFlexItemsRowValues( - node, - ownerDirection, - mainAxisownerSize, - availableInnerWidth, - availableInnerMainDim, - startOfLineIndex, - lineCount); - endOfLineIndex = collectedFlexItemsValues.endOfLineIndex; - - // If we don't need to measure the cross axis, we can skip the entire flex - // step. - const bool canSkipFlex = - !performLayout && measureModeCrossDim == YGMeasureModeExactly; - - // STEP 5: RESOLVING FLEXIBLE LENGTHS ON MAIN AXIS - // Calculate the remaining available space that needs to be allocated. If - // the main dimension size isn't known, it is computed based on the line - // length, so there's no more space left to distribute. - - bool sizeBasedOnContent = false; - // If we don't measure with exact main dimension we want to ensure we don't - // violate min and max - if (measureModeMainDim != YGMeasureModeExactly) { - if (!YGFloatIsUndefined(minInnerMainDim) && - collectedFlexItemsValues.sizeConsumedOnCurrentLine < - minInnerMainDim) { - availableInnerMainDim = minInnerMainDim; - } else if ( - !YGFloatIsUndefined(maxInnerMainDim) && - collectedFlexItemsValues.sizeConsumedOnCurrentLine > - maxInnerMainDim) { - availableInnerMainDim = maxInnerMainDim; - } else { - if (!node->getConfig()->useLegacyStretchBehaviour && - ((YGFloatIsUndefined( - collectedFlexItemsValues.totalFlexGrowFactors) && - collectedFlexItemsValues.totalFlexGrowFactors == 0) || - (YGFloatIsUndefined(node->resolveFlexGrow()) && - node->resolveFlexGrow() == 0))) { - // If we don't have any children to flex or we can't flex the node - // itself, space we've used is all space we need. Root node also - // should be shrunk to minimum - availableInnerMainDim = - collectedFlexItemsValues.sizeConsumedOnCurrentLine; - } - - if (node->getConfig()->useLegacyStretchBehaviour) { - node->setLayoutDidUseLegacyFlag(true); - } - sizeBasedOnContent = !node->getConfig()->useLegacyStretchBehaviour; - } - } - - if (!sizeBasedOnContent && !YGFloatIsUndefined(availableInnerMainDim)) { - collectedFlexItemsValues.remainingFreeSpace = availableInnerMainDim - - collectedFlexItemsValues.sizeConsumedOnCurrentLine; - } else if (collectedFlexItemsValues.sizeConsumedOnCurrentLine < 0) { - // availableInnerMainDim is indefinite which means the node is being sized - // based on its content. sizeConsumedOnCurrentLine is negative which means - // the node will allocate 0 points for its content. Consequently, - // remainingFreeSpace is 0 - sizeConsumedOnCurrentLine. - collectedFlexItemsValues.remainingFreeSpace = - -collectedFlexItemsValues.sizeConsumedOnCurrentLine; - } - - if (!canSkipFlex) { - YGResolveFlexibleLength( - node, - collectedFlexItemsValues, - mainAxis, - crossAxis, - mainAxisownerSize, - availableInnerMainDim, - availableInnerCrossDim, - availableInnerWidth, - availableInnerHeight, - flexBasisOverflows, - measureModeCrossDim, - performLayout, - config, - layoutMarkerData); - } - - node->setLayoutHadOverflow( - node->getLayout().hadOverflow | - (collectedFlexItemsValues.remainingFreeSpace < 0)); - - // STEP 6: MAIN-AXIS JUSTIFICATION & CROSS-AXIS SIZE DETERMINATION - - // At this point, all the children have their dimensions set in the main - // axis. Their dimensions are also set in the cross axis with the exception - // of items that are aligned "stretch". We need to compute these stretch - // values and set the final positions. - - YGJustifyMainAxis( - node, - collectedFlexItemsValues, - startOfLineIndex, - mainAxis, - crossAxis, - measureModeMainDim, - measureModeCrossDim, - mainAxisownerSize, - ownerWidth, - availableInnerMainDim, - availableInnerCrossDim, - availableInnerWidth, - performLayout); - - float containerCrossAxis = availableInnerCrossDim; - if (measureModeCrossDim == YGMeasureModeUndefined || - measureModeCrossDim == YGMeasureModeAtMost) { - // Compute the cross axis from the max cross dimension of the children. - containerCrossAxis = - YGNodeBoundAxis( - node, - crossAxis, - collectedFlexItemsValues.crossDim + paddingAndBorderAxisCross, - crossAxisownerSize, - ownerWidth) - - paddingAndBorderAxisCross; - } - - // If there's no flex wrap, the cross dimension is defined by the container. - if (!isNodeFlexWrap && measureModeCrossDim == YGMeasureModeExactly) { - collectedFlexItemsValues.crossDim = availableInnerCrossDim; - } - - // Clamp to the min/max size specified on the container. - collectedFlexItemsValues.crossDim = - YGNodeBoundAxis( - node, - crossAxis, - collectedFlexItemsValues.crossDim + paddingAndBorderAxisCross, - crossAxisownerSize, - ownerWidth) - - paddingAndBorderAxisCross; - - // STEP 7: CROSS-AXIS ALIGNMENT - // We can skip child alignment if we're just measuring the container. - if (performLayout) { - for (uint32_t i = startOfLineIndex; i < endOfLineIndex; i++) { - const YGNodeRef child = node->getChild(i); - if (child->getStyle().display == YGDisplayNone) { - continue; - } - if (child->getStyle().positionType == YGPositionTypeAbsolute) { - // If the child is absolutely positioned and has a - // top/left/bottom/right set, override all the previously computed - // positions to set it correctly. - const bool isChildLeadingPosDefined = - child->isLeadingPositionDefined(crossAxis); - if (isChildLeadingPosDefined) { - child->setLayoutPosition( - child->getLeadingPosition(crossAxis, availableInnerCrossDim) - .unwrap() + - node->getLeadingBorder(crossAxis) + - child->getLeadingMargin(crossAxis, availableInnerWidth) - .unwrap(), - pos[crossAxis]); - } - // If leading position is not defined or calculations result in Nan, - // default to border + margin - if (!isChildLeadingPosDefined || - YGFloatIsUndefined(child->getLayout().position[pos[crossAxis]])) { - child->setLayoutPosition( - node->getLeadingBorder(crossAxis) + - child->getLeadingMargin(crossAxis, availableInnerWidth) - .unwrap(), - pos[crossAxis]); - } - } else { - float leadingCrossDim = leadingPaddingAndBorderCross; - - // For a relative children, we're either using alignItems (owner) or - // alignSelf (child) in order to determine the position in the cross - // axis - const YGAlign alignItem = YGNodeAlignItem(node, child); - - // If the child uses align stretch, we need to lay it out one more - // time, this time forcing the cross-axis size to be the computed - // cross size for the current line. - if (alignItem == YGAlignStretch && - child->marginLeadingValue(crossAxis).unit != YGUnitAuto && - child->marginTrailingValue(crossAxis).unit != YGUnitAuto) { - // If the child defines a definite size for its cross axis, there's - // no need to stretch. - if (!YGNodeIsStyleDimDefined( - child, crossAxis, availableInnerCrossDim)) { - float childMainSize = - child->getLayout().measuredDimensions[dim[mainAxis]]; - float childCrossSize = - !child->getStyle().aspectRatio.isUndefined() - ? child->getMarginForAxis(crossAxis, availableInnerWidth) - .unwrap() + - (isMainAxisRow ? childMainSize / - child->getStyle().aspectRatio.unwrap() - : childMainSize * - child->getStyle().aspectRatio.unwrap()) - : collectedFlexItemsValues.crossDim; - - childMainSize += - child->getMarginForAxis(mainAxis, availableInnerWidth) - .unwrap(); - - YGMeasureMode childMainMeasureMode = YGMeasureModeExactly; - YGMeasureMode childCrossMeasureMode = YGMeasureModeExactly; - YGConstrainMaxSizeForMode( - child, - mainAxis, - availableInnerMainDim, - availableInnerWidth, - &childMainMeasureMode, - &childMainSize); - YGConstrainMaxSizeForMode( - child, - crossAxis, - availableInnerCrossDim, - availableInnerWidth, - &childCrossMeasureMode, - &childCrossSize); - - const float childWidth = - isMainAxisRow ? childMainSize : childCrossSize; - const float childHeight = - !isMainAxisRow ? childMainSize : childCrossSize; - - const YGMeasureMode childWidthMeasureMode = - YGFloatIsUndefined(childWidth) ? YGMeasureModeUndefined - : YGMeasureModeExactly; - const YGMeasureMode childHeightMeasureMode = - YGFloatIsUndefined(childHeight) ? YGMeasureModeUndefined - : YGMeasureModeExactly; - - YGLayoutNodeInternal( - child, - childWidth, - childHeight, - direction, - childWidthMeasureMode, - childHeightMeasureMode, - availableInnerWidth, - availableInnerHeight, - true, - "stretch", - config, - layoutMarkerData); - } - } else { - const float remainingCrossDim = containerCrossAxis - - YGNodeDimWithMargin(child, crossAxis, availableInnerWidth); - - if (child->marginLeadingValue(crossAxis).unit == YGUnitAuto && - child->marginTrailingValue(crossAxis).unit == YGUnitAuto) { - leadingCrossDim += YGFloatMax(0.0f, remainingCrossDim / 2); - } else if ( - child->marginTrailingValue(crossAxis).unit == YGUnitAuto) { - // No-Op - } else if ( - child->marginLeadingValue(crossAxis).unit == YGUnitAuto) { - leadingCrossDim += YGFloatMax(0.0f, remainingCrossDim); - } else if (alignItem == YGAlignFlexStart) { - // No-Op - } else if (alignItem == YGAlignCenter) { - leadingCrossDim += remainingCrossDim / 2; - } else { - leadingCrossDim += remainingCrossDim; - } - } - // And we apply the position - child->setLayoutPosition( - child->getLayout().position[pos[crossAxis]] + totalLineCrossDim + - leadingCrossDim, - pos[crossAxis]); - } - } - } - - totalLineCrossDim += collectedFlexItemsValues.crossDim; - maxLineMainDim = - YGFloatMax(maxLineMainDim, collectedFlexItemsValues.mainDim); - } - - // STEP 8: MULTI-LINE CONTENT ALIGNMENT - // currentLead stores the size of the cross dim - if (performLayout && (lineCount > 1 || YGIsBaselineLayout(node))) { - float crossDimLead = 0; - float currentLead = leadingPaddingAndBorderCross; - if (!YGFloatIsUndefined(availableInnerCrossDim)) { - const float remainingAlignContentDim = - availableInnerCrossDim - totalLineCrossDim; - switch (node->getStyle().alignContent) { - case YGAlignFlexEnd: - currentLead += remainingAlignContentDim; - break; - case YGAlignCenter: - currentLead += remainingAlignContentDim / 2; - break; - case YGAlignStretch: - if (availableInnerCrossDim > totalLineCrossDim) { - crossDimLead = remainingAlignContentDim / lineCount; - } - break; - case YGAlignSpaceAround: - if (availableInnerCrossDim > totalLineCrossDim) { - currentLead += remainingAlignContentDim / (2 * lineCount); - if (lineCount > 1) { - crossDimLead = remainingAlignContentDim / lineCount; - } - } else { - currentLead += remainingAlignContentDim / 2; - } - break; - case YGAlignSpaceBetween: - if (availableInnerCrossDim > totalLineCrossDim && lineCount > 1) { - crossDimLead = remainingAlignContentDim / (lineCount - 1); - } - break; - case YGAlignAuto: - case YGAlignFlexStart: - case YGAlignBaseline: - break; - } - } - uint32_t endIndex = 0; - for (uint32_t i = 0; i < lineCount; i++) { - const uint32_t startIndex = endIndex; - uint32_t ii; - - // compute the line's height and find the endIndex - float lineHeight = 0; - float maxAscentForCurrentLine = 0; - float maxDescentForCurrentLine = 0; - for (ii = startIndex; ii < childCount; ii++) { - const YGNodeRef child = node->getChild(ii); - if (child->getStyle().display == YGDisplayNone) { - continue; - } - if (child->getStyle().positionType == YGPositionTypeRelative) { - if (child->getLineIndex() != i) { - break; - } - if (YGNodeIsLayoutDimDefined(child, crossAxis)) { - lineHeight = YGFloatMax( - lineHeight, - child->getLayout().measuredDimensions[dim[crossAxis]] + - child->getMarginForAxis(crossAxis, availableInnerWidth) - .unwrap()); - } - if (YGNodeAlignItem(node, child) == YGAlignBaseline) { - const float ascent = YGBaseline(child) + - child - ->getLeadingMargin( - YGFlexDirectionColumn, availableInnerWidth) - .unwrap(); - const float descent = - child->getLayout().measuredDimensions[YGDimensionHeight] + - child - ->getMarginForAxis( - YGFlexDirectionColumn, availableInnerWidth) - .unwrap() - - ascent; - maxAscentForCurrentLine = - YGFloatMax(maxAscentForCurrentLine, ascent); - maxDescentForCurrentLine = - YGFloatMax(maxDescentForCurrentLine, descent); - lineHeight = YGFloatMax( - lineHeight, maxAscentForCurrentLine + maxDescentForCurrentLine); - } - } - } - endIndex = ii; - lineHeight += crossDimLead; - - if (performLayout) { - for (ii = startIndex; ii < endIndex; ii++) { - const YGNodeRef child = node->getChild(ii); - if (child->getStyle().display == YGDisplayNone) { - continue; - } - if (child->getStyle().positionType == YGPositionTypeRelative) { - switch (YGNodeAlignItem(node, child)) { - case YGAlignFlexStart: { - child->setLayoutPosition( - currentLead + - child->getLeadingMargin(crossAxis, availableInnerWidth) - .unwrap(), - pos[crossAxis]); - break; - } - case YGAlignFlexEnd: { - child->setLayoutPosition( - currentLead + lineHeight - - child->getTrailingMargin(crossAxis, availableInnerWidth) - .unwrap() - - child->getLayout().measuredDimensions[dim[crossAxis]], - pos[crossAxis]); - break; - } - case YGAlignCenter: { - float childHeight = - child->getLayout().measuredDimensions[dim[crossAxis]]; - - child->setLayoutPosition( - currentLead + (lineHeight - childHeight) / 2, - pos[crossAxis]); - break; - } - case YGAlignStretch: { - child->setLayoutPosition( - currentLead + - child->getLeadingMargin(crossAxis, availableInnerWidth) - .unwrap(), - pos[crossAxis]); - - // Remeasure child with the line height as it as been only - // measured with the owners height yet. - if (!YGNodeIsStyleDimDefined( - child, crossAxis, availableInnerCrossDim)) { - const float childWidth = isMainAxisRow - ? (child->getLayout() - .measuredDimensions[YGDimensionWidth] + - child->getMarginForAxis(mainAxis, availableInnerWidth) - .unwrap()) - : lineHeight; - - const float childHeight = !isMainAxisRow - ? (child->getLayout() - .measuredDimensions[YGDimensionHeight] + - child->getMarginForAxis(crossAxis, availableInnerWidth) - .unwrap()) - : lineHeight; - - if (!(YGFloatsEqual( - childWidth, - child->getLayout() - .measuredDimensions[YGDimensionWidth]) && - YGFloatsEqual( - childHeight, - child->getLayout() - .measuredDimensions[YGDimensionHeight]))) { - YGLayoutNodeInternal( - child, - childWidth, - childHeight, - direction, - YGMeasureModeExactly, - YGMeasureModeExactly, - availableInnerWidth, - availableInnerHeight, - true, - "multiline-stretch", - config, - layoutMarkerData); - } - } - break; - } - case YGAlignBaseline: { - child->setLayoutPosition( - currentLead + maxAscentForCurrentLine - YGBaseline(child) + - child - ->getLeadingPosition( - YGFlexDirectionColumn, availableInnerCrossDim) - .unwrap(), - YGEdgeTop); - - break; - } - case YGAlignAuto: - case YGAlignSpaceBetween: - case YGAlignSpaceAround: - break; - } - } - } - } - currentLead += lineHeight; - } - } - - // STEP 9: COMPUTING FINAL DIMENSIONS - - node->setLayoutMeasuredDimension( - YGNodeBoundAxis( - node, - YGFlexDirectionRow, - availableWidth - marginAxisRow, - ownerWidth, - ownerWidth), - YGDimensionWidth); - - node->setLayoutMeasuredDimension( - YGNodeBoundAxis( - node, - YGFlexDirectionColumn, - availableHeight - marginAxisColumn, - ownerHeight, - ownerWidth), - YGDimensionHeight); - - // If the user didn't specify a width or height for the node, set the - // dimensions based on the children. - if (measureModeMainDim == YGMeasureModeUndefined || - (node->getStyle().overflow != YGOverflowScroll && - measureModeMainDim == YGMeasureModeAtMost)) { - // Clamp the size to the min/max size, if specified, and make sure it - // doesn't go below the padding and border amount. - node->setLayoutMeasuredDimension( - YGNodeBoundAxis( - node, mainAxis, maxLineMainDim, mainAxisownerSize, ownerWidth), - dim[mainAxis]); - - } else if ( - measureModeMainDim == YGMeasureModeAtMost && - node->getStyle().overflow == YGOverflowScroll) { - node->setLayoutMeasuredDimension( - YGFloatMax( - YGFloatMin( - availableInnerMainDim + paddingAndBorderAxisMain, - YGNodeBoundAxisWithinMinAndMax( - node, - mainAxis, - YGFloatOptional{maxLineMainDim}, - mainAxisownerSize) - .unwrap()), - paddingAndBorderAxisMain), - dim[mainAxis]); - } - - if (measureModeCrossDim == YGMeasureModeUndefined || - (node->getStyle().overflow != YGOverflowScroll && - measureModeCrossDim == YGMeasureModeAtMost)) { - // Clamp the size to the min/max size, if specified, and make sure it - // doesn't go below the padding and border amount. - node->setLayoutMeasuredDimension( - YGNodeBoundAxis( - node, - crossAxis, - totalLineCrossDim + paddingAndBorderAxisCross, - crossAxisownerSize, - ownerWidth), - dim[crossAxis]); - - } else if ( - measureModeCrossDim == YGMeasureModeAtMost && - node->getStyle().overflow == YGOverflowScroll) { - node->setLayoutMeasuredDimension( - YGFloatMax( - YGFloatMin( - availableInnerCrossDim + paddingAndBorderAxisCross, - YGNodeBoundAxisWithinMinAndMax( - node, - crossAxis, - YGFloatOptional{totalLineCrossDim + - paddingAndBorderAxisCross}, - crossAxisownerSize) - .unwrap()), - paddingAndBorderAxisCross), - dim[crossAxis]); - } - - // As we only wrapped in normal direction yet, we need to reverse the - // positions on wrap-reverse. - if (performLayout && node->getStyle().flexWrap == YGWrapWrapReverse) { - for (uint32_t i = 0; i < childCount; i++) { - const YGNodeRef child = YGNodeGetChild(node, i); - if (child->getStyle().positionType == YGPositionTypeRelative) { - child->setLayoutPosition( - node->getLayout().measuredDimensions[dim[crossAxis]] - - child->getLayout().position[pos[crossAxis]] - - child->getLayout().measuredDimensions[dim[crossAxis]], - pos[crossAxis]); - } - } - } - - if (performLayout) { - // STEP 10: SIZING AND POSITIONING ABSOLUTE CHILDREN - for (auto child : node->getChildren()) { - if (child->getStyle().positionType != YGPositionTypeAbsolute) { - continue; - } - YGNodeAbsoluteLayoutChild( - node, - child, - availableInnerWidth, - isMainAxisRow ? measureModeMainDim : measureModeCrossDim, - availableInnerHeight, - direction, - config, - layoutMarkerData); - } - - // STEP 11: SETTING TRAILING POSITIONS FOR CHILDREN - const bool needsMainTrailingPos = mainAxis == YGFlexDirectionRowReverse || - mainAxis == YGFlexDirectionColumnReverse; - const bool needsCrossTrailingPos = crossAxis == YGFlexDirectionRowReverse || - crossAxis == YGFlexDirectionColumnReverse; - - // Set trailing position if necessary. - if (needsMainTrailingPos || needsCrossTrailingPos) { - for (uint32_t i = 0; i < childCount; i++) { - const YGNodeRef child = node->getChild(i); - if (child->getStyle().display == YGDisplayNone) { - continue; - } - if (needsMainTrailingPos) { - YGNodeSetChildTrailingPosition(node, child, mainAxis); - } - - if (needsCrossTrailingPos) { - YGNodeSetChildTrailingPosition(node, child, crossAxis); - } - } - } - } -} - -uint32_t gDepth = 0; -bool gPrintChanges = false; -bool gPrintSkips = false; - -static const char* spacer = - " "; - -static const char* YGSpacer(const unsigned long level) { - const size_t spacerLen = strlen(spacer); - if (level > spacerLen) { - return &spacer[0]; - } else { - return &spacer[spacerLen - level]; - } -} - -static const char* YGMeasureModeName( - const YGMeasureMode mode, - const bool performLayout) { - constexpr auto N = enums::count(); - const char* kMeasureModeNames[N] = {"UNDEFINED", "EXACTLY", "AT_MOST"}; - const char* kLayoutModeNames[N] = { - "LAY_UNDEFINED", "LAY_EXACTLY", "LAY_AT_MOST"}; - - if (mode >= N) { - return ""; - } - - return performLayout ? kLayoutModeNames[mode] : kMeasureModeNames[mode]; -} - -static inline bool YGMeasureModeSizeIsExactAndMatchesOldMeasuredSize( - YGMeasureMode sizeMode, - float size, - float lastComputedSize) { - return sizeMode == YGMeasureModeExactly && - YGFloatsEqual(size, lastComputedSize); -} - -static inline bool YGMeasureModeOldSizeIsUnspecifiedAndStillFits( - YGMeasureMode sizeMode, - float size, - YGMeasureMode lastSizeMode, - float lastComputedSize) { - return sizeMode == YGMeasureModeAtMost && - lastSizeMode == YGMeasureModeUndefined && - (size >= lastComputedSize || YGFloatsEqual(size, lastComputedSize)); -} - -static inline bool YGMeasureModeNewMeasureSizeIsStricterAndStillValid( - YGMeasureMode sizeMode, - float size, - YGMeasureMode lastSizeMode, - float lastSize, - float lastComputedSize) { - return lastSizeMode == YGMeasureModeAtMost && - sizeMode == YGMeasureModeAtMost && !YGFloatIsUndefined(lastSize) && - !YGFloatIsUndefined(size) && !YGFloatIsUndefined(lastComputedSize) && - lastSize > size && - (lastComputedSize <= size || YGFloatsEqual(size, lastComputedSize)); -} - -float YGRoundValueToPixelGrid( - const float value, - const float pointScaleFactor, - const bool forceCeil, - const bool forceFloor) { - float scaledValue = value * pointScaleFactor; - // We want to calculate `fractial` such that `floor(scaledValue) = scaledValue - // - fractial`. - float fractial = fmodf(scaledValue, 1.0f); - if (fractial < 0) { - // This branch is for handling negative numbers for `value`. - // - // Regarding `floor` and `ceil`. Note that for a number x, `floor(x) <= x <= - // ceil(x)` even for negative numbers. Here are a couple of examples: - // - x = 2.2: floor( 2.2) = 2, ceil( 2.2) = 3 - // - x = -2.2: floor(-2.2) = -3, ceil(-2.2) = -2 - // - // Regarding `fmodf`. For fractional negative numbers, `fmodf` returns a - // negative number. For example, `fmodf(-2.2) = -0.2`. However, we want - // `fractial` to be the number such that subtracting it from `value` will - // give us `floor(value)`. In the case of negative numbers, adding 1 to - // `fmodf(value)` gives us this. Let's continue the example from above: - // - fractial = fmodf(-2.2) = -0.2 - // - Add 1 to the fraction: fractial2 = fractial + 1 = -0.2 + 1 = 0.8 - // - Finding the `floor`: -2.2 - fractial2 = -2.2 - 0.8 = -3 - ++fractial; - } - if (YGFloatsEqual(fractial, 0)) { - // First we check if the value is already rounded - scaledValue = scaledValue - fractial; - } else if (YGFloatsEqual(fractial, 1.0f)) { - scaledValue = scaledValue - fractial + 1.0f; - } else if (forceCeil) { - // Next we check if we need to use forced rounding - scaledValue = scaledValue - fractial + 1.0f; - } else if (forceFloor) { - scaledValue = scaledValue - fractial; - } else { - // Finally we just round the value - scaledValue = scaledValue - fractial + - (!YGFloatIsUndefined(fractial) && - (fractial > 0.5f || YGFloatsEqual(fractial, 0.5f)) - ? 1.0f - : 0.0f); - } - return (YGFloatIsUndefined(scaledValue) || - YGFloatIsUndefined(pointScaleFactor)) - ? YGUndefined - : scaledValue / pointScaleFactor; -} - -bool YGNodeCanUseCachedMeasurement( - const YGMeasureMode widthMode, - const float width, - const YGMeasureMode heightMode, - const float height, - const YGMeasureMode lastWidthMode, - const float lastWidth, - const YGMeasureMode lastHeightMode, - const float lastHeight, - const float lastComputedWidth, - const float lastComputedHeight, - const float marginRow, - const float marginColumn, - const YGConfigRef config) { - if ((!YGFloatIsUndefined(lastComputedHeight) && lastComputedHeight < 0) || - (!YGFloatIsUndefined(lastComputedWidth) && lastComputedWidth < 0)) { - return false; - } - bool useRoundedComparison = - config != nullptr && config->pointScaleFactor != 0; - const float effectiveWidth = useRoundedComparison - ? YGRoundValueToPixelGrid(width, config->pointScaleFactor, false, false) - : width; - const float effectiveHeight = useRoundedComparison - ? YGRoundValueToPixelGrid(height, config->pointScaleFactor, false, false) - : height; - const float effectiveLastWidth = useRoundedComparison - ? YGRoundValueToPixelGrid( - lastWidth, config->pointScaleFactor, false, false) - : lastWidth; - const float effectiveLastHeight = useRoundedComparison - ? YGRoundValueToPixelGrid( - lastHeight, config->pointScaleFactor, false, false) - : lastHeight; - - const bool hasSameWidthSpec = lastWidthMode == widthMode && - YGFloatsEqual(effectiveLastWidth, effectiveWidth); - const bool hasSameHeightSpec = lastHeightMode == heightMode && - YGFloatsEqual(effectiveLastHeight, effectiveHeight); - - const bool widthIsCompatible = - hasSameWidthSpec || - YGMeasureModeSizeIsExactAndMatchesOldMeasuredSize( - widthMode, width - marginRow, lastComputedWidth) || - YGMeasureModeOldSizeIsUnspecifiedAndStillFits( - widthMode, width - marginRow, lastWidthMode, lastComputedWidth) || - YGMeasureModeNewMeasureSizeIsStricterAndStillValid( - widthMode, - width - marginRow, - lastWidthMode, - lastWidth, - lastComputedWidth); - - const bool heightIsCompatible = - hasSameHeightSpec || - YGMeasureModeSizeIsExactAndMatchesOldMeasuredSize( - heightMode, height - marginColumn, lastComputedHeight) || - YGMeasureModeOldSizeIsUnspecifiedAndStillFits( - heightMode, - height - marginColumn, - lastHeightMode, - lastComputedHeight) || - YGMeasureModeNewMeasureSizeIsStricterAndStillValid( - heightMode, - height - marginColumn, - lastHeightMode, - lastHeight, - lastComputedHeight); - - return widthIsCompatible && heightIsCompatible; -} - -// -// This is a wrapper around the YGNodelayoutImpl function. It determines whether -// the layout request is redundant and can be skipped. -// -// Parameters: -// Input parameters are the same as YGNodelayoutImpl (see above) -// Return parameter is true if layout was performed, false if skipped -// -bool YGLayoutNodeInternal( - const YGNodeRef node, - const float availableWidth, - const float availableHeight, - const YGDirection ownerDirection, - const YGMeasureMode widthMeasureMode, - const YGMeasureMode heightMeasureMode, - const float ownerWidth, - const float ownerHeight, - const bool performLayout, - const char* reason, - const YGConfigRef config, - YGMarkerLayoutData& layoutMarkerData) { - YGLayout* layout = &node->getLayout(); - - gDepth++; - - const bool needToVisitNode = - (node->isDirty() && layout->generationCount != gCurrentGenerationCount) || - layout->lastOwnerDirection != ownerDirection; - - if (needToVisitNode) { - // Invalidate the cached results. - layout->nextCachedMeasurementsIndex = 0; - layout->cachedLayout.widthMeasureMode = (YGMeasureMode) -1; - layout->cachedLayout.heightMeasureMode = (YGMeasureMode) -1; - layout->cachedLayout.computedWidth = -1; - layout->cachedLayout.computedHeight = -1; - } - - YGCachedMeasurement* cachedResults = nullptr; - - // Determine whether the results are already cached. We maintain a separate - // cache for layouts and measurements. A layout operation modifies the - // positions and dimensions for nodes in the subtree. The algorithm assumes - // that each node gets layed out a maximum of one time per tree layout, but - // multiple measurements may be required to resolve all of the flex - // dimensions. We handle nodes with measure functions specially here because - // they are the most expensive to measure, so it's worth avoiding redundant - // measurements if at all possible. - if (node->getMeasure() != nullptr) { - const float marginAxisRow = - node->getMarginForAxis(YGFlexDirectionRow, ownerWidth).unwrap(); - const float marginAxisColumn = - node->getMarginForAxis(YGFlexDirectionColumn, ownerWidth).unwrap(); - - // First, try to use the layout cache. - if (YGNodeCanUseCachedMeasurement( - widthMeasureMode, - availableWidth, - heightMeasureMode, - availableHeight, - layout->cachedLayout.widthMeasureMode, - layout->cachedLayout.availableWidth, - layout->cachedLayout.heightMeasureMode, - layout->cachedLayout.availableHeight, - layout->cachedLayout.computedWidth, - layout->cachedLayout.computedHeight, - marginAxisRow, - marginAxisColumn, - config)) { - cachedResults = &layout->cachedLayout; - } else { - // Try to use the measurement cache. - for (uint32_t i = 0; i < layout->nextCachedMeasurementsIndex; i++) { - if (YGNodeCanUseCachedMeasurement( - widthMeasureMode, - availableWidth, - heightMeasureMode, - availableHeight, - layout->cachedMeasurements[i].widthMeasureMode, - layout->cachedMeasurements[i].availableWidth, - layout->cachedMeasurements[i].heightMeasureMode, - layout->cachedMeasurements[i].availableHeight, - layout->cachedMeasurements[i].computedWidth, - layout->cachedMeasurements[i].computedHeight, - marginAxisRow, - marginAxisColumn, - config)) { - cachedResults = &layout->cachedMeasurements[i]; - break; - } - } - } - } else if (performLayout) { - if (YGFloatsEqual(layout->cachedLayout.availableWidth, availableWidth) && - YGFloatsEqual(layout->cachedLayout.availableHeight, availableHeight) && - layout->cachedLayout.widthMeasureMode == widthMeasureMode && - layout->cachedLayout.heightMeasureMode == heightMeasureMode) { - cachedResults = &layout->cachedLayout; - } - } else { - for (uint32_t i = 0; i < layout->nextCachedMeasurementsIndex; i++) { - if (YGFloatsEqual( - layout->cachedMeasurements[i].availableWidth, availableWidth) && - YGFloatsEqual( - layout->cachedMeasurements[i].availableHeight, availableHeight) && - layout->cachedMeasurements[i].widthMeasureMode == widthMeasureMode && - layout->cachedMeasurements[i].heightMeasureMode == - heightMeasureMode) { - cachedResults = &layout->cachedMeasurements[i]; - break; - } - } - } - - if (!needToVisitNode && cachedResults != nullptr) { - layout->measuredDimensions[YGDimensionWidth] = cachedResults->computedWidth; - layout->measuredDimensions[YGDimensionHeight] = - cachedResults->computedHeight; - - (performLayout ? layoutMarkerData.cachedLayouts - : layoutMarkerData.cachedMeasures) += 1; - - if (gPrintChanges && gPrintSkips) { - YGLog( - node, - YGLogLevelVerbose, - "%s%d.{[skipped] ", - YGSpacer(gDepth), - gDepth); - if (node->getPrintFunc() != nullptr) { - node->getPrintFunc()(node); - } - YGLog( - node, - YGLogLevelVerbose, - "wm: %s, hm: %s, aw: %f ah: %f => d: (%f, %f) %s\n", - YGMeasureModeName(widthMeasureMode, performLayout), - YGMeasureModeName(heightMeasureMode, performLayout), - availableWidth, - availableHeight, - cachedResults->computedWidth, - cachedResults->computedHeight, - reason); - } - } else { - if (gPrintChanges) { - YGLog( - node, - YGLogLevelVerbose, - "%s%d.{%s", - YGSpacer(gDepth), - gDepth, - needToVisitNode ? "*" : ""); - if (node->getPrintFunc() != nullptr) { - node->getPrintFunc()(node); - } - YGLog( - node, - YGLogLevelVerbose, - "wm: %s, hm: %s, aw: %f ah: %f %s\n", - YGMeasureModeName(widthMeasureMode, performLayout), - YGMeasureModeName(heightMeasureMode, performLayout), - availableWidth, - availableHeight, - reason); - } - - YGNodelayoutImpl( - node, - availableWidth, - availableHeight, - ownerDirection, - widthMeasureMode, - heightMeasureMode, - ownerWidth, - ownerHeight, - performLayout, - config, - layoutMarkerData); - - if (gPrintChanges) { - YGLog( - node, - YGLogLevelVerbose, - "%s%d.}%s", - YGSpacer(gDepth), - gDepth, - needToVisitNode ? "*" : ""); - if (node->getPrintFunc() != nullptr) { - node->getPrintFunc()(node); - } - YGLog( - node, - YGLogLevelVerbose, - "wm: %s, hm: %s, d: (%f, %f) %s\n", - YGMeasureModeName(widthMeasureMode, performLayout), - YGMeasureModeName(heightMeasureMode, performLayout), - layout->measuredDimensions[YGDimensionWidth], - layout->measuredDimensions[YGDimensionHeight], - reason); - } - - layout->lastOwnerDirection = ownerDirection; - - if (cachedResults == nullptr) { - if (layout->nextCachedMeasurementsIndex + 1 > - (uint32_t) layoutMarkerData.maxMeasureCache) { - layoutMarkerData.maxMeasureCache = - layout->nextCachedMeasurementsIndex + 1; - } - if (layout->nextCachedMeasurementsIndex == YG_MAX_CACHED_RESULT_COUNT) { - if (gPrintChanges) { - YGLog(node, YGLogLevelVerbose, "Out of cache entries!\n"); - } - layout->nextCachedMeasurementsIndex = 0; - } - - YGCachedMeasurement* newCacheEntry; - if (performLayout) { - // Use the single layout cache entry. - newCacheEntry = &layout->cachedLayout; - } else { - // Allocate a new measurement cache entry. - newCacheEntry = - &layout->cachedMeasurements[layout->nextCachedMeasurementsIndex]; - layout->nextCachedMeasurementsIndex++; - } - - newCacheEntry->availableWidth = availableWidth; - newCacheEntry->availableHeight = availableHeight; - newCacheEntry->widthMeasureMode = widthMeasureMode; - newCacheEntry->heightMeasureMode = heightMeasureMode; - newCacheEntry->computedWidth = - layout->measuredDimensions[YGDimensionWidth]; - newCacheEntry->computedHeight = - layout->measuredDimensions[YGDimensionHeight]; - } - } - - if (performLayout) { - node->setLayoutDimension( - node->getLayout().measuredDimensions[YGDimensionWidth], - YGDimensionWidth); - node->setLayoutDimension( - node->getLayout().measuredDimensions[YGDimensionHeight], - YGDimensionHeight); - - node->setHasNewLayout(true); - node->setDirty(false); - } - - gDepth--; - layout->generationCount = gCurrentGenerationCount; - return (needToVisitNode || cachedResults == nullptr); -} - -void YGConfigSetPointScaleFactor( - const YGConfigRef config, - const float pixelsInPoint) { - YGAssertWithConfig( - config, - pixelsInPoint >= 0.0f, - "Scale factor should not be less than zero"); - - // We store points for Pixel as we will use it for rounding - if (pixelsInPoint == 0.0f) { - // Zero is used to skip rounding - config->pointScaleFactor = 0.0f; - } else { - config->pointScaleFactor = pixelsInPoint; - } -} - -static void YGRoundToPixelGrid( - const YGNodeRef node, - const float pointScaleFactor, - const float absoluteLeft, - const float absoluteTop) { - if (pointScaleFactor == 0.0f) { - return; - } - - const float nodeLeft = node->getLayout().position[YGEdgeLeft]; - const float nodeTop = node->getLayout().position[YGEdgeTop]; - - const float nodeWidth = node->getLayout().dimensions[YGDimensionWidth]; - const float nodeHeight = node->getLayout().dimensions[YGDimensionHeight]; - - const float absoluteNodeLeft = absoluteLeft + nodeLeft; - const float absoluteNodeTop = absoluteTop + nodeTop; - - const float absoluteNodeRight = absoluteNodeLeft + nodeWidth; - const float absoluteNodeBottom = absoluteNodeTop + nodeHeight; - - // If a node has a custom measure function we never want to round down its - // size as this could lead to unwanted text truncation. - const bool textRounding = node->getNodeType() == YGNodeTypeText; - - node->setLayoutPosition( - YGRoundValueToPixelGrid(nodeLeft, pointScaleFactor, false, textRounding), - YGEdgeLeft); - - node->setLayoutPosition( - YGRoundValueToPixelGrid(nodeTop, pointScaleFactor, false, textRounding), - YGEdgeTop); - - // We multiply dimension by scale factor and if the result is close to the - // whole number, we don't have any fraction To verify if the result is close - // to whole number we want to check both floor and ceil numbers - const bool hasFractionalWidth = - !YGFloatsEqual(fmodf(nodeWidth * pointScaleFactor, 1.0), 0) && - !YGFloatsEqual(fmodf(nodeWidth * pointScaleFactor, 1.0), 1.0); - const bool hasFractionalHeight = - !YGFloatsEqual(fmodf(nodeHeight * pointScaleFactor, 1.0), 0) && - !YGFloatsEqual(fmodf(nodeHeight * pointScaleFactor, 1.0), 1.0); - - node->setLayoutDimension( - YGRoundValueToPixelGrid( - absoluteNodeRight, - pointScaleFactor, - (textRounding && hasFractionalWidth), - (textRounding && !hasFractionalWidth)) - - YGRoundValueToPixelGrid( - absoluteNodeLeft, pointScaleFactor, false, textRounding), - YGDimensionWidth); - - node->setLayoutDimension( - YGRoundValueToPixelGrid( - absoluteNodeBottom, - pointScaleFactor, - (textRounding && hasFractionalHeight), - (textRounding && !hasFractionalHeight)) - - YGRoundValueToPixelGrid( - absoluteNodeTop, pointScaleFactor, false, textRounding), - YGDimensionHeight); - - const uint32_t childCount = YGNodeGetChildCount(node); - for (uint32_t i = 0; i < childCount; i++) { - YGRoundToPixelGrid( - YGNodeGetChild(node, i), - pointScaleFactor, - absoluteNodeLeft, - absoluteNodeTop); - } -} - -void YGNodeCalculateLayout( - const YGNodeRef node, - const float ownerWidth, - const float ownerHeight, - const YGDirection ownerDirection) { - marker::MarkerSection marker{node}; - - // Increment the generation count. This will force the recursive routine to - // visit all dirty nodes at least once. Subsequent visits will be skipped if - // the input parameters don't change. - gCurrentGenerationCount++; - node->resolveDimension(); - float width = YGUndefined; - YGMeasureMode widthMeasureMode = YGMeasureModeUndefined; - if (YGNodeIsStyleDimDefined(node, YGFlexDirectionRow, ownerWidth)) { - width = - (YGResolveValue( - node->getResolvedDimension(dim[YGFlexDirectionRow]), ownerWidth) + - node->getMarginForAxis(YGFlexDirectionRow, ownerWidth)) - .unwrap(); - widthMeasureMode = YGMeasureModeExactly; - } else if (!YGResolveValue( - node->getStyle().maxDimensions[YGDimensionWidth], ownerWidth) - .isUndefined()) { - width = YGResolveValue( - node->getStyle().maxDimensions[YGDimensionWidth], ownerWidth) - .unwrap(); - widthMeasureMode = YGMeasureModeAtMost; - } else { - width = ownerWidth; - widthMeasureMode = YGFloatIsUndefined(width) ? YGMeasureModeUndefined - : YGMeasureModeExactly; - } - - float height = YGUndefined; - YGMeasureMode heightMeasureMode = YGMeasureModeUndefined; - if (YGNodeIsStyleDimDefined(node, YGFlexDirectionColumn, ownerHeight)) { - height = (YGResolveValue( - node->getResolvedDimension(dim[YGFlexDirectionColumn]), - ownerHeight) + - node->getMarginForAxis(YGFlexDirectionColumn, ownerWidth)) - .unwrap(); - heightMeasureMode = YGMeasureModeExactly; - } else if (!YGResolveValue( - node->getStyle().maxDimensions[YGDimensionHeight], - ownerHeight) - .isUndefined()) { - height = YGResolveValue( - node->getStyle().maxDimensions[YGDimensionHeight], ownerHeight) - .unwrap(); - heightMeasureMode = YGMeasureModeAtMost; - } else { - height = ownerHeight; - heightMeasureMode = YGFloatIsUndefined(height) ? YGMeasureModeUndefined - : YGMeasureModeExactly; - } - if (YGLayoutNodeInternal( - node, - width, - height, - ownerDirection, - widthMeasureMode, - heightMeasureMode, - ownerWidth, - ownerHeight, - true, - "initial", - node->getConfig(), - marker.data)) { - node->setPosition( - node->getLayout().direction, ownerWidth, ownerHeight, ownerWidth); - YGRoundToPixelGrid(node, node->getConfig()->pointScaleFactor, 0.0f, 0.0f); - - if (node->getConfig()->printTree) { - YGNodePrint( - node, - (YGPrintOptions)( - YGPrintOptionsLayout | YGPrintOptionsChildren | - YGPrintOptionsStyle)); - } - } - - // We want to get rid off `useLegacyStretchBehaviour` from YGConfig. But we - // aren't sure whether client's of yoga have gotten rid off this flag or not. - // So logging this in YGLayout would help to find out the call sites depending - // on this flag. This check would be removed once we are sure no one is - // dependent on this flag anymore. The flag - // `shouldDiffLayoutWithoutLegacyStretchBehaviour` in YGConfig will help to - // run experiments. - if (node->getConfig()->shouldDiffLayoutWithoutLegacyStretchBehaviour && - node->didUseLegacyFlag()) { - const YGNodeRef originalNode = YGNodeDeepClone(node); - originalNode->resolveDimension(); - // Recursively mark nodes as dirty - originalNode->markDirtyAndPropogateDownwards(); - gCurrentGenerationCount++; - // Rerun the layout, and calculate the diff - originalNode->setAndPropogateUseLegacyFlag(false); - YGMarkerLayoutData layoutMarkerData; - if (YGLayoutNodeInternal( - originalNode, - width, - height, - ownerDirection, - widthMeasureMode, - heightMeasureMode, - ownerWidth, - ownerHeight, - true, - "initial", - originalNode->getConfig(), - layoutMarkerData)) { - originalNode->setPosition( - originalNode->getLayout().direction, - ownerWidth, - ownerHeight, - ownerWidth); - YGRoundToPixelGrid( - originalNode, - originalNode->getConfig()->pointScaleFactor, - 0.0f, - 0.0f); - - // Set whether the two layouts are different or not. - auto neededLegacyStretchBehaviour = - !originalNode->isLayoutTreeEqualToNode(*node); - node->setLayoutDoesLegacyFlagAffectsLayout(neededLegacyStretchBehaviour); - - if (originalNode->getConfig()->printTree) { - YGNodePrint( - originalNode, - (YGPrintOptions)( - YGPrintOptionsLayout | YGPrintOptionsChildren | - YGPrintOptionsStyle)); - } - } - YGConfigFreeRecursive(originalNode); - YGNodeFreeRecursive(originalNode); - } -} - -void YGConfigSetLogger(const YGConfigRef config, YGLogger logger) { - if (logger != nullptr) { - config->logger = logger; - } else { -#ifdef ANDROID - config->logger = &YGAndroidLog; -#else - config->logger = &YGDefaultLog; -#endif - } -} - -void YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour( - const YGConfigRef config, - const bool shouldDiffLayout) { - config->shouldDiffLayoutWithoutLegacyStretchBehaviour = shouldDiffLayout; -} - -static void YGVLog( - const YGConfigRef config, - const YGNodeRef node, - YGLogLevel level, - const char* format, - va_list args) { - const YGConfigRef logConfig = - config != nullptr ? config : YGConfigGetDefault(); - logConfig->logger(logConfig, node, level, format, args); - - if (level == YGLogLevelFatal) { - abort(); - } -} - -void YGLogWithConfig( - const YGConfigRef config, - YGLogLevel level, - const char* format, - ...) { - va_list args; - va_start(args, format); - YGVLog(config, nullptr, level, format, args); - va_end(args); -} - -void YGLog(const YGNodeRef node, YGLogLevel level, const char* format, ...) { - va_list args; - va_start(args, format); - YGVLog( - node == nullptr ? nullptr : node->getConfig(), node, level, format, args); - va_end(args); -} - -void YGAssert(const bool condition, const char* message) { - if (!condition) { - YGLog(nullptr, YGLogLevelFatal, "%s\n", message); - } -} - -void YGAssertWithNode( - const YGNodeRef node, - const bool condition, - const char* message) { - if (!condition) { - YGLog(node, YGLogLevelFatal, "%s\n", message); - } -} - -void YGAssertWithConfig( - const YGConfigRef config, - const bool condition, - const char* message) { - if (!condition) { - YGLogWithConfig(config, YGLogLevelFatal, "%s\n", message); - } -} - -void YGConfigSetExperimentalFeatureEnabled( - const YGConfigRef config, - const YGExperimentalFeature feature, - const bool enabled) { - config->experimentalFeatures[feature] = enabled; -} - -inline bool YGConfigIsExperimentalFeatureEnabled( - const YGConfigRef config, - const YGExperimentalFeature feature) { - return config->experimentalFeatures[feature]; -} - -void YGConfigSetUseWebDefaults(const YGConfigRef config, const bool enabled) { - config->useWebDefaults = enabled; -} - -void YGConfigSetUseLegacyStretchBehaviour( - const YGConfigRef config, - const bool useLegacyStretchBehaviour) { - config->useLegacyStretchBehaviour = useLegacyStretchBehaviour; -} - -bool YGConfigGetUseWebDefaults(const YGConfigRef config) { - return config->useWebDefaults; -} - -void YGConfigSetContext(const YGConfigRef config, void* context) { - config->context = context; -} - -void* YGConfigGetContext(const YGConfigRef config) { - return config->context; -} - -void YGConfigSetCloneNodeFunc( - const YGConfigRef config, - const YGCloneNodeFunc callback) { - config->cloneNodeCallback = callback; -} - -static void YGTraverseChildrenPreOrder( - const YGVector& children, - const std::function& f) { - for (YGNodeRef node : children) { - f(node); - YGTraverseChildrenPreOrder(node->getChildren(), f); - } -} - -void YGTraversePreOrder( - YGNodeRef const node, - std::function&& f) { - if (!node) { - return; - } - f(node); - YGTraverseChildrenPreOrder(node->getChildren(), f); -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/Yoga.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/Yoga.h deleted file mode 100644 index 214c5f69..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/Yoga.h +++ /dev/null @@ -1,441 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#pragma once - -#include -#include -#include -#include -#include -#include - -#ifndef __cplusplus -#include -#endif - -#include "YGEnums.h" -#include "YGMacros.h" -#include "YGValue.h" - -YG_EXTERN_C_BEGIN - -typedef struct YGSize { - float width; - float height; -} YGSize; - -typedef struct YGConfig* YGConfigRef; - -typedef struct YGNode* YGNodeRef; - -typedef YGSize (*YGMeasureFunc)( - YGNodeRef node, - float width, - YGMeasureMode widthMode, - float height, - YGMeasureMode heightMode); -typedef float ( - *YGBaselineFunc)(YGNodeRef node, const float width, const float height); -typedef void (*YGDirtiedFunc)(YGNodeRef node); -typedef void (*YGPrintFunc)(YGNodeRef node); -typedef void (*YGNodeCleanupFunc)(YGNodeRef node); -typedef int (*YGLogger)( - const YGConfigRef config, - const YGNodeRef node, - YGLogLevel level, - const char* format, - va_list args); -typedef YGNodeRef ( - *YGCloneNodeFunc)(YGNodeRef oldNode, YGNodeRef owner, int childIndex); - -// YGNode -WIN_EXPORT YGNodeRef YGNodeNew(void); -WIN_EXPORT YGNodeRef YGNodeNewWithConfig(const YGConfigRef config); -WIN_EXPORT YGNodeRef YGNodeClone(const YGNodeRef node); -WIN_EXPORT void YGNodeFree(const YGNodeRef node); -WIN_EXPORT void YGNodeFreeRecursiveWithCleanupFunc( - const YGNodeRef node, - YGNodeCleanupFunc cleanup); -WIN_EXPORT void YGNodeFreeRecursive(const YGNodeRef node); -WIN_EXPORT void YGNodeReset(const YGNodeRef node); -WIN_EXPORT int32_t YGNodeGetInstanceCount(void); - -WIN_EXPORT void YGNodeInsertChild( - const YGNodeRef node, - const YGNodeRef child, - const uint32_t index); - -WIN_EXPORT void YGNodeRemoveChild(const YGNodeRef node, const YGNodeRef child); -WIN_EXPORT void YGNodeRemoveAllChildren(const YGNodeRef node); -WIN_EXPORT YGNodeRef YGNodeGetChild(const YGNodeRef node, const uint32_t index); -WIN_EXPORT YGNodeRef YGNodeGetOwner(const YGNodeRef node); -WIN_EXPORT YGNodeRef YGNodeGetParent(const YGNodeRef node); -WIN_EXPORT uint32_t YGNodeGetChildCount(const YGNodeRef node); -WIN_EXPORT void YGNodeSetChildren( - YGNodeRef const owner, - const YGNodeRef children[], - const uint32_t count); - -WIN_EXPORT void YGNodeSetIsReferenceBaseline( - YGNodeRef node, - bool isReferenceBaseline); - -WIN_EXPORT bool YGNodeIsReferenceBaseline(YGNodeRef node); - -WIN_EXPORT void YGNodeCalculateLayout( - const YGNodeRef node, - const float availableWidth, - const float availableHeight, - const YGDirection ownerDirection); - -// Mark a node as dirty. Only valid for nodes with a custom measure function -// set. -// -// Yoga knows when to mark all other nodes as dirty but because nodes with -// measure functions depend on information not known to Yoga they must perform -// this dirty marking manually. -WIN_EXPORT void YGNodeMarkDirty(const YGNodeRef node); - -// Marks the current node and all its descendants as dirty. -// -// Intended to be used for Uoga benchmarks. Don't use in production, as calling -// `YGCalculateLayout` will cause the recalculation of each and every node. -WIN_EXPORT void YGNodeMarkDirtyAndPropogateToDescendants(const YGNodeRef node); - -WIN_EXPORT void YGNodePrint(const YGNodeRef node, const YGPrintOptions options); - -WIN_EXPORT bool YGFloatIsUndefined(const float value); - -WIN_EXPORT bool YGNodeCanUseCachedMeasurement( - const YGMeasureMode widthMode, - const float width, - const YGMeasureMode heightMode, - const float height, - const YGMeasureMode lastWidthMode, - const float lastWidth, - const YGMeasureMode lastHeightMode, - const float lastHeight, - const float lastComputedWidth, - const float lastComputedHeight, - const float marginRow, - const float marginColumn, - const YGConfigRef config); - -WIN_EXPORT void YGNodeCopyStyle( - const YGNodeRef dstNode, - const YGNodeRef srcNode); - -WIN_EXPORT void* YGNodeGetContext(YGNodeRef node); -WIN_EXPORT void YGNodeSetContext(YGNodeRef node, void* context); -void YGConfigSetPrintTreeFlag(YGConfigRef config, bool enabled); -YGMeasureFunc YGNodeGetMeasureFunc(YGNodeRef node); -WIN_EXPORT void YGNodeSetMeasureFunc(YGNodeRef node, YGMeasureFunc measureFunc); -YGBaselineFunc YGNodeGetBaselineFunc(YGNodeRef node); -void YGNodeSetBaselineFunc(YGNodeRef node, YGBaselineFunc baselineFunc); -YGDirtiedFunc YGNodeGetDirtiedFunc(YGNodeRef node); -void YGNodeSetDirtiedFunc(YGNodeRef node, YGDirtiedFunc dirtiedFunc); -YGPrintFunc YGNodeGetPrintFunc(YGNodeRef node); -void YGNodeSetPrintFunc(YGNodeRef node, YGPrintFunc printFunc); -WIN_EXPORT bool YGNodeGetHasNewLayout(YGNodeRef node); -WIN_EXPORT void YGNodeSetHasNewLayout(YGNodeRef node, bool hasNewLayout); -YGNodeType YGNodeGetNodeType(YGNodeRef node); -void YGNodeSetNodeType(YGNodeRef node, YGNodeType nodeType); -WIN_EXPORT bool YGNodeIsDirty(YGNodeRef node); -bool YGNodeLayoutGetDidUseLegacyFlag(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetDirection( - const YGNodeRef node, - const YGDirection direction); -WIN_EXPORT YGDirection YGNodeStyleGetDirection(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetFlexDirection( - const YGNodeRef node, - const YGFlexDirection flexDirection); -WIN_EXPORT YGFlexDirection YGNodeStyleGetFlexDirection(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetJustifyContent( - const YGNodeRef node, - const YGJustify justifyContent); -WIN_EXPORT YGJustify YGNodeStyleGetJustifyContent(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetAlignContent( - const YGNodeRef node, - const YGAlign alignContent); -WIN_EXPORT YGAlign YGNodeStyleGetAlignContent(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetAlignItems( - const YGNodeRef node, - const YGAlign alignItems); -WIN_EXPORT YGAlign YGNodeStyleGetAlignItems(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetAlignSelf( - const YGNodeRef node, - const YGAlign alignSelf); -WIN_EXPORT YGAlign YGNodeStyleGetAlignSelf(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetPositionType( - const YGNodeRef node, - const YGPositionType positionType); -WIN_EXPORT YGPositionType YGNodeStyleGetPositionType(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetFlexWrap( - const YGNodeRef node, - const YGWrap flexWrap); -WIN_EXPORT YGWrap YGNodeStyleGetFlexWrap(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetOverflow( - const YGNodeRef node, - const YGOverflow overflow); -WIN_EXPORT YGOverflow YGNodeStyleGetOverflow(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetDisplay( - const YGNodeRef node, - const YGDisplay display); -WIN_EXPORT YGDisplay YGNodeStyleGetDisplay(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetFlex(const YGNodeRef node, const float flex); -WIN_EXPORT float YGNodeStyleGetFlex(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetFlexGrow( - const YGNodeRef node, - const float flexGrow); -WIN_EXPORT float YGNodeStyleGetFlexGrow(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetFlexShrink( - const YGNodeRef node, - const float flexShrink); -WIN_EXPORT float YGNodeStyleGetFlexShrink(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetFlexBasis( - const YGNodeRef node, - const float flexBasis); -WIN_EXPORT void YGNodeStyleSetFlexBasisPercent( - const YGNodeRef node, - const float flexBasis); -WIN_EXPORT void YGNodeStyleSetFlexBasisAuto(const YGNodeRef node); -WIN_EXPORT YGValue YGNodeStyleGetFlexBasis(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetPosition( - const YGNodeRef node, - const YGEdge edge, - const float position); -WIN_EXPORT void YGNodeStyleSetPositionPercent( - const YGNodeRef node, - const YGEdge edge, - const float position); -WIN_EXPORT YGValue -YGNodeStyleGetPosition(const YGNodeRef node, const YGEdge edge); - -WIN_EXPORT void YGNodeStyleSetMargin( - const YGNodeRef node, - const YGEdge edge, - const float margin); -WIN_EXPORT void YGNodeStyleSetMarginPercent( - const YGNodeRef node, - const YGEdge edge, - const float margin); -WIN_EXPORT void YGNodeStyleSetMarginAuto( - const YGNodeRef node, - const YGEdge edge); -WIN_EXPORT YGValue -YGNodeStyleGetMargin(const YGNodeRef node, const YGEdge edge); - -WIN_EXPORT void YGNodeStyleSetPadding( - const YGNodeRef node, - const YGEdge edge, - const float padding); -WIN_EXPORT void YGNodeStyleSetPaddingPercent( - const YGNodeRef node, - const YGEdge edge, - const float padding); -WIN_EXPORT YGValue -YGNodeStyleGetPadding(const YGNodeRef node, const YGEdge edge); - -WIN_EXPORT void YGNodeStyleSetBorder( - const YGNodeRef node, - const YGEdge edge, - const float border); -WIN_EXPORT float YGNodeStyleGetBorder(const YGNodeRef node, const YGEdge edge); - -WIN_EXPORT void YGNodeStyleSetWidth(const YGNodeRef node, const float width); -WIN_EXPORT void YGNodeStyleSetWidthPercent( - const YGNodeRef node, - const float width); -WIN_EXPORT void YGNodeStyleSetWidthAuto(const YGNodeRef node); -WIN_EXPORT YGValue YGNodeStyleGetWidth(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetHeight(const YGNodeRef node, const float height); -WIN_EXPORT void YGNodeStyleSetHeightPercent( - const YGNodeRef node, - const float height); -WIN_EXPORT void YGNodeStyleSetHeightAuto(const YGNodeRef node); -WIN_EXPORT YGValue YGNodeStyleGetHeight(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetMinWidth( - const YGNodeRef node, - const float minWidth); -WIN_EXPORT void YGNodeStyleSetMinWidthPercent( - const YGNodeRef node, - const float minWidth); -WIN_EXPORT YGValue YGNodeStyleGetMinWidth(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetMinHeight( - const YGNodeRef node, - const float minHeight); -WIN_EXPORT void YGNodeStyleSetMinHeightPercent( - const YGNodeRef node, - const float minHeight); -WIN_EXPORT YGValue YGNodeStyleGetMinHeight(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetMaxWidth( - const YGNodeRef node, - const float maxWidth); -WIN_EXPORT void YGNodeStyleSetMaxWidthPercent( - const YGNodeRef node, - const float maxWidth); -WIN_EXPORT YGValue YGNodeStyleGetMaxWidth(const YGNodeRef node); - -WIN_EXPORT void YGNodeStyleSetMaxHeight( - const YGNodeRef node, - const float maxHeight); -WIN_EXPORT void YGNodeStyleSetMaxHeightPercent( - const YGNodeRef node, - const float maxHeight); -WIN_EXPORT YGValue YGNodeStyleGetMaxHeight(const YGNodeRef node); - -// Yoga specific properties, not compatible with flexbox specification Aspect -// ratio control the size of the undefined dimension of a node. Aspect ratio is -// encoded as a floating point value width/height. e.g. A value of 2 leads to a -// node with a width twice the size of its height while a value of 0.5 gives the -// opposite effect. -// -// - On a node with a set width/height aspect ratio control the size of the -// unset dimension -// - On a node with a set flex basis aspect ratio controls the size of the node -// in the cross axis if unset -// - On a node with a measure function aspect ratio works as though the measure -// function measures the flex basis -// - On a node with flex grow/shrink aspect ratio controls the size of the node -// in the cross axis if unset -// - Aspect ratio takes min/max dimensions into account -WIN_EXPORT void YGNodeStyleSetAspectRatio( - const YGNodeRef node, - const float aspectRatio); -WIN_EXPORT float YGNodeStyleGetAspectRatio(const YGNodeRef node); - -WIN_EXPORT float YGNodeLayoutGetLeft(const YGNodeRef node); -WIN_EXPORT float YGNodeLayoutGetTop(const YGNodeRef node); -WIN_EXPORT float YGNodeLayoutGetRight(const YGNodeRef node); -WIN_EXPORT float YGNodeLayoutGetBottom(const YGNodeRef node); -WIN_EXPORT float YGNodeLayoutGetWidth(const YGNodeRef node); -WIN_EXPORT float YGNodeLayoutGetHeight(const YGNodeRef node); -WIN_EXPORT YGDirection YGNodeLayoutGetDirection(const YGNodeRef node); -WIN_EXPORT bool YGNodeLayoutGetHadOverflow(const YGNodeRef node); -bool YGNodeLayoutGetDidLegacyStretchFlagAffectLayout(const YGNodeRef node); - -// Get the computed values for these nodes after performing layout. If they were -// set using point values then the returned value will be the same as -// YGNodeStyleGetXXX. However if they were set using a percentage value then the -// returned value is the computed value used during layout. -WIN_EXPORT float YGNodeLayoutGetMargin(const YGNodeRef node, const YGEdge edge); -WIN_EXPORT float YGNodeLayoutGetBorder(const YGNodeRef node, const YGEdge edge); -WIN_EXPORT float YGNodeLayoutGetPadding( - const YGNodeRef node, - const YGEdge edge); - -WIN_EXPORT void YGConfigSetLogger(const YGConfigRef config, YGLogger logger); -WIN_EXPORT void YGLog( - const YGNodeRef node, - YGLogLevel level, - const char* message, - ...); -WIN_EXPORT void YGLogWithConfig( - const YGConfigRef config, - YGLogLevel level, - const char* format, - ...); -WIN_EXPORT void YGAssert(const bool condition, const char* message); -WIN_EXPORT void YGAssertWithNode( - const YGNodeRef node, - const bool condition, - const char* message); -WIN_EXPORT void YGAssertWithConfig( - const YGConfigRef config, - const bool condition, - const char* message); -// Set this to number of pixels in 1 point to round calculation results If you -// want to avoid rounding - set PointScaleFactor to 0 -WIN_EXPORT void YGConfigSetPointScaleFactor( - const YGConfigRef config, - const float pixelsInPoint); -void YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour( - const YGConfigRef config, - const bool shouldDiffLayout); - -// Yoga previously had an error where containers would take the maximum space -// possible instead of the minimum like they are supposed to. In practice this -// resulted in implicit behaviour similar to align-self: stretch; Because this -// was such a long-standing bug we must allow legacy users to switch back to -// this behaviour. -WIN_EXPORT void YGConfigSetUseLegacyStretchBehaviour( - const YGConfigRef config, - const bool useLegacyStretchBehaviour); - -// YGConfig -WIN_EXPORT YGConfigRef YGConfigNew(void); -WIN_EXPORT void YGConfigFree(const YGConfigRef config); -WIN_EXPORT void YGConfigCopy(const YGConfigRef dest, const YGConfigRef src); -WIN_EXPORT int32_t YGConfigGetInstanceCount(void); - -WIN_EXPORT void YGConfigSetExperimentalFeatureEnabled( - const YGConfigRef config, - const YGExperimentalFeature feature, - const bool enabled); -WIN_EXPORT bool YGConfigIsExperimentalFeatureEnabled( - const YGConfigRef config, - const YGExperimentalFeature feature); - -// Using the web defaults is the prefered configuration for new projects. Usage -// of non web defaults should be considered as legacy. -WIN_EXPORT void YGConfigSetUseWebDefaults( - const YGConfigRef config, - const bool enabled); -WIN_EXPORT bool YGConfigGetUseWebDefaults(const YGConfigRef config); - -WIN_EXPORT void YGConfigSetCloneNodeFunc( - const YGConfigRef config, - const YGCloneNodeFunc callback); - -// Export only for C# -WIN_EXPORT YGConfigRef YGConfigGetDefault(void); - -WIN_EXPORT void YGConfigSetContext(const YGConfigRef config, void* context); -WIN_EXPORT void* YGConfigGetContext(const YGConfigRef config); - -WIN_EXPORT float YGRoundValueToPixelGrid( - const float value, - const float pointScaleFactor, - const bool forceCeil, - const bool forceFloor); - -YG_EXTERN_C_END - -#ifdef __cplusplus - -#include -#include - -// Calls f on each node in the tree including the given node argument. -extern void YGTraversePreOrder( - YGNodeRef const node, - std::function&& f); - -extern void YGNodeSetChildren( - YGNodeRef const owner, - const std::vector& children); - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/instrumentation.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/instrumentation.h deleted file mode 100644 index 5cc544c5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/ReactCommon/yoga/yoga/instrumentation.h +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#include "YGConfig.h" -#include "YGMarker.h" -#include "YGNode.h" - -namespace facebook { -namespace yoga { -namespace marker { - -template -class MarkerSection { -private: - using Data = detail::MarkerData; - -public: - MarkerSection(YGNodeRef node) : MarkerSection{node, node->getConfig()} {} - ~MarkerSection() { - if (endMarker_) { - endMarker_(MarkerType, node_, markerData(&data), userData_); - } - } - - typename Data::type data = {}; - - template - static Ret wrap(YGNodeRef node, Ret (*fn)(Args...), Args... args) { - MarkerSection section{node}; - return fn(std::forward(args)...); - } - -private: - decltype(YGMarkerCallbacks{}.endMarker) endMarker_; - YGNodeRef node_; - void* userData_; - - MarkerSection(YGNodeRef node, YGConfigRef config) - : MarkerSection{node, config ? &config->markerCallbacks : nullptr} {} - MarkerSection(YGNodeRef node, YGMarkerCallbacks* callbacks) - : endMarker_{callbacks ? callbacks->endMarker : nullptr}, - node_{node}, - userData_{ - callbacks && callbacks->startMarker - ? callbacks->startMarker(MarkerType, node, markerData(&data)) - : nullptr} {} - - static YGMarkerData markerData(typename Data::type* d) { - YGMarkerData markerData = {}; - Data::get(markerData) = d; - return markerData; - } -}; - -} // namespace marker -} // namespace yoga -} // namespace facebook diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Settings/RCTSettings.xcodeproj/project.pbxproj b/ios/ElectrodeApiImpl/Libraries/ReactNative/Settings/RCTSettings.xcodeproj/project.pbxproj deleted file mode 100644 index 2366798e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Settings/RCTSettings.xcodeproj/project.pbxproj +++ /dev/null @@ -1,328 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 13DBA45E1AEE749000A17CF8 /* RCTSettingsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13DBA45D1AEE749000A17CF8 /* RCTSettingsManager.m */; }; - 2D3B5F2C1D9B0ECA00451313 /* RCTSettingsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13DBA45D1AEE749000A17CF8 /* RCTSettingsManager.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libRCTSettings.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTSettings.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 13DBA45C1AEE749000A17CF8 /* RCTSettingsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSettingsManager.h; sourceTree = ""; }; - 13DBA45D1AEE749000A17CF8 /* RCTSettingsManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSettingsManager.m; sourceTree = ""; }; - 2D2A28611D9B046600D4039D /* libRCTSettings-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTSettings-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 134814211AA4EA7D00B7C361 /* Products */ = { - isa = PBXGroup; - children = ( - 134814201AA4EA6300B7C361 /* libRCTSettings.a */, - ); - name = Products; - sourceTree = ""; - }; - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - 13DBA45C1AEE749000A17CF8 /* RCTSettingsManager.h */, - 13DBA45D1AEE749000A17CF8 /* RCTSettingsManager.m */, - 134814211AA4EA7D00B7C361 /* Products */, - 2D2A28611D9B046600D4039D /* libRCTSettings-tvOS.a */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 2D2A28601D9B046600D4039D /* RCTSettings-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D2A28691D9B046600D4039D /* Build configuration list for PBXNativeTarget "RCTSettings-tvOS" */; - buildPhases = ( - 2D2A285D1D9B046600D4039D /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTSettings-tvOS"; - productName = "RCTSettings-tvOS"; - productReference = 2D2A28611D9B046600D4039D /* libRCTSettings-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 58B511DA1A9E6C8500147676 /* RCTSettings */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTSettings" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTSettings; - productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libRCTSettings.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 2D2A28601D9B046600D4039D = { - CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Automatic; - }; - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTSettings" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511D21A9E6C8500147676; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B511DA1A9E6C8500147676 /* RCTSettings */, - 2D2A28601D9B046600D4039D /* RCTSettings-tvOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 2D2A285D1D9B046600D4039D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D3B5F2C1D9B0ECA00451313 /* RCTSettingsManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13DBA45E1AEE749000A17CF8 /* RCTSettingsManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 2D2A28671D9B046600D4039D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 2D2A28681D9B046600D4039D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTSettings; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTSettings; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2D2A28691D9B046600D4039D /* Build configuration list for PBXNativeTarget "RCTSettings-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D2A28671D9B046600D4039D /* Debug */, - 2D2A28681D9B046600D4039D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTSettings" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTSettings" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Settings/RCTSettingsManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Settings/RCTSettingsManager.h deleted file mode 100644 index d9723b2d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Settings/RCTSettingsManager.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTSettingsManager : NSObject - -- (instancetype)initWithUserDefaults:(NSUserDefaults *)defaults NS_DESIGNATED_INITIALIZER; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Settings/RCTSettingsManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Settings/RCTSettingsManager.m deleted file mode 100644 index ab8e14df..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Settings/RCTSettingsManager.m +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSettingsManager.h" - -#import -#import -#import -#import - -@implementation RCTSettingsManager -{ - BOOL _ignoringUpdates; - NSUserDefaults *_defaults; -} - -@synthesize bridge = _bridge; - -RCT_EXPORT_MODULE() - -+ (BOOL)requiresMainQueueSetup -{ - return NO; -} - -- (instancetype)init -{ - return [self initWithUserDefaults:[NSUserDefaults standardUserDefaults]]; -} - -- (instancetype)initWithUserDefaults:(NSUserDefaults *)defaults -{ - if ((self = [super init])) { - _defaults = defaults; - - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(userDefaultsDidChange:) - name:NSUserDefaultsDidChangeNotification - object:_defaults]; - } - return self; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (NSDictionary *)constantsToExport -{ - return [self getConstants]; -} - -- (NSDictionary *)getConstants -{ - return @{@"settings": RCTJSONClean([_defaults dictionaryRepresentation])}; -} - -- (void)userDefaultsDidChange:(NSNotification *)note -{ - if (_ignoringUpdates) { - return; - } - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_bridge.eventDispatcher - sendDeviceEventWithName:@"settingsUpdated" - body:RCTJSONClean([_defaults dictionaryRepresentation])]; -#pragma clang diagnostic pop -} - -/** - * Set one or more values in the settings. - * TODO: would it be useful to have a callback for when this has completed? - */ -RCT_EXPORT_METHOD(setValues:(NSDictionary *)values) -{ - _ignoringUpdates = YES; - [values enumerateKeysAndObjectsUsingBlock:^(NSString *key, id json, BOOL *stop) { - id plist = [RCTConvert NSPropertyList:json]; - if (plist) { - [self->_defaults setObject:plist forKey:key]; - } else { - [self->_defaults removeObjectForKey:key]; - } - }]; - - [_defaults synchronize]; - _ignoringUpdates = NO; -} - -/** - * Remove some values from the settings. - */ -RCT_EXPORT_METHOD(deleteValues:(NSArray *)keys) -{ - _ignoringUpdates = YES; - for (NSString *key in keys) { - [_defaults removeObjectForKey:key]; - } - - [_defaults synchronize]; - _ignoringUpdates = NO; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Settings/Settings.android.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Settings/Settings.android.js deleted file mode 100644 index d754a750..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Settings/Settings.android.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const Settings = { - get(key: string): mixed { - console.warn('Settings is not yet supported on Android'); - return null; - }, - - set(settings: Object) { - console.warn('Settings is not yet supported on Android'); - }, - - watchKeys(keys: string | Array, callback: Function): number { - console.warn('Settings is not yet supported on Android'); - return -1; - }, - - clearWatch(watchId: number) { - console.warn('Settings is not yet supported on Android'); - }, -}; - -module.exports = Settings; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Settings/Settings.ios.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Settings/Settings.ios.js deleted file mode 100644 index e1c329b0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Settings/Settings.ios.js +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const RCTDeviceEventEmitter = require('RCTDeviceEventEmitter'); -const RCTSettingsManager = require('NativeModules').SettingsManager; - -const invariant = require('invariant'); - -const subscriptions: Array<{keys: Array, callback: ?Function}> = []; - -const Settings = { - _settings: RCTSettingsManager && RCTSettingsManager.settings, - - get(key: string): mixed { - return this._settings[key]; - }, - - set(settings: Object) { - this._settings = Object.assign(this._settings, settings); - RCTSettingsManager.setValues(settings); - }, - - watchKeys(keys: string | Array, callback: Function): number { - if (typeof keys === 'string') { - keys = [keys]; - } - - invariant( - Array.isArray(keys), - 'keys should be a string or array of strings', - ); - - const sid = subscriptions.length; - subscriptions.push({keys: keys, callback: callback}); - return sid; - }, - - clearWatch(watchId: number) { - if (watchId < subscriptions.length) { - subscriptions[watchId] = {keys: [], callback: null}; - } - }, - - _sendObservations(body: Object) { - Object.keys(body).forEach(key => { - const newValue = body[key]; - const didChange = this._settings[key] !== newValue; - this._settings[key] = newValue; - - if (didChange) { - subscriptions.forEach(sub => { - if (sub.keys.indexOf(key) !== -1 && sub.callback) { - sub.callback(); - } - }); - } - }); - }, -}; - -RCTDeviceEventEmitter.addListener( - 'settingsUpdated', - Settings._sendObservations.bind(Settings), -); - -module.exports = Settings; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/BaseText/RCTBaseTextShadowView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/BaseText/RCTBaseTextShadowView.h deleted file mode 100644 index a7cbf10b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/BaseText/RCTBaseTextShadowView.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "RCTTextAttributes.h" - -NS_ASSUME_NONNULL_BEGIN - -extern NSString *const RCTBaseTextShadowViewEmbeddedShadowViewAttributeName; - -@interface RCTBaseTextShadowView : RCTShadowView - -@property (nonatomic, strong) RCTTextAttributes *textAttributes; - -- (NSAttributedString *)attributedTextWithBaseTextAttributes:(nullable RCTTextAttributes *)baseTextAttributes; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/BaseText/RCTBaseTextShadowView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/BaseText/RCTBaseTextShadowView.m deleted file mode 100644 index 993e88f8..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/BaseText/RCTBaseTextShadowView.m +++ /dev/null @@ -1,161 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTBaseTextShadowView.h" - -#import - -#import "RCTRawTextShadowView.h" -#import "RCTVirtualTextShadowView.h" - -NSString *const RCTBaseTextShadowViewEmbeddedShadowViewAttributeName = @"RCTBaseTextShadowViewEmbeddedShadowViewAttributeName"; - -static void RCTInlineViewYogaNodeDirtied(YGNodeRef node) -{ - // An inline view (a view nested inside of a text node) does not have a parent - // in the Yoga tree. Consequently, we have to manually propagate the inline - // view's dirty signal up through the text nodes. At some point, it'll reach - // the outermost text node which has a Yoga node and then Yoga will take over - // the dirty signal propagation. - RCTShadowView *inlineView = (__bridge RCTShadowView *)YGNodeGetContext(node); - RCTBaseTextShadowView *baseTextShadowView = - (RCTBaseTextShadowView *)inlineView.reactSuperview; - - [baseTextShadowView dirtyLayout]; -} - -@implementation RCTBaseTextShadowView -{ - NSAttributedString *_Nullable _cachedAttributedText; - RCTTextAttributes *_Nullable _cachedTextAttributes; -} - -- (instancetype)init -{ - if (self = [super init]) { - _textAttributes = [RCTTextAttributes new]; - } - - return self; -} - -- (void)setReactTag:(NSNumber *)reactTag -{ - [super setReactTag:reactTag]; - _textAttributes.tag = reactTag; -} - -#pragma mark - Life Cycle - -- (void)insertReactSubview:(RCTShadowView *)subview atIndex:(NSInteger)index -{ - [super insertReactSubview:subview atIndex:index]; - - [self dirtyLayout]; - - if (![subview isKindOfClass:[RCTVirtualTextShadowView class]]) { - YGNodeSetDirtiedFunc(subview.yogaNode, RCTInlineViewYogaNodeDirtied); - } -} - -- (void)removeReactSubview:(RCTShadowView *)subview -{ - if (![subview isKindOfClass:[RCTVirtualTextShadowView class]]) { - YGNodeSetDirtiedFunc(subview.yogaNode, NULL); - } - - [self dirtyLayout]; - - [super removeReactSubview:subview]; -} - -#pragma mark - attributedString - -- (NSAttributedString *)attributedTextWithBaseTextAttributes:(nullable RCTTextAttributes *)baseTextAttributes -{ - RCTTextAttributes *textAttributes; - - if (baseTextAttributes) { - textAttributes = [baseTextAttributes copy]; - [textAttributes applyTextAttributes:self.textAttributes]; - } else { - textAttributes = [self.textAttributes copy]; - } - - if (_cachedAttributedText && [_cachedTextAttributes isEqual:textAttributes]) { - return _cachedAttributedText; - } - - NSMutableAttributedString *attributedText = [NSMutableAttributedString new]; - - [attributedText beginEditing]; - - for (RCTShadowView *shadowView in self.reactSubviews) { - // Special Case: RCTRawTextShadowView - if ([shadowView isKindOfClass:[RCTRawTextShadowView class]]) { - RCTRawTextShadowView *rawTextShadowView = (RCTRawTextShadowView *)shadowView; - NSString *text = rawTextShadowView.text; - if (text) { - NSAttributedString *rawTextAttributedString = - [[NSAttributedString alloc] initWithString:[textAttributes applyTextAttributesToText:text] - attributes:textAttributes.effectiveTextAttributes]; - [attributedText appendAttributedString:rawTextAttributedString]; - } - continue; - } - - // Special Case: RCTBaseTextShadowView - if ([shadowView isKindOfClass:[RCTBaseTextShadowView class]]) { - RCTBaseTextShadowView *baseTextShadowView = (RCTBaseTextShadowView *)shadowView; - NSAttributedString *baseTextAttributedString = - [baseTextShadowView attributedTextWithBaseTextAttributes:textAttributes]; - [attributedText appendAttributedString:baseTextAttributedString]; - continue; - } - - // Generic Case: Any RCTShadowView - NSTextAttachment *attachment = [NSTextAttachment new]; - NSMutableAttributedString *embeddedShadowViewAttributedString = [NSMutableAttributedString new]; - [embeddedShadowViewAttributedString beginEditing]; - [embeddedShadowViewAttributedString appendAttributedString:[NSAttributedString attributedStringWithAttachment:attachment]]; - [embeddedShadowViewAttributedString addAttribute:RCTBaseTextShadowViewEmbeddedShadowViewAttributeName - value:shadowView - range:(NSRange){0, embeddedShadowViewAttributedString.length}]; - [embeddedShadowViewAttributedString endEditing]; - [attributedText appendAttributedString:embeddedShadowViewAttributedString]; - } - - [attributedText endEditing]; - - [self clearLayout]; - - _cachedAttributedText = [attributedText copy]; - _cachedTextAttributes = textAttributes; - - return _cachedAttributedText; -} - -- (void)dirtyLayout -{ - [super dirtyLayout]; - _cachedAttributedText = nil; - _cachedTextAttributes = nil; -} - -- (void)didUpdateReactSubviews -{ - [super didUpdateReactSubviews]; - [self dirtyLayout]; -} - -- (void)didSetProps:(NSArray *)changedProps -{ - [super didSetProps:changedProps]; - [self dirtyLayout]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/BaseText/RCTBaseTextViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/BaseText/RCTBaseTextViewManager.h deleted file mode 100644 index 782a4761..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/BaseText/RCTBaseTextViewManager.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface RCTBaseTextViewManager : RCTViewManager - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/BaseText/RCTBaseTextViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/BaseText/RCTBaseTextViewManager.m deleted file mode 100644 index 247c636d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/BaseText/RCTBaseTextViewManager.m +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTBaseTextViewManager.h" - -@implementation RCTBaseTextViewManager - -RCT_EXPORT_MODULE(RCTBaseText) - -- (UIView *)view -{ - RCTAssert(NO, @"The `-[RCTBaseTextViewManager view]` property must be overridden in subclass."); - return nil; -} - -- (RCTShadowView *)shadowView -{ - RCTAssert(NO, @"The `-[RCTBaseTextViewManager shadowView]` property must be overridden in subclass."); - return nil; -} - -#pragma mark - Text Attributes - -// Color -RCT_REMAP_SHADOW_PROPERTY(color, textAttributes.foregroundColor, UIColor) -RCT_REMAP_SHADOW_PROPERTY(backgroundColor, textAttributes.backgroundColor, UIColor) -RCT_REMAP_SHADOW_PROPERTY(opacity, textAttributes.opacity, CGFloat) -// Font -RCT_REMAP_SHADOW_PROPERTY(fontFamily, textAttributes.fontFamily, NSString) -RCT_REMAP_SHADOW_PROPERTY(fontSize, textAttributes.fontSize, CGFloat) -RCT_REMAP_SHADOW_PROPERTY(fontWeight, textAttributes.fontWeight, NSString) -RCT_REMAP_SHADOW_PROPERTY(fontStyle, textAttributes.fontStyle, NSString) -RCT_REMAP_SHADOW_PROPERTY(fontVariant, textAttributes.fontVariant, NSArray) -RCT_REMAP_SHADOW_PROPERTY(allowFontScaling, textAttributes.allowFontScaling, BOOL) -RCT_REMAP_SHADOW_PROPERTY(maxFontSizeMultiplier, textAttributes.maxFontSizeMultiplier, CGFloat) -RCT_REMAP_SHADOW_PROPERTY(letterSpacing, textAttributes.letterSpacing, CGFloat) -// Paragraph Styles -RCT_REMAP_SHADOW_PROPERTY(lineHeight, textAttributes.lineHeight, CGFloat) -RCT_REMAP_SHADOW_PROPERTY(textAlign, textAttributes.alignment, NSTextAlignment) -RCT_REMAP_SHADOW_PROPERTY(writingDirection, textAttributes.baseWritingDirection, NSWritingDirection) -// Decoration -RCT_REMAP_SHADOW_PROPERTY(textDecorationColor, textAttributes.textDecorationColor, UIColor) -RCT_REMAP_SHADOW_PROPERTY(textDecorationStyle, textAttributes.textDecorationStyle, NSUnderlineStyle) -RCT_REMAP_SHADOW_PROPERTY(textDecorationLine, textAttributes.textDecorationLine, RCTTextDecorationLineType) -// Shadow -RCT_REMAP_SHADOW_PROPERTY(textShadowOffset, textAttributes.textShadowOffset, CGSize) -RCT_REMAP_SHADOW_PROPERTY(textShadowRadius, textAttributes.textShadowRadius, CGFloat) -RCT_REMAP_SHADOW_PROPERTY(textShadowColor, textAttributes.textShadowColor, UIColor) -// Special -RCT_REMAP_SHADOW_PROPERTY(isHighlighted, textAttributes.isHighlighted, BOOL) -RCT_REMAP_SHADOW_PROPERTY(textTransform, textAttributes.textTransform, RCTTextTransform) - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RCTConvert+Text.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RCTConvert+Text.h deleted file mode 100644 index 0a33ab38..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RCTConvert+Text.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "RCTTextTransform.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface RCTConvert (Text) - -+ (UITextAutocorrectionType)UITextAutocorrectionType:(nullable id)json; -+ (UITextSpellCheckingType)UITextSpellCheckingType:(nullable id)json; -+ (RCTTextTransform)RCTTextTransform:(nullable id)json; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RCTConvert+Text.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RCTConvert+Text.m deleted file mode 100644 index cd91ba96..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RCTConvert+Text.m +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTConvert+Text.h" - -@implementation RCTConvert (Text) - -+ (UITextAutocorrectionType)UITextAutocorrectionType:(id)json -{ - return - json == nil ? UITextAutocorrectionTypeDefault : - [RCTConvert BOOL:json] ? UITextAutocorrectionTypeYes : - UITextAutocorrectionTypeNo; -} - -+ (UITextSpellCheckingType)UITextSpellCheckingType:(id)json -{ - return - json == nil ? UITextSpellCheckingTypeDefault : - [RCTConvert BOOL:json] ? UITextSpellCheckingTypeYes : - UITextSpellCheckingTypeNo; -} - -RCT_ENUM_CONVERTER(RCTTextTransform, (@{ - @"none": @(RCTTextTransformNone), - @"capitalize": @(RCTTextTransformCapitalize), - @"uppercase": @(RCTTextTransformUppercase), - @"lowercase": @(RCTTextTransformLowercase), -}), RCTTextTransformUndefined, integerValue) - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RCTText.xcodeproj/project.pbxproj b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RCTText.xcodeproj/project.pbxproj deleted file mode 100644 index d3205e5e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RCTText.xcodeproj/project.pbxproj +++ /dev/null @@ -1,722 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 5956B130200FEBAA008D9D16 /* RCTRawTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B0FD200FEBA9008D9D16 /* RCTRawTextShadowView.m */; }; - 5956B131200FEBAA008D9D16 /* RCTRawTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B0FE200FEBA9008D9D16 /* RCTRawTextViewManager.m */; }; - 5956B132200FEBAA008D9D16 /* RCTSinglelineTextInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B101200FEBA9008D9D16 /* RCTSinglelineTextInputView.m */; }; - 5956B133200FEBAA008D9D16 /* RCTUITextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B103200FEBA9008D9D16 /* RCTUITextField.m */; }; - 5956B134200FEBAA008D9D16 /* RCTSinglelineTextInputViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B106200FEBA9008D9D16 /* RCTSinglelineTextInputViewManager.m */; }; - 5956B135200FEBAA008D9D16 /* RCTBaseTextInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B10A200FEBA9008D9D16 /* RCTBaseTextInputView.m */; }; - 5956B136200FEBAA008D9D16 /* RCTBackedTextInputDelegateAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B10D200FEBA9008D9D16 /* RCTBackedTextInputDelegateAdapter.m */; }; - 5956B137200FEBAA008D9D16 /* RCTBaseTextInputShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B10F200FEBA9008D9D16 /* RCTBaseTextInputShadowView.m */; }; - 5956B138200FEBAA008D9D16 /* RCTTextSelection.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B110200FEBA9008D9D16 /* RCTTextSelection.m */; }; - 5956B139200FEBAA008D9D16 /* RCTBaseTextInputViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B111200FEBA9008D9D16 /* RCTBaseTextInputViewManager.m */; }; - 5956B13A200FEBAA008D9D16 /* RCTMultilineTextInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B115200FEBA9008D9D16 /* RCTMultilineTextInputView.m */; }; - 5956B13B200FEBAA008D9D16 /* RCTMultilineTextInputViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B118200FEBA9008D9D16 /* RCTMultilineTextInputViewManager.m */; }; - 5956B13C200FEBAA008D9D16 /* RCTUITextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B119200FEBA9008D9D16 /* RCTUITextView.m */; }; - 5956B13D200FEBAA008D9D16 /* RCTBaseTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B11E200FEBA9008D9D16 /* RCTBaseTextShadowView.m */; }; - 5956B13E200FEBAA008D9D16 /* RCTBaseTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B11F200FEBA9008D9D16 /* RCTBaseTextViewManager.m */; }; - 5956B13F200FEBAA008D9D16 /* RCTTextAttributes.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B120200FEBA9008D9D16 /* RCTTextAttributes.m */; }; - 5956B140200FEBAA008D9D16 /* RCTTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B122200FEBAA008D9D16 /* RCTTextShadowView.m */; }; - 5956B141200FEBAA008D9D16 /* NSTextStorage+FontScaling.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B125200FEBAA008D9D16 /* NSTextStorage+FontScaling.m */; }; - 5956B142200FEBAA008D9D16 /* RCTTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B127200FEBAA008D9D16 /* RCTTextViewManager.m */; }; - 5956B143200FEBAA008D9D16 /* RCTTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B128200FEBAA008D9D16 /* RCTTextView.m */; }; - 5956B144200FEBAA008D9D16 /* RCTVirtualTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B12B200FEBAA008D9D16 /* RCTVirtualTextViewManager.m */; }; - 5956B145200FEBAA008D9D16 /* RCTVirtualTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B12E200FEBAA008D9D16 /* RCTVirtualTextShadowView.m */; }; - 5956B146200FEBAA008D9D16 /* RCTConvert+Text.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B12F200FEBAA008D9D16 /* RCTConvert+Text.m */; }; - 5956B160200FF324008D9D16 /* RCTBaseTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B11D200FEBA9008D9D16 /* RCTBaseTextShadowView.h */; }; - 5956B161200FF324008D9D16 /* RCTBaseTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B11C200FEBA9008D9D16 /* RCTBaseTextViewManager.h */; }; - 5956B162200FF324008D9D16 /* RCTRawTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B0FC200FEBA9008D9D16 /* RCTRawTextShadowView.h */; }; - 5956B163200FF324008D9D16 /* RCTRawTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B0FB200FEBA9008D9D16 /* RCTRawTextViewManager.h */; }; - 5956B164200FF324008D9D16 /* RCTConvert+Text.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B0F9200FEBA9008D9D16 /* RCTConvert+Text.h */; }; - 5956B165200FF324008D9D16 /* RCTTextAttributes.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B11A200FEBA9008D9D16 /* RCTTextAttributes.h */; }; - 5956B166200FF324008D9D16 /* NSTextStorage+FontScaling.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B129200FEBAA008D9D16 /* NSTextStorage+FontScaling.h */; }; - 5956B167200FF324008D9D16 /* RCTTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B126200FEBAA008D9D16 /* RCTTextShadowView.h */; }; - 5956B168200FF324008D9D16 /* RCTTextView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B123200FEBAA008D9D16 /* RCTTextView.h */; }; - 5956B169200FF324008D9D16 /* RCTTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B124200FEBAA008D9D16 /* RCTTextViewManager.h */; }; - 5956B16A200FF324008D9D16 /* RCTMultilineTextInputView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B117200FEBA9008D9D16 /* RCTMultilineTextInputView.h */; }; - 5956B16B200FF324008D9D16 /* RCTMultilineTextInputViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B114200FEBA9008D9D16 /* RCTMultilineTextInputViewManager.h */; }; - 5956B16C200FF324008D9D16 /* RCTUITextView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B116200FEBA9008D9D16 /* RCTUITextView.h */; }; - 5956B16D200FF324008D9D16 /* RCTBackedTextInputDelegate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B10C200FEBA9008D9D16 /* RCTBackedTextInputDelegate.h */; }; - 5956B16E200FF324008D9D16 /* RCTBackedTextInputDelegateAdapter.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B107200FEBA9008D9D16 /* RCTBackedTextInputDelegateAdapter.h */; }; - 5956B16F200FF324008D9D16 /* RCTBackedTextInputViewProtocol.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B112200FEBA9008D9D16 /* RCTBackedTextInputViewProtocol.h */; }; - 5956B170200FF324008D9D16 /* RCTBaseTextInputShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B109200FEBA9008D9D16 /* RCTBaseTextInputShadowView.h */; }; - 5956B171200FF324008D9D16 /* RCTBaseTextInputView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B10E200FEBA9008D9D16 /* RCTBaseTextInputView.h */; }; - 5956B172200FF324008D9D16 /* RCTBaseTextInputViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B10B200FEBA9008D9D16 /* RCTBaseTextInputViewManager.h */; }; - 5956B173200FF324008D9D16 /* RCTTextSelection.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B108200FEBA9008D9D16 /* RCTTextSelection.h */; }; - 5956B174200FF324008D9D16 /* RCTSinglelineTextInputView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B104200FEBA9008D9D16 /* RCTSinglelineTextInputView.h */; }; - 5956B175200FF324008D9D16 /* RCTSinglelineTextInputViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B102200FEBA9008D9D16 /* RCTSinglelineTextInputViewManager.h */; }; - 5956B176200FF324008D9D16 /* RCTUITextField.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B105200FEBA9008D9D16 /* RCTUITextField.h */; }; - 5956B177200FF324008D9D16 /* RCTVirtualTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B12C200FEBAA008D9D16 /* RCTVirtualTextShadowView.h */; }; - 5956B178200FF324008D9D16 /* RCTVirtualTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B12D200FEBAA008D9D16 /* RCTVirtualTextViewManager.h */; }; - 5956B179200FF338008D9D16 /* RCTBaseTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B11D200FEBA9008D9D16 /* RCTBaseTextShadowView.h */; }; - 5956B17A200FF338008D9D16 /* RCTBaseTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B11C200FEBA9008D9D16 /* RCTBaseTextViewManager.h */; }; - 5956B17B200FF338008D9D16 /* RCTRawTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B0FC200FEBA9008D9D16 /* RCTRawTextShadowView.h */; }; - 5956B17C200FF338008D9D16 /* RCTRawTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B0FB200FEBA9008D9D16 /* RCTRawTextViewManager.h */; }; - 5956B17D200FF338008D9D16 /* RCTConvert+Text.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B0F9200FEBA9008D9D16 /* RCTConvert+Text.h */; }; - 5956B17E200FF338008D9D16 /* RCTTextAttributes.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B11A200FEBA9008D9D16 /* RCTTextAttributes.h */; }; - 5956B17F200FF338008D9D16 /* NSTextStorage+FontScaling.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B129200FEBAA008D9D16 /* NSTextStorage+FontScaling.h */; }; - 5956B180200FF338008D9D16 /* RCTTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B126200FEBAA008D9D16 /* RCTTextShadowView.h */; }; - 5956B181200FF338008D9D16 /* RCTTextView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B123200FEBAA008D9D16 /* RCTTextView.h */; }; - 5956B182200FF338008D9D16 /* RCTTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B124200FEBAA008D9D16 /* RCTTextViewManager.h */; }; - 5956B183200FF338008D9D16 /* RCTMultilineTextInputView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B117200FEBA9008D9D16 /* RCTMultilineTextInputView.h */; }; - 5956B184200FF338008D9D16 /* RCTMultilineTextInputViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B114200FEBA9008D9D16 /* RCTMultilineTextInputViewManager.h */; }; - 5956B185200FF338008D9D16 /* RCTUITextView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B116200FEBA9008D9D16 /* RCTUITextView.h */; }; - 5956B186200FF338008D9D16 /* RCTBackedTextInputDelegate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B10C200FEBA9008D9D16 /* RCTBackedTextInputDelegate.h */; }; - 5956B187200FF338008D9D16 /* RCTBackedTextInputDelegateAdapter.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B107200FEBA9008D9D16 /* RCTBackedTextInputDelegateAdapter.h */; }; - 5956B188200FF338008D9D16 /* RCTBackedTextInputViewProtocol.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B112200FEBA9008D9D16 /* RCTBackedTextInputViewProtocol.h */; }; - 5956B189200FF338008D9D16 /* RCTBaseTextInputShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B109200FEBA9008D9D16 /* RCTBaseTextInputShadowView.h */; }; - 5956B18A200FF338008D9D16 /* RCTBaseTextInputView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B10E200FEBA9008D9D16 /* RCTBaseTextInputView.h */; }; - 5956B18B200FF338008D9D16 /* RCTBaseTextInputViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B10B200FEBA9008D9D16 /* RCTBaseTextInputViewManager.h */; }; - 5956B18C200FF338008D9D16 /* RCTTextSelection.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B108200FEBA9008D9D16 /* RCTTextSelection.h */; }; - 5956B18D200FF338008D9D16 /* RCTSinglelineTextInputView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B104200FEBA9008D9D16 /* RCTSinglelineTextInputView.h */; }; - 5956B18E200FF338008D9D16 /* RCTSinglelineTextInputViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B102200FEBA9008D9D16 /* RCTSinglelineTextInputViewManager.h */; }; - 5956B18F200FF338008D9D16 /* RCTUITextField.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B105200FEBA9008D9D16 /* RCTUITextField.h */; }; - 5956B190200FF338008D9D16 /* RCTVirtualTextShadowView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B12C200FEBAA008D9D16 /* RCTVirtualTextShadowView.h */; }; - 5956B191200FF338008D9D16 /* RCTVirtualTextViewManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5956B12D200FEBAA008D9D16 /* RCTVirtualTextViewManager.h */; }; - 5956B192200FF35C008D9D16 /* RCTBaseTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B11E200FEBA9008D9D16 /* RCTBaseTextShadowView.m */; }; - 5956B193200FF35C008D9D16 /* RCTBaseTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B11F200FEBA9008D9D16 /* RCTBaseTextViewManager.m */; }; - 5956B194200FF35C008D9D16 /* RCTRawTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B0FD200FEBA9008D9D16 /* RCTRawTextShadowView.m */; }; - 5956B195200FF35C008D9D16 /* RCTRawTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B0FE200FEBA9008D9D16 /* RCTRawTextViewManager.m */; }; - 5956B196200FF35C008D9D16 /* RCTConvert+Text.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B12F200FEBAA008D9D16 /* RCTConvert+Text.m */; }; - 5956B197200FF35C008D9D16 /* RCTTextAttributes.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B120200FEBA9008D9D16 /* RCTTextAttributes.m */; }; - 5956B198200FF35C008D9D16 /* NSTextStorage+FontScaling.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B125200FEBAA008D9D16 /* NSTextStorage+FontScaling.m */; }; - 5956B199200FF35C008D9D16 /* RCTTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B122200FEBAA008D9D16 /* RCTTextShadowView.m */; }; - 5956B19A200FF35C008D9D16 /* RCTTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B128200FEBAA008D9D16 /* RCTTextView.m */; }; - 5956B19B200FF35C008D9D16 /* RCTTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B127200FEBAA008D9D16 /* RCTTextViewManager.m */; }; - 5956B19C200FF35C008D9D16 /* RCTMultilineTextInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B115200FEBA9008D9D16 /* RCTMultilineTextInputView.m */; }; - 5956B19D200FF35C008D9D16 /* RCTMultilineTextInputViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B118200FEBA9008D9D16 /* RCTMultilineTextInputViewManager.m */; }; - 5956B19E200FF35C008D9D16 /* RCTUITextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B119200FEBA9008D9D16 /* RCTUITextView.m */; }; - 5956B19F200FF35C008D9D16 /* RCTBackedTextInputDelegateAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B10D200FEBA9008D9D16 /* RCTBackedTextInputDelegateAdapter.m */; }; - 5956B1A0200FF35C008D9D16 /* RCTBaseTextInputShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B10F200FEBA9008D9D16 /* RCTBaseTextInputShadowView.m */; }; - 5956B1A1200FF35C008D9D16 /* RCTBaseTextInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B10A200FEBA9008D9D16 /* RCTBaseTextInputView.m */; }; - 5956B1A2200FF35C008D9D16 /* RCTBaseTextInputViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B111200FEBA9008D9D16 /* RCTBaseTextInputViewManager.m */; }; - 5956B1A3200FF35C008D9D16 /* RCTTextSelection.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B110200FEBA9008D9D16 /* RCTTextSelection.m */; }; - 5956B1A4200FF35C008D9D16 /* RCTSinglelineTextInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B101200FEBA9008D9D16 /* RCTSinglelineTextInputView.m */; }; - 5956B1A5200FF35C008D9D16 /* RCTSinglelineTextInputViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B106200FEBA9008D9D16 /* RCTSinglelineTextInputViewManager.m */; }; - 5956B1A6200FF35C008D9D16 /* RCTUITextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B103200FEBA9008D9D16 /* RCTUITextField.m */; }; - 5956B1A7200FF35C008D9D16 /* RCTVirtualTextShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B12E200FEBAA008D9D16 /* RCTVirtualTextShadowView.m */; }; - 5956B1A8200FF35C008D9D16 /* RCTVirtualTextViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956B12B200FEBAA008D9D16 /* RCTVirtualTextViewManager.m */; }; - 5970936920845EFC00D163A7 /* RCTTextTransform.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5970936820845DDE00D163A7 /* RCTTextTransform.h */; }; - 5970936A20845F0600D163A7 /* RCTTextTransform.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5970936820845DDE00D163A7 /* RCTTextTransform.h */; }; - 5C245F39205E216A00D936E9 /* RCTInputAccessoryShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C245F37205E216A00D936E9 /* RCTInputAccessoryShadowView.m */; }; - 8F2807C7202D2B6B005D65E6 /* RCTInputAccessoryViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F2807C1202D2B6A005D65E6 /* RCTInputAccessoryViewManager.m */; }; - 8F2807C8202D2B6B005D65E6 /* RCTInputAccessoryView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F2807C3202D2B6A005D65E6 /* RCTInputAccessoryView.m */; }; - 8F2807C9202D2B6B005D65E6 /* RCTInputAccessoryViewContent.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F2807C5202D2B6B005D65E6 /* RCTInputAccessoryViewContent.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 599DF25E1F0306540079B53E /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTText; - dstSubfolderSpec = 16; - files = ( - 5970936920845EFC00D163A7 /* RCTTextTransform.h in Copy Headers */, - 5956B160200FF324008D9D16 /* RCTBaseTextShadowView.h in Copy Headers */, - 5956B161200FF324008D9D16 /* RCTBaseTextViewManager.h in Copy Headers */, - 5956B162200FF324008D9D16 /* RCTRawTextShadowView.h in Copy Headers */, - 5956B163200FF324008D9D16 /* RCTRawTextViewManager.h in Copy Headers */, - 5956B164200FF324008D9D16 /* RCTConvert+Text.h in Copy Headers */, - 5956B165200FF324008D9D16 /* RCTTextAttributes.h in Copy Headers */, - 5956B166200FF324008D9D16 /* NSTextStorage+FontScaling.h in Copy Headers */, - 5956B167200FF324008D9D16 /* RCTTextShadowView.h in Copy Headers */, - 5956B168200FF324008D9D16 /* RCTTextView.h in Copy Headers */, - 5956B169200FF324008D9D16 /* RCTTextViewManager.h in Copy Headers */, - 5956B16A200FF324008D9D16 /* RCTMultilineTextInputView.h in Copy Headers */, - 5956B16B200FF324008D9D16 /* RCTMultilineTextInputViewManager.h in Copy Headers */, - 5956B16C200FF324008D9D16 /* RCTUITextView.h in Copy Headers */, - 5956B16D200FF324008D9D16 /* RCTBackedTextInputDelegate.h in Copy Headers */, - 5956B16E200FF324008D9D16 /* RCTBackedTextInputDelegateAdapter.h in Copy Headers */, - 5956B16F200FF324008D9D16 /* RCTBackedTextInputViewProtocol.h in Copy Headers */, - 5956B170200FF324008D9D16 /* RCTBaseTextInputShadowView.h in Copy Headers */, - 5956B171200FF324008D9D16 /* RCTBaseTextInputView.h in Copy Headers */, - 5956B172200FF324008D9D16 /* RCTBaseTextInputViewManager.h in Copy Headers */, - 5956B173200FF324008D9D16 /* RCTTextSelection.h in Copy Headers */, - 5956B174200FF324008D9D16 /* RCTSinglelineTextInputView.h in Copy Headers */, - 5956B175200FF324008D9D16 /* RCTSinglelineTextInputViewManager.h in Copy Headers */, - 5956B176200FF324008D9D16 /* RCTUITextField.h in Copy Headers */, - 5956B177200FF324008D9D16 /* RCTVirtualTextShadowView.h in Copy Headers */, - 5956B178200FF324008D9D16 /* RCTVirtualTextViewManager.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - 599DF2601F0306AD0079B53E /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/RCTText; - dstSubfolderSpec = 16; - files = ( - 5970936A20845F0600D163A7 /* RCTTextTransform.h in Copy Headers */, - 5956B179200FF338008D9D16 /* RCTBaseTextShadowView.h in Copy Headers */, - 5956B17A200FF338008D9D16 /* RCTBaseTextViewManager.h in Copy Headers */, - 5956B17B200FF338008D9D16 /* RCTRawTextShadowView.h in Copy Headers */, - 5956B17C200FF338008D9D16 /* RCTRawTextViewManager.h in Copy Headers */, - 5956B17D200FF338008D9D16 /* RCTConvert+Text.h in Copy Headers */, - 5956B17E200FF338008D9D16 /* RCTTextAttributes.h in Copy Headers */, - 5956B17F200FF338008D9D16 /* NSTextStorage+FontScaling.h in Copy Headers */, - 5956B180200FF338008D9D16 /* RCTTextShadowView.h in Copy Headers */, - 5956B181200FF338008D9D16 /* RCTTextView.h in Copy Headers */, - 5956B182200FF338008D9D16 /* RCTTextViewManager.h in Copy Headers */, - 5956B183200FF338008D9D16 /* RCTMultilineTextInputView.h in Copy Headers */, - 5956B184200FF338008D9D16 /* RCTMultilineTextInputViewManager.h in Copy Headers */, - 5956B185200FF338008D9D16 /* RCTUITextView.h in Copy Headers */, - 5956B186200FF338008D9D16 /* RCTBackedTextInputDelegate.h in Copy Headers */, - 5956B187200FF338008D9D16 /* RCTBackedTextInputDelegateAdapter.h in Copy Headers */, - 5956B188200FF338008D9D16 /* RCTBackedTextInputViewProtocol.h in Copy Headers */, - 5956B189200FF338008D9D16 /* RCTBaseTextInputShadowView.h in Copy Headers */, - 5956B18A200FF338008D9D16 /* RCTBaseTextInputView.h in Copy Headers */, - 5956B18B200FF338008D9D16 /* RCTBaseTextInputViewManager.h in Copy Headers */, - 5956B18C200FF338008D9D16 /* RCTTextSelection.h in Copy Headers */, - 5956B18D200FF338008D9D16 /* RCTSinglelineTextInputView.h in Copy Headers */, - 5956B18E200FF338008D9D16 /* RCTSinglelineTextInputViewManager.h in Copy Headers */, - 5956B18F200FF338008D9D16 /* RCTUITextField.h in Copy Headers */, - 5956B190200FF338008D9D16 /* RCTVirtualTextShadowView.h in Copy Headers */, - 5956B191200FF338008D9D16 /* RCTVirtualTextViewManager.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 2D2A287B1D9B048500D4039D /* libRCTText-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTText-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 58B5119B1A9E6C1200147676 /* libRCTText.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTText.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 5956B0F9200FEBA9008D9D16 /* RCTConvert+Text.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RCTConvert+Text.h"; sourceTree = ""; }; - 5956B0FB200FEBA9008D9D16 /* RCTRawTextViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRawTextViewManager.h; sourceTree = ""; }; - 5956B0FC200FEBA9008D9D16 /* RCTRawTextShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRawTextShadowView.h; sourceTree = ""; }; - 5956B0FD200FEBA9008D9D16 /* RCTRawTextShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRawTextShadowView.m; sourceTree = ""; }; - 5956B0FE200FEBA9008D9D16 /* RCTRawTextViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRawTextViewManager.m; sourceTree = ""; }; - 5956B101200FEBA9008D9D16 /* RCTSinglelineTextInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSinglelineTextInputView.m; sourceTree = ""; }; - 5956B102200FEBA9008D9D16 /* RCTSinglelineTextInputViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSinglelineTextInputViewManager.h; sourceTree = ""; }; - 5956B103200FEBA9008D9D16 /* RCTUITextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUITextField.m; sourceTree = ""; }; - 5956B104200FEBA9008D9D16 /* RCTSinglelineTextInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSinglelineTextInputView.h; sourceTree = ""; }; - 5956B105200FEBA9008D9D16 /* RCTUITextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTUITextField.h; sourceTree = ""; }; - 5956B106200FEBA9008D9D16 /* RCTSinglelineTextInputViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSinglelineTextInputViewManager.m; sourceTree = ""; }; - 5956B107200FEBA9008D9D16 /* RCTBackedTextInputDelegateAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBackedTextInputDelegateAdapter.h; sourceTree = ""; }; - 5956B108200FEBA9008D9D16 /* RCTTextSelection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTextSelection.h; sourceTree = ""; }; - 5956B109200FEBA9008D9D16 /* RCTBaseTextInputShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBaseTextInputShadowView.h; sourceTree = ""; }; - 5956B10A200FEBA9008D9D16 /* RCTBaseTextInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBaseTextInputView.m; sourceTree = ""; }; - 5956B10B200FEBA9008D9D16 /* RCTBaseTextInputViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBaseTextInputViewManager.h; sourceTree = ""; }; - 5956B10C200FEBA9008D9D16 /* RCTBackedTextInputDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBackedTextInputDelegate.h; sourceTree = ""; }; - 5956B10D200FEBA9008D9D16 /* RCTBackedTextInputDelegateAdapter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBackedTextInputDelegateAdapter.m; sourceTree = ""; }; - 5956B10E200FEBA9008D9D16 /* RCTBaseTextInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBaseTextInputView.h; sourceTree = ""; }; - 5956B10F200FEBA9008D9D16 /* RCTBaseTextInputShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBaseTextInputShadowView.m; sourceTree = ""; }; - 5956B110200FEBA9008D9D16 /* RCTTextSelection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTextSelection.m; sourceTree = ""; }; - 5956B111200FEBA9008D9D16 /* RCTBaseTextInputViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBaseTextInputViewManager.m; sourceTree = ""; }; - 5956B112200FEBA9008D9D16 /* RCTBackedTextInputViewProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBackedTextInputViewProtocol.h; sourceTree = ""; }; - 5956B114200FEBA9008D9D16 /* RCTMultilineTextInputViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTMultilineTextInputViewManager.h; sourceTree = ""; }; - 5956B115200FEBA9008D9D16 /* RCTMultilineTextInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMultilineTextInputView.m; sourceTree = ""; }; - 5956B116200FEBA9008D9D16 /* RCTUITextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTUITextView.h; sourceTree = ""; }; - 5956B117200FEBA9008D9D16 /* RCTMultilineTextInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTMultilineTextInputView.h; sourceTree = ""; }; - 5956B118200FEBA9008D9D16 /* RCTMultilineTextInputViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMultilineTextInputViewManager.m; sourceTree = ""; }; - 5956B119200FEBA9008D9D16 /* RCTUITextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUITextView.m; sourceTree = ""; }; - 5956B11A200FEBA9008D9D16 /* RCTTextAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTextAttributes.h; sourceTree = ""; }; - 5956B11C200FEBA9008D9D16 /* RCTBaseTextViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBaseTextViewManager.h; sourceTree = ""; }; - 5956B11D200FEBA9008D9D16 /* RCTBaseTextShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBaseTextShadowView.h; sourceTree = ""; }; - 5956B11E200FEBA9008D9D16 /* RCTBaseTextShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBaseTextShadowView.m; sourceTree = ""; }; - 5956B11F200FEBA9008D9D16 /* RCTBaseTextViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBaseTextViewManager.m; sourceTree = ""; }; - 5956B120200FEBA9008D9D16 /* RCTTextAttributes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTextAttributes.m; sourceTree = ""; }; - 5956B122200FEBAA008D9D16 /* RCTTextShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTextShadowView.m; sourceTree = ""; }; - 5956B123200FEBAA008D9D16 /* RCTTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTextView.h; sourceTree = ""; }; - 5956B124200FEBAA008D9D16 /* RCTTextViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTextViewManager.h; sourceTree = ""; }; - 5956B125200FEBAA008D9D16 /* NSTextStorage+FontScaling.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSTextStorage+FontScaling.m"; sourceTree = ""; }; - 5956B126200FEBAA008D9D16 /* RCTTextShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTextShadowView.h; sourceTree = ""; }; - 5956B127200FEBAA008D9D16 /* RCTTextViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTextViewManager.m; sourceTree = ""; }; - 5956B128200FEBAA008D9D16 /* RCTTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTextView.m; sourceTree = ""; }; - 5956B129200FEBAA008D9D16 /* NSTextStorage+FontScaling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSTextStorage+FontScaling.h"; sourceTree = ""; }; - 5956B12B200FEBAA008D9D16 /* RCTVirtualTextViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTVirtualTextViewManager.m; sourceTree = ""; }; - 5956B12C200FEBAA008D9D16 /* RCTVirtualTextShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTVirtualTextShadowView.h; sourceTree = ""; }; - 5956B12D200FEBAA008D9D16 /* RCTVirtualTextViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTVirtualTextViewManager.h; sourceTree = ""; }; - 5956B12E200FEBAA008D9D16 /* RCTVirtualTextShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTVirtualTextShadowView.m; sourceTree = ""; }; - 5956B12F200FEBAA008D9D16 /* RCTConvert+Text.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RCTConvert+Text.m"; sourceTree = ""; }; - 5970936820845DDE00D163A7 /* RCTTextTransform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTextTransform.h; sourceTree = ""; }; - 5C245F37205E216A00D936E9 /* RCTInputAccessoryShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTInputAccessoryShadowView.m; sourceTree = ""; }; - 5C245F38205E216A00D936E9 /* RCTInputAccessoryShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTInputAccessoryShadowView.h; sourceTree = ""; }; - 8F2807C1202D2B6A005D65E6 /* RCTInputAccessoryViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTInputAccessoryViewManager.m; sourceTree = ""; }; - 8F2807C2202D2B6A005D65E6 /* RCTInputAccessoryViewContent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTInputAccessoryViewContent.h; sourceTree = ""; }; - 8F2807C3202D2B6A005D65E6 /* RCTInputAccessoryView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTInputAccessoryView.m; sourceTree = ""; }; - 8F2807C4202D2B6A005D65E6 /* RCTInputAccessoryView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTInputAccessoryView.h; sourceTree = ""; }; - 8F2807C5202D2B6B005D65E6 /* RCTInputAccessoryViewContent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTInputAccessoryViewContent.m; sourceTree = ""; }; - 8F2807C6202D2B6B005D65E6 /* RCTInputAccessoryViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTInputAccessoryViewManager.h; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 58B511921A9E6C1200147676 = { - isa = PBXGroup; - children = ( - 5956B11B200FEBA9008D9D16 /* BaseText */, - 58B5119C1A9E6C1200147676 /* Products */, - 5956B0FA200FEBA9008D9D16 /* RawText */, - 5956B0F9200FEBA9008D9D16 /* RCTConvert+Text.h */, - 5956B12F200FEBAA008D9D16 /* RCTConvert+Text.m */, - 5956B11A200FEBA9008D9D16 /* RCTTextAttributes.h */, - 5956B120200FEBA9008D9D16 /* RCTTextAttributes.m */, - 5970936820845DDE00D163A7 /* RCTTextTransform.h */, - 5956B121200FEBAA008D9D16 /* Text */, - 5956B0FF200FEBA9008D9D16 /* TextInput */, - 5956B12A200FEBAA008D9D16 /* VirtualText */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 58B5119C1A9E6C1200147676 /* Products */ = { - isa = PBXGroup; - children = ( - 58B5119B1A9E6C1200147676 /* libRCTText.a */, - 2D2A287B1D9B048500D4039D /* libRCTText-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 5956B0FA200FEBA9008D9D16 /* RawText */ = { - isa = PBXGroup; - children = ( - 5956B0FC200FEBA9008D9D16 /* RCTRawTextShadowView.h */, - 5956B0FD200FEBA9008D9D16 /* RCTRawTextShadowView.m */, - 5956B0FB200FEBA9008D9D16 /* RCTRawTextViewManager.h */, - 5956B0FE200FEBA9008D9D16 /* RCTRawTextViewManager.m */, - ); - path = RawText; - sourceTree = ""; - }; - 5956B0FF200FEBA9008D9D16 /* TextInput */ = { - isa = PBXGroup; - children = ( - 5C245F38205E216A00D936E9 /* RCTInputAccessoryShadowView.h */, - 5C245F37205E216A00D936E9 /* RCTInputAccessoryShadowView.m */, - 8F2807C4202D2B6A005D65E6 /* RCTInputAccessoryView.h */, - 8F2807C3202D2B6A005D65E6 /* RCTInputAccessoryView.m */, - 8F2807C2202D2B6A005D65E6 /* RCTInputAccessoryViewContent.h */, - 8F2807C5202D2B6B005D65E6 /* RCTInputAccessoryViewContent.m */, - 8F2807C6202D2B6B005D65E6 /* RCTInputAccessoryViewManager.h */, - 8F2807C1202D2B6A005D65E6 /* RCTInputAccessoryViewManager.m */, - 5956B113200FEBA9008D9D16 /* Multiline */, - 5956B10C200FEBA9008D9D16 /* RCTBackedTextInputDelegate.h */, - 5956B107200FEBA9008D9D16 /* RCTBackedTextInputDelegateAdapter.h */, - 5956B10D200FEBA9008D9D16 /* RCTBackedTextInputDelegateAdapter.m */, - 5956B112200FEBA9008D9D16 /* RCTBackedTextInputViewProtocol.h */, - 5956B109200FEBA9008D9D16 /* RCTBaseTextInputShadowView.h */, - 5956B10F200FEBA9008D9D16 /* RCTBaseTextInputShadowView.m */, - 5956B10E200FEBA9008D9D16 /* RCTBaseTextInputView.h */, - 5956B10A200FEBA9008D9D16 /* RCTBaseTextInputView.m */, - 5956B10B200FEBA9008D9D16 /* RCTBaseTextInputViewManager.h */, - 5956B111200FEBA9008D9D16 /* RCTBaseTextInputViewManager.m */, - 5956B108200FEBA9008D9D16 /* RCTTextSelection.h */, - 5956B110200FEBA9008D9D16 /* RCTTextSelection.m */, - 5956B100200FEBA9008D9D16 /* Singleline */, - ); - path = TextInput; - sourceTree = ""; - }; - 5956B100200FEBA9008D9D16 /* Singleline */ = { - isa = PBXGroup; - children = ( - 5956B104200FEBA9008D9D16 /* RCTSinglelineTextInputView.h */, - 5956B101200FEBA9008D9D16 /* RCTSinglelineTextInputView.m */, - 5956B102200FEBA9008D9D16 /* RCTSinglelineTextInputViewManager.h */, - 5956B106200FEBA9008D9D16 /* RCTSinglelineTextInputViewManager.m */, - 5956B105200FEBA9008D9D16 /* RCTUITextField.h */, - 5956B103200FEBA9008D9D16 /* RCTUITextField.m */, - ); - path = Singleline; - sourceTree = ""; - }; - 5956B113200FEBA9008D9D16 /* Multiline */ = { - isa = PBXGroup; - children = ( - 5956B117200FEBA9008D9D16 /* RCTMultilineTextInputView.h */, - 5956B115200FEBA9008D9D16 /* RCTMultilineTextInputView.m */, - 5956B114200FEBA9008D9D16 /* RCTMultilineTextInputViewManager.h */, - 5956B118200FEBA9008D9D16 /* RCTMultilineTextInputViewManager.m */, - 5956B116200FEBA9008D9D16 /* RCTUITextView.h */, - 5956B119200FEBA9008D9D16 /* RCTUITextView.m */, - ); - path = Multiline; - sourceTree = ""; - }; - 5956B11B200FEBA9008D9D16 /* BaseText */ = { - isa = PBXGroup; - children = ( - 5956B11D200FEBA9008D9D16 /* RCTBaseTextShadowView.h */, - 5956B11E200FEBA9008D9D16 /* RCTBaseTextShadowView.m */, - 5956B11C200FEBA9008D9D16 /* RCTBaseTextViewManager.h */, - 5956B11F200FEBA9008D9D16 /* RCTBaseTextViewManager.m */, - ); - path = BaseText; - sourceTree = ""; - }; - 5956B121200FEBAA008D9D16 /* Text */ = { - isa = PBXGroup; - children = ( - 5956B129200FEBAA008D9D16 /* NSTextStorage+FontScaling.h */, - 5956B125200FEBAA008D9D16 /* NSTextStorage+FontScaling.m */, - 5956B126200FEBAA008D9D16 /* RCTTextShadowView.h */, - 5956B122200FEBAA008D9D16 /* RCTTextShadowView.m */, - 5956B123200FEBAA008D9D16 /* RCTTextView.h */, - 5956B128200FEBAA008D9D16 /* RCTTextView.m */, - 5956B124200FEBAA008D9D16 /* RCTTextViewManager.h */, - 5956B127200FEBAA008D9D16 /* RCTTextViewManager.m */, - ); - path = Text; - sourceTree = ""; - }; - 5956B12A200FEBAA008D9D16 /* VirtualText */ = { - isa = PBXGroup; - children = ( - 5956B12C200FEBAA008D9D16 /* RCTVirtualTextShadowView.h */, - 5956B12E200FEBAA008D9D16 /* RCTVirtualTextShadowView.m */, - 5956B12D200FEBAA008D9D16 /* RCTVirtualTextViewManager.h */, - 5956B12B200FEBAA008D9D16 /* RCTVirtualTextViewManager.m */, - ); - path = VirtualText; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 2D2A287A1D9B048500D4039D /* RCTText-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D2A28831D9B048500D4039D /* Build configuration list for PBXNativeTarget "RCTText-tvOS" */; - buildPhases = ( - 599DF2601F0306AD0079B53E /* Copy Headers */, - 2D2A28771D9B048500D4039D /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "RCTText-tvOS"; - productName = "RCTText-tvOS"; - productReference = 2D2A287B1D9B048500D4039D /* libRCTText-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 58B5119A1A9E6C1200147676 /* RCTText */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511AF1A9E6C1300147676 /* Build configuration list for PBXNativeTarget "RCTText" */; - buildPhases = ( - 599DF25E1F0306540079B53E /* Copy Headers */, - 58B511971A9E6C1200147676 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTText; - productName = RCTText; - productReference = 58B5119B1A9E6C1200147676 /* libRCTText.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511931A9E6C1200147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 2D2A287A1D9B048500D4039D = { - CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Automatic; - }; - 58B5119A1A9E6C1200147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511961A9E6C1200147676 /* Build configuration list for PBXProject "RCTText" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 58B511921A9E6C1200147676; - productRefGroup = 58B5119C1A9E6C1200147676 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B5119A1A9E6C1200147676 /* RCTText */, - 2D2A287A1D9B048500D4039D /* RCTText-tvOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 2D2A28771D9B048500D4039D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 5956B192200FF35C008D9D16 /* RCTBaseTextShadowView.m in Sources */, - 5956B193200FF35C008D9D16 /* RCTBaseTextViewManager.m in Sources */, - 5956B194200FF35C008D9D16 /* RCTRawTextShadowView.m in Sources */, - 5956B195200FF35C008D9D16 /* RCTRawTextViewManager.m in Sources */, - 5956B196200FF35C008D9D16 /* RCTConvert+Text.m in Sources */, - 5956B197200FF35C008D9D16 /* RCTTextAttributes.m in Sources */, - 5956B198200FF35C008D9D16 /* NSTextStorage+FontScaling.m in Sources */, - 5956B199200FF35C008D9D16 /* RCTTextShadowView.m in Sources */, - 5956B19A200FF35C008D9D16 /* RCTTextView.m in Sources */, - 5956B19B200FF35C008D9D16 /* RCTTextViewManager.m in Sources */, - 5956B19C200FF35C008D9D16 /* RCTMultilineTextInputView.m in Sources */, - 5956B19D200FF35C008D9D16 /* RCTMultilineTextInputViewManager.m in Sources */, - 5956B19E200FF35C008D9D16 /* RCTUITextView.m in Sources */, - 5956B19F200FF35C008D9D16 /* RCTBackedTextInputDelegateAdapter.m in Sources */, - 5956B1A0200FF35C008D9D16 /* RCTBaseTextInputShadowView.m in Sources */, - 5956B1A1200FF35C008D9D16 /* RCTBaseTextInputView.m in Sources */, - 5956B1A2200FF35C008D9D16 /* RCTBaseTextInputViewManager.m in Sources */, - 5956B1A3200FF35C008D9D16 /* RCTTextSelection.m in Sources */, - 5956B1A4200FF35C008D9D16 /* RCTSinglelineTextInputView.m in Sources */, - 5956B1A5200FF35C008D9D16 /* RCTSinglelineTextInputViewManager.m in Sources */, - 5956B1A6200FF35C008D9D16 /* RCTUITextField.m in Sources */, - 5956B1A7200FF35C008D9D16 /* RCTVirtualTextShadowView.m in Sources */, - 5956B1A8200FF35C008D9D16 /* RCTVirtualTextViewManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 58B511971A9E6C1200147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 5956B13D200FEBAA008D9D16 /* RCTBaseTextShadowView.m in Sources */, - 5956B140200FEBAA008D9D16 /* RCTTextShadowView.m in Sources */, - 5956B131200FEBAA008D9D16 /* RCTRawTextViewManager.m in Sources */, - 5956B137200FEBAA008D9D16 /* RCTBaseTextInputShadowView.m in Sources */, - 8F2807C7202D2B6B005D65E6 /* RCTInputAccessoryViewManager.m in Sources */, - 5956B146200FEBAA008D9D16 /* RCTConvert+Text.m in Sources */, - 8F2807C9202D2B6B005D65E6 /* RCTInputAccessoryViewContent.m in Sources */, - 5956B13F200FEBAA008D9D16 /* RCTTextAttributes.m in Sources */, - 8F2807C8202D2B6B005D65E6 /* RCTInputAccessoryView.m in Sources */, - 5956B143200FEBAA008D9D16 /* RCTTextView.m in Sources */, - 5956B13C200FEBAA008D9D16 /* RCTUITextView.m in Sources */, - 5956B136200FEBAA008D9D16 /* RCTBackedTextInputDelegateAdapter.m in Sources */, - 5956B13E200FEBAA008D9D16 /* RCTBaseTextViewManager.m in Sources */, - 5956B145200FEBAA008D9D16 /* RCTVirtualTextShadowView.m in Sources */, - 5956B142200FEBAA008D9D16 /* RCTTextViewManager.m in Sources */, - 5956B135200FEBAA008D9D16 /* RCTBaseTextInputView.m in Sources */, - 5956B144200FEBAA008D9D16 /* RCTVirtualTextViewManager.m in Sources */, - 5C245F39205E216A00D936E9 /* RCTInputAccessoryShadowView.m in Sources */, - 5956B13B200FEBAA008D9D16 /* RCTMultilineTextInputViewManager.m in Sources */, - 5956B134200FEBAA008D9D16 /* RCTSinglelineTextInputViewManager.m in Sources */, - 5956B139200FEBAA008D9D16 /* RCTBaseTextInputViewManager.m in Sources */, - 5956B138200FEBAA008D9D16 /* RCTTextSelection.m in Sources */, - 5956B130200FEBAA008D9D16 /* RCTRawTextShadowView.m in Sources */, - 5956B141200FEBAA008D9D16 /* NSTextStorage+FontScaling.m in Sources */, - 5956B132200FEBAA008D9D16 /* RCTSinglelineTextInputView.m in Sources */, - 5956B13A200FEBAA008D9D16 /* RCTMultilineTextInputView.m in Sources */, - 5956B133200FEBAA008D9D16 /* RCTUITextField.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 2D2A28811D9B048500D4039D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 2D2A28821D9B048500D4039D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 58B511AD1A9E6C1300147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 58B511AE1A9E6C1300147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 58B511B01A9E6C1300147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_STATIC_ANALYZER_MODE = deep; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 58B511B11A9E6C1300147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_STATIC_ANALYZER_MODE = deep; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2D2A28831D9B048500D4039D /* Build configuration list for PBXNativeTarget "RCTText-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D2A28811D9B048500D4039D /* Debug */, - 2D2A28821D9B048500D4039D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511961A9E6C1200147676 /* Build configuration list for PBXProject "RCTText" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511AD1A9E6C1300147676 /* Debug */, - 58B511AE1A9E6C1300147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511AF1A9E6C1300147676 /* Build configuration list for PBXNativeTarget "RCTText" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511B01A9E6C1300147676 /* Debug */, - 58B511B11A9E6C1300147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511931A9E6C1200147676 /* Project object */; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RCTTextAttributes.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RCTTextAttributes.h deleted file mode 100644 index 01070aa4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RCTTextAttributes.h +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#import "RCTTextTransform.h" - -NS_ASSUME_NONNULL_BEGIN - -extern NSString *const RCTTextAttributesIsHighlightedAttributeName; -extern NSString *const RCTTextAttributesTagAttributeName; - -/** - * Represents knowledge about all supported *text* attributes - * assigned to some text component such as , , - * and . - */ -@interface RCTTextAttributes : NSObject - -// Color -@property (nonatomic, strong, nullable) UIColor *foregroundColor; -@property (nonatomic, strong, nullable) UIColor *backgroundColor; -@property (nonatomic, assign) CGFloat opacity; -// Font -@property (nonatomic, copy, nullable) NSString *fontFamily; -@property (nonatomic, assign) CGFloat fontSize; -@property (nonatomic, assign) CGFloat fontSizeMultiplier; -@property (nonatomic, assign) CGFloat maxFontSizeMultiplier; -@property (nonatomic, copy, nullable) NSString *fontWeight; -@property (nonatomic, copy, nullable) NSString *fontStyle; -@property (nonatomic, copy, nullable) NSArray *fontVariant; -@property (nonatomic, assign) BOOL allowFontScaling; -@property (nonatomic, assign) CGFloat letterSpacing; -// Paragraph Styles -@property (nonatomic, assign) CGFloat lineHeight; -@property (nonatomic, assign) NSTextAlignment alignment; -@property (nonatomic, assign) NSWritingDirection baseWritingDirection; -// Decoration -@property (nonatomic, strong, nullable) UIColor *textDecorationColor; -@property (nonatomic, assign) NSUnderlineStyle textDecorationStyle; -@property (nonatomic, assign) RCTTextDecorationLineType textDecorationLine; -// Shadow -@property (nonatomic, assign) CGSize textShadowOffset; -@property (nonatomic, assign) CGFloat textShadowRadius; -@property (nonatomic, strong, nullable) UIColor *textShadowColor; -// Special -@property (nonatomic, assign) BOOL isHighlighted; -@property (nonatomic, strong, nullable) NSNumber *tag; -@property (nonatomic, assign) UIUserInterfaceLayoutDirection layoutDirection; -@property (nonatomic, assign) RCTTextTransform textTransform; - -#pragma mark - Inheritance - -- (void)applyTextAttributes:(RCTTextAttributes *)textAttributes; - -#pragma mark - Adapters - -/** - * Text attributes in NSAttributedString terms. - */ -- (NSDictionary *)effectiveTextAttributes; - -/** - * Constructed font. - */ -- (UIFont *)effectiveFont; - -/** - * Font size multiplier reflects `allowFontScaling`, `fontSizeMultiplier`, and `maxFontSizeMultiplier`. - */ -- (CGFloat)effectiveFontSizeMultiplier; - -/** - * Foreground and background colors with opacity and right defaults. - */ -- (UIColor *)effectiveForegroundColor; -- (UIColor *)effectiveBackgroundColor; - -/** - * Text transformed per 'none', 'uppercase', 'lowercase', 'capitalize' - */ -- (NSString *)applyTextAttributesToText:(NSString *)text; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RCTTextAttributes.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RCTTextAttributes.m deleted file mode 100644 index f1bf6bea..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RCTTextAttributes.m +++ /dev/null @@ -1,298 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTextAttributes.h" - -#import -#import -#import - -NSString *const RCTTextAttributesIsHighlightedAttributeName = @"RCTTextAttributesIsHighlightedAttributeName"; -NSString *const RCTTextAttributesTagAttributeName = @"RCTTextAttributesTagAttributeName"; - -@implementation RCTTextAttributes - -- (instancetype)init -{ - if (self = [super init]) { - _fontSize = NAN; - _letterSpacing = NAN; - _lineHeight = NAN; - _textDecorationStyle = NSUnderlineStyleSingle; - _fontSizeMultiplier = NAN; - _maxFontSizeMultiplier = NAN; - _alignment = NSTextAlignmentNatural; - _baseWritingDirection = NSWritingDirectionNatural; - _textShadowRadius = NAN; - _opacity = NAN; - _textTransform = RCTTextTransformUndefined; - } - - return self; -} - -- (void)applyTextAttributes:(RCTTextAttributes *)textAttributes -{ - // Note: All lines marked with `*` does not use explicit/correct rules to compare old and new values becuase - // their types do not have special designated value representing undefined/unspecified/inherit meaning. - // We will address this in the future. - - // Color - _foregroundColor = textAttributes->_foregroundColor ?: _foregroundColor; - _backgroundColor = textAttributes->_backgroundColor ?: _backgroundColor; - _opacity = !isnan(textAttributes->_opacity) ? (isnan(_opacity) ? 1.0 : _opacity) * textAttributes->_opacity : _opacity; - - // Font - _fontFamily = textAttributes->_fontFamily ?: _fontFamily; - _fontSize = !isnan(textAttributes->_fontSize) ? textAttributes->_fontSize : _fontSize; - _fontSizeMultiplier = !isnan(textAttributes->_fontSizeMultiplier) ? textAttributes->_fontSizeMultiplier : _fontSizeMultiplier; - _maxFontSizeMultiplier = !isnan(textAttributes->_maxFontSizeMultiplier) ? textAttributes->_maxFontSizeMultiplier : _maxFontSizeMultiplier; - _fontWeight = textAttributes->_fontWeight ?: _fontWeight; - _fontStyle = textAttributes->_fontStyle ?: _fontStyle; - _fontVariant = textAttributes->_fontVariant ?: _fontVariant; - _allowFontScaling = textAttributes->_allowFontScaling || _allowFontScaling; // * - _letterSpacing = !isnan(textAttributes->_letterSpacing) ? textAttributes->_letterSpacing : _letterSpacing; - - // Paragraph Styles - _lineHeight = !isnan(textAttributes->_lineHeight) ? textAttributes->_lineHeight : _lineHeight; - _alignment = textAttributes->_alignment != NSTextAlignmentNatural ? textAttributes->_alignment : _alignment; // * - _baseWritingDirection = textAttributes->_baseWritingDirection != NSWritingDirectionNatural ? textAttributes->_baseWritingDirection : _baseWritingDirection; // * - - // Decoration - _textDecorationColor = textAttributes->_textDecorationColor ?: _textDecorationColor; - _textDecorationStyle = textAttributes->_textDecorationStyle != NSUnderlineStyleSingle ? textAttributes->_textDecorationStyle : _textDecorationStyle; // * - _textDecorationLine = textAttributes->_textDecorationLine != RCTTextDecorationLineTypeNone ? textAttributes->_textDecorationLine : _textDecorationLine; // * - - // Shadow - _textShadowOffset = !CGSizeEqualToSize(textAttributes->_textShadowOffset, CGSizeZero) ? textAttributes->_textShadowOffset : _textShadowOffset; // * - _textShadowRadius = !isnan(textAttributes->_textShadowRadius) ? textAttributes->_textShadowRadius : _textShadowRadius; - _textShadowColor = textAttributes->_textShadowColor ?: _textShadowColor; - - // Special - _isHighlighted = textAttributes->_isHighlighted || _isHighlighted; // * - _tag = textAttributes->_tag ?: _tag; - _layoutDirection = textAttributes->_layoutDirection != UIUserInterfaceLayoutDirectionLeftToRight ? textAttributes->_layoutDirection : _layoutDirection; - _textTransform = textAttributes->_textTransform != RCTTextTransformUndefined ? textAttributes->_textTransform : _textTransform; -} - -- (NSDictionary *)effectiveTextAttributes -{ - NSMutableDictionary *attributes = - [NSMutableDictionary dictionaryWithCapacity:10]; - - // Font - UIFont *font = self.effectiveFont; - if (font) { - attributes[NSFontAttributeName] = font; - } - - // Colors - UIColor *effectiveForegroundColor = self.effectiveForegroundColor; - - if (_foregroundColor || !isnan(_opacity)) { - attributes[NSForegroundColorAttributeName] = effectiveForegroundColor; - } - - if (_backgroundColor || !isnan(_opacity)) { - attributes[NSBackgroundColorAttributeName] = self.effectiveBackgroundColor; - } - - // Kerning - if (!isnan(_letterSpacing)) { - attributes[NSKernAttributeName] = @(_letterSpacing); - } - - // Paragraph Style - NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new]; - BOOL isParagraphStyleUsed = NO; - if (_alignment != NSTextAlignmentNatural) { - NSTextAlignment alignment = _alignment; - if (_layoutDirection == UIUserInterfaceLayoutDirectionRightToLeft) { - if (alignment == NSTextAlignmentRight) { - alignment = NSTextAlignmentLeft; - } else if (alignment == NSTextAlignmentLeft) { - alignment = NSTextAlignmentRight; - } - } - - paragraphStyle.alignment = alignment; - isParagraphStyleUsed = YES; - } - - if (_baseWritingDirection != NSWritingDirectionNatural) { - paragraphStyle.baseWritingDirection = _baseWritingDirection; - isParagraphStyleUsed = YES; - } - - if (!isnan(_lineHeight)) { - CGFloat lineHeight = _lineHeight * self.effectiveFontSizeMultiplier; - paragraphStyle.minimumLineHeight = lineHeight; - paragraphStyle.maximumLineHeight = lineHeight; - isParagraphStyleUsed = YES; - } - - if (isParagraphStyleUsed) { - attributes[NSParagraphStyleAttributeName] = paragraphStyle; - } - - // Decoration - BOOL isTextDecorationEnabled = NO; - if (_textDecorationLine == RCTTextDecorationLineTypeUnderline || - _textDecorationLine == RCTTextDecorationLineTypeUnderlineStrikethrough) { - isTextDecorationEnabled = YES; - attributes[NSUnderlineStyleAttributeName] = @(_textDecorationStyle); - } - - if (_textDecorationLine == RCTTextDecorationLineTypeStrikethrough || - _textDecorationLine == RCTTextDecorationLineTypeUnderlineStrikethrough){ - isTextDecorationEnabled = YES; - attributes[NSStrikethroughStyleAttributeName] = @(_textDecorationStyle); - } - - if (_textDecorationColor || isTextDecorationEnabled) { - attributes[NSStrikethroughColorAttributeName] = _textDecorationColor ?: effectiveForegroundColor; - attributes[NSUnderlineColorAttributeName] = _textDecorationColor ?: effectiveForegroundColor; - } - - // Shadow - if (!CGSizeEqualToSize(_textShadowOffset, CGSizeZero)) { - NSShadow *shadow = [NSShadow new]; - shadow.shadowOffset = _textShadowOffset; - shadow.shadowBlurRadius = _textShadowRadius; - shadow.shadowColor = _textShadowColor; - attributes[NSShadowAttributeName] = shadow; - } - - // Special - if (_isHighlighted) { - attributes[RCTTextAttributesIsHighlightedAttributeName] = @YES; - } - - if (_tag) { - attributes[RCTTextAttributesTagAttributeName] = _tag; - } - - return [attributes copy]; -} - -- (UIFont *)effectiveFont -{ - // FIXME: RCTFont has thread-safety issues and must be rewritten. - return [RCTFont updateFont:nil - withFamily:_fontFamily - size:@(isnan(_fontSize) ? 0 : _fontSize) - weight:_fontWeight - style:_fontStyle - variant:_fontVariant - scaleMultiplier:self.effectiveFontSizeMultiplier]; -} - -- (CGFloat)effectiveFontSizeMultiplier -{ - bool fontScalingEnabled = !RCTHasFontHandlerSet() && _allowFontScaling; - - if (fontScalingEnabled) { - CGFloat fontSizeMultiplier = !isnan(_fontSizeMultiplier) ? _fontSizeMultiplier : 1.0; - CGFloat maxFontSizeMultiplier = !isnan(_maxFontSizeMultiplier) ? _maxFontSizeMultiplier : 0.0; - return maxFontSizeMultiplier >= 1.0 ? fminf(maxFontSizeMultiplier, fontSizeMultiplier) : fontSizeMultiplier; - } else { - return 1.0; - } -} - -- (UIColor *)effectiveForegroundColor -{ - UIColor *effectiveForegroundColor = _foregroundColor ?: [UIColor blackColor]; - - if (!isnan(_opacity)) { - effectiveForegroundColor = [effectiveForegroundColor colorWithAlphaComponent:CGColorGetAlpha(effectiveForegroundColor.CGColor) * _opacity]; - } - - return effectiveForegroundColor; -} - -- (UIColor *)effectiveBackgroundColor -{ - UIColor *effectiveBackgroundColor = _backgroundColor;// ?: [[UIColor whiteColor] colorWithAlphaComponent:0]; - - if (effectiveBackgroundColor && !isnan(_opacity)) { - effectiveBackgroundColor = [effectiveBackgroundColor colorWithAlphaComponent:CGColorGetAlpha(effectiveBackgroundColor.CGColor) * _opacity]; - } - - return effectiveBackgroundColor ?: [UIColor clearColor]; -} - -- (NSString *)applyTextAttributesToText:(NSString *)text -{ - switch (_textTransform) { - case RCTTextTransformUndefined: - case RCTTextTransformNone: - return text; - case RCTTextTransformLowercase: - return [text lowercaseString]; - case RCTTextTransformUppercase: - return [text uppercaseString]; - case RCTTextTransformCapitalize: - return [text capitalizedString]; - } -} - -- (RCTTextAttributes *)copyWithZone:(NSZone *)zone -{ - RCTTextAttributes *textAttributes = [RCTTextAttributes new]; - [textAttributes applyTextAttributes:self]; - return textAttributes; -} - -#pragma mark - NSObject - -- (BOOL)isEqual:(RCTTextAttributes *)textAttributes -{ - if (self == textAttributes) { - return YES; - } - -#define RCTTextAttributesCompareFloats(a) ((a == textAttributes->a) || (isnan(a) && isnan(textAttributes->a))) -#define RCTTextAttributesCompareSize(a) CGSizeEqualToSize(a, textAttributes->a) -#define RCTTextAttributesCompareObjects(a) ((a == textAttributes->a) || [a isEqual:textAttributes->a]) -#define RCTTextAttributesCompareStrings(a) ((a == textAttributes->a) || [a isEqualToString:textAttributes->a]) -#define RCTTextAttributesCompareOthers(a) (a == textAttributes->a) - - return - RCTTextAttributesCompareObjects(_foregroundColor) && - RCTTextAttributesCompareObjects(_backgroundColor) && - RCTTextAttributesCompareFloats(_opacity) && - // Font - RCTTextAttributesCompareObjects(_fontFamily) && - RCTTextAttributesCompareFloats(_fontSize) && - RCTTextAttributesCompareFloats(_fontSizeMultiplier) && - RCTTextAttributesCompareFloats(_maxFontSizeMultiplier) && - RCTTextAttributesCompareStrings(_fontWeight) && - RCTTextAttributesCompareObjects(_fontStyle) && - RCTTextAttributesCompareObjects(_fontVariant) && - RCTTextAttributesCompareOthers(_allowFontScaling) && - RCTTextAttributesCompareFloats(_letterSpacing) && - // Paragraph Styles - RCTTextAttributesCompareFloats(_lineHeight) && - RCTTextAttributesCompareFloats(_alignment) && - RCTTextAttributesCompareOthers(_baseWritingDirection) && - // Decoration - RCTTextAttributesCompareObjects(_textDecorationColor) && - RCTTextAttributesCompareOthers(_textDecorationStyle) && - RCTTextAttributesCompareOthers(_textDecorationLine) && - // Shadow - RCTTextAttributesCompareSize(_textShadowOffset) && - RCTTextAttributesCompareFloats(_textShadowRadius) && - RCTTextAttributesCompareObjects(_textShadowColor) && - // Special - RCTTextAttributesCompareOthers(_isHighlighted) && - RCTTextAttributesCompareObjects(_tag) && - RCTTextAttributesCompareOthers(_layoutDirection) && - RCTTextAttributesCompareOthers(_textTransform); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RCTTextTransform.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RCTTextTransform.h deleted file mode 100644 index af50fe63..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RCTTextTransform.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -typedef NS_ENUM(NSInteger, RCTTextTransform) { - RCTTextTransformUndefined = 0, - RCTTextTransformNone, - RCTTextTransformCapitalize, - RCTTextTransformUppercase, - RCTTextTransformLowercase, -}; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RawText/RCTRawTextShadowView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RawText/RCTRawTextShadowView.h deleted file mode 100644 index ca875b33..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RawText/RCTRawTextShadowView.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface RCTRawTextShadowView : RCTShadowView - -@property (nonatomic, copy, nullable) NSString *text; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RawText/RCTRawTextShadowView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RawText/RCTRawTextShadowView.m deleted file mode 100644 index 82305862..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RawText/RCTRawTextShadowView.m +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTRawTextShadowView.h" - -#import - -@implementation RCTRawTextShadowView - -- (void)setText:(NSString *)text -{ - if (_text != text && ![_text isEqualToString:text]) { - _text = [text copy]; - [self dirtyLayout]; - } -} - -- (void)dirtyLayout -{ - [self.superview dirtyLayout]; -} - -- (NSString *)description -{ - NSString *superDescription = super.description; - return [[superDescription substringToIndex:superDescription.length - 1] stringByAppendingFormat:@"; text: %@>", self.text]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RawText/RCTRawTextViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RawText/RCTRawTextViewManager.h deleted file mode 100644 index d67d56aa..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RawText/RCTRawTextViewManager.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface RCTRawTextViewManager : RCTViewManager - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RawText/RCTRawTextViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RawText/RCTRawTextViewManager.m deleted file mode 100644 index 641f4e7d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/RawText/RCTRawTextViewManager.m +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTRawTextViewManager.h" - -#import "RCTRawTextShadowView.h" - -@implementation RCTRawTextViewManager - -RCT_EXPORT_MODULE(RCTRawText) - -- (UIView *)view -{ - return [UIView new]; -} - -- (RCTShadowView *)shadowView -{ - return [RCTRawTextShadowView new]; -} - -RCT_EXPORT_SHADOW_PROPERTY(text, NSString) - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text.js deleted file mode 100644 index 97240579..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text.js +++ /dev/null @@ -1,291 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const DeprecatedTextPropTypes = require('DeprecatedTextPropTypes'); -const React = require('React'); -const ReactNativeViewAttributes = require('ReactNativeViewAttributes'); -const TextAncestor = require('TextAncestor'); -const Touchable = require('Touchable'); -const UIManager = require('UIManager'); - -const createReactNativeComponentClass = require('createReactNativeComponentClass'); -const nullthrows = require('nullthrows'); -const processColor = require('processColor'); - -import type {PressEvent} from 'CoreEventTypes'; -import type {NativeComponent} from 'ReactNative'; -import type {PressRetentionOffset, TextProps} from 'TextProps'; - -type ResponseHandlers = $ReadOnly<{| - onStartShouldSetResponder: () => boolean, - onResponderGrant: (event: PressEvent, dispatchID: string) => void, - onResponderMove: (event: PressEvent) => void, - onResponderRelease: (event: PressEvent) => void, - onResponderTerminate: (event: PressEvent) => void, - onResponderTerminationRequest: () => boolean, -|}>; - -type Props = $ReadOnly<{| - ...TextProps, - forwardedRef: ?React.Ref<'RCTText' | 'RCTVirtualText'>, -|}>; - -type State = {| - touchable: {| - touchState: ?string, - responderID: ?number, - |}, - isHighlighted: boolean, - createResponderHandlers: () => ResponseHandlers, - responseHandlers: ?ResponseHandlers, -|}; - -const PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30}; - -const viewConfig = { - validAttributes: { - ...ReactNativeViewAttributes.UIView, - isHighlighted: true, - numberOfLines: true, - ellipsizeMode: true, - allowFontScaling: true, - maxFontSizeMultiplier: true, - disabled: true, - selectable: true, - selectionColor: true, - adjustsFontSizeToFit: true, - minimumFontScale: true, - textBreakStrategy: true, - onTextLayout: true, - }, - directEventTypes: { - topTextLayout: { - registrationName: 'onTextLayout', - }, - }, - uiViewClassName: 'RCTText', -}; - -/** - * A React component for displaying text. - * - * See https://facebook.github.io/react-native/docs/text.html - */ -class TouchableText extends React.Component { - static defaultProps = { - accessible: true, - allowFontScaling: true, - ellipsizeMode: 'tail', - }; - - touchableGetPressRectOffset: ?() => PressRetentionOffset; - touchableHandleActivePressIn: ?() => void; - touchableHandleActivePressOut: ?() => void; - touchableHandleLongPress: ?(event: PressEvent) => void; - touchableHandlePress: ?(event: PressEvent) => void; - touchableHandleResponderGrant: ?( - event: PressEvent, - dispatchID: string, - ) => void; - touchableHandleResponderMove: ?(event: PressEvent) => void; - touchableHandleResponderRelease: ?(event: PressEvent) => void; - touchableHandleResponderTerminate: ?(event: PressEvent) => void; - touchableHandleResponderTerminationRequest: ?() => boolean; - - state = { - ...Touchable.Mixin.touchableGetInitialState(), - isHighlighted: false, - createResponderHandlers: this._createResponseHandlers.bind(this), - responseHandlers: null, - }; - - static getDerivedStateFromProps( - nextProps: Props, - prevState: State, - ): $Shape | null { - return prevState.responseHandlers == null && isTouchable(nextProps) - ? { - responseHandlers: prevState.createResponderHandlers(), - } - : null; - } - - static viewConfig = viewConfig; - - render(): React.Node { - let props = this.props; - if (isTouchable(props)) { - props = { - ...props, - ...this.state.responseHandlers, - isHighlighted: this.state.isHighlighted, - }; - } - if (props.selectionColor != null) { - props = { - ...props, - selectionColor: processColor(props.selectionColor), - }; - } - if (__DEV__) { - if (Touchable.TOUCH_TARGET_DEBUG && props.onPress != null) { - props = { - ...props, - style: [props.style, {color: 'magenta'}], - }; - } - } - return ( - - {hasTextAncestor => - hasTextAncestor ? ( - - ) : ( - - - - ) - } - - ); - } - - _createResponseHandlers(): ResponseHandlers { - return { - onStartShouldSetResponder: (): boolean => { - const {onStartShouldSetResponder} = this.props; - const shouldSetResponder = - (onStartShouldSetResponder == null - ? false - : onStartShouldSetResponder()) || isTouchable(this.props); - - if (shouldSetResponder) { - this._attachTouchHandlers(); - } - return shouldSetResponder; - }, - onResponderGrant: (event: PressEvent, dispatchID: string): void => { - nullthrows(this.touchableHandleResponderGrant)(event, dispatchID); - if (this.props.onResponderGrant != null) { - this.props.onResponderGrant.call(this, event, dispatchID); - } - }, - onResponderMove: (event: PressEvent): void => { - nullthrows(this.touchableHandleResponderMove)(event); - if (this.props.onResponderMove != null) { - this.props.onResponderMove.call(this, event); - } - }, - onResponderRelease: (event: PressEvent): void => { - nullthrows(this.touchableHandleResponderRelease)(event); - if (this.props.onResponderRelease != null) { - this.props.onResponderRelease.call(this, event); - } - }, - onResponderTerminate: (event: PressEvent): void => { - nullthrows(this.touchableHandleResponderTerminate)(event); - if (this.props.onResponderTerminate != null) { - this.props.onResponderTerminate.call(this, event); - } - }, - onResponderTerminationRequest: (): boolean => { - const {onResponderTerminationRequest} = this.props; - if (!nullthrows(this.touchableHandleResponderTerminationRequest)()) { - return false; - } - if (onResponderTerminationRequest == null) { - return true; - } - return onResponderTerminationRequest(); - }, - }; - } - - /** - * Lazily attaches Touchable.Mixin handlers. - */ - _attachTouchHandlers(): void { - if (this.touchableGetPressRectOffset != null) { - return; - } - for (const key in Touchable.Mixin) { - if (typeof Touchable.Mixin[key] === 'function') { - (this: any)[key] = Touchable.Mixin[key].bind(this); - } - } - this.touchableHandleActivePressIn = (): void => { - if (!this.props.suppressHighlighting && isTouchable(this.props)) { - this.setState({isHighlighted: true}); - } - }; - this.touchableHandleActivePressOut = (): void => { - if (!this.props.suppressHighlighting && isTouchable(this.props)) { - this.setState({isHighlighted: false}); - } - }; - this.touchableHandlePress = (event: PressEvent): void => { - if (this.props.onPress != null) { - this.props.onPress(event); - } - }; - this.touchableHandleLongPress = (event: PressEvent): void => { - if (this.props.onLongPress != null) { - this.props.onLongPress(event); - } - }; - this.touchableGetPressRectOffset = (): PressRetentionOffset => - this.props.pressRetentionOffset == null - ? PRESS_RECT_OFFSET - : this.props.pressRetentionOffset; - } -} - -const isTouchable = (props: Props): boolean => - props.onPress != null || - props.onLongPress != null || - props.onStartShouldSetResponder != null; - -const RCTText = createReactNativeComponentClass( - viewConfig.uiViewClassName, - () => viewConfig, -); - -const RCTVirtualText = - UIManager.getViewManagerConfig('RCTVirtualText') == null - ? RCTText - : createReactNativeComponentClass('RCTVirtualText', () => ({ - validAttributes: { - ...ReactNativeViewAttributes.UIView, - isHighlighted: true, - maxFontSizeMultiplier: true, - }, - uiViewClassName: 'RCTVirtualText', - })); - -const Text = ( - props: TextProps, - forwardedRef: ?React.Ref<'RCTText' | 'RCTVirtualText'>, -) => { - return ; -}; -const TextToExport = React.forwardRef(Text); -TextToExport.displayName = 'Text'; - -// TODO: Deprecate this. -/* $FlowFixMe(>=0.89.0 site=react_native_fb) This comment suppresses an error - * found when Flow v0.89 was deployed. To see the error, delete this comment - * and run Flow. */ -TextToExport.propTypes = DeprecatedTextPropTypes; - -module.exports = ((TextToExport: $FlowFixMe): Class< - NativeComponent, ->); diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/NSTextStorage+FontScaling.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/NSTextStorage+FontScaling.h deleted file mode 100644 index 1ec019ef..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/NSTextStorage+FontScaling.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface NSTextStorage (FontScaling) - -- (void)scaleFontSizeToFitSize:(CGSize)size - minimumFontSize:(CGFloat)minimumFontSize - maximumFontSize:(CGFloat)maximumFontSize; - -- (void)scaleFontSizeWithRatio:(CGFloat)ratio - minimumFontSize:(CGFloat)minimumFontSize - maximumFontSize:(CGFloat)maximumFontSize; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/NSTextStorage+FontScaling.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/NSTextStorage+FontScaling.m deleted file mode 100644 index 01f6c8a1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/NSTextStorage+FontScaling.m +++ /dev/null @@ -1,137 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "NSTextStorage+FontScaling.h" - -typedef NS_OPTIONS(NSInteger, RCTTextSizeComparisonOptions) { - RCTTextSizeComparisonSmaller = 1 << 0, - RCTTextSizeComparisonLarger = 1 << 1, - RCTTextSizeComparisonWithinRange = 1 << 2, -}; - -@implementation NSTextStorage (FontScaling) - -- (void)scaleFontSizeToFitSize:(CGSize)size - minimumFontSize:(CGFloat)minimumFontSize - maximumFontSize:(CGFloat)maximumFontSize -{ - CGFloat bottomRatio = 1.0/128.0; - CGFloat topRatio = 128.0; - CGFloat ratio = 1.0; - - NSAttributedString *originalAttributedString = [self copy]; - - CGFloat lastRatioWhichFits = 0.02; - - while (true) { - [self scaleFontSizeWithRatio:ratio - minimumFontSize:minimumFontSize - maximumFontSize:maximumFontSize]; - - RCTTextSizeComparisonOptions comparsion = - [self compareToSize:size thresholdRatio:0.01]; - - if ( - (comparsion & RCTTextSizeComparisonWithinRange) && - (comparsion & RCTTextSizeComparisonSmaller) - ) { - return; - } else if (comparsion & RCTTextSizeComparisonSmaller) { - bottomRatio = ratio; - lastRatioWhichFits = ratio; - } else { - topRatio = ratio; - } - - ratio = (topRatio + bottomRatio) / 2.0; - - CGFloat kRatioThreshold = 0.005; - if ( - ABS(topRatio - bottomRatio) < kRatioThreshold || - ABS(topRatio - ratio) < kRatioThreshold || - ABS(bottomRatio - ratio) < kRatioThreshold - ) { - [self replaceCharactersInRange:(NSRange){0, self.length} - withAttributedString:originalAttributedString]; - - [self scaleFontSizeWithRatio:lastRatioWhichFits - minimumFontSize:minimumFontSize - maximumFontSize:maximumFontSize]; - return; - } - - [self replaceCharactersInRange:(NSRange){0, self.length} - withAttributedString:originalAttributedString]; - } -} - - -- (RCTTextSizeComparisonOptions)compareToSize:(CGSize)size thresholdRatio:(CGFloat)thresholdRatio -{ - NSLayoutManager *layoutManager = self.layoutManagers.firstObject; - NSTextContainer *textContainer = layoutManager.textContainers.firstObject; - - [layoutManager ensureLayoutForTextContainer:textContainer]; - - // Does it fit the text container? - NSRange glyphRange = [layoutManager glyphRangeForTextContainer:textContainer]; - NSRange truncatedGlyphRange = [layoutManager truncatedGlyphRangeInLineFragmentForGlyphAtIndex:glyphRange.length - 1]; - - if (truncatedGlyphRange.location != NSNotFound) { - return RCTTextSizeComparisonLarger; - } - - CGSize measuredSize = [layoutManager usedRectForTextContainer:textContainer].size; - - // Does it fit the size? - BOOL fitsSize = - size.width >= measuredSize.width && - size.height >= measuredSize.height; - - CGSize thresholdSize = (CGSize){ - size.width * thresholdRatio, - size.height * thresholdRatio, - }; - - RCTTextSizeComparisonOptions result = 0; - - result |= (fitsSize) ? RCTTextSizeComparisonSmaller : RCTTextSizeComparisonLarger; - - if (ABS(measuredSize.width - size.width) < thresholdSize.width) { - result = result | RCTTextSizeComparisonWithinRange; - } - - return result; -} - -- (void)scaleFontSizeWithRatio:(CGFloat)ratio - minimumFontSize:(CGFloat)minimumFontSize - maximumFontSize:(CGFloat)maximumFontSize -{ - [self beginEditing]; - - [self enumerateAttribute:NSFontAttributeName - inRange:(NSRange){0, self.length} - options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired - usingBlock: - ^(UIFont *_Nullable font, NSRange range, BOOL *_Nonnull stop) { - if (!font) { - return; - } - - CGFloat fontSize = MAX(MIN(font.pointSize * ratio, maximumFontSize), minimumFontSize); - - [self addAttribute:NSFontAttributeName - value:[font fontWithSize:fontSize] - range:range]; - } - ]; - - [self endEditing]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/RCTTextShadowView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/RCTTextShadowView.h deleted file mode 100644 index aaaf8e3d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/RCTTextShadowView.h +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "RCTBaseTextShadowView.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface RCTTextShadowView : RCTBaseTextShadowView - -- (instancetype)initWithBridge:(RCTBridge *)bridge; - -@property (nonatomic, assign) NSInteger maximumNumberOfLines; -@property (nonatomic, assign) NSLineBreakMode lineBreakMode; -@property (nonatomic, assign) BOOL adjustsFontSizeToFit; -@property (nonatomic, assign) CGFloat minimumFontScale; -@property (nonatomic, copy) RCTDirectEventBlock onTextLayout; - -- (void)uiManagerWillPerformMounting; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/RCTTextShadowView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/RCTTextShadowView.m deleted file mode 100644 index d1baf9cc..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/RCTTextShadowView.m +++ /dev/null @@ -1,417 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTextShadowView.h" - -#import -#import -#import -#import - -#import "NSTextStorage+FontScaling.h" -#import "RCTTextView.h" - -@implementation RCTTextShadowView -{ - __weak RCTBridge *_bridge; - BOOL _needsUpdateView; - NSMapTable *_cachedTextStorages; -} - -- (instancetype)initWithBridge:(RCTBridge *)bridge -{ - if (self = [super init]) { - _bridge = bridge; - _cachedTextStorages = [NSMapTable strongToStrongObjectsMapTable]; - _needsUpdateView = YES; - YGNodeSetMeasureFunc(self.yogaNode, RCTTextShadowViewMeasure); - YGNodeSetBaselineFunc(self.yogaNode, RCTTextShadowViewBaseline); - } - - return self; -} - -- (BOOL)isYogaLeafNode -{ - return YES; -} - -- (void)dirtyLayout -{ - [super dirtyLayout]; - YGNodeMarkDirty(self.yogaNode); - [self invalidateCache]; -} - -- (void)invalidateCache -{ - [_cachedTextStorages removeAllObjects]; - _needsUpdateView = YES; -} - -#pragma mark - RCTUIManagerObserver - -- (void)uiManagerWillPerformMounting -{ - if (YGNodeIsDirty(self.yogaNode)) { - return; - } - - if (!_needsUpdateView) { - return; - } - _needsUpdateView = NO; - - CGRect contentFrame = self.contentFrame; - NSTextStorage *textStorage = [self textStorageAndLayoutManagerThatFitsSize:self.contentFrame.size - exclusiveOwnership:YES]; - - NSNumber *tag = self.reactTag; - NSMutableArray *descendantViewTags = [NSMutableArray new]; - [textStorage enumerateAttribute:RCTBaseTextShadowViewEmbeddedShadowViewAttributeName - inRange:NSMakeRange(0, textStorage.length) - options:0 - usingBlock: - ^(RCTShadowView *shadowView, NSRange range, __unused BOOL *stop) { - if (!shadowView) { - return; - } - - [descendantViewTags addObject:shadowView.reactTag]; - } - ]; - - [_bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { - RCTTextView *textView = (RCTTextView *)viewRegistry[tag]; - if (!textView) { - return; - } - - NSMutableArray *descendantViews = - [NSMutableArray arrayWithCapacity:descendantViewTags.count]; - [descendantViewTags enumerateObjectsUsingBlock:^(NSNumber *_Nonnull descendantViewTag, NSUInteger index, BOOL *_Nonnull stop) { - UIView *descendantView = viewRegistry[descendantViewTag]; - if (!descendantView) { - return; - } - - [descendantViews addObject:descendantView]; - }]; - - // Removing all references to Shadow Views to avoid unnececery retainning. - [textStorage removeAttribute:RCTBaseTextShadowViewEmbeddedShadowViewAttributeName range:NSMakeRange(0, textStorage.length)]; - - [textView setTextStorage:textStorage - contentFrame:contentFrame - descendantViews:descendantViews]; - }]; -} - -- (void)postprocessAttributedText:(NSMutableAttributedString *)attributedText -{ - __block CGFloat maximumLineHeight = 0; - - [attributedText enumerateAttribute:NSParagraphStyleAttributeName - inRange:NSMakeRange(0, attributedText.length) - options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired - usingBlock: - ^(NSParagraphStyle *paragraphStyle, __unused NSRange range, __unused BOOL *stop) { - if (!paragraphStyle) { - return; - } - - maximumLineHeight = MAX(paragraphStyle.maximumLineHeight, maximumLineHeight); - } - ]; - - if (maximumLineHeight == 0) { - // `lineHeight` was not specified, nothing to do. - return; - } - - __block CGFloat maximumFontLineHeight = 0; - - [attributedText enumerateAttribute:NSFontAttributeName - inRange:NSMakeRange(0, attributedText.length) - options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired - usingBlock: - ^(UIFont *font, NSRange range, __unused BOOL *stop) { - if (!font) { - return; - } - - if (maximumFontLineHeight <= font.lineHeight) { - maximumFontLineHeight = font.lineHeight; - } - } - ]; - - if (maximumLineHeight < maximumFontLineHeight) { - return; - } - - CGFloat baseLineOffset = maximumLineHeight / 2.0 - maximumFontLineHeight / 2.0; - - [attributedText addAttribute:NSBaselineOffsetAttributeName - value:@(baseLineOffset) - range:NSMakeRange(0, attributedText.length)]; -} - -- (NSAttributedString *)attributedTextWithMeasuredAttachmentsThatFitSize:(CGSize)size -{ - NSMutableAttributedString *attributedText = - [[NSMutableAttributedString alloc] initWithAttributedString:[self attributedTextWithBaseTextAttributes:nil]]; - - [attributedText beginEditing]; - - [attributedText enumerateAttribute:RCTBaseTextShadowViewEmbeddedShadowViewAttributeName - inRange:NSMakeRange(0, attributedText.length) - options:0 - usingBlock: - ^(RCTShadowView *shadowView, NSRange range, __unused BOOL *stop) { - if (!shadowView) { - return; - } - - CGSize fittingSize = [shadowView sizeThatFitsMinimumSize:CGSizeZero - maximumSize:size]; - NSTextAttachment *attachment = [NSTextAttachment new]; - attachment.bounds = (CGRect){CGPointZero, fittingSize}; - [attributedText addAttribute:NSAttachmentAttributeName value:attachment range:range]; - } - ]; - - [attributedText endEditing]; - - return [attributedText copy]; -} - -- (NSTextStorage *)textStorageAndLayoutManagerThatFitsSize:(CGSize)size - exclusiveOwnership:(BOOL)exclusiveOwnership -{ - NSValue *key = [NSValue valueWithCGSize:size]; - NSTextStorage *cachedTextStorage = [_cachedTextStorages objectForKey:key]; - - if (cachedTextStorage) { - if (exclusiveOwnership) { - [_cachedTextStorages removeObjectForKey:key]; - } - - return cachedTextStorage; - } - - NSTextContainer *textContainer = [[NSTextContainer alloc] initWithSize:size]; - - textContainer.lineFragmentPadding = 0.0; // Note, the default value is 5. - textContainer.lineBreakMode = - _maximumNumberOfLines > 0 ? _lineBreakMode : NSLineBreakByClipping; - textContainer.maximumNumberOfLines = _maximumNumberOfLines; - - NSLayoutManager *layoutManager = [NSLayoutManager new]; - [layoutManager addTextContainer:textContainer]; - - NSTextStorage *textStorage = - [[NSTextStorage alloc] initWithAttributedString:[self attributedTextWithMeasuredAttachmentsThatFitSize:size]]; - - [self postprocessAttributedText:textStorage]; - - [textStorage addLayoutManager:layoutManager]; - - if (_adjustsFontSizeToFit) { - CGFloat minimumFontSize = - MAX(_minimumFontScale * (self.textAttributes.effectiveFont.pointSize), 4.0); - [textStorage scaleFontSizeToFitSize:size - minimumFontSize:minimumFontSize - maximumFontSize:self.textAttributes.effectiveFont.pointSize]; - } - - if (!exclusiveOwnership) { - [_cachedTextStorages setObject:textStorage forKey:key]; - } - - return textStorage; -} - -- (void)layoutWithMetrics:(RCTLayoutMetrics)layoutMetrics - layoutContext:(RCTLayoutContext)layoutContext -{ - // If the view got new `contentFrame`, we have to redraw it because - // and sizes of embedded views may change. - if (!CGRectEqualToRect(self.layoutMetrics.contentFrame, layoutMetrics.contentFrame)) { - _needsUpdateView = YES; - } - - if (self.textAttributes.layoutDirection != layoutMetrics.layoutDirection) { - self.textAttributes.layoutDirection = layoutMetrics.layoutDirection; - [self invalidateCache]; - } - - [super layoutWithMetrics:layoutMetrics layoutContext:layoutContext]; -} - -- (void)layoutSubviewsWithContext:(RCTLayoutContext)layoutContext -{ - NSTextStorage *textStorage = - [self textStorageAndLayoutManagerThatFitsSize:self.availableSize - exclusiveOwnership:NO]; - NSLayoutManager *layoutManager = textStorage.layoutManagers.firstObject; - NSTextContainer *textContainer = layoutManager.textContainers.firstObject; - NSRange glyphRange = [layoutManager glyphRangeForTextContainer:textContainer]; - NSRange characterRange = [layoutManager characterRangeForGlyphRange:glyphRange - actualGlyphRange:NULL]; - - [textStorage enumerateAttribute:RCTBaseTextShadowViewEmbeddedShadowViewAttributeName - inRange:characterRange - options:0 - usingBlock: - ^(RCTShadowView *shadowView, NSRange range, BOOL *stop) { - if (!shadowView) { - return; - } - - CGRect glyphRect = [layoutManager boundingRectForGlyphRange:range - inTextContainer:textContainer]; - - NSTextAttachment *attachment = - [textStorage attribute:NSAttachmentAttributeName atIndex:range.location effectiveRange:nil]; - - CGSize attachmentSize = attachment.bounds.size; - - UIFont *font = [textStorage attribute:NSFontAttributeName atIndex:range.location effectiveRange:nil]; - - CGRect frame = {{ - RCTRoundPixelValue(glyphRect.origin.x), - RCTRoundPixelValue(glyphRect.origin.y + glyphRect.size.height - attachmentSize.height + font.descender) - }, { - RCTRoundPixelValue(attachmentSize.width), - RCTRoundPixelValue(attachmentSize.height) - }}; - - NSRange truncatedGlyphRange = [layoutManager truncatedGlyphRangeInLineFragmentForGlyphAtIndex:range.location]; - BOOL viewIsTruncated = NSIntersectionRange(range, truncatedGlyphRange).length != 0; - - RCTLayoutContext localLayoutContext = layoutContext; - localLayoutContext.absolutePosition.x += frame.origin.x; - localLayoutContext.absolutePosition.y += frame.origin.y; - - [shadowView layoutWithMinimumSize:frame.size - maximumSize:frame.size - layoutDirection:self.layoutMetrics.layoutDirection - layoutContext:localLayoutContext]; - - RCTLayoutMetrics localLayoutMetrics = shadowView.layoutMetrics; - localLayoutMetrics.frame.origin = frame.origin; // Reinforcing a proper frame origin for the Shadow View. - if (viewIsTruncated) { - localLayoutMetrics.displayType = RCTDisplayTypeNone; - } - [shadowView layoutWithMetrics:localLayoutMetrics layoutContext:localLayoutContext]; - } - ]; - - - if (_onTextLayout) { - NSMutableArray *lineData = [NSMutableArray new]; - [layoutManager - enumerateLineFragmentsForGlyphRange:glyphRange - usingBlock:^(CGRect overallRect, CGRect usedRect, NSTextContainer * _Nonnull usedTextContainer, NSRange lineGlyphRange, BOOL * _Nonnull stop) { - NSRange range = [layoutManager characterRangeForGlyphRange:lineGlyphRange actualGlyphRange:nil]; - NSString *renderedString = [textStorage.string substringWithRange:range]; - UIFont *font = [[textStorage attributedSubstringFromRange:range] attribute:NSFontAttributeName atIndex:0 effectiveRange:nil]; - [lineData addObject: - @{ - @"text": renderedString, - @"x": @(usedRect.origin.x), - @"y": @(usedRect.origin.y), - @"width": @(usedRect.size.width), - @"height": @(usedRect.size.height), - @"descender": @(-font.descender), - @"capHeight": @(font.capHeight), - @"ascender": @(font.ascender), - @"xHeight": @(font.xHeight), - }]; - }]; - NSDictionary *payload = - @{ - @"lines": lineData, - }; - _onTextLayout(payload); - } -} - -- (CGFloat)lastBaselineForSize:(CGSize)size -{ - NSAttributedString *attributedText = - [self textStorageAndLayoutManagerThatFitsSize:size exclusiveOwnership:NO]; - - __block CGFloat maximumDescender = 0.0; - - [attributedText enumerateAttribute:NSFontAttributeName - inRange:NSMakeRange(0, attributedText.length) - options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired - usingBlock: - ^(UIFont *font, NSRange range, __unused BOOL *stop) { - if (maximumDescender > font.descender) { - maximumDescender = font.descender; - } - } - ]; - - return size.height + maximumDescender; -} - -static YGSize RCTTextShadowViewMeasure(YGNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode) -{ - CGSize maximumSize = (CGSize){ - widthMode == YGMeasureModeUndefined ? CGFLOAT_MAX : RCTCoreGraphicsFloatFromYogaFloat(width), - heightMode == YGMeasureModeUndefined ? CGFLOAT_MAX : RCTCoreGraphicsFloatFromYogaFloat(height), - }; - - RCTTextShadowView *shadowTextView = (__bridge RCTTextShadowView *)YGNodeGetContext(node); - - NSTextStorage *textStorage = - [shadowTextView textStorageAndLayoutManagerThatFitsSize:maximumSize - exclusiveOwnership:NO]; - - NSLayoutManager *layoutManager = textStorage.layoutManagers.firstObject; - NSTextContainer *textContainer = layoutManager.textContainers.firstObject; - [layoutManager ensureLayoutForTextContainer:textContainer]; - CGSize size = [layoutManager usedRectForTextContainer:textContainer].size; - - CGFloat letterSpacing = shadowTextView.textAttributes.letterSpacing; - if (!isnan(letterSpacing) && letterSpacing < 0) { - size.width -= letterSpacing; - } - - size = (CGSize){ - MIN(RCTCeilPixelValue(size.width), maximumSize.width), - MIN(RCTCeilPixelValue(size.height), maximumSize.height) - }; - - // Adding epsilon value illuminates problems with converting values from - // `double` to `float`, and then rounding them to pixel grid in Yoga. - CGFloat epsilon = 0.001; - return (YGSize){ - RCTYogaFloatFromCoreGraphicsFloat(size.width + epsilon), - RCTYogaFloatFromCoreGraphicsFloat(size.height + epsilon) - }; -} - -static float RCTTextShadowViewBaseline(YGNodeRef node, const float width, const float height) -{ - RCTTextShadowView *shadowTextView = (__bridge RCTTextShadowView *)YGNodeGetContext(node); - - CGSize size = (CGSize){ - RCTCoreGraphicsFloatFromYogaFloat(width), - RCTCoreGraphicsFloatFromYogaFloat(height) - }; - - CGFloat lastBaseline = [shadowTextView lastBaselineForSize:size]; - - return RCTYogaFloatFromCoreGraphicsFloat(lastBaseline); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/RCTTextView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/RCTTextView.h deleted file mode 100644 index a082013c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/RCTTextView.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface RCTTextView : UIView - -@property (nonatomic, assign) BOOL selectable; - -- (void)setTextStorage:(NSTextStorage *)textStorage - contentFrame:(CGRect)contentFrame - descendantViews:(NSArray *)descendantViews; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/RCTTextView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/RCTTextView.m deleted file mode 100644 index 917cf839..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/RCTTextView.m +++ /dev/null @@ -1,267 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTextView.h" - -#import - -#import -#import - -#import "RCTTextShadowView.h" - -@implementation RCTTextView -{ - CAShapeLayer *_highlightLayer; - UILongPressGestureRecognizer *_longPressGestureRecognizer; - - NSArray *_Nullable _descendantViews; - NSTextStorage *_Nullable _textStorage; - CGRect _contentFrame; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - self.isAccessibilityElement = YES; - self.accessibilityTraits |= UIAccessibilityTraitStaticText; - self.opaque = NO; - self.contentMode = UIViewContentModeRedraw; - } - return self; -} - -- (NSString *)description -{ - NSString *superDescription = super.description; - NSRange semicolonRange = [superDescription rangeOfString:@";"]; - NSString *replacement = [NSString stringWithFormat:@"; reactTag: %@; text: %@", self.reactTag, _textStorage.string]; - return [superDescription stringByReplacingCharactersInRange:semicolonRange withString:replacement]; -} - -- (void)setSelectable:(BOOL)selectable -{ - if (_selectable == selectable) { - return; - } - - _selectable = selectable; - - if (_selectable) { - [self enableContextMenu]; - } - else { - [self disableContextMenu]; - } -} - -- (void)reactSetFrame:(CGRect)frame -{ - // Text looks super weird if its frame is animated. - // This disables the frame animation, without affecting opacity, etc. - [UIView performWithoutAnimation:^{ - [super reactSetFrame:frame]; - }]; -} - -- (void)didUpdateReactSubviews -{ - // Do nothing, as subviews are managed by `setTextStorage:` method -} - -- (void)setTextStorage:(NSTextStorage *)textStorage - contentFrame:(CGRect)contentFrame - descendantViews:(NSArray *)descendantViews -{ - _textStorage = textStorage; - _contentFrame = contentFrame; - - // FIXME: Optimize this. - for (UIView *view in _descendantViews) { - [view removeFromSuperview]; - } - - _descendantViews = descendantViews; - - for (UIView *view in descendantViews) { - [self addSubview:view]; - } - - [self setNeedsDisplay]; -} - -- (void)drawRect:(CGRect)rect -{ - if (!_textStorage) { - return; - } - - - NSLayoutManager *layoutManager = _textStorage.layoutManagers.firstObject; - NSTextContainer *textContainer = layoutManager.textContainers.firstObject; - - NSRange glyphRange = [layoutManager glyphRangeForTextContainer:textContainer]; - [layoutManager drawBackgroundForGlyphRange:glyphRange atPoint:_contentFrame.origin]; - [layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:_contentFrame.origin]; - - __block UIBezierPath *highlightPath = nil; - NSRange characterRange = [layoutManager characterRangeForGlyphRange:glyphRange - actualGlyphRange:NULL]; - [_textStorage enumerateAttribute:RCTTextAttributesIsHighlightedAttributeName - inRange:characterRange - options:0 - usingBlock: - ^(NSNumber *value, NSRange range, __unused BOOL *stop) { - if (!value.boolValue) { - return; - } - - [layoutManager enumerateEnclosingRectsForGlyphRange:range - withinSelectedGlyphRange:range - inTextContainer:textContainer - usingBlock: - ^(CGRect enclosingRect, __unused BOOL *anotherStop) { - UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectInset(enclosingRect, -2, -2) cornerRadius:2]; - if (highlightPath) { - [highlightPath appendPath:path]; - } else { - highlightPath = path; - } - } - ]; - }]; - - if (highlightPath) { - if (!_highlightLayer) { - _highlightLayer = [CAShapeLayer layer]; - _highlightLayer.fillColor = [UIColor colorWithWhite:0 alpha:0.25].CGColor; - [self.layer addSublayer:_highlightLayer]; - } - _highlightLayer.position = _contentFrame.origin; - _highlightLayer.path = highlightPath.CGPath; - } else { - [_highlightLayer removeFromSuperlayer]; - _highlightLayer = nil; - } -} - - -- (NSNumber *)reactTagAtPoint:(CGPoint)point -{ - NSNumber *reactTag = self.reactTag; - - CGFloat fraction; - NSLayoutManager *layoutManager = _textStorage.layoutManagers.firstObject; - NSTextContainer *textContainer = layoutManager.textContainers.firstObject; - NSUInteger characterIndex = [layoutManager characterIndexForPoint:point - inTextContainer:textContainer - fractionOfDistanceBetweenInsertionPoints:&fraction]; - - // If the point is not before (fraction == 0.0) the first character and not - // after (fraction == 1.0) the last character, then the attribute is valid. - if (_textStorage.length > 0 && (fraction > 0 || characterIndex > 0) && (fraction < 1 || characterIndex < _textStorage.length - 1)) { - reactTag = [_textStorage attribute:RCTTextAttributesTagAttributeName atIndex:characterIndex effectiveRange:NULL]; - } - - return reactTag; -} - -- (void)didMoveToWindow -{ - [super didMoveToWindow]; - - if (!self.window) { - self.layer.contents = nil; - if (_highlightLayer) { - [_highlightLayer removeFromSuperlayer]; - _highlightLayer = nil; - } - } else if (_textStorage) { - [self setNeedsDisplay]; - } -} - -#pragma mark - Accessibility - -- (NSString *)accessibilityLabel -{ - NSString *superAccessibilityLabel = [super accessibilityLabel]; - if (superAccessibilityLabel) { - return superAccessibilityLabel; - } - return _textStorage.string; -} - -#pragma mark - Context Menu - -- (void)enableContextMenu -{ - _longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)]; - [self addGestureRecognizer:_longPressGestureRecognizer]; -} - -- (void)disableContextMenu -{ - [self removeGestureRecognizer:_longPressGestureRecognizer]; - _longPressGestureRecognizer = nil; -} - -- (void)handleLongPress:(UILongPressGestureRecognizer *)gesture -{ -#if !TARGET_OS_TV - UIMenuController *menuController = [UIMenuController sharedMenuController]; - - if (menuController.isMenuVisible) { - return; - } - - if (!self.isFirstResponder) { - [self becomeFirstResponder]; - } - - [menuController setTargetRect:self.bounds inView:self]; - [menuController setMenuVisible:YES animated:YES]; -#endif -} - -- (BOOL)canBecomeFirstResponder -{ - return _selectable; -} - -- (BOOL)canPerformAction:(SEL)action withSender:(id)sender -{ - if (_selectable && action == @selector(copy:)) { - return YES; - } - - return [self.nextResponder canPerformAction:action withSender:sender]; -} - -- (void)copy:(id)sender -{ -#if !TARGET_OS_TV - NSAttributedString *attributedText = _textStorage; - - NSMutableDictionary *item = [NSMutableDictionary new]; - - NSData *rtf = [attributedText dataFromRange:NSMakeRange(0, attributedText.length) - documentAttributes:@{NSDocumentTypeDocumentAttribute: NSRTFDTextDocumentType} - error:nil]; - - if (rtf) { - [item setObject:rtf forKey:(id)kUTTypeFlatRTFD]; - } - - [item setObject:attributedText.string forKey:(id)kUTTypeUTF8PlainText]; - - UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; - pasteboard.items = @[item]; -#endif -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/RCTTextViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/RCTTextViewManager.h deleted file mode 100644 index e9586b3d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/RCTTextViewManager.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "RCTBaseTextViewManager.h" - -@interface RCTTextViewManager : RCTBaseTextViewManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/RCTTextViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/RCTTextViewManager.m deleted file mode 100644 index 9e0af363..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/Text/RCTTextViewManager.m +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTextViewManager.h" - -#import -#import -#import -#import -#import -#import - -#import "RCTTextShadowView.h" -#import "RCTTextView.h" - -@interface RCTTextViewManager () - -@end - -@implementation RCTTextViewManager -{ - NSHashTable *_shadowViews; -} - -RCT_EXPORT_MODULE(RCTText) - -RCT_REMAP_SHADOW_PROPERTY(numberOfLines, maximumNumberOfLines, NSInteger) -RCT_REMAP_SHADOW_PROPERTY(ellipsizeMode, lineBreakMode, NSLineBreakMode) -RCT_REMAP_SHADOW_PROPERTY(adjustsFontSizeToFit, adjustsFontSizeToFit, BOOL) -RCT_REMAP_SHADOW_PROPERTY(minimumFontScale, minimumFontScale, CGFloat) - -RCT_EXPORT_SHADOW_PROPERTY(onTextLayout, RCTDirectEventBlock) - -RCT_EXPORT_VIEW_PROPERTY(selectable, BOOL) - -- (void)setBridge:(RCTBridge *)bridge -{ - [super setBridge:bridge]; - _shadowViews = [NSHashTable weakObjectsHashTable]; - - [bridge.uiManager.observerCoordinator addObserver:self]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleDidUpdateMultiplierNotification) - name:RCTAccessibilityManagerDidUpdateMultiplierNotification - object:bridge.accessibilityManager]; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (UIView *)view -{ - return [RCTTextView new]; -} - -- (RCTShadowView *)shadowView -{ - RCTTextShadowView *shadowView = [[RCTTextShadowView alloc] initWithBridge:self.bridge]; - shadowView.textAttributes.fontSizeMultiplier = self.bridge.accessibilityManager.multiplier; - [_shadowViews addObject:shadowView]; - return shadowView; -} - -#pragma mark - RCTUIManagerObserver - -- (void)uiManagerWillPerformMounting:(__unused RCTUIManager *)uiManager -{ - for (RCTTextShadowView *shadowView in _shadowViews) { - [shadowView uiManagerWillPerformMounting]; - } -} - -#pragma mark - Font Size Multiplier - -- (void)handleDidUpdateMultiplierNotification -{ - CGFloat fontSizeMultiplier = self.bridge.accessibilityManager.multiplier; - - NSHashTable *shadowViews = _shadowViews; - RCTExecuteOnUIManagerQueue(^{ - for (RCTTextShadowView *shadowView in shadowViews) { - shadowView.textAttributes.fontSizeMultiplier = fontSizeMultiplier; - [shadowView dirtyLayout]; - } - - [self.bridge.uiManager setNeedsLayout]; - }); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextAncestor.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextAncestor.js deleted file mode 100644 index e3463859..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextAncestor.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict - * @format - */ - -'use strict'; - -const React = require('React'); - -/** - * Whether the current element is the descendant of a element. - */ -/* $FlowFixMe(>=0.85.0 site=react_native_fb) This comment suppresses an error - * found when Flow v0.85 was deployed. To see the error, delete this comment - * and run Flow. */ -module.exports = React.createContext(false); diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Multiline/RCTMultilineTextInputView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Multiline/RCTMultilineTextInputView.h deleted file mode 100644 index fca70914..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Multiline/RCTMultilineTextInputView.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTBaseTextInputView.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface RCTMultilineTextInputView : RCTBaseTextInputView - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Multiline/RCTMultilineTextInputView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Multiline/RCTMultilineTextInputView.m deleted file mode 100644 index dd6b4890..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Multiline/RCTMultilineTextInputView.m +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTMultilineTextInputView.h" - -#import - -#import "RCTUITextView.h" - -@implementation RCTMultilineTextInputView -{ - RCTUITextView *_backedTextInputView; -} - -- (instancetype)initWithBridge:(RCTBridge *)bridge -{ - if (self = [super initWithBridge:bridge]) { - // `blurOnSubmit` defaults to `false` for by design. - self.blurOnSubmit = NO; - - _backedTextInputView = [[RCTUITextView alloc] initWithFrame:self.bounds]; - _backedTextInputView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - _backedTextInputView.backgroundColor = [UIColor clearColor]; - _backedTextInputView.textColor = [UIColor blackColor]; - // This line actually removes 5pt (default value) left and right padding in UITextView. - _backedTextInputView.textContainer.lineFragmentPadding = 0; -#if !TARGET_OS_TV - _backedTextInputView.scrollsToTop = NO; -#endif - _backedTextInputView.scrollEnabled = YES; - _backedTextInputView.textInputDelegate = self; - - [self addSubview:_backedTextInputView]; - } - - return self; -} - -- (id)backedTextInputView -{ - return _backedTextInputView; -} - -#pragma mark - UIScrollViewDelegate - -- (void)scrollViewDidScroll:(UIScrollView *)scrollView -{ - RCTDirectEventBlock onScroll = self.onScroll; - - if (onScroll) { - CGPoint contentOffset = scrollView.contentOffset; - CGSize contentSize = scrollView.contentSize; - CGSize size = scrollView.bounds.size; - UIEdgeInsets contentInset = scrollView.contentInset; - - onScroll(@{ - @"contentOffset": @{ - @"x": @(contentOffset.x), - @"y": @(contentOffset.y) - }, - @"contentInset": @{ - @"top": @(contentInset.top), - @"left": @(contentInset.left), - @"bottom": @(contentInset.bottom), - @"right": @(contentInset.right) - }, - @"contentSize": @{ - @"width": @(contentSize.width), - @"height": @(contentSize.height) - }, - @"layoutMeasurement": @{ - @"width": @(size.width), - @"height": @(size.height) - }, - @"zoomScale": @(scrollView.zoomScale ?: 1), - }); - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.h deleted file mode 100644 index 18dc486c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTBaseTextInputViewManager.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface RCTMultilineTextInputViewManager : RCTBaseTextInputViewManager - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m deleted file mode 100644 index b086dfae..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTMultilineTextInputViewManager.h" - -#import "RCTMultilineTextInputView.h" - -@implementation RCTMultilineTextInputViewManager - -RCT_EXPORT_MODULE() - -- (UIView *)view -{ - return [[RCTMultilineTextInputView alloc] initWithBridge:self.bridge]; -} - -#pragma mark - Multiline (aka TextView) specific properties - -#if !TARGET_OS_TV -RCT_REMAP_VIEW_PROPERTY(dataDetectorTypes, backedTextInputView.dataDetectorTypes, UIDataDetectorTypes) -#endif - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Multiline/RCTUITextView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Multiline/RCTUITextView.h deleted file mode 100644 index 2c0bbb22..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Multiline/RCTUITextView.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "RCTBackedTextInputViewProtocol.h" - -#import "RCTBackedTextInputDelegate.h" - -NS_ASSUME_NONNULL_BEGIN - -/* - * Just regular UITextView... but much better! - */ -@interface RCTUITextView : UITextView - -- (instancetype)initWithFrame:(CGRect)frame textContainer:(nullable NSTextContainer *)textContainer NS_UNAVAILABLE; -- (instancetype)initWithCoder:(NSCoder *)decoder NS_UNAVAILABLE; - -@property (nonatomic, weak) id textInputDelegate; - -@property (nonatomic, assign) BOOL contextMenuHidden; -@property (nonatomic, assign, readonly) BOOL textWasPasted; -@property (nonatomic, copy, nullable) NSString *placeholder; -@property (nonatomic, strong, nullable) UIColor *placeholderColor; - -@property (nonatomic, assign) CGFloat preferredMaxLayoutWidth; - -// The `clearButtonMode` property actually is not supported yet; -// it's declared here only to conform to the interface. -@property (nonatomic, assign) UITextFieldViewMode clearButtonMode; - -// The `caretHidden` property actually is not supported yet; -// it's declared here only to conform to the interface. -@property (nonatomic, assign) BOOL caretHidden; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Multiline/RCTUITextView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Multiline/RCTUITextView.m deleted file mode 100644 index c50638fc..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Multiline/RCTUITextView.m +++ /dev/null @@ -1,274 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTUITextView.h" - -#import -#import - -#import "RCTBackedTextInputDelegateAdapter.h" - -@implementation RCTUITextView -{ - UILabel *_placeholderView; - UITextView *_detachedTextView; - RCTBackedTextViewDelegateAdapter *_textInputDelegateAdapter; -} - -static UIFont *defaultPlaceholderFont() -{ - return [UIFont systemFontOfSize:17]; -} - -static UIColor *defaultPlaceholderColor() -{ - // Default placeholder color from UITextField. - return [UIColor colorWithRed:0 green:0 blue:0.0980392 alpha:0.22]; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(textDidChange) - name:UITextViewTextDidChangeNotification - object:self]; - - _placeholderView = [[UILabel alloc] initWithFrame:self.bounds]; - _placeholderView.isAccessibilityElement = NO; - _placeholderView.numberOfLines = 0; - _placeholderView.textColor = defaultPlaceholderColor(); - [self addSubview:_placeholderView]; - - _textInputDelegateAdapter = [[RCTBackedTextViewDelegateAdapter alloc] initWithTextView:self]; - } - - return self; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (NSString *)accessibilityLabel -{ - NSMutableString *accessibilityLabel = [NSMutableString new]; - - NSString *superAccessibilityLabel = [super accessibilityLabel]; - if (superAccessibilityLabel.length > 0) { - [accessibilityLabel appendString:superAccessibilityLabel]; - } - - if (self.placeholder.length > 0 && self.attributedText.string.length == 0) { - if (accessibilityLabel.length > 0) { - [accessibilityLabel appendString:@" "]; - } - [accessibilityLabel appendString:self.placeholder]; - } - - return accessibilityLabel; -} - -#pragma mark - Properties - -- (void)setPlaceholder:(NSString *)placeholder -{ - _placeholder = placeholder; - _placeholderView.text = _placeholder; -} - -- (void)setPlaceholderColor:(UIColor *)placeholderColor -{ - _placeholderColor = placeholderColor; - _placeholderView.textColor = _placeholderColor ?: defaultPlaceholderColor(); -} - -- (void)textDidChange -{ - _textWasPasted = NO; - [self invalidatePlaceholderVisibility]; -} - -#pragma mark - Overrides - -- (void)setFont:(UIFont *)font -{ - [super setFont:font]; - _placeholderView.font = font ?: defaultPlaceholderFont(); -} - -- (void)setTextAlignment:(NSTextAlignment)textAlignment -{ - [super setTextAlignment:textAlignment]; - _placeholderView.textAlignment = textAlignment; -} - -- (void)setAttributedText:(NSAttributedString *)attributedText -{ - // Using `setAttributedString:` while user is typing breaks some internal mechanics - // when entering complex input languages such as Chinese, Korean or Japanese. - // see: https://github.com/facebook/react-native/issues/19339 - - // We try to avoid calling this method as much as we can. - // If the text has changed, there is nothing we can do. - if (![super.attributedText.string isEqualToString:attributedText.string]) { - [super setAttributedText:attributedText]; - } else { - // But if the text is preserved, we just copying the attributes from the source string. - if (![super.attributedText isEqualToAttributedString:attributedText]) { - [self copyTextAttributesFrom:attributedText]; - } - } - - [self textDidChange]; -} - -#pragma mark - Overrides - -- (void)setSelectedTextRange:(UITextRange *)selectedTextRange notifyDelegate:(BOOL)notifyDelegate -{ - if (!notifyDelegate) { - // We have to notify an adapter that following selection change was initiated programmatically, - // so the adapter must not generate a notification for it. - [_textInputDelegateAdapter skipNextTextInputDidChangeSelectionEventWithTextRange:selectedTextRange]; - } - - [super setSelectedTextRange:selectedTextRange]; -} - -- (void)paste:(id)sender -{ - [super paste:sender]; - _textWasPasted = YES; -} - -- (void)setContentOffset:(CGPoint)contentOffset animated:(__unused BOOL)animated -{ - // Turning off scroll animation. - // This fixes the problem also known as "flaky scrolling". - [super setContentOffset:contentOffset animated:NO]; -} - -#pragma mark - Layout - -- (CGFloat)preferredMaxLayoutWidth -{ - // Returning size DOES contain `textContainerInset` (aka `padding`). - return _preferredMaxLayoutWidth ?: self.placeholderSize.width; -} - -- (CGSize)placeholderSize -{ - UIEdgeInsets textContainerInset = self.textContainerInset; - NSString *placeholder = self.placeholder ?: @""; - CGSize placeholderSize = [placeholder sizeWithAttributes:@{NSFontAttributeName: self.font ?: defaultPlaceholderFont()}]; - placeholderSize = CGSizeMake(RCTCeilPixelValue(placeholderSize.width), RCTCeilPixelValue(placeholderSize.height)); - placeholderSize.width += textContainerInset.left + textContainerInset.right; - placeholderSize.height += textContainerInset.top + textContainerInset.bottom; - // Returning size DOES contain `textContainerInset` (aka `padding`; as `sizeThatFits:` does). - return placeholderSize; -} - -- (CGSize)contentSize -{ - CGSize contentSize = super.contentSize; - CGSize placeholderSize = self.placeholderSize; - // When a text input is empty, it actually displays a placehoder. - // So, we have to consider `placeholderSize` as a minimum `contentSize`. - // Returning size DOES contain `textContainerInset` (aka `padding`). - return CGSizeMake( - MAX(contentSize.width, placeholderSize.width), - MAX(contentSize.height, placeholderSize.height)); -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - - CGRect textFrame = UIEdgeInsetsInsetRect(self.bounds, self.textContainerInset); - CGFloat placeholderHeight = [_placeholderView sizeThatFits:textFrame.size].height; - textFrame.size.height = MIN(placeholderHeight, textFrame.size.height); - _placeholderView.frame = textFrame; -} - -- (CGSize)intrinsicContentSize -{ - // Returning size DOES contain `textContainerInset` (aka `padding`). - return [self sizeThatFits:CGSizeMake(self.preferredMaxLayoutWidth, CGFLOAT_MAX)]; -} - -- (CGSize)sizeThatFits:(CGSize)size -{ - // Returned fitting size depends on text size and placeholder size. - CGSize textSize = [self fixedSizeThatFits:size]; - CGSize placeholderSize = self.placeholderSize; - // Returning size DOES contain `textContainerInset` (aka `padding`). - return CGSizeMake(MAX(textSize.width, placeholderSize.width), MAX(textSize.height, placeholderSize.height)); -} - -- (CGSize)fixedSizeThatFits:(CGSize)size -{ - // UITextView on iOS 8 has a bug that automatically scrolls to the top - // when calling `sizeThatFits:`. Use a copy so that self is not screwed up. - static BOOL useCustomImplementation = NO; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - useCustomImplementation = ![[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){9,0,0}]; - }); - - if (!useCustomImplementation) { - return [super sizeThatFits:size]; - } - - if (!_detachedTextView) { - _detachedTextView = [UITextView new]; - } - - _detachedTextView.attributedText = self.attributedText; - _detachedTextView.font = self.font; - _detachedTextView.textContainerInset = self.textContainerInset; - - return [_detachedTextView sizeThatFits:size]; -} - -#pragma mark - Context Menu - -- (BOOL)canPerformAction:(SEL)action withSender:(id)sender -{ - if (_contextMenuHidden) { - return NO; - } - - return [super canPerformAction:action withSender:sender]; -} - -#pragma mark - Placeholder - -- (void)invalidatePlaceholderVisibility -{ - BOOL isVisible = _placeholder.length != 0 && self.attributedText.length == 0; - _placeholderView.hidden = !isVisible; -} - -#pragma mark - Utility Methods - -- (void)copyTextAttributesFrom:(NSAttributedString *)sourceString -{ - [self.textStorage beginEditing]; - - NSTextStorage *textStorage = self.textStorage; - [sourceString enumerateAttributesInRange:NSMakeRange(0, sourceString.length) - options:NSAttributedStringEnumerationReverse - usingBlock:^(NSDictionary * _Nonnull attrs, NSRange range, BOOL * _Nonnull stop) { - [textStorage setAttributes:attrs range:range]; - }]; - - [self.textStorage endEditing]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBackedTextInputDelegate.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBackedTextInputDelegate.h deleted file mode 100644 index 4beb21bc..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBackedTextInputDelegate.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@protocol RCTBackedTextInputViewProtocol; - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTBackedTextInputDelegate - -- (BOOL)textInputShouldBeginEditing; // Return `NO` to disallow editing. -- (void)textInputDidBeginEditing; - -- (BOOL)textInputShouldEndEditing; // Return `YES` to allow editing to stop and to resign first responder status. `NO` to disallow the editing session to end. -- (void)textInputDidEndEditing; // May be called if forced even if `textInputShouldEndEditing` returns `NO` (e.g. view removed from window) or `[textInput endEditing:YES]` called. - -- (BOOL)textInputShouldReturn; // May be called right before `textInputShouldEndEditing` if "Return" button was pressed. -- (void)textInputDidReturn; - -- (BOOL)textInputShouldChangeTextInRange:(NSRange)range replacementText:(NSString *)string; // Return NO to not change text. -- (void)textInputDidChange; - -- (void)textInputDidChangeSelection; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBackedTextInputDelegateAdapter.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBackedTextInputDelegateAdapter.h deleted file mode 100644 index 5f5ea9ca..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBackedTextInputDelegateAdapter.h +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "RCTBackedTextInputViewProtocol.h" -#import "RCTBackedTextInputDelegate.h" - -NS_ASSUME_NONNULL_BEGIN - -#pragma mark - RCTBackedTextFieldDelegateAdapter (for UITextField) - -@interface RCTBackedTextFieldDelegateAdapter : NSObject - -- (instancetype)initWithTextField:(UITextField *)backedTextInputView; - -- (void)skipNextTextInputDidChangeSelectionEventWithTextRange:(UITextRange *)textRange; -- (void)selectedTextRangeWasSet; - -@end - -#pragma mark - RCTBackedTextViewDelegateAdapter (for UITextView) - -@interface RCTBackedTextViewDelegateAdapter : NSObject - -- (instancetype)initWithTextView:(UITextView *)backedTextInputView; - -- (void)skipNextTextInputDidChangeSelectionEventWithTextRange:(UITextRange *)textRange; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBackedTextInputDelegateAdapter.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBackedTextInputDelegateAdapter.m deleted file mode 100644 index 75421035..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +++ /dev/null @@ -1,235 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTBackedTextInputDelegateAdapter.h" - -#pragma mark - RCTBackedTextFieldDelegateAdapter (for UITextField) - -static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingContext; - -@interface RCTBackedTextFieldDelegateAdapter () -@end - -@implementation RCTBackedTextFieldDelegateAdapter { - __weak UITextField *_backedTextInputView; - BOOL _textDidChangeIsComing; - UITextRange *_previousSelectedTextRange; -} - -- (instancetype)initWithTextField:(UITextField *)backedTextInputView -{ - if (self = [super init]) { - _backedTextInputView = backedTextInputView; - backedTextInputView.delegate = self; - - [_backedTextInputView addTarget:self action:@selector(textFieldDidChange) forControlEvents:UIControlEventEditingChanged]; - [_backedTextInputView addTarget:self action:@selector(textFieldDidEndEditingOnExit) forControlEvents:UIControlEventEditingDidEndOnExit]; - } - - return self; -} - -- (void)dealloc -{ - [_backedTextInputView removeTarget:self action:nil forControlEvents:UIControlEventEditingChanged]; - [_backedTextInputView removeTarget:self action:nil forControlEvents:UIControlEventEditingDidEndOnExit]; -} - -#pragma mark - UITextFieldDelegate - -- (BOOL)textFieldShouldBeginEditing:(__unused UITextField *)textField -{ - return [_backedTextInputView.textInputDelegate textInputShouldBeginEditing]; -} - -- (void)textFieldDidBeginEditing:(__unused UITextField *)textField -{ - [_backedTextInputView.textInputDelegate textInputDidBeginEditing]; -} - -- (BOOL)textFieldShouldEndEditing:(__unused UITextField *)textField -{ - return [_backedTextInputView.textInputDelegate textInputShouldEndEditing]; -} - -- (void)textFieldDidEndEditing:(__unused UITextField *)textField -{ - if (_textDidChangeIsComing) { - // iOS does't call `textViewDidChange:` delegate method if the change was happened because of autocorrection - // which was triggered by losing focus. So, we call it manually. - _textDidChangeIsComing = NO; - [_backedTextInputView.textInputDelegate textInputDidChange]; - } - - [_backedTextInputView.textInputDelegate textInputDidEndEditing]; -} - -- (BOOL)textField:(__unused UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string -{ - BOOL result = [_backedTextInputView.textInputDelegate textInputShouldChangeTextInRange:range replacementText:string]; - if (result) { - _textDidChangeIsComing = YES; - } - return result; -} - -- (BOOL)textFieldShouldReturn:(__unused UITextField *)textField -{ - return [_backedTextInputView.textInputDelegate textInputShouldReturn]; -} - -#pragma mark - UIControlEventEditing* Family Events - -- (void)textFieldDidChange -{ - _textDidChangeIsComing = NO; - [_backedTextInputView.textInputDelegate textInputDidChange]; - - // `selectedTextRangeWasSet` isn't triggered during typing. - [self textFieldProbablyDidChangeSelection]; -} - -- (void)textFieldDidEndEditingOnExit -{ - [_backedTextInputView.textInputDelegate textInputDidReturn]; -} - -#pragma mark - UIKeyboardInput (private UIKit protocol) - -// This method allows us to detect a [Backspace] `keyPress` -// even when there is no more text in the `UITextField`. -- (BOOL)keyboardInputShouldDelete:(__unused UITextField *)textField -{ - [_backedTextInputView.textInputDelegate textInputShouldChangeTextInRange:NSMakeRange(0, 0) replacementText:@""]; - return YES; -} - -#pragma mark - Public Interface - -- (void)skipNextTextInputDidChangeSelectionEventWithTextRange:(UITextRange *)textRange -{ - _previousSelectedTextRange = textRange; -} - -- (void)selectedTextRangeWasSet -{ - [self textFieldProbablyDidChangeSelection]; -} - -#pragma mark - Generalization - -- (void)textFieldProbablyDidChangeSelection -{ - if ([_backedTextInputView.selectedTextRange isEqual:_previousSelectedTextRange]) { - return; - } - - _previousSelectedTextRange = _backedTextInputView.selectedTextRange; - [_backedTextInputView.textInputDelegate textInputDidChangeSelection]; -} - -@end - -#pragma mark - RCTBackedTextViewDelegateAdapter (for UITextView) - -@interface RCTBackedTextViewDelegateAdapter () -@end - -@implementation RCTBackedTextViewDelegateAdapter { - __weak UITextView *_backedTextInputView; - BOOL _textDidChangeIsComing; - UITextRange *_previousSelectedTextRange; -} - -- (instancetype)initWithTextView:(UITextView *)backedTextInputView -{ - if (self = [super init]) { - _backedTextInputView = backedTextInputView; - backedTextInputView.delegate = self; - } - - return self; -} - -#pragma mark - UITextViewDelegate - -- (BOOL)textViewShouldBeginEditing:(__unused UITextView *)textView -{ - return [_backedTextInputView.textInputDelegate textInputShouldBeginEditing]; -} - -- (void)textViewDidBeginEditing:(__unused UITextView *)textView -{ - [_backedTextInputView.textInputDelegate textInputDidBeginEditing]; -} - -- (BOOL)textViewShouldEndEditing:(__unused UITextView *)textView -{ - return [_backedTextInputView.textInputDelegate textInputShouldEndEditing]; -} - -- (void)textViewDidEndEditing:(__unused UITextView *)textView -{ - if (_textDidChangeIsComing) { - // iOS does't call `textViewDidChange:` delegate method if the change was happened because of autocorrection - // which was triggered by losing focus. So, we call it manually. - _textDidChangeIsComing = NO; - [_backedTextInputView.textInputDelegate textInputDidChange]; - } - - [_backedTextInputView.textInputDelegate textInputDidEndEditing]; -} - -- (BOOL)textView:(__unused UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text -{ - // Custom implementation of `textInputShouldReturn` and `textInputDidReturn` pair for `UITextView`. - if (!_backedTextInputView.textWasPasted && [text isEqualToString:@"\n"]) { - if ([_backedTextInputView.textInputDelegate textInputShouldReturn]) { - [_backedTextInputView.textInputDelegate textInputDidReturn]; - [_backedTextInputView endEditing:NO]; - return NO; - } - } - - BOOL result = [_backedTextInputView.textInputDelegate textInputShouldChangeTextInRange:range replacementText:text]; - if (result) { - _textDidChangeIsComing = YES; - } - return result; -} - -- (void)textViewDidChange:(__unused UITextView *)textView -{ - _textDidChangeIsComing = NO; - [_backedTextInputView.textInputDelegate textInputDidChange]; -} - -- (void)textViewDidChangeSelection:(__unused UITextView *)textView -{ - [self textViewProbablyDidChangeSelection]; -} - -#pragma mark - Public Interface - -- (void)skipNextTextInputDidChangeSelectionEventWithTextRange:(UITextRange *)textRange -{ - _previousSelectedTextRange = textRange; -} - -#pragma mark - Generalization - -- (void)textViewProbablyDidChangeSelection -{ - if ([_backedTextInputView.selectedTextRange isEqual:_previousSelectedTextRange]) { - return; - } - - _previousSelectedTextRange = _backedTextInputView.selectedTextRange; - [_backedTextInputView.textInputDelegate textInputDidChangeSelection]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBackedTextInputViewProtocol.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBackedTextInputViewProtocol.h deleted file mode 100644 index 9992986a..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBackedTextInputViewProtocol.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@protocol RCTBackedTextInputDelegate; - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTBackedTextInputViewProtocol - -@property (nonatomic, strong, nullable) UIColor *textColor; -@property (nonatomic, strong, nullable) UIFont *font; -@property (nonatomic, copy, nullable) NSAttributedString *attributedText; -@property (nonatomic, copy, nullable) NSString *placeholder; -@property (nonatomic, strong, nullable) UIColor *placeholderColor; -@property (nonatomic, assign) NSTextAlignment textAlignment; -@property (nonatomic, assign, readonly) BOOL textWasPasted; -@property (nonatomic, assign) UIEdgeInsets textContainerInset; -@property (nonatomic, strong, nullable) UIView *inputAccessoryView; -@property (nonatomic, weak, nullable) id textInputDelegate; -@property (nonatomic, readonly) CGSize contentSize; - -// This protocol disallows direct access to `selectedTextRange` property because -// unwise usage of it can break the `delegate` behavior. So, we always have to -// explicitly specify should `delegate` be notified about the change or not. -// If the change was initiated programmatically, we must NOT notify the delegate. -// If the change was a result of user actions (like typing or touches), we MUST notify the delegate. -- (void)setSelectedTextRange:(nullable UITextRange *)selectedTextRange NS_UNAVAILABLE; -- (void)setSelectedTextRange:(nullable UITextRange *)selectedTextRange notifyDelegate:(BOOL)notifyDelegate; - -// This protocol disallows direct access to `text` property because -// unwise usage of it can break the `attributeText` behavior. -// Use `attributedText.string` instead. -@property (nonatomic, copy, nullable) NSString *text NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBaseTextInputShadowView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBaseTextInputShadowView.h deleted file mode 100644 index 8b424462..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBaseTextInputShadowView.h +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTBaseTextShadowView.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface RCTBaseTextInputShadowView : RCTBaseTextShadowView - -- (instancetype)initWithBridge:(RCTBridge *)bridge; - -@property (nonatomic, copy, nullable) NSString *text; -@property (nonatomic, copy, nullable) NSString *placeholder; -@property (nonatomic, assign) NSInteger maximumNumberOfLines; -@property (nonatomic, copy, nullable) RCTDirectEventBlock onContentSizeChange; - -- (void)uiManagerWillPerformMounting; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBaseTextInputShadowView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBaseTextInputShadowView.m deleted file mode 100644 index c79d65e1..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBaseTextInputShadowView.m +++ /dev/null @@ -1,311 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTBaseTextInputShadowView.h" - -#import -#import -#import -#import - -#import "NSTextStorage+FontScaling.h" -#import "RCTBaseTextInputView.h" - -@implementation RCTBaseTextInputShadowView -{ - __weak RCTBridge *_bridge; - NSAttributedString *_Nullable _previousAttributedText; - BOOL _needsUpdateView; - NSAttributedString *_Nullable _localAttributedText; - CGSize _previousContentSize; - - NSString *_text; - NSTextStorage *_textStorage; - NSTextContainer *_textContainer; - NSLayoutManager *_layoutManager; -} - -- (instancetype)initWithBridge:(RCTBridge *)bridge -{ - if (self = [super init]) { - _bridge = bridge; - _needsUpdateView = YES; - - YGNodeSetMeasureFunc(self.yogaNode, RCTBaseTextInputShadowViewMeasure); - YGNodeSetBaselineFunc(self.yogaNode, RCTTextInputShadowViewBaseline); - } - - return self; -} - -- (BOOL)isYogaLeafNode -{ - return YES; -} - -- (void)layoutSubviewsWithContext:(RCTLayoutContext)layoutContext -{ - // Do nothing. -} - -- (void)setLocalData:(NSObject *)localData -{ - NSAttributedString *attributedText = (NSAttributedString *)localData; - - if ([attributedText isEqualToAttributedString:_localAttributedText]) { - return; - } - - _localAttributedText = attributedText; - [self dirtyLayout]; -} - -- (void)dirtyLayout -{ - [super dirtyLayout]; - _needsUpdateView = YES; - YGNodeMarkDirty(self.yogaNode); - [self invalidateContentSize]; -} - -- (void)invalidateContentSize -{ - if (!_onContentSizeChange) { - return; - } - - CGSize maximumSize = self.layoutMetrics.frame.size; - - if (_maximumNumberOfLines == 1) { - maximumSize.width = CGFLOAT_MAX; - } else { - maximumSize.height = CGFLOAT_MAX; - } - - CGSize contentSize = [self sizeThatFitsMinimumSize:(CGSize)CGSizeZero maximumSize:maximumSize]; - - if (CGSizeEqualToSize(_previousContentSize, contentSize)) { - return; - } - _previousContentSize = contentSize; - - _onContentSizeChange(@{ - @"contentSize": @{ - @"height": @(contentSize.height), - @"width": @(contentSize.width), - }, - @"target": self.reactTag, - }); -} - -- (NSString *)text -{ - return _text; -} - -- (void)setText:(NSString *)text -{ - _text = text; - // Clear `_previousAttributedText` to notify the view about the change - // when `text` native prop is set. - _previousAttributedText = nil; - [self dirtyLayout]; -} - -#pragma mark - RCTUIManagerObserver - -- (void)uiManagerWillPerformMounting -{ - if (YGNodeIsDirty(self.yogaNode)) { - return; - } - - if (!_needsUpdateView) { - return; - } - _needsUpdateView = NO; - - UIEdgeInsets borderInsets = self.borderAsInsets; - UIEdgeInsets paddingInsets = self.paddingAsInsets; - - RCTTextAttributes *textAttributes = [self.textAttributes copy]; - - NSMutableAttributedString *attributedText = - [[NSMutableAttributedString alloc] initWithAttributedString:[self attributedTextWithBaseTextAttributes:nil]]; - - // Removing all references to Shadow Views and tags to avoid unnececery retainning - // and problems with comparing the strings. - [attributedText removeAttribute:RCTBaseTextShadowViewEmbeddedShadowViewAttributeName - range:NSMakeRange(0, attributedText.length)]; - - [attributedText removeAttribute:RCTTextAttributesTagAttributeName - range:NSMakeRange(0, attributedText.length)]; - - if (self.text.length) { - NSAttributedString *propertyAttributedText = - [[NSAttributedString alloc] initWithString:self.text - attributes:self.textAttributes.effectiveTextAttributes]; - [attributedText insertAttributedString:propertyAttributedText atIndex:0]; - } - - BOOL isAttributedTextChanged = NO; - if (![_previousAttributedText isEqualToAttributedString:attributedText]) { - // We have to follow `set prop` pattern: - // If the value has not changed, we must not notify the view about the change, - // otherwise we may break local (temporary) state of the text input. - isAttributedTextChanged = YES; - _previousAttributedText = [attributedText copy]; - } - - NSNumber *tag = self.reactTag; - - [_bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { - RCTBaseTextInputView *baseTextInputView = (RCTBaseTextInputView *)viewRegistry[tag]; - if (!baseTextInputView) { - return; - } - - baseTextInputView.textAttributes = textAttributes; - baseTextInputView.reactBorderInsets = borderInsets; - baseTextInputView.reactPaddingInsets = paddingInsets; - - if (isAttributedTextChanged) { - baseTextInputView.attributedText = attributedText; - } - }]; -} - -#pragma mark - - -- (NSAttributedString *)measurableAttributedText -{ - // Only for the very first render when we don't have `_localAttributedText`, - // we use value directly from the property and/or nested content. - NSAttributedString *attributedText = - _localAttributedText ?: [self attributedTextWithBaseTextAttributes:nil]; - - if (attributedText.length == 0) { - // It's impossible to measure empty attributed string because all attributes are - // assosiated with some characters, so no characters means no data. - - // Placeholder also can represent the intrinsic size when it is visible. - NSString *text = self.placeholder; - if (!text.length) { - // Note: `zero-width space` is insufficient in some cases. - text = @"I"; - } - attributedText = [[NSAttributedString alloc] initWithString:text attributes:self.textAttributes.effectiveTextAttributes]; - } - - return attributedText; -} - -- (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximumSize -{ - NSAttributedString *attributedText = [self measurableAttributedText]; - - if (!_textStorage) { - _textContainer = [NSTextContainer new]; - _textContainer.lineFragmentPadding = 0.0; // Note, the default value is 5. - _layoutManager = [NSLayoutManager new]; - [_layoutManager addTextContainer:_textContainer]; - _textStorage = [NSTextStorage new]; - [_textStorage addLayoutManager:_layoutManager]; - } - - _textContainer.size = maximumSize; - _textContainer.maximumNumberOfLines = _maximumNumberOfLines; - [_textStorage replaceCharactersInRange:(NSRange){0, _textStorage.length} - withAttributedString:attributedText]; - [_layoutManager ensureLayoutForTextContainer:_textContainer]; - CGSize size = [_layoutManager usedRectForTextContainer:_textContainer].size; - - return (CGSize){ - MAX(minimumSize.width, MIN(RCTCeilPixelValue(size.width), maximumSize.width)), - MAX(minimumSize.height, MIN(RCTCeilPixelValue(size.height), maximumSize.height)) - }; -} - -- (CGFloat)lastBaselineForSize:(CGSize)size -{ - NSAttributedString *attributedText = [self measurableAttributedText]; - - __block CGFloat maximumDescender = 0.0; - - [attributedText enumerateAttribute:NSFontAttributeName - inRange:NSMakeRange(0, attributedText.length) - options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired - usingBlock: - ^(UIFont *font, NSRange range, __unused BOOL *stop) { - if (maximumDescender > font.descender) { - maximumDescender = font.descender; - } - } - ]; - - return size.height + maximumDescender; -} - -static YGSize RCTBaseTextInputShadowViewMeasure(YGNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode) -{ - RCTShadowView *shadowView = (__bridge RCTShadowView *)YGNodeGetContext(node); - - CGSize minimumSize = CGSizeMake(0, 0); - CGSize maximumSize = CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX); - - CGSize size = { - RCTCoreGraphicsFloatFromYogaFloat(width), - RCTCoreGraphicsFloatFromYogaFloat(height) - }; - - switch (widthMode) { - case YGMeasureModeUndefined: - break; - case YGMeasureModeExactly: - minimumSize.width = size.width; - maximumSize.width = size.width; - break; - case YGMeasureModeAtMost: - maximumSize.width = size.width; - break; - } - - switch (heightMode) { - case YGMeasureModeUndefined: - break; - case YGMeasureModeExactly: - minimumSize.height = size.height; - maximumSize.height = size.height; - break; - case YGMeasureModeAtMost: - maximumSize.height = size.height; - break; - } - - CGSize measuredSize = [shadowView sizeThatFitsMinimumSize:minimumSize maximumSize:maximumSize]; - - return (YGSize){ - RCTYogaFloatFromCoreGraphicsFloat(measuredSize.width), - RCTYogaFloatFromCoreGraphicsFloat(measuredSize.height) - }; -} - -static float RCTTextInputShadowViewBaseline(YGNodeRef node, const float width, const float height) -{ - RCTBaseTextInputShadowView *shadowTextView = (__bridge RCTBaseTextInputShadowView *)YGNodeGetContext(node); - - CGSize size = (CGSize){ - RCTCoreGraphicsFloatFromYogaFloat(width), - RCTCoreGraphicsFloatFromYogaFloat(height) - }; - - CGFloat lastBaseline = [shadowTextView lastBaselineForSize:size]; - - return RCTYogaFloatFromCoreGraphicsFloat(lastBaseline); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBaseTextInputView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBaseTextInputView.h deleted file mode 100644 index 5b62f902..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBaseTextInputView.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#import "RCTBackedTextInputDelegate.h" -#import "RCTBackedTextInputViewProtocol.h" - -@class RCTBridge; -@class RCTEventDispatcher; -@class RCTTextAttributes; -@class RCTTextSelection; - -NS_ASSUME_NONNULL_BEGIN - -@interface RCTBaseTextInputView : RCTView - -- (instancetype)initWithBridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER; - -- (instancetype)init NS_UNAVAILABLE; -- (instancetype)initWithCoder:(NSCoder *)decoder NS_UNAVAILABLE; -- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; - -@property (nonatomic, readonly) UIView *backedTextInputView; - -@property (nonatomic, strong, nullable) RCTTextAttributes *textAttributes; -@property (nonatomic, assign) UIEdgeInsets reactPaddingInsets; -@property (nonatomic, assign) UIEdgeInsets reactBorderInsets; - -@property (nonatomic, copy, nullable) RCTDirectEventBlock onContentSizeChange; -@property (nonatomic, copy, nullable) RCTDirectEventBlock onSelectionChange; -@property (nonatomic, copy, nullable) RCTDirectEventBlock onChange; -@property (nonatomic, copy, nullable) RCTDirectEventBlock onTextInput; -@property (nonatomic, copy, nullable) RCTDirectEventBlock onScroll; - -@property (nonatomic, assign) NSInteger mostRecentEventCount; -@property (nonatomic, assign) BOOL blurOnSubmit; -@property (nonatomic, assign) BOOL selectTextOnFocus; -@property (nonatomic, assign) BOOL clearTextOnFocus; -@property (nonatomic, assign) BOOL secureTextEntry; -@property (nonatomic, copy) RCTTextSelection *selection; -@property (nonatomic, strong, nullable) NSNumber *maxLength; -@property (nonatomic, copy) NSAttributedString *attributedText; -@property (nonatomic, copy) NSString *inputAccessoryViewID; -@property (nonatomic, assign) UIKeyboardType keyboardType; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBaseTextInputView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBaseTextInputView.m deleted file mode 100644 index fac75588..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBaseTextInputView.m +++ /dev/null @@ -1,657 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTBaseTextInputView.h" - -#import -#import -#import -#import -#import -#import -#import - -#import "RCTInputAccessoryView.h" -#import "RCTInputAccessoryViewContent.h" -#import "RCTTextAttributes.h" -#import "RCTTextSelection.h" - -@implementation RCTBaseTextInputView { - __weak RCTBridge *_bridge; - __weak RCTEventDispatcher *_eventDispatcher; - BOOL _hasInputAccesoryView; - NSString *_Nullable _predictedText; - NSInteger _nativeEventCount; -} - -- (instancetype)initWithBridge:(RCTBridge *)bridge -{ - RCTAssertParam(bridge); - - if (self = [super initWithFrame:CGRectZero]) { - _bridge = bridge; - _eventDispatcher = bridge.eventDispatcher; - } - - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) -RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)decoder) -RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) - -- (UIView *)backedTextInputView -{ - RCTAssert(NO, @"-[RCTBaseTextInputView backedTextInputView] must be implemented in subclass."); - return nil; -} - -#pragma mark - RCTComponent - -- (void)didUpdateReactSubviews -{ - // Do nothing. -} - -#pragma mark - Properties - -- (void)setTextAttributes:(RCTTextAttributes *)textAttributes -{ - _textAttributes = textAttributes; - [self enforceTextAttributesIfNeeded]; -} - -- (void)enforceTextAttributesIfNeeded -{ - id backedTextInputView = self.backedTextInputView; - if (backedTextInputView.attributedText.string.length != 0) { - return; - } - - backedTextInputView.font = _textAttributes.effectiveFont; - backedTextInputView.textColor = _textAttributes.effectiveForegroundColor; - backedTextInputView.textAlignment = _textAttributes.alignment; -} - -- (void)setReactPaddingInsets:(UIEdgeInsets)reactPaddingInsets -{ - _reactPaddingInsets = reactPaddingInsets; - // We apply `paddingInsets` as `backedTextInputView`'s `textContainerInset`. - self.backedTextInputView.textContainerInset = reactPaddingInsets; - [self setNeedsLayout]; -} - -- (void)setReactBorderInsets:(UIEdgeInsets)reactBorderInsets -{ - _reactBorderInsets = reactBorderInsets; - // We apply `borderInsets` as `backedTextInputView` layout offset. - self.backedTextInputView.frame = UIEdgeInsetsInsetRect(self.bounds, reactBorderInsets); - [self setNeedsLayout]; -} - -- (NSAttributedString *)attributedText -{ - return self.backedTextInputView.attributedText; -} - -- (BOOL)textOf:(NSAttributedString*)newText equals:(NSAttributedString*)oldText{ - // When the dictation is running we can't update the attibuted text on the backed up text view - // because setting the attributed string will kill the dictation. This means that we can't impose - // the settings on a dictation. - // Similarly, when the user is in the middle of inputting some text in Japanese/Chinese, there will be styling on the - // text that we should disregard. See https://developer.apple.com/documentation/uikit/uitextinput/1614489-markedtextrange?language=objc - // for more info. - // If the user added an emoji, the sytem adds a font attribute for the emoji and stores the original font in NSOriginalFont. - // Lastly, when entering a password, etc., there will be additional styling on the field as the native text view - // handles showing the last character for a split second. - __block BOOL fontHasBeenUpdatedBySystem = false; - [oldText enumerateAttribute:@"NSOriginalFont" inRange:NSMakeRange(0, oldText.length) options:0 usingBlock:^(id value, NSRange range, BOOL *stop) { - if (value){ - fontHasBeenUpdatedBySystem = true; - } - }]; - - BOOL shouldFallbackToBareTextComparison = - [self.backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"dictation"] || - self.backedTextInputView.markedTextRange || - self.backedTextInputView.isSecureTextEntry || - fontHasBeenUpdatedBySystem; - - if (shouldFallbackToBareTextComparison) { - return ([newText.string isEqualToString:oldText.string]); - } else { - return ([newText isEqualToAttributedString:oldText]); - } -} - -- (void)setAttributedText:(NSAttributedString *)attributedText -{ - NSInteger eventLag = _nativeEventCount - _mostRecentEventCount; - BOOL textNeedsUpdate = NO; - // Remove tag attribute to ensure correct attributed string comparison. - NSMutableAttributedString *const backedTextInputViewTextCopy = [self.backedTextInputView.attributedText mutableCopy]; - NSMutableAttributedString *const attributedTextCopy = [attributedText mutableCopy]; - - [backedTextInputViewTextCopy removeAttribute:RCTTextAttributesTagAttributeName - range:NSMakeRange(0, backedTextInputViewTextCopy.length)]; - - [attributedTextCopy removeAttribute:RCTTextAttributesTagAttributeName - range:NSMakeRange(0, attributedTextCopy.length)]; - - textNeedsUpdate = ([self textOf:attributedTextCopy equals:backedTextInputViewTextCopy] == NO); - - if (eventLag == 0 && textNeedsUpdate) { - UITextRange *selection = self.backedTextInputView.selectedTextRange; - NSInteger oldTextLength = self.backedTextInputView.attributedText.string.length; - - self.backedTextInputView.attributedText = attributedText; - - if (selection.empty) { - // Maintaining a cursor position relative to the end of the old text. - NSInteger offsetStart = - [self.backedTextInputView offsetFromPosition:self.backedTextInputView.beginningOfDocument - toPosition:selection.start]; - NSInteger offsetFromEnd = oldTextLength - offsetStart; - NSInteger newOffset = attributedText.string.length - offsetFromEnd; - UITextPosition *position = - [self.backedTextInputView positionFromPosition:self.backedTextInputView.beginningOfDocument - offset:newOffset]; - [self.backedTextInputView setSelectedTextRange:[self.backedTextInputView textRangeFromPosition:position toPosition:position] - notifyDelegate:YES]; - } - - [self updateLocalData]; - } else if (eventLag > RCTTextUpdateLagWarningThreshold) { - RCTLogWarn(@"Native TextInput(%@) is %lld events ahead of JS - try to make your JS faster.", self.backedTextInputView.attributedText.string, (long long)eventLag); - } -} - -- (RCTTextSelection *)selection -{ - id backedTextInputView = self.backedTextInputView; - UITextRange *selectedTextRange = backedTextInputView.selectedTextRange; - return [[RCTTextSelection new] initWithStart:[backedTextInputView offsetFromPosition:backedTextInputView.beginningOfDocument toPosition:selectedTextRange.start] - end:[backedTextInputView offsetFromPosition:backedTextInputView.beginningOfDocument toPosition:selectedTextRange.end]]; -} - -- (void)setSelection:(RCTTextSelection *)selection -{ - if (!selection) { - return; - } - - id backedTextInputView = self.backedTextInputView; - - UITextRange *previousSelectedTextRange = backedTextInputView.selectedTextRange; - UITextPosition *start = [backedTextInputView positionFromPosition:backedTextInputView.beginningOfDocument offset:selection.start]; - UITextPosition *end = [backedTextInputView positionFromPosition:backedTextInputView.beginningOfDocument offset:selection.end]; - UITextRange *selectedTextRange = [backedTextInputView textRangeFromPosition:start toPosition:end]; - - NSInteger eventLag = _nativeEventCount - _mostRecentEventCount; - if (eventLag == 0 && ![previousSelectedTextRange isEqual:selectedTextRange]) { - [backedTextInputView setSelectedTextRange:selectedTextRange notifyDelegate:NO]; - } else if (eventLag > RCTTextUpdateLagWarningThreshold) { - RCTLogWarn(@"Native TextInput(%@) is %lld events ahead of JS - try to make your JS faster.", backedTextInputView.attributedText.string, (long long)eventLag); - } -} - -- (void)setTextContentType:(NSString *)type -{ - #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 - if (@available(iOS 10.0, *)) { - - static dispatch_once_t onceToken; - static NSDictionary *contentTypeMap; - - dispatch_once(&onceToken, ^{ - contentTypeMap = @{@"none": @"", - @"URL": UITextContentTypeURL, - @"addressCity": UITextContentTypeAddressCity, - @"addressCityAndState":UITextContentTypeAddressCityAndState, - @"addressState": UITextContentTypeAddressState, - @"countryName": UITextContentTypeCountryName, - @"creditCardNumber": UITextContentTypeCreditCardNumber, - @"emailAddress": UITextContentTypeEmailAddress, - @"familyName": UITextContentTypeFamilyName, - @"fullStreetAddress": UITextContentTypeFullStreetAddress, - @"givenName": UITextContentTypeGivenName, - @"jobTitle": UITextContentTypeJobTitle, - @"location": UITextContentTypeLocation, - @"middleName": UITextContentTypeMiddleName, - @"name": UITextContentTypeName, - @"namePrefix": UITextContentTypeNamePrefix, - @"nameSuffix": UITextContentTypeNameSuffix, - @"nickname": UITextContentTypeNickname, - @"organizationName": UITextContentTypeOrganizationName, - @"postalCode": UITextContentTypePostalCode, - @"streetAddressLine1": UITextContentTypeStreetAddressLine1, - @"streetAddressLine2": UITextContentTypeStreetAddressLine2, - @"sublocality": UITextContentTypeSublocality, - @"telephoneNumber": UITextContentTypeTelephoneNumber, - }; - - #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ - if (@available(iOS 11.0, tvOS 11.0, *)) { - NSDictionary * iOS11extras = @{@"username": UITextContentTypeUsername, - @"password": UITextContentTypePassword}; - - NSMutableDictionary * iOS11baseMap = [contentTypeMap mutableCopy]; - [iOS11baseMap addEntriesFromDictionary:iOS11extras]; - - contentTypeMap = [iOS11baseMap copy]; - } - #endif - - #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 120000 /* __IPHONE_12_0 */ - if (@available(iOS 12.0, tvOS 12.0, *)) { - NSDictionary * iOS12extras = @{@"newPassword": UITextContentTypeNewPassword, - @"oneTimeCode": UITextContentTypeOneTimeCode}; - - NSMutableDictionary * iOS12baseMap = [contentTypeMap mutableCopy]; - [iOS12baseMap addEntriesFromDictionary:iOS12extras]; - - contentTypeMap = [iOS12baseMap copy]; - } - #endif - }); - - // Setting textContentType to an empty string will disable any - // default behaviour, like the autofill bar for password inputs - self.backedTextInputView.textContentType = contentTypeMap[type] ?: type; - } - #endif -} - -- (UIKeyboardType)keyboardType -{ - return self.backedTextInputView.keyboardType; -} - -- (void)setKeyboardType:(UIKeyboardType)keyboardType -{ - UIView *textInputView = self.backedTextInputView; - if (textInputView.keyboardType != keyboardType) { - textInputView.keyboardType = keyboardType; - // Without the call to reloadInputViews, the keyboard will not change until the textview field (the first responder) loses and regains focus. - if (textInputView.isFirstResponder) { - [textInputView reloadInputViews]; - } - } -} - -- (BOOL)secureTextEntry { - return self.backedTextInputView.secureTextEntry; -} - -- (void)setSecureTextEntry:(BOOL)secureTextEntry { - UIView *textInputView = self.backedTextInputView; - - if (textInputView.secureTextEntry != secureTextEntry) { - textInputView.secureTextEntry = secureTextEntry; - - // Fix #5859, see https://stackoverflow.com/questions/14220187/uitextfield-has-trailing-whitespace-after-securetextentry-toggle/22537788#22537788 - NSAttributedString *originalText = [textInputView.attributedText copy]; - self.backedTextInputView.attributedText = [NSAttributedString new]; - self.backedTextInputView.attributedText = originalText; - } - -} - -#pragma mark - RCTBackedTextInputDelegate - -- (BOOL)textInputShouldBeginEditing -{ - return YES; -} - -- (void)textInputDidBeginEditing -{ - if (_clearTextOnFocus) { - self.backedTextInputView.attributedText = [NSAttributedString new]; - } - - if (_selectTextOnFocus) { - [self.backedTextInputView selectAll:nil]; - } - - [_eventDispatcher sendTextEventWithType:RCTTextEventTypeFocus - reactTag:self.reactTag - text:self.backedTextInputView.attributedText.string - key:nil - eventCount:_nativeEventCount]; -} - -- (BOOL)textInputShouldEndEditing -{ - return YES; -} - -- (void)textInputDidEndEditing -{ - [_eventDispatcher sendTextEventWithType:RCTTextEventTypeEnd - reactTag:self.reactTag - text:self.backedTextInputView.attributedText.string - key:nil - eventCount:_nativeEventCount]; - - [_eventDispatcher sendTextEventWithType:RCTTextEventTypeBlur - reactTag:self.reactTag - text:self.backedTextInputView.attributedText.string - key:nil - eventCount:_nativeEventCount]; -} - -- (BOOL)textInputShouldReturn -{ - // We send `submit` event here, in `textInputShouldReturn` - // (not in `textInputDidReturn)`, because of semantic of the event: - // `onSubmitEditing` is called when "Submit" button - // (the blue key on onscreen keyboard) did pressed - // (no connection to any specific "submitting" process). - [_eventDispatcher sendTextEventWithType:RCTTextEventTypeSubmit - reactTag:self.reactTag - text:self.backedTextInputView.attributedText.string - key:nil - eventCount:_nativeEventCount]; - - return _blurOnSubmit; -} - -- (void)textInputDidReturn -{ - // Does nothing. -} - -- (BOOL)textInputShouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text -{ - id backedTextInputView = self.backedTextInputView; - - if (!backedTextInputView.textWasPasted) { - [_eventDispatcher sendTextEventWithType:RCTTextEventTypeKeyPress - reactTag:self.reactTag - text:nil - key:text - eventCount:_nativeEventCount]; - } - - if (_maxLength) { - NSUInteger allowedLength = _maxLength.integerValue - backedTextInputView.attributedText.string.length + range.length; - - if (text.length > allowedLength) { - // If we typed/pasted more than one character, limit the text inputted. - if (text.length > 1) { - // Truncate the input string so the result is exactly maxLength - NSString *limitedString = [text substringToIndex:allowedLength]; - NSMutableAttributedString *newAttributedText = [backedTextInputView.attributedText mutableCopy]; - [newAttributedText replaceCharactersInRange:range withString:limitedString]; - backedTextInputView.attributedText = newAttributedText; - _predictedText = newAttributedText.string; - - // Collapse selection at end of insert to match normal paste behavior. - UITextPosition *insertEnd = [backedTextInputView positionFromPosition:backedTextInputView.beginningOfDocument - offset:(range.location + allowedLength)]; - [backedTextInputView setSelectedTextRange:[backedTextInputView textRangeFromPosition:insertEnd toPosition:insertEnd] - notifyDelegate:YES]; - - [self textInputDidChange]; - } - - return NO; - } - } - - NSString *previousText = backedTextInputView.attributedText.string ?: @""; - - if (range.location + range.length > backedTextInputView.attributedText.string.length) { - _predictedText = backedTextInputView.attributedText.string; - } else { - _predictedText = [backedTextInputView.attributedText.string stringByReplacingCharactersInRange:range withString:text]; - } - - if (_onTextInput) { - _onTextInput(@{ - @"text": text, - @"previousText": previousText, - @"range": @{ - @"start": @(range.location), - @"end": @(range.location + range.length) - }, - @"eventCount": @(_nativeEventCount), - }); - } - - return YES; -} - -- (void)textInputDidChange -{ - [self updateLocalData]; - - id backedTextInputView = self.backedTextInputView; - - // Detect when `backedTextInputView` updates happend that didn't invoke `shouldChangeTextInRange` - // (e.g. typing simplified chinese in pinyin will insert and remove spaces without - // calling shouldChangeTextInRange). This will cause JS to get out of sync so we - // update the mismatched range. - NSRange currentRange; - NSRange predictionRange; - if (findMismatch(backedTextInputView.attributedText.string, _predictedText, ¤tRange, &predictionRange)) { - NSString *replacement = [backedTextInputView.attributedText.string substringWithRange:currentRange]; - [self textInputShouldChangeTextInRange:predictionRange replacementText:replacement]; - // JS will assume the selection changed based on the location of our shouldChangeTextInRange, so reset it. - [self textInputDidChangeSelection]; - } - - _nativeEventCount++; - - if (_onChange) { - _onChange(@{ - @"text": self.attributedText.string, - @"target": self.reactTag, - @"eventCount": @(_nativeEventCount), - }); - } -} - -- (void)textInputDidChangeSelection -{ - if (!_onSelectionChange) { - return; - } - - RCTTextSelection *selection = self.selection; - - _onSelectionChange(@{ - @"selection": @{ - @"start": @(selection.start), - @"end": @(selection.end), - }, - }); -} - -- (void)updateLocalData -{ - [self enforceTextAttributesIfNeeded]; - - [_bridge.uiManager setLocalData:[self.backedTextInputView.attributedText copy] - forView:self]; -} - -#pragma mark - Layout (in UIKit terms, with all insets) - -- (CGSize)intrinsicContentSize -{ - CGSize size = self.backedTextInputView.intrinsicContentSize; - size.width += _reactBorderInsets.left + _reactBorderInsets.right; - size.height += _reactBorderInsets.top + _reactBorderInsets.bottom; - // Returning value DOES include border and padding insets. - return size; -} - -- (CGSize)sizeThatFits:(CGSize)size -{ - CGFloat compoundHorizontalBorderInset = _reactBorderInsets.left + _reactBorderInsets.right; - CGFloat compoundVerticalBorderInset = _reactBorderInsets.top + _reactBorderInsets.bottom; - - size.width -= compoundHorizontalBorderInset; - size.height -= compoundVerticalBorderInset; - - // Note: `paddingInsets` was already included in `backedTextInputView` size - // because it was applied as `textContainerInset`. - CGSize fittingSize = [self.backedTextInputView sizeThatFits:size]; - - fittingSize.width += compoundHorizontalBorderInset; - fittingSize.height += compoundVerticalBorderInset; - - // Returning value DOES include border and padding insets. - return fittingSize; -} - -#pragma mark - Accessibility - -- (UIView *)reactAccessibilityElement -{ - return self.backedTextInputView; -} - -#pragma mark - Focus Control - -- (void)reactFocus -{ - [self.backedTextInputView reactFocus]; -} - -- (void)reactBlur -{ - [self.backedTextInputView reactBlur]; -} - -- (void)didMoveToWindow -{ - [self.backedTextInputView reactFocusIfNeeded]; -} - -#pragma mark - Custom Input Accessory View - -- (void)didSetProps:(NSArray *)changedProps -{ - if ([changedProps containsObject:@"inputAccessoryViewID"] && self.inputAccessoryViewID) { - [self setCustomInputAccessoryViewWithNativeID:self.inputAccessoryViewID]; - } else if (!self.inputAccessoryViewID) { - [self setDefaultInputAccessoryView]; - } -} - -- (void)setCustomInputAccessoryViewWithNativeID:(NSString *)nativeID -{ - #if !TARGET_OS_TV - __weak RCTBaseTextInputView *weakSelf = self; - [_bridge.uiManager rootViewForReactTag:self.reactTag withCompletion:^(UIView *rootView) { - RCTBaseTextInputView *strongSelf = weakSelf; - if (rootView) { - UIView *accessoryView = [strongSelf->_bridge.uiManager viewForNativeID:nativeID - withRootTag:rootView.reactTag]; - if (accessoryView && [accessoryView isKindOfClass:[RCTInputAccessoryView class]]) { - strongSelf.backedTextInputView.inputAccessoryView = ((RCTInputAccessoryView *)accessoryView).inputAccessoryView; - [strongSelf reloadInputViewsIfNecessary]; - } - } - }]; - #endif /* !TARGET_OS_TV */ -} - -- (void)setDefaultInputAccessoryView -{ - #if !TARGET_OS_TV - UIView *textInputView = self.backedTextInputView; - UIKeyboardType keyboardType = textInputView.keyboardType; - - // These keyboard types (all are number pads) don't have a "Done" button by default, - // so we create an `inputAccessoryView` with this button for them. - BOOL shouldHaveInputAccesoryView = - ( - keyboardType == UIKeyboardTypeNumberPad || - keyboardType == UIKeyboardTypePhonePad || - keyboardType == UIKeyboardTypeDecimalPad || - keyboardType == UIKeyboardTypeASCIICapableNumberPad - ) && - textInputView.returnKeyType == UIReturnKeyDone; - - if (_hasInputAccesoryView == shouldHaveInputAccesoryView) { - return; - } - - _hasInputAccesoryView = shouldHaveInputAccesoryView; - - if (shouldHaveInputAccesoryView) { - UIToolbar *toolbarView = [[UIToolbar alloc] init]; - [toolbarView sizeToFit]; - UIBarButtonItem *flexibleSpace = - [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace - target:nil - action:nil]; - UIBarButtonItem *doneButton = - [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone - target:self - action:@selector(handleInputAccessoryDoneButton)]; - toolbarView.items = @[flexibleSpace, doneButton]; - textInputView.inputAccessoryView = toolbarView; - } - else { - textInputView.inputAccessoryView = nil; - } - [self reloadInputViewsIfNecessary]; - #endif /* !TARGET_OS_TV */ -} - -- (void)reloadInputViewsIfNecessary -{ - // We have to call `reloadInputViews` for focused text inputs to update an accessory view. - if (self.backedTextInputView.isFirstResponder) { - [self.backedTextInputView reloadInputViews]; - } -} - -- (void)handleInputAccessoryDoneButton -{ - if ([self textInputShouldReturn]) { - [self.backedTextInputView endEditing:YES]; - } -} - -#pragma mark - Helpers - -static BOOL findMismatch(NSString *first, NSString *second, NSRange *firstRange, NSRange *secondRange) -{ - NSInteger firstMismatch = -1; - for (NSUInteger ii = 0; ii < MAX(first.length, second.length); ii++) { - if (ii >= first.length || ii >= second.length || [first characterAtIndex:ii] != [second characterAtIndex:ii]) { - firstMismatch = ii; - break; - } - } - - if (firstMismatch == -1) { - return NO; - } - - NSUInteger ii = second.length; - NSUInteger lastMismatch = first.length; - while (ii > firstMismatch && lastMismatch > firstMismatch) { - if ([first characterAtIndex:(lastMismatch - 1)] != [second characterAtIndex:(ii - 1)]) { - break; - } - ii--; - lastMismatch--; - } - - *firstRange = NSMakeRange(firstMismatch, lastMismatch - firstMismatch); - *secondRange = NSMakeRange(firstMismatch, ii - firstMismatch); - return YES; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBaseTextInputViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBaseTextInputViewManager.h deleted file mode 100644 index 4eb39b1d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBaseTextInputViewManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTBaseTextViewManager.h" - -@interface RCTBaseTextInputViewManager : RCTBaseTextViewManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBaseTextInputViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBaseTextInputViewManager.m deleted file mode 100644 index d226782b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTBaseTextInputViewManager.m +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTBaseTextInputViewManager.h" - -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#import "RCTBaseTextInputShadowView.h" -#import "RCTBaseTextInputView.h" -#import "RCTConvert+Text.h" - -@interface RCTBaseTextInputViewManager () - -@end - -@implementation RCTBaseTextInputViewManager -{ - NSHashTable *_shadowViews; -} - -RCT_EXPORT_MODULE() - -#pragma mark - Unified properties - -RCT_REMAP_VIEW_PROPERTY(autoCapitalize, backedTextInputView.autocapitalizationType, UITextAutocapitalizationType) -RCT_REMAP_VIEW_PROPERTY(autoCorrect, backedTextInputView.autocorrectionType, UITextAutocorrectionType) -RCT_REMAP_VIEW_PROPERTY(contextMenuHidden, backedTextInputView.contextMenuHidden, BOOL) -RCT_REMAP_VIEW_PROPERTY(editable, backedTextInputView.editable, BOOL) -RCT_REMAP_VIEW_PROPERTY(enablesReturnKeyAutomatically, backedTextInputView.enablesReturnKeyAutomatically, BOOL) -RCT_REMAP_VIEW_PROPERTY(keyboardAppearance, backedTextInputView.keyboardAppearance, UIKeyboardAppearance) -RCT_REMAP_VIEW_PROPERTY(placeholder, backedTextInputView.placeholder, NSString) -RCT_REMAP_VIEW_PROPERTY(placeholderTextColor, backedTextInputView.placeholderColor, UIColor) -RCT_REMAP_VIEW_PROPERTY(returnKeyType, backedTextInputView.returnKeyType, UIReturnKeyType) -RCT_REMAP_VIEW_PROPERTY(selectionColor, backedTextInputView.tintColor, UIColor) -RCT_REMAP_VIEW_PROPERTY(spellCheck, backedTextInputView.spellCheckingType, UITextSpellCheckingType) -RCT_REMAP_VIEW_PROPERTY(caretHidden, backedTextInputView.caretHidden, BOOL) -RCT_REMAP_VIEW_PROPERTY(clearButtonMode, backedTextInputView.clearButtonMode, UITextFieldViewMode) -RCT_REMAP_VIEW_PROPERTY(scrollEnabled, backedTextInputView.scrollEnabled, BOOL) -RCT_EXPORT_VIEW_PROPERTY(secureTextEntry, BOOL) -RCT_EXPORT_VIEW_PROPERTY(blurOnSubmit, BOOL) -RCT_EXPORT_VIEW_PROPERTY(clearTextOnFocus, BOOL) -RCT_EXPORT_VIEW_PROPERTY(keyboardType, UIKeyboardType) -RCT_EXPORT_VIEW_PROPERTY(maxLength, NSNumber) -RCT_EXPORT_VIEW_PROPERTY(selectTextOnFocus, BOOL) -RCT_EXPORT_VIEW_PROPERTY(selection, RCTTextSelection) -RCT_EXPORT_VIEW_PROPERTY(inputAccessoryViewID, NSString) -RCT_EXPORT_VIEW_PROPERTY(textContentType, NSString) - -RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onSelectionChange, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onTextInput, RCTDirectEventBlock) -RCT_EXPORT_VIEW_PROPERTY(onScroll, RCTDirectEventBlock) - -RCT_EXPORT_VIEW_PROPERTY(mostRecentEventCount, NSInteger) - -RCT_EXPORT_SHADOW_PROPERTY(text, NSString) -RCT_EXPORT_SHADOW_PROPERTY(placeholder, NSString) -RCT_EXPORT_SHADOW_PROPERTY(onContentSizeChange, RCTBubblingEventBlock) - - -- (RCTShadowView *)shadowView -{ - RCTBaseTextInputShadowView *shadowView = [[RCTBaseTextInputShadowView alloc] initWithBridge:self.bridge]; - shadowView.textAttributes.fontSizeMultiplier = self.bridge.accessibilityManager.multiplier; - [_shadowViews addObject:shadowView]; - return shadowView; -} - -- (void)setBridge:(RCTBridge *)bridge -{ - [super setBridge:bridge]; - - _shadowViews = [NSHashTable weakObjectsHashTable]; - - [bridge.uiManager.observerCoordinator addObserver:self]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleDidUpdateMultiplierNotification) - name:RCTAccessibilityManagerDidUpdateMultiplierNotification - object:bridge.accessibilityManager]; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -#pragma mark - RCTUIManagerObserver - -- (void)uiManagerWillPerformMounting:(__unused RCTUIManager *)uiManager -{ - for (RCTBaseTextInputShadowView *shadowView in _shadowViews) { - [shadowView uiManagerWillPerformMounting]; - } -} - -#pragma mark - Font Size Multiplier - -- (void)handleDidUpdateMultiplierNotification -{ - CGFloat fontSizeMultiplier = self.bridge.accessibilityManager.multiplier; - - NSHashTable *shadowViews = _shadowViews; - RCTExecuteOnUIManagerQueue(^{ - for (RCTBaseTextInputShadowView *shadowView in shadowViews) { - shadowView.textAttributes.fontSizeMultiplier = fontSizeMultiplier; - [shadowView dirtyLayout]; - } - - [self.bridge.uiManager setNeedsLayout]; - }); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryShadowView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryShadowView.h deleted file mode 100644 index 0e73aaca..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryShadowView.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTInputAccessoryShadowView : RCTShadowView - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryShadowView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryShadowView.m deleted file mode 100644 index 68a6681d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryShadowView.m +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTInputAccessoryShadowView.h" - -#import - -@implementation RCTInputAccessoryShadowView - -- (void)insertReactSubview:(RCTShadowView *)subview atIndex:(NSInteger)atIndex -{ - [super insertReactSubview:subview atIndex:atIndex]; - subview.width = (YGValue) { RCTScreenSize().width, YGUnitPoint }; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryView.h deleted file mode 100644 index ec1e2917..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryView.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@class RCTBridge; -@class RCTInputAccessoryViewContent; - -@interface RCTInputAccessoryView : UIView - -- (instancetype)initWithBridge:(RCTBridge *)bridge; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryView.m deleted file mode 100644 index 1535f971..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryView.m +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTInputAccessoryView.h" - -#import -#import -#import - -#import "RCTInputAccessoryViewContent.h" - -@interface RCTInputAccessoryView() - -// Overriding `inputAccessoryView` to `readwrite`. -@property (nonatomic, readwrite, retain) UIView *inputAccessoryView; - -@end - -@implementation RCTInputAccessoryView -{ - BOOL _shouldBecomeFirstResponder; -} - -- (instancetype)initWithBridge:(RCTBridge *)bridge -{ - if (self = [super init]) { - _inputAccessoryView = [RCTInputAccessoryViewContent new]; - RCTTouchHandler *const touchHandler = [[RCTTouchHandler alloc] initWithBridge:bridge]; - [touchHandler attachToView:_inputAccessoryView]; - } - return self; -} - -- (BOOL)canBecomeFirstResponder -{ - return true; -} - -- (void)reactSetFrame:(CGRect)frame -{ - [_inputAccessoryView reactSetFrame:frame]; - - if (_shouldBecomeFirstResponder) { - _shouldBecomeFirstResponder = NO; - [self becomeFirstResponder]; - } -} - -- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)index -{ - [super insertReactSubview:subview atIndex:index]; - [_inputAccessoryView insertReactSubview:subview atIndex:index]; -} - -- (void)removeReactSubview:(UIView *)subview -{ - [super removeReactSubview:subview]; - [_inputAccessoryView removeReactSubview:subview]; -} - -- (void)didUpdateReactSubviews -{ - // Do nothing, as subviews are managed by `insertReactSubview:atIndex:`. -} - -- (void)didSetProps:(NSArray *)changedProps -{ - // If the accessory view is not linked to a text input via nativeID, assume it is - // a standalone component that should get focus whenever it is rendered. - if (![changedProps containsObject:@"nativeID"] && !self.nativeID) { - _shouldBecomeFirstResponder = YES; - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryViewContent.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryViewContent.h deleted file mode 100644 index 09321c89..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryViewContent.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTInputAccessoryViewContent : UIView - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryViewContent.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryViewContent.m deleted file mode 100644 index 6cd4350e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryViewContent.m +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTInputAccessoryViewContent.h" - -#import - -@implementation RCTInputAccessoryViewContent -{ - UIView *_safeAreaContainer; - NSLayoutConstraint *_heightConstraint; -} - -- (instancetype)init -{ - if (self = [super init]) { - _safeAreaContainer = [UIView new]; - [self addSubview:_safeAreaContainer]; - - // Use autolayout to position the view properly and take into account - // safe area insets on iPhone X. - // TODO: Support rotation, anchor to left and right without breaking frame x coordinate (T27974328). - self.autoresizingMask = UIViewAutoresizingFlexibleHeight; - _safeAreaContainer.translatesAutoresizingMaskIntoConstraints = NO; - - _heightConstraint = [_safeAreaContainer.heightAnchor constraintEqualToConstant:0]; - _heightConstraint.active = YES; - - if (@available(iOS 11.0, *)) { - [_safeAreaContainer.bottomAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.bottomAnchor].active = YES; - [_safeAreaContainer.topAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.topAnchor].active = YES; - [_safeAreaContainer.leadingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.leadingAnchor].active = YES; - [_safeAreaContainer.trailingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.trailingAnchor].active = YES; - } else { - [_safeAreaContainer.bottomAnchor constraintEqualToAnchor:self.bottomAnchor].active = YES; - [_safeAreaContainer.topAnchor constraintEqualToAnchor:self.topAnchor].active = YES; - [_safeAreaContainer.leadingAnchor constraintEqualToAnchor:self.leadingAnchor].active = YES; - [_safeAreaContainer.trailingAnchor constraintEqualToAnchor:self.trailingAnchor].active = YES; - } - } - return self; -} - -- (CGSize)intrinsicContentSize -{ - // This is needed so the view size is based on autolayout constraints. - return CGSizeZero; -} - -- (void)reactSetFrame:(CGRect)frame -{ - // We still need to set the frame here, otherwise it won't be - // measured until moved to the window during the keyboard opening - // animation. If this happens, the height will be animated from 0 to - // its actual size and we don't want that. - [self setFrame:frame]; - [_safeAreaContainer setFrame:frame]; - - _heightConstraint.constant = frame.size.height; - [self layoutIfNeeded]; -} - -- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)index -{ - [super insertReactSubview:subview atIndex:index]; - [_safeAreaContainer insertSubview:subview atIndex:index]; -} - -- (void)removeReactSubview:(UIView *)subview -{ - [super removeReactSubview:subview]; - [subview removeFromSuperview]; - if ([[_safeAreaContainer subviews] count] == 0 && [self isFirstResponder]) { - [self resignFirstResponder]; - } -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryViewManager.h deleted file mode 100644 index cada7d44..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryViewManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTInputAccessoryViewManager : RCTViewManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryViewManager.m deleted file mode 100644 index 5fe42d86..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTInputAccessoryViewManager.m +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTInputAccessoryViewManager.h" - -#import "RCTInputAccessoryShadowView.h" -#import "RCTInputAccessoryView.h" - -@implementation RCTInputAccessoryViewManager - -RCT_EXPORT_MODULE() - -+ (BOOL)requiresMainQueueSetup -{ - return NO; -} - -- (UIView *)view -{ - return [[RCTInputAccessoryView alloc] initWithBridge:self.bridge]; -} - -- (RCTShadowView *)shadowView -{ - return [RCTInputAccessoryShadowView new]; -} - -RCT_REMAP_VIEW_PROPERTY(backgroundColor, inputAccessoryView.backgroundColor, UIColor) - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTTextSelection.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTTextSelection.h deleted file mode 100644 index 0b4b9a02..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTTextSelection.h +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -/** - * Object containing information about a TextInput's selection. - */ -@interface RCTTextSelection : NSObject - -@property (nonatomic, assign, readonly) NSInteger start; -@property (nonatomic, assign, readonly) NSInteger end; - -- (instancetype)initWithStart:(NSInteger)start end:(NSInteger)end; - -@end - -@interface RCTConvert (RCTTextSelection) - -+ (RCTTextSelection *)RCTTextSelection:(id)json; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTTextSelection.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTTextSelection.m deleted file mode 100644 index 082b8fd3..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/RCTTextSelection.m +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTextSelection.h" - -@implementation RCTTextSelection - -- (instancetype)initWithStart:(NSInteger)start end:(NSInteger)end -{ - if (self = [super init]) { - _start = start; - _end = end; - } - return self; -} - -@end - -@implementation RCTConvert (RCTTextSelection) - -+ (RCTTextSelection *)RCTTextSelection:(id)json -{ - if ([json isKindOfClass:[NSDictionary class]]) { - NSInteger start = [self NSInteger:json[@"start"]]; - NSInteger end = [self NSInteger:json[@"end"]]; - return [[RCTTextSelection alloc] initWithStart:start end:end]; - } - - return nil; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Singleline/RCTSinglelineTextInputView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Singleline/RCTSinglelineTextInputView.h deleted file mode 100644 index c5ca8ee7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Singleline/RCTSinglelineTextInputView.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTBaseTextInputView.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface RCTSinglelineTextInputView : RCTBaseTextInputView - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Singleline/RCTSinglelineTextInputView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Singleline/RCTSinglelineTextInputView.m deleted file mode 100644 index 4292a04f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Singleline/RCTSinglelineTextInputView.m +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSinglelineTextInputView.h" - -#import - -#import "RCTUITextField.h" - -@implementation RCTSinglelineTextInputView -{ - RCTUITextField *_backedTextInputView; -} - -- (instancetype)initWithBridge:(RCTBridge *)bridge -{ - if (self = [super initWithBridge:bridge]) { - // `blurOnSubmit` defaults to `true` for by design. - self.blurOnSubmit = YES; - - _backedTextInputView = [[RCTUITextField alloc] initWithFrame:self.bounds]; - _backedTextInputView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - _backedTextInputView.textInputDelegate = self; - - [self addSubview:_backedTextInputView]; - } - - return self; -} - -- (id)backedTextInputView -{ - return _backedTextInputView; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.h deleted file mode 100644 index 5662c792..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTBaseTextInputViewManager.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface RCTSinglelineTextInputViewManager : RCTBaseTextInputViewManager - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.m deleted file mode 100644 index 5a2af1cb..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.m +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSinglelineTextInputViewManager.h" - -#import "RCTBaseTextInputShadowView.h" -#import "RCTSinglelineTextInputView.h" - -@implementation RCTSinglelineTextInputViewManager - -RCT_EXPORT_MODULE() - -- (RCTShadowView *)shadowView -{ - RCTBaseTextInputShadowView *shadowView = - (RCTBaseTextInputShadowView *)[super shadowView]; - - shadowView.maximumNumberOfLines = 1; - - return shadowView; -} - -- (UIView *)view -{ - return [[RCTSinglelineTextInputView alloc] initWithBridge:self.bridge]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Singleline/RCTUITextField.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Singleline/RCTUITextField.h deleted file mode 100644 index 5e3c5b34..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Singleline/RCTUITextField.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "RCTBackedTextInputViewProtocol.h" - -NS_ASSUME_NONNULL_BEGIN - -/* - * Just regular UITextField... but much better! - */ -@interface RCTUITextField : UITextField - -- (instancetype)initWithCoder:(NSCoder *)decoder NS_UNAVAILABLE; - -@property (nonatomic, weak) id textInputDelegate; - -@property (nonatomic, assign) BOOL caretHidden; -@property (nonatomic, assign) BOOL contextMenuHidden; -@property (nonatomic, assign, readonly) BOOL textWasPasted; -@property (nonatomic, strong, nullable) UIColor *placeholderColor; -@property (nonatomic, assign) UIEdgeInsets textContainerInset; -@property (nonatomic, assign, getter=isEditable) BOOL editable; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Singleline/RCTUITextField.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Singleline/RCTUITextField.m deleted file mode 100644 index 03a9198e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextInput/Singleline/RCTUITextField.m +++ /dev/null @@ -1,179 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTUITextField.h" - -#import -#import - -#import "RCTBackedTextInputDelegateAdapter.h" - -@implementation RCTUITextField { - RCTBackedTextFieldDelegateAdapter *_textInputDelegateAdapter; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(_textDidChange) - name:UITextFieldTextDidChangeNotification - object:self]; - - _textInputDelegateAdapter = [[RCTBackedTextFieldDelegateAdapter alloc] initWithTextField:self]; - } - - return self; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (void)_textDidChange -{ - _textWasPasted = NO; -} - -#pragma mark - Properties - -- (void)setTextContainerInset:(UIEdgeInsets)textContainerInset -{ - _textContainerInset = textContainerInset; - [self setNeedsLayout]; -} - -- (void)setPlaceholder:(NSString *)placeholder -{ - [super setPlaceholder:placeholder]; - [self _updatePlaceholder]; -} - -- (void)setPlaceholderColor:(UIColor *)placeholderColor -{ - _placeholderColor = placeholderColor; - [self _updatePlaceholder]; -} - -- (void)_updatePlaceholder -{ - if (self.placeholder == nil) { - return; - } - - NSMutableDictionary *attributes = [NSMutableDictionary new]; - if (_placeholderColor) { - [attributes setObject:_placeholderColor forKey:NSForegroundColorAttributeName]; - } - - self.attributedPlaceholder = [[NSAttributedString alloc] initWithString:self.placeholder - attributes:attributes]; -} - -- (BOOL)isEditable -{ - return self.isEnabled; -} - -- (void)setEditable:(BOOL)editable -{ - self.enabled = editable; -} - -- (void)setScrollEnabled:(BOOL)enabled -{ - // Do noting, compatible with multiline textinput -} - -- (BOOL)scrollEnabled -{ - return NO; -} - -#pragma mark - Context Menu - -- (BOOL)canPerformAction:(SEL)action withSender:(id)sender -{ - if (_contextMenuHidden) { - return NO; - } - - return [super canPerformAction:action withSender:sender]; -} - -#pragma mark - Caret Manipulation - -- (CGRect)caretRectForPosition:(UITextPosition *)position -{ - if (_caretHidden) { - return CGRectZero; - } - - return [super caretRectForPosition:position]; -} - - -#pragma mark - Positioning Overrides - -- (CGRect)textRectForBounds:(CGRect)bounds -{ - return UIEdgeInsetsInsetRect([super textRectForBounds:bounds], _textContainerInset); -} - -- (CGRect)editingRectForBounds:(CGRect)bounds -{ - return [self textRectForBounds:bounds]; -} - -#pragma mark - Overrides - -- (void)setSelectedTextRange:(UITextRange *)selectedTextRange notifyDelegate:(BOOL)notifyDelegate -{ - if (!notifyDelegate) { - // We have to notify an adapter that following selection change was initiated programmatically, - // so the adapter must not generate a notification for it. - [_textInputDelegateAdapter skipNextTextInputDidChangeSelectionEventWithTextRange:selectedTextRange]; - } - - [super setSelectedTextRange:selectedTextRange]; -} - -- (void)paste:(id)sender -{ - [super paste:sender]; - _textWasPasted = YES; -} - -#pragma mark - Layout - -- (CGSize)contentSize -{ - // Returning size DOES contain `textContainerInset` (aka `padding`). - return self.intrinsicContentSize; -} - -- (CGSize)intrinsicContentSize -{ - // Note: `placeholder` defines intrinsic size for ``. - NSString *text = self.placeholder ?: @""; - CGSize size = [text sizeWithAttributes:@{NSFontAttributeName: self.font}]; - size = CGSizeMake(RCTCeilPixelValue(size.width), RCTCeilPixelValue(size.height)); - size.width += _textContainerInset.left + _textContainerInset.right; - size.height += _textContainerInset.top + _textContainerInset.bottom; - // Returning size DOES contain `textContainerInset` (aka `padding`). - return size; -} - -- (CGSize)sizeThatFits:(CGSize)size -{ - // All size values here contain `textContainerInset` (aka `padding`). - CGSize intrinsicSize = self.intrinsicContentSize; - return CGSizeMake(MIN(size.width, intrinsicSize.width), MIN(size.height, intrinsicSize.height)); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextPropTypes.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextPropTypes.js deleted file mode 100644 index dddb43ea..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextPropTypes.js +++ /dev/null @@ -1,135 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const DeprecatedColorPropType = require('DeprecatedColorPropType'); -const DeprecatedEdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); -const PropTypes = require('prop-types'); -const DeprecatedStyleSheetPropType = require('DeprecatedStyleSheetPropType'); -const TextStylePropTypes = require('TextStylePropTypes'); - -const stylePropType = DeprecatedStyleSheetPropType(TextStylePropTypes); - -module.exports = { - /** - * When `numberOfLines` is set, this prop defines how text will be - * truncated. - * - * See https://facebook.github.io/react-native/docs/text.html#ellipsizemode - */ - ellipsizeMode: PropTypes.oneOf(['head', 'middle', 'tail', 'clip']), - /** - * Used to truncate the text with an ellipsis. - * - * See https://facebook.github.io/react-native/docs/text.html#numberoflines - */ - numberOfLines: PropTypes.number, - /** - * Set text break strategy on Android. - * - * See https://facebook.github.io/react-native/docs/text.html#textbreakstrategy - */ - textBreakStrategy: PropTypes.oneOf(['simple', 'highQuality', 'balanced']), - /** - * Invoked on mount and layout changes. - * - * See https://facebook.github.io/react-native/docs/text.html#onlayout - */ - onLayout: PropTypes.func, - /** - * This function is called on press. - * - * See https://facebook.github.io/react-native/docs/text.html#onpress - */ - onPress: PropTypes.func, - /** - * This function is called on long press. - * - * See https://facebook.github.io/react-native/docs/text.html#onlongpress - */ - onLongPress: PropTypes.func, - /** - * Defines how far your touch may move off of the button, before - * deactivating the button. - * - * See https://facebook.github.io/react-native/docs/text.html#pressretentionoffset - */ - pressRetentionOffset: DeprecatedEdgeInsetsPropType, - /** - * Lets the user select text. - * - * See https://facebook.github.io/react-native/docs/text.html#selectable - */ - selectable: PropTypes.bool, - /** - * The highlight color of the text. - * - * See https://facebook.github.io/react-native/docs/text.html#selectioncolor - */ - selectionColor: DeprecatedColorPropType, - /** - * When `true`, no visual change is made when text is pressed down. - * - * See https://facebook.github.io/react-native/docs/text.html#supperhighlighting - */ - suppressHighlighting: PropTypes.bool, - style: stylePropType, - /** - * Used to locate this view in end-to-end tests. - * - * See https://facebook.github.io/react-native/docs/text.html#testid - */ - testID: PropTypes.string, - /** - * Used to locate this view from native code. - * - * See https://facebook.github.io/react-native/docs/text.html#nativeid - */ - nativeID: PropTypes.string, - /** - * Whether fonts should scale to respect Text Size accessibility settings. - * - * See https://facebook.github.io/react-native/docs/text.html#allowfontscaling - */ - allowFontScaling: PropTypes.bool, - /** - * Specifies largest possible scale a font can reach when `allowFontScaling` is enabled. - * Possible values: - * `null/undefined` (default): inherit from the parent node or the global default (0) - * `0`: no max, ignore parent/global default - * `>= 1`: sets the maxFontSizeMultiplier of this node to this value - */ - maxFontSizeMultiplier: PropTypes.number, - /** - * Indicates whether the view is an accessibility element. - * - * See https://facebook.github.io/react-native/docs/text.html#accessible - */ - accessible: PropTypes.bool, - /** - * Whether font should be scaled down automatically. - * - * See https://facebook.github.io/react-native/docs/text.html#adjustsfontsizetofit - */ - adjustsFontSizeToFit: PropTypes.bool, - /** - * Smallest possible scale a font can reach. - * - * See https://facebook.github.io/react-native/docs/text.html#minimumfontscale - */ - minimumFontScale: PropTypes.number, - /** - * Specifies the disabled state of the text view for testing purposes. - * - * See https://facebook.github.io/react-native/docs/text.html#disabled - */ - disabled: PropTypes.bool, -}; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextProps.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextProps.js deleted file mode 100644 index 2ffa8959..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextProps.js +++ /dev/null @@ -1,186 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -'use strict'; - -import type {LayoutEvent, PressEvent, TextLayoutEvent} from 'CoreEventTypes'; -import type React from 'React'; -import type {TextStyleProp} from 'StyleSheet'; -import type { - AccessibilityRole, - AccessibilityStates, - AccessibilityTrait, -} from 'ViewAccessibility'; - -export type PressRetentionOffset = $ReadOnly<{| - top: number, - left: number, - bottom: number, - right: number, -|}>; - -/** - * @see https://facebook.github.io/react-native/docs/text.html#reference - */ -export type TextProps = $ReadOnly<{| - /** - * Indicates whether the view is an accessibility element. - * - * See https://facebook.github.io/react-native/docs/text.html#accessible - */ - accessible?: ?boolean, - accessibilityHint?: ?Stringish, - accessibilityLabel?: ?Stringish, - accessibilityRole?: ?AccessibilityRole, - accessibilityStates?: ?AccessibilityStates, - accessibilityTraits?: ?(AccessibilityTrait | Array), - - /** - * Whether font should be scaled down automatically. - * - * See https://facebook.github.io/react-native/docs/text.html#adjustsfontsizetofit - */ - adjustsFontSizeToFit?: ?boolean, - - /** - * Whether fonts should scale to respect Text Size accessibility settings. - * - * See https://facebook.github.io/react-native/docs/text.html#allowfontscaling - */ - allowFontScaling?: ?boolean, - children?: ?React.Node, - - /** - * When `numberOfLines` is set, this prop defines how text will be - * truncated. - * - * See https://facebook.github.io/react-native/docs/text.html#ellipsizemode - */ - ellipsizeMode?: ?('clip' | 'head' | 'middle' | 'tail'), - - /** - * Specifies largest possible scale a font can reach when `allowFontScaling` is enabled. - * Possible values: - * `null/undefined` (default): inherit from the parent node or the global default (0) - * `0`: no max, ignore parent/global default - * `>= 1`: sets the maxFontSizeMultiplier of this node to this value - */ - maxFontSizeMultiplier?: ?number, - - /** - * Used to locate this view from native code. - * - * See https://facebook.github.io/react-native/docs/text.html#nativeid - */ - nativeID?: ?string, - - /** - * Used to truncate the text with an ellipsis. - * - * See https://facebook.github.io/react-native/docs/text.html#numberoflines - */ - numberOfLines?: ?number, - - /** - * Invoked on mount and layout changes. - * - * See https://facebook.github.io/react-native/docs/text.html#onlayout - */ - onLayout?: ?(event: LayoutEvent) => mixed, - - /** - * This function is called on long press. - * - * See https://facebook.github.io/react-native/docs/text.html#onlongpress - */ - onLongPress?: ?(event: PressEvent) => mixed, - - /** - * This function is called on press. - * - * See https://facebook.github.io/react-native/docs/text.html#onpress - */ - onPress?: ?(event: PressEvent) => mixed, - onResponderGrant?: ?(event: PressEvent, dispatchID: string) => void, - onResponderMove?: ?(event: PressEvent) => void, - onResponderRelease?: ?(event: PressEvent) => void, - onResponderTerminate?: ?(event: PressEvent) => void, - onResponderTerminationRequest?: ?() => boolean, - onStartShouldSetResponder?: ?() => boolean, - onMoveShouldSetResponder?: ?() => boolean, - onTextLayout?: ?(event: TextLayoutEvent) => mixed, - - /** - * Defines how far your touch may move off of the button, before - * deactivating the button. - * - * See https://facebook.github.io/react-native/docs/text.html#pressretentionoffset - */ - pressRetentionOffset?: ?PressRetentionOffset, - - /** - * Lets the user select text. - * - * See https://facebook.github.io/react-native/docs/text.html#selectable - */ - selectable?: ?boolean, - style?: ?TextStyleProp, - - /** - * Used to locate this view in end-to-end tests. - * - * See https://facebook.github.io/react-native/docs/text.html#testid - */ - testID?: ?string, - - /** - * Android Only - */ - - /** - * Specifies the disabled state of the text view for testing purposes. - * - * See https://facebook.github.io/react-native/docs/text.html#disabled - */ - disabled?: ?boolean, - - /** - * The highlight color of the text. - * - * See https://facebook.github.io/react-native/docs/text.html#selectioncolor - */ - selectionColor?: ?string, - - /** - * Set text break strategy on Android. - * - * See https://facebook.github.io/react-native/docs/text.html#textbreakstrategy - */ - textBreakStrategy?: ?('balanced' | 'highQuality' | 'simple'), - - /** - * iOS Only - */ - adjustsFontSizeToFit?: ?boolean, - - /** - * Smallest possible scale a font can reach. - * - * See https://facebook.github.io/react-native/docs/text.html#minimumfontscale - */ - minimumFontScale?: ?number, - - /** - * When `true`, no visual change is made when text is pressed down. - * - * See https://facebook.github.io/react-native/docs/text.html#supperhighlighting - */ - suppressHighlighting?: ?boolean, -|}>; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextStylePropTypes.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextStylePropTypes.js deleted file mode 100644 index d4755ef7..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/TextStylePropTypes.js +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const DeprecatedColorPropType = require('DeprecatedColorPropType'); -const ReactPropTypes = require('prop-types'); -const DeprecatedViewStylePropTypes = require('DeprecatedViewStylePropTypes'); - -const TextStylePropTypes = { - ...DeprecatedViewStylePropTypes, - - color: DeprecatedColorPropType, - fontFamily: ReactPropTypes.string, - fontSize: ReactPropTypes.number, - fontStyle: ReactPropTypes.oneOf(['normal', 'italic']), - /** - * Specifies font weight. The values 'normal' and 'bold' are supported for - * most fonts. Not all fonts have a variant for each of the numeric values, - * in that case the closest one is chosen. - */ - fontWeight: ReactPropTypes.oneOf([ - 'normal' /*default*/, - 'bold', - '100', - '200', - '300', - '400', - '500', - '600', - '700', - '800', - '900', - ]), - /** - * @platform ios - */ - fontVariant: ReactPropTypes.arrayOf( - ReactPropTypes.oneOf([ - 'small-caps', - 'oldstyle-nums', - 'lining-nums', - 'tabular-nums', - 'proportional-nums', - ]), - ), - textShadowOffset: ReactPropTypes.shape({ - width: ReactPropTypes.number, - height: ReactPropTypes.number, - }), - textShadowRadius: ReactPropTypes.number, - textShadowColor: DeprecatedColorPropType, - /** - * @platform ios - */ - letterSpacing: ReactPropTypes.number, - lineHeight: ReactPropTypes.number, - /** - * Specifies text alignment. The value 'justify' is only supported on iOS and - * fallbacks to `left` on Android. - */ - textAlign: ReactPropTypes.oneOf([ - 'auto' /*default*/, - 'left', - 'right', - 'center', - 'justify', - ]), - /** - * @platform android - */ - textAlignVertical: ReactPropTypes.oneOf([ - 'auto' /*default*/, - 'top', - 'bottom', - 'center', - ]), - /** - * Set to `false` to remove extra font padding intended to make space for certain ascenders / descenders. - * With some fonts, this padding can make text look slightly misaligned when centered vertically. - * For best results also set `textAlignVertical` to `center`. Default is true. - * @platform android - */ - includeFontPadding: ReactPropTypes.bool, - textDecorationLine: ReactPropTypes.oneOf([ - 'none' /*default*/, - 'underline', - 'line-through', - 'underline line-through', - ]), - /** - * @platform ios - */ - textDecorationStyle: ReactPropTypes.oneOf([ - 'solid' /*default*/, - 'double', - 'dotted', - 'dashed', - ]), - /** - * @platform ios - */ - textDecorationColor: DeprecatedColorPropType, - textTransform: ReactPropTypes.oneOf([ - 'none' /*default*/, - 'capitalize', - 'uppercase', - 'lowercase', - ]), - /** - * @platform ios - */ - writingDirection: ReactPropTypes.oneOf(['auto' /*default*/, 'ltr', 'rtl']), -}; - -module.exports = TextStylePropTypes; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/VirtualText/RCTVirtualTextShadowView.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/VirtualText/RCTVirtualTextShadowView.h deleted file mode 100644 index c2bef898..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/VirtualText/RCTVirtualTextShadowView.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTBaseTextShadowView.h" - -@interface RCTVirtualTextShadowView : RCTBaseTextShadowView - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/VirtualText/RCTVirtualTextShadowView.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/VirtualText/RCTVirtualTextShadowView.m deleted file mode 100644 index ef659cc5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/VirtualText/RCTVirtualTextShadowView.m +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTVirtualTextShadowView.h" - -#import -#import - -#import "RCTRawTextShadowView.h" - -@implementation RCTVirtualTextShadowView { - BOOL _isLayoutDirty; -} - -#pragma mark - Layout - -- (void)dirtyLayout -{ - [super dirtyLayout]; - - if (_isLayoutDirty) { - return; - } - _isLayoutDirty = YES; - - [self.superview dirtyLayout]; -} - -- (void)clearLayout -{ - _isLayoutDirty = NO; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/VirtualText/RCTVirtualTextViewManager.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/VirtualText/RCTVirtualTextViewManager.h deleted file mode 100644 index 3382d762..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/VirtualText/RCTVirtualTextViewManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTBaseTextViewManager.h" - -@interface RCTVirtualTextViewManager : RCTBaseTextViewManager - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/VirtualText/RCTVirtualTextViewManager.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/VirtualText/RCTVirtualTextViewManager.m deleted file mode 100644 index 48eec5ff..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Text/VirtualText/RCTVirtualTextViewManager.m +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTVirtualTextViewManager.h" - -#import "RCTVirtualTextShadowView.h" - -@implementation RCTVirtualTextViewManager - -RCT_EXPORT_MODULE(RCTVirtualText) - -- (UIView *)view -{ - return [UIView new]; -} - -- (RCTShadowView *)shadowView -{ - return [RCTVirtualTextShadowView new]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Vibration/RCTVibration.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/Vibration/RCTVibration.h deleted file mode 100644 index b6172f23..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Vibration/RCTVibration.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTVibration : NSObject - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Vibration/RCTVibration.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/Vibration/RCTVibration.m deleted file mode 100644 index 0c960cd4..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Vibration/RCTVibration.m +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTVibration.h" - -#import - -@implementation RCTVibration - -RCT_EXPORT_MODULE() - -RCT_EXPORT_METHOD(vibrate) -{ - AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Vibration/RCTVibration.xcodeproj/project.pbxproj b/ios/ElectrodeApiImpl/Libraries/ReactNative/Vibration/RCTVibration.xcodeproj/project.pbxproj deleted file mode 100644 index 4e009955..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Vibration/RCTVibration.xcodeproj/project.pbxproj +++ /dev/null @@ -1,253 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 832C819C1AAF6E1A007FA2F7 /* RCTVibration.m in Sources */ = {isa = PBXBuildFile; fileRef = 832C819B1AAF6E1A007FA2F7 /* RCTVibration.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 832C81801AAF6DEF007FA2F7 /* libRCTVibration.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTVibration.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 832C819A1AAF6E1A007FA2F7 /* RCTVibration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTVibration.h; sourceTree = ""; }; - 832C819B1AAF6E1A007FA2F7 /* RCTVibration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTVibration.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 832C81771AAF6DEF007FA2F7 = { - isa = PBXGroup; - children = ( - 832C819A1AAF6E1A007FA2F7 /* RCTVibration.h */, - 832C819B1AAF6E1A007FA2F7 /* RCTVibration.m */, - 832C81811AAF6DEF007FA2F7 /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 832C81811AAF6DEF007FA2F7 /* Products */ = { - isa = PBXGroup; - children = ( - 832C81801AAF6DEF007FA2F7 /* libRCTVibration.a */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 832C817F1AAF6DEF007FA2F7 /* RCTVibration */ = { - isa = PBXNativeTarget; - buildConfigurationList = 832C81941AAF6DF0007FA2F7 /* Build configuration list for PBXNativeTarget "RCTVibration" */; - buildPhases = ( - 832C817C1AAF6DEF007FA2F7 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTVibration; - productName = RCTVibration; - productReference = 832C81801AAF6DEF007FA2F7 /* libRCTVibration.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 832C81781AAF6DEF007FA2F7 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 832C817F1AAF6DEF007FA2F7 = { - CreatedOnToolsVersion = 6.2; - }; - }; - }; - buildConfigurationList = 832C817B1AAF6DEF007FA2F7 /* Build configuration list for PBXProject "RCTVibration" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 832C81771AAF6DEF007FA2F7; - productRefGroup = 832C81811AAF6DEF007FA2F7 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 832C817F1AAF6DEF007FA2F7 /* RCTVibration */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 832C817C1AAF6DEF007FA2F7 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 832C819C1AAF6E1A007FA2F7 /* RCTVibration.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 832C81921AAF6DF0007FA2F7 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 832C81931AAF6DF0007FA2F7 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 832C81951AAF6DF0007FA2F7 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 832C81961AAF6DF0007FA2F7 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_STATIC_ANALYZER_MODE = deep; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 832C817B1AAF6DEF007FA2F7 /* Build configuration list for PBXProject "RCTVibration" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 832C81921AAF6DF0007FA2F7 /* Debug */, - 832C81931AAF6DF0007FA2F7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 832C81941AAF6DF0007FA2F7 /* Build configuration list for PBXNativeTarget "RCTVibration" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 832C81951AAF6DF0007FA2F7 /* Debug */, - 832C81961AAF6DF0007FA2F7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 832C81781AAF6DEF007FA2F7 /* Project object */; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Vibration/Vibration.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Vibration/Vibration.js deleted file mode 100644 index 7c8f695b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Vibration/Vibration.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - * @jsdoc - */ - -'use strict'; - -const RCTVibration = require('NativeModules').Vibration; -const Platform = require('Platform'); - -/** - * Vibration API - * - * See https://facebook.github.io/react-native/docs/vibration.html - */ - -let _vibrating: boolean = false; -let _id: number = 0; // _id is necessary to prevent race condition. - -function vibrateByPattern(pattern: Array, repeat: boolean = false) { - if (_vibrating) { - return; - } - _vibrating = true; - if (pattern[0] === 0) { - RCTVibration.vibrate(); - pattern = pattern.slice(1); - } - if (pattern.length === 0) { - _vibrating = false; - return; - } - setTimeout(() => vibrateScheduler(++_id, pattern, repeat, 1), pattern[0]); -} - -function vibrateScheduler( - id, - pattern: Array, - repeat: boolean, - nextIndex: number, -) { - if (!_vibrating || id !== _id) { - return; - } - RCTVibration.vibrate(); - if (nextIndex >= pattern.length) { - if (repeat) { - nextIndex = 0; - } else { - _vibrating = false; - return; - } - } - setTimeout( - () => vibrateScheduler(id, pattern, repeat, nextIndex + 1), - pattern[nextIndex], - ); -} - -const Vibration = { - /** - * Trigger a vibration with specified `pattern`. - * - * See https://facebook.github.io/react-native/docs/vibration.html#vibrate - */ - vibrate: function( - pattern: number | Array = 400, - repeat: boolean = false, - ) { - if (Platform.OS === 'android') { - if (typeof pattern === 'number') { - RCTVibration.vibrate(pattern); - } else if (Array.isArray(pattern)) { - RCTVibration.vibrateByPattern(pattern, repeat ? 0 : -1); - } else { - throw new Error('Vibration pattern should be a number or array'); - } - } else { - if (_vibrating) { - return; - } - if (typeof pattern === 'number') { - RCTVibration.vibrate(); - } else if (Array.isArray(pattern)) { - vibrateByPattern(pattern, repeat); - } else { - throw new Error('Vibration pattern should be a number or array'); - } - } - }, - /** - * Stop vibration - * - * See https://facebook.github.io/react-native/docs/vibration.html#cancel - */ - cancel: function() { - if (Platform.OS === 'ios') { - _vibrating = false; - } else { - RCTVibration.cancel(); - } - }, -}; - -module.exports = Vibration; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Vibration/VibrationIOS.android.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Vibration/VibrationIOS.android.js deleted file mode 100644 index f87869a6..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Vibration/VibrationIOS.android.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * Stub of VibrationIOS for Android. - * - * @format - */ - -'use strict'; - -const warning = require('fbjs/lib/warning'); - -const VibrationIOS = { - vibrate: function() { - warning( - false, - 'VibrationIOS is deprecated, and will be removed. Use Vibration instead.', - ); - }, -}; - -module.exports = VibrationIOS; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/Vibration/VibrationIOS.ios.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/Vibration/VibrationIOS.ios.js deleted file mode 100644 index 5e6a0f46..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/Vibration/VibrationIOS.ios.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const RCTVibration = require('NativeModules').Vibration; - -const invariant = require('invariant'); -const warning = require('fbjs/lib/warning'); - -/** - * NOTE: `VibrationIOS` is being deprecated. Use `Vibration` instead. - * - * The Vibration API is exposed at `VibrationIOS.vibrate()`. On iOS, calling this - * function will trigger a one second vibration. The vibration is asynchronous - * so this method will return immediately. - * - * There will be no effect on devices that do not support Vibration, eg. the iOS - * simulator. - * - * Vibration patterns are currently unsupported. - */ - -const VibrationIOS = { - /** - * @deprecated - */ - vibrate: function() { - warning( - false, - 'VibrationIOS is deprecated and will be removed. Please use Vibration instead.', - ); - invariant(arguments[0] === undefined, 'Vibration patterns not supported.'); - RCTVibration.vibrate(); - }, -}; - -module.exports = VibrationIOS; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTReconnectingWebSocket.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTReconnectingWebSocket.h deleted file mode 100644 index a371b785..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTReconnectingWebSocket.h +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#if RCT_DEV // Only supported in dev mode - -@class RCTReconnectingWebSocket; - -@protocol RCTReconnectingWebSocketDelegate -- (void)reconnectingWebSocketDidOpen:(RCTReconnectingWebSocket *)webSocket; -- (void)reconnectingWebSocket:(RCTReconnectingWebSocket *)webSocket didReceiveMessage:(id)message; -/** Sent when the socket has closed due to error or clean shutdown. An automatic reconnect will start shortly. */ -- (void)reconnectingWebSocketDidClose:(RCTReconnectingWebSocket *)webSocket; -@end - -@interface RCTReconnectingWebSocket : NSObject - -/** Delegate will be messaged on the given queue (required). */ -- (instancetype)initWithURL:(NSURL *)url queue:(dispatch_queue_t)queue; - -@property (nonatomic, weak) id delegate; -- (void)send:(id)data; -- (void)start; -- (void)stop; - -- (instancetype)initWithURL:(NSURL *)url __deprecated_msg("Use initWithURL:queue: instead"); -/** @brief Must be set before -start to have effect */ -@property (nonatomic, strong) dispatch_queue_t delegateDispatchQueue __deprecated_msg("Use initWithURL:queue: instead"); - -@end - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTReconnectingWebSocket.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTReconnectingWebSocket.m deleted file mode 100644 index 98480838..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTReconnectingWebSocket.m +++ /dev/null @@ -1,177 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTReconnectingWebSocket.h" - -#import -#import - -#if __has_include() -#import -#else -#import -#endif - -#if __has_include() && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 100300 /* __IPHONE_10_3 */ -#import -#endif /* __IPHONE_10_3 */ - -#import "RCTSRWebSocket.h" - -#if RCT_DEV // Only supported in dev mode - -#if __has_include() && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 100300 /* __IPHONE_10_3 */ - -// From https://github.com/apple/swift/blob/ad40c770bfe372f879b530443a3d94761fe258a6/stdlib/public/SDK/os/os_log.m -typedef struct os_log_pack_s { - uint64_t olp_continuous_time; - struct timespec olp_wall_time; - const void *olp_mh; - const void *olp_pc; - const char *olp_format; - uint8_t olp_data[0]; -} os_log_pack_s, *os_log_pack_t; - -static void (*orig__nwlog_pack)(os_log_pack_t pack, os_log_type_t logType); - -static void my__nwlog_pack(os_log_pack_t pack, os_log_type_t logType) -{ - if (logType == OS_LOG_TYPE_ERROR && strstr(pack->olp_format, "Connection has no connected handler") == NULL) { - orig__nwlog_pack(pack, logType); - } -} - -#endif /* __IPHONE_10_3 */ - -static void (*orig_nwlog_legacy_v)(int, char*, va_list); - -static void my_nwlog_legacy_v(int level, char *format, va_list args) { - static const uint buffer_size = 256; - static char buffer[buffer_size]; - va_list copy; - va_copy(copy, args); - vsnprintf(buffer, buffer_size, format, copy); - va_end(copy); - - if (strstr(buffer, "nw_connection_get_connected_socket_block_invoke") == NULL && - strstr(buffer, "Connection has no connected handler") == NULL) { - orig_nwlog_legacy_v(level, format, args); - } -} - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ - -static void (*orig_os_log_error_impl)(void *dso, os_log_t log, os_log_type_t type, const char *format, uint8_t *buf, uint32_t size); - -static void my_os_log_error_impl(void *dso, os_log_t log, os_log_type_t type, const char *format, uint8_t *buf, uint32_t size) -{ - if (strstr(format, "TCP Conn %p Failed : error %ld:%d") == NULL) { - orig_os_log_error_impl(dso, log, type, format, buf, size); - } -} - -#endif /* __IPHONE_11_0 */ - -@interface RCTReconnectingWebSocket () -@end - -@implementation RCTReconnectingWebSocket { - NSURL *_url; - RCTSRWebSocket *_socket; -} - -+ (void)load -{ - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - rebind_symbols((struct rebinding[1]){ - {"nwlog_legacy_v", my_nwlog_legacy_v, (void *)&orig_nwlog_legacy_v} - }, 1); -#if __has_include() && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 100300 /* __IPHONE_10_3 */ - rebind_symbols((struct rebinding[1]){ - {"__nwlog_pack", my__nwlog_pack, (void *)&orig__nwlog_pack} - }, 1); -#endif /* __IPHONE_10_3 */ -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ - rebind_symbols((struct rebinding[1]){ - {"_os_log_error_impl", my_os_log_error_impl, (void *)&orig_os_log_error_impl} - }, 1); -#endif /* __IPHONE_11_0 */ - }); -} - -- (instancetype)initWithURL:(NSURL *)url queue:(dispatch_queue_t)queue -{ - if (self = [super init]) { - _url = url; - _delegateDispatchQueue = queue; - } - return self; -} - -- (instancetype)initWithURL:(NSURL *)url -{ - return [self initWithURL:url queue:dispatch_get_main_queue()]; -} - -- (void)send:(id)data -{ - [_socket send:data]; -} - -- (void)start -{ - [self stop]; - _socket = [[RCTSRWebSocket alloc] initWithURL:_url]; - _socket.delegate = self; - [_socket setDelegateDispatchQueue:_delegateDispatchQueue]; - [_socket open]; -} - -- (void)stop -{ - _socket.delegate = nil; - [_socket closeWithCode:1000 reason:@"Invalidated"]; - _socket = nil; -} - -- (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message -{ - [_delegate reconnectingWebSocket:self 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)webSocketDidOpen:(RCTSRWebSocket *)webSocket -{ - [_delegate reconnectingWebSocketDidOpen:self]; -} - -- (void)webSocket:(RCTSRWebSocket *)webSocket didFailWithError:(NSError *)error -{ - [_delegate reconnectingWebSocketDidClose:self]; - [self reconnect]; -} - -- (void)webSocket:(RCTSRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean -{ - [_delegate reconnectingWebSocketDidClose:self]; - [self reconnect]; -} - -@end - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTSRWebSocket.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTSRWebSocket.h deleted file mode 100644 index 1b17cffa..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTSRWebSocket.h +++ /dev/null @@ -1,132 +0,0 @@ -// -// Copyright 2012 Square Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import -#import - -typedef NS_ENUM(unsigned int, RCTSRReadyState) { - RCTSR_CONNECTING = 0, - RCTSR_OPEN = 1, - RCTSR_CLOSING = 2, - RCTSR_CLOSED = 3, -}; - -typedef NS_ENUM(NSInteger, RCTSRStatusCode) { - RCTSRStatusCodeNormal = 1000, - RCTSRStatusCodeGoingAway = 1001, - RCTSRStatusCodeProtocolError = 1002, - RCTSRStatusCodeUnhandledType = 1003, - // 1004 reserved. - RCTSRStatusNoStatusReceived = 1005, - // 1004-1006 reserved. - RCTSRStatusCodeInvalidUTF8 = 1007, - RCTSRStatusCodePolicyViolated = 1008, - RCTSRStatusCodeMessageTooBig = 1009, -}; - -@class RCTSRWebSocket; - -extern NSString *const RCTSRWebSocketErrorDomain; -extern NSString *const RCTSRHTTPResponseErrorKey; - -#pragma mark - RCTSRWebSocketDelegate - -@protocol RCTSRWebSocketDelegate; - -#pragma mark - RCTSRWebSocket - -@interface RCTSRWebSocket : NSObject - -@property (nonatomic, weak) id delegate; - -@property (nonatomic, readonly) RCTSRReadyState readyState; -@property (nonatomic, readonly, strong) NSURL *url; - -// This returns the negotiated protocol. -// It will be nil until after the handshake completes. -@property (nonatomic, readonly, copy) NSString *protocol; - -// Protocols should be an array of strings that turn into Sec-WebSocket-Protocol. -- (instancetype)initWithURLRequest:(NSURLRequest *)request protocols:(NSArray *)protocols NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithURLRequest:(NSURLRequest *)request; - -// Some helper constructors. -- (instancetype)initWithURL:(NSURL *)url protocols:(NSArray *)protocols; -- (instancetype)initWithURL:(NSURL *)url; - -// Delegate queue will be dispatch_main_queue by default. -// You cannot set both OperationQueue and dispatch_queue. -- (void)setDelegateOperationQueue:(NSOperationQueue *)queue; -- (void)setDelegateDispatchQueue:(dispatch_queue_t)queue; - -// By default, it will schedule itself on +[NSRunLoop RCTSR_networkRunLoop] using defaultModes. -- (void)scheduleInRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode; -- (void)unscheduleFromRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode; - -// RCTSRWebSockets are intended for one-time-use only. Open should be called once and only once. -- (void)open; - -- (void)close; -- (void)closeWithCode:(NSInteger)code reason:(NSString *)reason; - -// Send a UTF8 String or Data. -- (void)send:(id)data; - -// Send Data (can be nil) in a ping message. -- (void)sendPing:(NSData *)data; - -@end - -#pragma mark - RCTSRWebSocketDelegate - -@protocol RCTSRWebSocketDelegate - -// message will either be an NSString if the server is using text -// or NSData if the server is using binary. -- (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message; - -@optional - -- (void)webSocketDidOpen:(RCTSRWebSocket *)webSocket; -- (void)webSocket:(RCTSRWebSocket *)webSocket didFailWithError:(NSError *)error; -- (void)webSocket:(RCTSRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean; -- (void)webSocket:(RCTSRWebSocket *)webSocket didReceivePong:(NSData *)pongPayload; - -@end - -#pragma mark - NSURLRequest (CertificateAdditions) - -@interface NSURLRequest (CertificateAdditions) - -@property (nonatomic, readonly, copy) NSArray *RCTSR_SSLPinnedCertificates; - -@end - -#pragma mark - NSMutableURLRequest (CertificateAdditions) - -@interface NSMutableURLRequest (CertificateAdditions) - -@property (nonatomic, copy) NSArray *RCTSR_SSLPinnedCertificates; - -@end - -#pragma mark - NSRunLoop (RCTSRWebSocket) - -@interface NSRunLoop (RCTSRWebSocket) - -+ (NSRunLoop *)RCTSR_networkRunLoop; - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTSRWebSocket.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTSRWebSocket.m deleted file mode 100644 index 96de0d39..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTSRWebSocket.m +++ /dev/null @@ -1,1645 +0,0 @@ -// -// Copyright 2012 Square Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import "RCTSRWebSocket.h" - -#import -#import - -#import - -#import -#import -#import - -typedef NS_ENUM(NSInteger, RCTSROpCode) { - RCTSROpCodeTextFrame = 0x1, - RCTSROpCodeBinaryFrame = 0x2, - // 3-7 reserved. - RCTSROpCodeConnectionClose = 0x8, - RCTSROpCodePing = 0x9, - RCTSROpCodePong = 0xA, - // B-F reserved. -}; - -typedef struct { - BOOL fin; - // BOOL rsv1; - // BOOL rsv2; - // BOOL rsv3; - uint8_t opcode; - BOOL masked; - uint64_t payload_length; -} frame_header; - -static NSString *const RCTSRWebSocketAppendToSecKeyString = @"258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; - -//#define RCTSR_ENABLE_LOG -#ifdef RCTSR_ENABLE_LOG -#define RCTSRLog(format...) RCTLogInfo(format) -#else -#define RCTSRLog(...) do { } while (0) -#endif - -// This is a hack, and probably not optimal -static inline int32_t validate_dispatch_data_partial_string(NSData *data) -{ - static const int maxCodepointSize = 3; - - for (int i = 0; i < maxCodepointSize; i++) { - NSString *str = [[NSString alloc] initWithBytesNoCopy:(char *)data.bytes length:data.length - i encoding:NSUTF8StringEncoding freeWhenDone:NO]; - if (str) { - return (int32_t)data.length - i; - } - } - - return -1; -} - -@interface NSData (RCTSRWebSocket) - -@property (nonatomic, readonly, copy) NSString *stringBySHA1ThenBase64Encoding; - -@end - - -@interface NSString (RCTSRWebSocket) - -@property (nonatomic, readonly, copy) NSString *stringBySHA1ThenBase64Encoding; - -@end - - -@interface NSURL (RCTSRWebSocket) - -// The origin isn't really applicable for a native application. -// So instead, just map ws -> http and wss -> https. -@property (nonatomic, readonly, copy) NSString *RCTSR_origin; - -@end - - -@interface _RCTSRRunLoopThread : NSThread - -@property (nonatomic, readonly) NSRunLoop *runLoop; - -@end - - -static NSString *newSHA1String(const char *bytes, size_t length) -{ - uint8_t md[CC_SHA1_DIGEST_LENGTH]; - - assert(length >= 0); - assert(length <= UINT32_MAX); - CC_SHA1(bytes, (CC_LONG)length, md); - - NSData *data = [NSData dataWithBytes:md length:CC_SHA1_DIGEST_LENGTH]; - return [data base64EncodedStringWithOptions:0]; -} - -@implementation NSData (RCTSRWebSocket) - -- (NSString *)stringBySHA1ThenBase64Encoding; -{ - return newSHA1String(self.bytes, self.length); -} - -@end - - -@implementation NSString (RCTSRWebSocket) - -- (NSString *)stringBySHA1ThenBase64Encoding; -{ - return newSHA1String(self.UTF8String, self.length); -} - -@end - -NSString *const RCTSRWebSocketErrorDomain = @"RCTSRWebSocketErrorDomain"; -NSString *const RCTSRHTTPResponseErrorKey = @"HTTPResponseStatusCode"; - -// Returns number of bytes consumed. Returning 0 means you didn't match. -// Sends bytes to callback handler; -typedef size_t (^stream_scanner)(NSData *collected_data); - -typedef void (^data_callback)(RCTSRWebSocket *webSocket, NSData *data); - -@interface RCTSRIOConsumer : NSObject - -@property (nonatomic, copy, readonly) stream_scanner consumer; -@property (nonatomic, copy, readonly) data_callback handler; -@property (nonatomic, assign) size_t bytesNeeded; -@property (nonatomic, assign, readonly) BOOL readToCurrentFrame; -@property (nonatomic, assign, readonly) BOOL unmaskBytes; - -@end - -// This class is not thread-safe, and is expected to always be run on the same queue. -@interface RCTSRIOConsumerPool : NSObject - -- (instancetype)initWithBufferCapacity:(NSUInteger)poolSize NS_DESIGNATED_INITIALIZER; - -- (RCTSRIOConsumer *)consumerWithScanner:(stream_scanner)scanner handler:(data_callback)handler bytesNeeded:(size_t)bytesNeeded readToCurrentFrame:(BOOL)readToCurrentFrame unmaskBytes:(BOOL)unmaskBytes; -- (void)returnConsumer:(RCTSRIOConsumer *)consumer; - -@end - -@interface RCTSRWebSocket () - -@property (nonatomic, assign) RCTSRReadyState readyState; - -@property (nonatomic, strong) NSOperationQueue *delegateOperationQueue; -@property (nonatomic, strong) dispatch_queue_t delegateDispatchQueue; - -@end - -@implementation RCTSRWebSocket -{ - NSInteger _webSocketVersion; - - NSOperationQueue *_delegateOperationQueue; - dispatch_queue_t _delegateDispatchQueue; - - dispatch_queue_t _workQueue; - NSMutableArray *_consumers; - - NSInputStream *_inputStream; - NSOutputStream *_outputStream; - - NSMutableData *_readBuffer; - NSUInteger _readBufferOffset; - - NSMutableData *_outputBuffer; - NSUInteger _outputBufferOffset; - - uint8_t _currentFrameOpcode; - size_t _currentFrameCount; - size_t _readOpCount; - uint32_t _currentStringScanPosition; - NSMutableData *_currentFrameData; - - NSString *_closeReason; - - NSString *_secKey; - - BOOL _pinnedCertFound; - - uint8_t _currentReadMaskKey[4]; - size_t _currentReadMaskOffset; - - BOOL _consumerStopped; - - BOOL _closeWhenFinishedWriting; - BOOL _failed; - - BOOL _secure; - NSURLRequest *_urlRequest; - - CFHTTPMessageRef _receivedHTTPHeaders; - - BOOL _sentClose; - BOOL _didFail; - int _closeCode; - - BOOL _isPumping; - - BOOL _cleanupScheduled; - - NSMutableSet *_scheduledRunloops; - - // We use this to retain ourselves. - __strong RCTSRWebSocket *_selfRetain; - - NSArray *_requestedProtocols; - RCTSRIOConsumerPool *_consumerPool; -} - -- (instancetype)initWithURLRequest:(NSURLRequest *)request protocols:(NSArray *)protocols -{ - RCTAssertParam(request); - - if ((self = [super init])) { - _url = request.URL; - _urlRequest = request; - - _requestedProtocols = [protocols copy]; - - [self _RCTSR_commonInit]; - } - return self; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (instancetype)initWithURLRequest:(NSURLRequest *)request; -{ - return [self initWithURLRequest:request protocols:nil]; -} - -- (instancetype)initWithURL:(NSURL *)URL; -{ - return [self initWithURL:URL protocols:nil]; -} - -- (instancetype)initWithURL:(NSURL *)URL protocols:(NSArray *)protocols; -{ - NSMutableURLRequest *request; - if (URL) { - // Build a mutable request so we can fill the cookie header. - request = [NSMutableURLRequest requestWithURL:URL]; - - // We load cookies from sharedHTTPCookieStorage (shared with XHR and - // fetch). To get HTTPS-only cookies for wss URLs, replace wss with https - // in the URL. - NSURLComponents *components = [NSURLComponents componentsWithURL:URL resolvingAgainstBaseURL:true]; - if ([components.scheme isEqualToString:@"wss"]) { - components.scheme = @"https"; - } - - // Load and set the cookie header. - NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:components.URL]; - [request setAllHTTPHeaderFields:[NSHTTPCookie requestHeaderFieldsWithCookies:cookies]]; - } - return [self initWithURLRequest:request protocols:protocols]; -} - -- (void)_RCTSR_commonInit; -{ - NSString *scheme = _url.scheme.lowercaseString; - assert([scheme isEqualToString:@"ws"] || [scheme isEqualToString:@"http"] || [scheme isEqualToString:@"wss"] || [scheme isEqualToString:@"https"]); - - if ([scheme isEqualToString:@"wss"] || [scheme isEqualToString:@"https"]) { - _secure = YES; - } - - _readyState = RCTSR_CONNECTING; - _consumerStopped = YES; - _webSocketVersion = 13; - - _workQueue = dispatch_queue_create("com.facebook.react.SRWebSocket", DISPATCH_QUEUE_SERIAL); - - // Going to set a specific on the queue so we can validate we're on the work queue - dispatch_queue_set_specific(_workQueue, (__bridge void *)self, (__bridge void *)_workQueue, NULL); - - _delegateDispatchQueue = dispatch_get_main_queue(); - - _readBuffer = [NSMutableData new]; - _outputBuffer = [NSMutableData new]; - - _currentFrameData = [NSMutableData new]; - - _consumers = [NSMutableArray new]; - - _consumerPool = [RCTSRIOConsumerPool new]; - - _scheduledRunloops = [NSMutableSet new]; - - [self _initializeStreams]; - - // default handlers -} - -- (void)assertOnWorkQueue; -{ - assert(dispatch_get_specific((__bridge void *)self) == (__bridge void *)_workQueue); -} - -- (void)dealloc -{ - _inputStream.delegate = nil; - _outputStream.delegate = nil; - - [_inputStream close]; - [_outputStream close]; - - if (_receivedHTTPHeaders) { - CFRelease(_receivedHTTPHeaders); - _receivedHTTPHeaders = NULL; - } -} - -#ifndef NDEBUG - -- (void)setReadyState:(RCTSRReadyState)aReadyState; -{ - [self willChangeValueForKey:@"readyState"]; - assert(aReadyState > _readyState); - _readyState = aReadyState; - [self didChangeValueForKey:@"readyState"]; -} - -#endif - -- (void)open; -{ - assert(_url); - RCTAssert(_readyState == RCTSR_CONNECTING, @"Cannot call -(void)open on RCTSRWebSocket more than once"); - - _selfRetain = self; - - [self _connect]; -} - -// Calls block on delegate queue -- (void)_performDelegateBlock:(dispatch_block_t)block; -{ - if (_delegateOperationQueue) { - [_delegateOperationQueue addOperationWithBlock:block]; - } else { - assert(_delegateDispatchQueue); - dispatch_async(_delegateDispatchQueue, block); - } -} - -- (void)setDelegateDispatchQueue:(dispatch_queue_t)queue; -{ - _delegateDispatchQueue = queue; -} - -- (BOOL)_checkHandshake:(CFHTTPMessageRef)httpMessage; -{ - NSString *acceptHeader = CFBridgingRelease(CFHTTPMessageCopyHeaderFieldValue(httpMessage, CFSTR("Sec-WebSocket-Accept"))); - - if (acceptHeader == nil) { - return NO; - } - - NSString *concattedString = [_secKey stringByAppendingString:RCTSRWebSocketAppendToSecKeyString]; - NSString *expectedAccept = [concattedString stringBySHA1ThenBase64Encoding]; - - return [acceptHeader isEqualToString:expectedAccept]; -} - -- (void)_HTTPHeadersDidFinish; -{ - NSInteger responseCode = CFHTTPMessageGetResponseStatusCode(_receivedHTTPHeaders); - - if (responseCode >= 400) { - RCTSRLog(@"Request failed with response code %ld", responseCode); - [self _failWithError:[NSError errorWithDomain:RCTSRWebSocketErrorDomain code:2132 userInfo:@{NSLocalizedDescriptionKey:[NSString stringWithFormat:@"received bad response code from server %ld", (long)responseCode], RCTSRHTTPResponseErrorKey:@(responseCode)}]]; - return; - } - - if (![self _checkHandshake:_receivedHTTPHeaders]) { - [self _failWithError:[NSError errorWithDomain:RCTSRWebSocketErrorDomain code:2133 userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Invalid Sec-WebSocket-Accept response"]}]]; - return; - } - - NSString *negotiatedProtocol = CFBridgingRelease(CFHTTPMessageCopyHeaderFieldValue(_receivedHTTPHeaders, CFSTR("Sec-WebSocket-Protocol"))); - if (negotiatedProtocol) { - // Make sure we requested the protocol - if ([_requestedProtocols indexOfObject:negotiatedProtocol] == NSNotFound) { - [self _failWithError:[NSError errorWithDomain:RCTSRWebSocketErrorDomain code:2133 userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Server specified Sec-WebSocket-Protocol that wasn't requested"]}]]; - return; - } - - _protocol = negotiatedProtocol; - } - - self.readyState = RCTSR_OPEN; - - if (!_didFail) { - [self _readFrameNew]; - } - - [self _performDelegateBlock:^{ - if ([self.delegate respondsToSelector:@selector(webSocketDidOpen:)]) { - [self.delegate webSocketDidOpen:self]; - }; - }]; -} - -- (void)_readHTTPHeader; -{ - if (_receivedHTTPHeaders == NULL) { - _receivedHTTPHeaders = CFHTTPMessageCreateEmpty(NULL, NO); - } - - [self _readUntilHeaderCompleteWithCallback:^(RCTSRWebSocket *socket, NSData *data) { - CFHTTPMessageAppendBytes(self->_receivedHTTPHeaders, (const UInt8 *)data.bytes, data.length); - - if (CFHTTPMessageIsHeaderComplete(self->_receivedHTTPHeaders)) { - RCTSRLog(@"Finished reading headers %@", CFBridgingRelease(CFHTTPMessageCopyAllHeaderFields(_receivedHTTPHeaders))); - [socket _HTTPHeadersDidFinish]; - } else { - [socket _readHTTPHeader]; - } - }]; -} - -- (void)didConnect -{ - RCTSRLog(@"Connected"); - CFHTTPMessageRef request = CFHTTPMessageCreateRequest(NULL, CFSTR("GET"), (__bridge CFURLRef)_url, kCFHTTPVersion1_1); - - // Set host first so it defaults - CFHTTPMessageSetHeaderFieldValue(request, CFSTR("Host"), (__bridge CFStringRef)(_url.port ? [NSString stringWithFormat:@"%@:%@", _url.host, _url.port] : _url.host)); - - NSMutableData *keyBytes = [[NSMutableData alloc] initWithLength:16]; - int result = SecRandomCopyBytes(kSecRandomDefault, keyBytes.length, keyBytes.mutableBytes); - assert(result == 0); - _secKey = [keyBytes base64EncodedStringWithOptions:0]; - assert([_secKey length] == 24); - - CFHTTPMessageSetHeaderFieldValue(request, CFSTR("Upgrade"), CFSTR("websocket")); - CFHTTPMessageSetHeaderFieldValue(request, CFSTR("Connection"), CFSTR("Upgrade")); - CFHTTPMessageSetHeaderFieldValue(request, CFSTR("Sec-WebSocket-Key"), (__bridge CFStringRef)_secKey); - CFHTTPMessageSetHeaderFieldValue(request, CFSTR("Sec-WebSocket-Version"), (__bridge CFStringRef)[NSString stringWithFormat:@"%ld", (long)_webSocketVersion]); - - CFHTTPMessageSetHeaderFieldValue(request, CFSTR("Origin"), (__bridge CFStringRef)_url.RCTSR_origin); - - if (_requestedProtocols) { - CFHTTPMessageSetHeaderFieldValue(request, CFSTR("Sec-WebSocket-Protocol"), (__bridge CFStringRef)[_requestedProtocols componentsJoinedByString:@", "]); - } - - [_urlRequest.allHTTPHeaderFields enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { - CFHTTPMessageSetHeaderFieldValue(request, (__bridge CFStringRef)key, (__bridge CFStringRef)obj); - }]; - - NSData *message = CFBridgingRelease(CFHTTPMessageCopySerializedMessage(request)); - - CFRelease(request); - - [self _writeData:message]; - [self _readHTTPHeader]; -} - -- (void)_initializeStreams; -{ - assert(_url.port.unsignedIntValue <= UINT32_MAX); - uint32_t port = _url.port.unsignedIntValue; - if (port == 0) { - if (!_secure) { - port = 80; - } else { - port = 443; - } - } - NSString *host = _url.host; - - CFReadStreamRef readStream = NULL; - CFWriteStreamRef writeStream = NULL; - - CFStreamCreatePairWithSocketToHost(NULL, (__bridge CFStringRef)host, port, &readStream, &writeStream); - - _outputStream = CFBridgingRelease(writeStream); - _inputStream = CFBridgingRelease(readStream); - - - if (_secure) { - NSMutableDictionary *SSLOptions = [NSMutableDictionary new]; - - [_outputStream setProperty:(__bridge id)kCFStreamSocketSecurityLevelNegotiatedSSL forKey:(__bridge id)kCFStreamPropertySocketSecurityLevel]; - - // If we're using pinned certs, don't validate the certificate chain - if (_urlRequest.RCTSR_SSLPinnedCertificates.count) { - [SSLOptions setValue:@NO forKey:(__bridge id)kCFStreamSSLValidatesCertificateChain]; - } - -#if DEBUG - [SSLOptions setValue:@NO forKey:(__bridge id)kCFStreamSSLValidatesCertificateChain]; - RCTLogInfo(@"SocketRocket: In debug mode. Allowing connection to any root cert"); -#endif - - [_outputStream setProperty:SSLOptions - forKey:(__bridge id)kCFStreamPropertySSLSettings]; - } - - _inputStream.delegate = self; - _outputStream.delegate = self; -} - -- (void)_connect; -{ - if (!_scheduledRunloops.count) { - [self scheduleInRunLoop:[NSRunLoop RCTSR_networkRunLoop] forMode:NSDefaultRunLoopMode]; - } - - [_outputStream open]; - [_inputStream open]; -} - -- (void)scheduleInRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode; -{ - [_outputStream scheduleInRunLoop:aRunLoop forMode:mode]; - [_inputStream scheduleInRunLoop:aRunLoop forMode:mode]; - - [_scheduledRunloops addObject:@[aRunLoop, mode]]; -} - -- (void)unscheduleFromRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode; -{ - [_outputStream removeFromRunLoop:aRunLoop forMode:mode]; - [_inputStream removeFromRunLoop:aRunLoop forMode:mode]; - - [_scheduledRunloops removeObject:@[aRunLoop, mode]]; -} - -- (void)close; -{ - [self closeWithCode:RCTSRStatusCodeNormal reason:nil]; -} - -- (void)closeWithCode:(NSInteger)code reason:(NSString *)reason; -{ - assert(code); - dispatch_async(_workQueue, ^{ - if (self.readyState == RCTSR_CLOSING || self.readyState == RCTSR_CLOSED) { - return; - } - - BOOL wasConnecting = self.readyState == RCTSR_CONNECTING; - - self.readyState = RCTSR_CLOSING; - - RCTSRLog(@"Closing with code %ld reason %@", code, reason); - - if (wasConnecting) { - [self _disconnect]; - return; - } - - size_t maxMsgSize = [reason maximumLengthOfBytesUsingEncoding:NSUTF8StringEncoding]; - NSMutableData *mutablePayload = [[NSMutableData alloc] initWithLength:sizeof(uint16_t) + maxMsgSize]; - NSData *payload = mutablePayload; - - ((uint16_t *)mutablePayload.mutableBytes)[0] = EndianU16_BtoN(code); - - if (reason) { - NSRange remainingRange = {0}; - - NSUInteger usedLength = 0; - - BOOL success = [reason getBytes:(char *)mutablePayload.mutableBytes + sizeof(uint16_t) maxLength:payload.length - sizeof(uint16_t) usedLength:&usedLength encoding:NSUTF8StringEncoding options:NSStringEncodingConversionExternalRepresentation range:NSMakeRange(0, reason.length) remainingRange:&remainingRange]; - - assert(success); - assert(remainingRange.length == 0); - - if (usedLength != maxMsgSize) { - payload = [payload subdataWithRange:NSMakeRange(0, usedLength + sizeof(uint16_t))]; - } - } - - [self _sendFrameWithOpcode:RCTSROpCodeConnectionClose data:payload]; - }); -} - -- (void)_closeWithProtocolError:(NSString *)message; -{ - // Need to shunt this on the _callbackQueue first to see if they received any messages - [self _performDelegateBlock:^{ - [self closeWithCode:RCTSRStatusCodeProtocolError reason:message]; - dispatch_async(self->_workQueue, ^{ - [self _disconnect]; - }); - }]; -} - -- (void)_failWithError:(NSError *)error; -{ - dispatch_async(_workQueue, ^{ - if (self.readyState != RCTSR_CLOSED) { - self->_failed = YES; - [self _performDelegateBlock:^{ - if ([self.delegate respondsToSelector:@selector(webSocket:didFailWithError:)]) { - [self.delegate webSocket:self didFailWithError:error]; - } - }]; - - self.readyState = RCTSR_CLOSED; - - RCTSRLog(@"Failing with error %@", error.localizedDescription); - - [self _disconnect]; - [self _scheduleCleanup]; - } - }); -} - -- (void)_writeData:(NSData *)data; -{ - [self assertOnWorkQueue]; - - if (_closeWhenFinishedWriting) { - return; - } - [_outputBuffer appendData:data]; - [self _pumpWriting]; -} - -- (void)send:(id)data; -{ - RCTAssert(self.readyState != RCTSR_CONNECTING, @"Invalid State: Cannot call send: until connection is open"); - // TODO: maybe not copy this for performance - data = [data copy]; - dispatch_async(_workQueue, ^{ - if ([data isKindOfClass:[NSString class]]) { - [self _sendFrameWithOpcode:RCTSROpCodeTextFrame data:[(NSString *)data dataUsingEncoding:NSUTF8StringEncoding]]; - } else if ([data isKindOfClass:[NSData class]]) { - [self _sendFrameWithOpcode:RCTSROpCodeBinaryFrame data:data]; - } else if (data == nil) { - [self _sendFrameWithOpcode:RCTSROpCodeTextFrame data:data]; - } else { - assert(NO); - } - }); -} - -- (void)sendPing:(NSData *)data; -{ - RCTAssert(self.readyState == RCTSR_OPEN, @"Invalid State: Cannot call send: until connection is open"); - // TODO: maybe not copy this for performance - data = [data copy] ?: [NSData data]; // It's okay for a ping to be empty - dispatch_async(_workQueue, ^{ - [self _sendFrameWithOpcode:RCTSROpCodePing data:data]; - }); -} - -- (void)handlePing:(NSData *)pingData; -{ - // Need to pingpong this off _callbackQueue first to make sure messages happen in order - [self _performDelegateBlock:^{ - dispatch_async(self->_workQueue, ^{ - [self _sendFrameWithOpcode:RCTSROpCodePong data:pingData]; - }); - }]; -} - -- (void)handlePong:(NSData *)pongData; -{ - RCTSRLog(@"Received pong"); - [self _performDelegateBlock:^{ - if ([self.delegate respondsToSelector:@selector(webSocket:didReceivePong:)]) { - [self.delegate webSocket:self didReceivePong:pongData]; - } - }]; -} - -- (void)_handleMessage:(id)message -{ - RCTSRLog(@"Received message"); - [self _performDelegateBlock:^{ - [self.delegate webSocket:self didReceiveMessage:message]; - }]; -} - -static inline BOOL closeCodeIsValid(int closeCode) -{ - if (closeCode < 1000) { - return NO; - } - - if (closeCode >= 1000 && closeCode <= 1011) { - if (closeCode == 1004 || - closeCode == 1005 || - closeCode == 1006) { - return NO; - } - return YES; - } - - if (closeCode >= 3000 && closeCode <= 3999) { - return YES; - } - - if (closeCode >= 4000 && closeCode <= 4999) { - return YES; - } - - return NO; -} - -// Note from RFC: -// -// If there is a body, the first two -// bytes of the body MUST be a 2-byte unsigned integer (in network byte -// order) representing a status code with value /code/ defined in -// Section 7.4. Following the 2-byte integer the body MAY contain UTF-8 -// encoded data with value /reason/, the interpretation of which is not -// defined by this specification. - -- (void)handleCloseWithData:(NSData *)data; -{ - size_t dataSize = data.length; - __block uint16_t closeCode = 0; - - RCTSRLog(@"Received close frame"); - - if (dataSize == 1) { - // TODO: handle error - [self _closeWithProtocolError:@"Payload for close must be larger than 2 bytes"]; - return; - } else if (dataSize >= 2) { - [data getBytes:&closeCode length:sizeof(closeCode)]; - _closeCode = EndianU16_BtoN(closeCode); - if (!closeCodeIsValid(_closeCode)) { - [self _closeWithProtocolError:[NSString stringWithFormat:@"Cannot have close code of %d", _closeCode]]; - return; - } - if (dataSize > 2) { - _closeReason = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(2, dataSize - 2)] encoding:NSUTF8StringEncoding]; - if (!_closeReason) { - [self _closeWithProtocolError:@"Close reason MUST be valid UTF-8"]; - return; - } - } - } else { - _closeCode = RCTSRStatusNoStatusReceived; - } - - [self assertOnWorkQueue]; - - if (self.readyState == RCTSR_OPEN) { - [self closeWithCode:1000 reason:nil]; - } - dispatch_async(_workQueue, ^{ - [self _disconnect]; - }); -} - -- (void)_disconnect; -{ - [self assertOnWorkQueue]; - RCTSRLog(@"Trying to disconnect"); - _closeWhenFinishedWriting = YES; - [self _pumpWriting]; -} - -- (void)_handleFrameWithData:(NSData *)frameData opCode:(NSInteger)opcode; -{ - // Check that the current data is valid UTF8 - - BOOL isControlFrame = (opcode == RCTSROpCodePing || opcode == RCTSROpCodePong || opcode == RCTSROpCodeConnectionClose); - if (!isControlFrame) { - [self _readFrameNew]; - } else { - dispatch_async(_workQueue, ^{ - [self _readFrameContinue]; - }); - } - - switch (opcode) { - case RCTSROpCodeTextFrame: { - NSString *str = [[NSString alloc] initWithData:frameData encoding:NSUTF8StringEncoding]; - if (str == nil && frameData) { - [self closeWithCode:RCTSRStatusCodeInvalidUTF8 reason:@"Text frames must be valid UTF-8"]; - dispatch_async(_workQueue, ^{ - [self _disconnect]; - }); - - return; - } - [self _handleMessage:str]; - break; - } - case RCTSROpCodeBinaryFrame: - [self _handleMessage:[frameData copy]]; - break; - case RCTSROpCodeConnectionClose: - [self handleCloseWithData:frameData]; - break; - case RCTSROpCodePing: - [self handlePing:frameData]; - break; - case RCTSROpCodePong: - [self handlePong:frameData]; - break; - default: - [self _closeWithProtocolError:[NSString stringWithFormat:@"Unknown opcode %ld", (long)opcode]]; - // TODO: Handle invalid opcode - break; - } -} - -- (void)_handleFrameHeader:(frame_header)frame_header curData:(NSData *)curData; -{ - assert(frame_header.opcode != 0); - - if (self.readyState != RCTSR_OPEN) { - return; - } - - BOOL isControlFrame = (frame_header.opcode == RCTSROpCodePing || frame_header.opcode == RCTSROpCodePong || frame_header.opcode == RCTSROpCodeConnectionClose); - - if (isControlFrame && !frame_header.fin) { - [self _closeWithProtocolError:@"Fragmented control frames not allowed"]; - return; - } - - if (isControlFrame && frame_header.payload_length >= 126) { - [self _closeWithProtocolError:@"Control frames cannot have payloads larger than 126 bytes"]; - return; - } - - if (!isControlFrame) { - _currentFrameOpcode = frame_header.opcode; - _currentFrameCount += 1; - } - - if (frame_header.payload_length == 0) { - if (isControlFrame) { - [self _handleFrameWithData:curData opCode:frame_header.opcode]; - } else { - if (frame_header.fin) { - [self _handleFrameWithData:_currentFrameData opCode:frame_header.opcode]; - } else { - // TODO: add assert that opcode is not a control; - [self _readFrameContinue]; - } - } - } else { - assert(frame_header.payload_length <= SIZE_T_MAX); - [self _addConsumerWithDataLength:(size_t)frame_header.payload_length callback:^(RCTSRWebSocket *socket, NSData *newData) { - if (isControlFrame) { - [socket _handleFrameWithData:newData opCode:frame_header.opcode]; - } else { - if (frame_header.fin) { - [socket _handleFrameWithData:socket->_currentFrameData opCode:frame_header.opcode]; - } else { - // TODO: add assert that opcode is not a control; - [socket _readFrameContinue]; - } - - } - } readToCurrentFrame:!isControlFrame unmaskBytes:frame_header.masked]; - } -} - -/* From RFC: - - 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-------+-+-------------+-------------------------------+ - |F|R|R|R| opcode|M| Payload len | Extended payload length | - |I|S|S|S| (4) |A| (7) | (16/64) | - |N|V|V|V| |S| | (if payload len==126/127) | - | |1|2|3| |K| | | - +-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - + - | Extended payload length continued, if payload len == 127 | - + - - - - - - - - - - - - - - - +-------------------------------+ - | |Masking-key, if MASK set to 1 | - +-------------------------------+-------------------------------+ - | Masking-key (continued) | Payload Data | - +-------------------------------- - - - - - - - - - - - - - - - + - : Payload Data continued ... : - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - | Payload Data continued ... | - +---------------------------------------------------------------+ - */ - -static const uint8_t RCTSRFinMask = 0x80; -static const uint8_t RCTSROpCodeMask = 0x0F; -static const uint8_t RCTSRRsvMask = 0x70; -static const uint8_t RCTSRMaskMask = 0x80; -static const uint8_t RCTSRPayloadLenMask = 0x7F; - -- (void)_readFrameContinue; -{ - assert((_currentFrameCount == 0 && _currentFrameOpcode == 0) || (_currentFrameCount > 0 && _currentFrameOpcode > 0)); - - [self _addConsumerWithDataLength:2 callback:^(RCTSRWebSocket *socket, NSData *data) { - __block frame_header header = {0}; - - const uint8_t *headerBuffer = data.bytes; - assert(data.length >= 2); - - if (headerBuffer[0] & RCTSRRsvMask) { - [socket _closeWithProtocolError:@"Server used RSV bits"]; - return; - } - - uint8_t receivedOpcode = (RCTSROpCodeMask &headerBuffer[0]); - - BOOL isControlFrame = (receivedOpcode == RCTSROpCodePing || receivedOpcode == RCTSROpCodePong || receivedOpcode == RCTSROpCodeConnectionClose); - - if (!isControlFrame && receivedOpcode != 0 && socket->_currentFrameCount > 0) { - [socket _closeWithProtocolError:@"all data frames after the initial data frame must have opcode 0"]; - return; - } - - if (receivedOpcode == 0 && socket->_currentFrameCount == 0) { - [socket _closeWithProtocolError:@"cannot continue a message"]; - return; - } - - header.opcode = receivedOpcode == 0 ? socket->_currentFrameOpcode : receivedOpcode; - - header.fin = !!(RCTSRFinMask &headerBuffer[0]); - - - header.masked = !!(RCTSRMaskMask &headerBuffer[1]); - header.payload_length = RCTSRPayloadLenMask & headerBuffer[1]; - - headerBuffer = NULL; - - if (header.masked) { - [socket _closeWithProtocolError:@"Client must receive unmasked data"]; - } - - size_t extra_bytes_needed = header.masked ? sizeof(self->_currentReadMaskKey) : 0; - - if (header.payload_length == 126) { - extra_bytes_needed += sizeof(uint16_t); - } else if (header.payload_length == 127) { - extra_bytes_needed += sizeof(uint64_t); - } - - if (extra_bytes_needed == 0) { - [socket _handleFrameHeader:header curData:socket->_currentFrameData]; - } else { - [socket _addConsumerWithDataLength:extra_bytes_needed callback:^(RCTSRWebSocket *_socket, NSData *_data) { - size_t mapped_size = _data.length; - const void *mapped_buffer = _data.bytes; - size_t offset = 0; - - if (header.payload_length == 126) { - assert(mapped_size >= sizeof(uint16_t)); - uint16_t newLen = EndianU16_BtoN(*(uint16_t *)(mapped_buffer)); - header.payload_length = newLen; - offset += sizeof(uint16_t); - } else if (header.payload_length == 127) { - assert(mapped_size >= sizeof(uint64_t)); - header.payload_length = EndianU64_BtoN(*(uint64_t *)(mapped_buffer)); - offset += sizeof(uint64_t); - } else { - assert(header.payload_length < 126 && header.payload_length >= 0); - } - - if (header.masked) { - assert(mapped_size >= sizeof(self->_currentReadMaskOffset) + offset); - memcpy(_socket->_currentReadMaskKey, ((uint8_t *)mapped_buffer) + offset, sizeof(_socket->_currentReadMaskKey)); - } - - [_socket _handleFrameHeader:header curData:_socket->_currentFrameData]; - } readToCurrentFrame:NO unmaskBytes:NO]; - } - } readToCurrentFrame:NO unmaskBytes:NO]; -} - -- (void)_readFrameNew; -{ - dispatch_async(_workQueue, ^{ - self->_currentFrameData.length = 0; - - self->_currentFrameOpcode = 0; - self->_currentFrameCount = 0; - self->_readOpCount = 0; - self->_currentStringScanPosition = 0; - - [self _readFrameContinue]; - }); -} - -- (void)_pumpWriting; -{ - [self assertOnWorkQueue]; - - NSUInteger dataLength = _outputBuffer.length; - if (dataLength - _outputBufferOffset > 0 && _outputStream.hasSpaceAvailable) { - NSInteger bytesWritten = [_outputStream write:_outputBuffer.bytes + _outputBufferOffset maxLength:dataLength - _outputBufferOffset]; - if (bytesWritten == -1) { - [self _failWithError:[NSError errorWithDomain:RCTSRWebSocketErrorDomain code:2145 userInfo:@{NSLocalizedDescriptionKey: @"Error writing to stream"}]]; - return; - } - - _outputBufferOffset += bytesWritten; - - if (_outputBufferOffset > 4096 && _outputBufferOffset > (_outputBuffer.length >> 1)) { - _outputBuffer = [[NSMutableData alloc] initWithBytes:(char *)_outputBuffer.bytes + _outputBufferOffset length:_outputBuffer.length - _outputBufferOffset]; - _outputBufferOffset = 0; - } - } - - if (_closeWhenFinishedWriting && - _outputBuffer.length - _outputBufferOffset == 0 && - (_inputStream.streamStatus != NSStreamStatusNotOpen && - _inputStream.streamStatus != NSStreamStatusClosed) && - !_sentClose) { - _sentClose = YES; - - [self _scheduleCleanup]; - - if (!_failed) { - [self _performDelegateBlock:^{ - if ([self.delegate respondsToSelector:@selector(webSocket:didCloseWithCode:reason:wasClean:)]) { - [self.delegate webSocket:self didCloseWithCode:self->_closeCode reason:self->_closeReason wasClean:YES]; - } - }]; - } - } -} - -- (void)_addConsumerWithScanner:(stream_scanner)consumer callback:(data_callback)callback; -{ - [self assertOnWorkQueue]; - [self _addConsumerWithScanner:consumer callback:callback dataLength:0]; -} - -- (void)_addConsumerWithDataLength:(size_t)dataLength callback:(data_callback)callback readToCurrentFrame:(BOOL)readToCurrentFrame unmaskBytes:(BOOL)unmaskBytes; -{ - [self assertOnWorkQueue]; - assert(dataLength); - - [_consumers addObject:[_consumerPool consumerWithScanner:nil handler:callback bytesNeeded:dataLength readToCurrentFrame:readToCurrentFrame unmaskBytes:unmaskBytes]]; - [self _pumpScanner]; -} - -- (void)_addConsumerWithScanner:(stream_scanner)consumer callback:(data_callback)callback dataLength:(size_t)dataLength; -{ - [self assertOnWorkQueue]; - [_consumers addObject:[_consumerPool consumerWithScanner:consumer handler:callback bytesNeeded:dataLength readToCurrentFrame:NO unmaskBytes:NO]]; - [self _pumpScanner]; -} - -static const char CRLFCRLFBytes[] = {'\r', '\n', '\r', '\n'}; - -- (void)_readUntilHeaderCompleteWithCallback:(data_callback)dataHandler; -{ - [self _readUntilBytes:CRLFCRLFBytes length:sizeof(CRLFCRLFBytes) callback:dataHandler]; -} - -- (void)_readUntilBytes:(const void *)bytes length:(size_t)length callback:(data_callback)dataHandler; -{ - // TODO: optimize so this can continue from where we last searched - stream_scanner consumer = ^size_t(NSData *data) { - __block size_t found_size = 0; - __block size_t match_count = 0; - - size_t size = data.length; - const unsigned char *buffer = data.bytes; - for (size_t i = 0; i < size; i++ ) { - if (((const unsigned char *)buffer)[i] == ((const unsigned char *)bytes)[match_count]) { - match_count += 1; - if (match_count == length) { - found_size = i + 1; - break; - } - } else { - match_count = 0; - } - } - return found_size; - }; - [self _addConsumerWithScanner:consumer callback:dataHandler]; -} - -// Returns true if did work -- (BOOL)_innerPumpScanner -{ - BOOL didWork = NO; - - if (self.readyState >= RCTSR_CLOSING) { - return didWork; - } - - if (!_consumers.count) { - return didWork; - } - - size_t curSize = _readBuffer.length - _readBufferOffset; - if (!curSize) { - return didWork; - } - - RCTSRIOConsumer *consumer = _consumers[0]; - - size_t bytesNeeded = consumer.bytesNeeded; - - size_t foundSize = 0; - if (consumer.consumer) { - NSData *tempView = [NSData dataWithBytesNoCopy:(char *)_readBuffer.bytes + _readBufferOffset length:_readBuffer.length - _readBufferOffset freeWhenDone:NO]; - foundSize = consumer.consumer(tempView); - } else { - assert(consumer.bytesNeeded); - if (curSize >= bytesNeeded) { - foundSize = bytesNeeded; - } else if (consumer.readToCurrentFrame) { - foundSize = curSize; - } - } - - NSData *slice = nil; - if (consumer.readToCurrentFrame || foundSize) { - NSRange sliceRange = NSMakeRange(_readBufferOffset, foundSize); - slice = [_readBuffer subdataWithRange:sliceRange]; - - _readBufferOffset += foundSize; - - if (_readBufferOffset > 4096 && _readBufferOffset > (_readBuffer.length >> 1)) { - _readBuffer = [[NSMutableData alloc] initWithBytes:(char *)_readBuffer.bytes + _readBufferOffset length:_readBuffer.length - _readBufferOffset]; _readBufferOffset = 0; - } - - if (consumer.unmaskBytes) { - NSMutableData *mutableSlice = [slice mutableCopy]; - - NSUInteger len = mutableSlice.length; - uint8_t *bytes = mutableSlice.mutableBytes; - - for (NSUInteger i = 0; i < len; i++) { - bytes[i] = bytes[i] ^ _currentReadMaskKey[_currentReadMaskOffset % sizeof(_currentReadMaskKey)]; - _currentReadMaskOffset += 1; - } - - slice = mutableSlice; - } - - if (consumer.readToCurrentFrame) { - [_currentFrameData appendData:slice]; - - _readOpCount += 1; - - if (_currentFrameOpcode == RCTSROpCodeTextFrame) { - // Validate UTF8 stuff. - size_t currentDataSize = _currentFrameData.length; - if (_currentFrameOpcode == RCTSROpCodeTextFrame && currentDataSize > 0) { - // TODO: Optimize this. Don't really have to copy all the data each time - - size_t scanSize = currentDataSize - _currentStringScanPosition; - - NSData *scan_data = [_currentFrameData subdataWithRange:NSMakeRange(_currentStringScanPosition, scanSize)]; - int32_t valid_utf8_size = validate_dispatch_data_partial_string(scan_data); - - if (valid_utf8_size == -1) { - [self closeWithCode:RCTSRStatusCodeInvalidUTF8 reason:@"Text frames must be valid UTF-8"]; - dispatch_async(_workQueue, ^{ - [self _disconnect]; - }); - return didWork; - } else { - _currentStringScanPosition += valid_utf8_size; - } - } - } - - consumer.bytesNeeded -= foundSize; - - if (consumer.bytesNeeded == 0) { - [_consumers removeObjectAtIndex:0]; - consumer.handler(self, nil); - [_consumerPool returnConsumer:consumer]; - didWork = YES; - } - } else if (foundSize) { - [_consumers removeObjectAtIndex:0]; - consumer.handler(self, slice); - [_consumerPool returnConsumer:consumer]; - didWork = YES; - } - } - return didWork; -} - -- (void)_pumpScanner; -{ - [self assertOnWorkQueue]; - - if (!_isPumping) { - _isPumping = YES; - } else { - return; - } - - while ([self _innerPumpScanner]) {} - - _isPumping = NO; -} - -//#define NOMASK - -static const size_t RCTSRFrameHeaderOverhead = 32; - -- (void)_sendFrameWithOpcode:(RCTSROpCode)opcode data:(id)data; -{ - [self assertOnWorkQueue]; - - if (nil == data) { - return; - } - - RCTAssert([data isKindOfClass:[NSData class]] || [data isKindOfClass:[NSString class]], @"NSString or NSData"); - - size_t payloadLength = [data isKindOfClass:[NSString class]] ? [(NSString *)data lengthOfBytesUsingEncoding:NSUTF8StringEncoding] : [data length]; - - NSMutableData *frame = [[NSMutableData alloc] initWithLength:payloadLength + RCTSRFrameHeaderOverhead]; - if (!frame) { - [self closeWithCode:RCTSRStatusCodeMessageTooBig reason:@"Message too big"]; - return; - } - uint8_t *frame_buffer = (uint8_t *)frame.mutableBytes; - - // set fin - frame_buffer[0] = RCTSRFinMask | opcode; - - BOOL useMask = YES; -#ifdef NOMASK - useMask = NO; -#endif - - if (useMask) { - // set the mask and header - frame_buffer[1] |= RCTSRMaskMask; - } - - size_t frame_buffer_size = 2; - - const uint8_t *unmasked_payload = NULL; - if ([data isKindOfClass:[NSData class]]) { - unmasked_payload = (uint8_t *)[data bytes]; - } else if ([data isKindOfClass:[NSString class]]) { - unmasked_payload = (const uint8_t *)[data UTF8String]; - } else { - return; - } - - if (payloadLength < 126) { - frame_buffer[1] |= payloadLength; - } else if (payloadLength <= UINT16_MAX) { - frame_buffer[1] |= 126; - *((uint16_t *)(frame_buffer + frame_buffer_size)) = EndianU16_BtoN((uint16_t)payloadLength); - frame_buffer_size += sizeof(uint16_t); - } else { - frame_buffer[1] |= 127; - *((uint64_t *)(frame_buffer + frame_buffer_size)) = EndianU64_BtoN((uint64_t)payloadLength); - frame_buffer_size += sizeof(uint64_t); - } - - if (!useMask) { - for (size_t i = 0; i < payloadLength; i++) { - frame_buffer[frame_buffer_size] = unmasked_payload[i]; - frame_buffer_size += 1; - } - } else { - uint8_t *mask_key = frame_buffer + frame_buffer_size; - int result = SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key); - assert(result == 0); - frame_buffer_size += sizeof(uint32_t); - - // TODO: could probably optimize this with SIMD - for (size_t i = 0; i < payloadLength; i++) { - frame_buffer[frame_buffer_size] = unmasked_payload[i] ^ mask_key[i % sizeof(uint32_t)]; - frame_buffer_size += 1; - } - } - - assert(frame_buffer_size <= [frame length]); - frame.length = frame_buffer_size; - - [self _writeData:frame]; -} - -- (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode; -{ - if (_secure && !_pinnedCertFound && (eventCode == NSStreamEventHasBytesAvailable || eventCode == NSStreamEventHasSpaceAvailable)) { - NSArray *sslCerts = _urlRequest.RCTSR_SSLPinnedCertificates; - if (sslCerts) { - SecTrustRef secTrust = (__bridge SecTrustRef)[aStream propertyForKey:(__bridge id)kCFStreamPropertySSLPeerTrust]; - if (secTrust) { - NSInteger numCerts = SecTrustGetCertificateCount(secTrust); - for (NSInteger i = 0; i < numCerts && !_pinnedCertFound; i++) { - SecCertificateRef cert = SecTrustGetCertificateAtIndex(secTrust, i); - NSData *certData = CFBridgingRelease(SecCertificateCopyData(cert)); - - for (id ref in sslCerts) { - SecCertificateRef trustedCert = (__bridge SecCertificateRef)ref; - NSData *trustedCertData = CFBridgingRelease(SecCertificateCopyData(trustedCert)); - - if ([trustedCertData isEqualToData:certData]) { - _pinnedCertFound = YES; - break; - } - } - } - } - - if (!_pinnedCertFound) { - dispatch_async(_workQueue, ^{ - [self _failWithError:[NSError errorWithDomain:RCTSRWebSocketErrorDomain code:23556 userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Invalid server cert"]}]]; - }); - return; - } - } - } - - // _workQueue cannot be NULL - if (!_workQueue) { - return; - } - __weak typeof(self) weakSelf = self; - dispatch_async(_workQueue, ^{ - typeof(self) strongSelf = weakSelf; - if (!strongSelf) { - return; - } - [strongSelf safeHandleEvent:eventCode stream:aStream]; - }); -} - -- (void)safeHandleEvent:(NSStreamEvent)eventCode stream:(NSStream *)aStream -{ - switch (eventCode) { - case NSStreamEventOpenCompleted: { - RCTSRLog(@"NSStreamEventOpenCompleted %@", aStream); - if (self.readyState >= RCTSR_CLOSING) { - return; - } - assert(self->_readBuffer); - - if (self.readyState == RCTSR_CONNECTING && aStream == self->_inputStream) { - [self didConnect]; - } - [self _pumpWriting]; - [self _pumpScanner]; - break; - } - - case NSStreamEventErrorOccurred: { - RCTSRLog(@"NSStreamEventErrorOccurred %@ %@", aStream, [aStream.streamError copy]); - // TODO: specify error better! - [self _failWithError:aStream.streamError]; - self->_readBufferOffset = 0; - self->_readBuffer.length = 0; - break; - - } - - case NSStreamEventEndEncountered: { - [self _pumpScanner]; - RCTSRLog(@"NSStreamEventEndEncountered %@", aStream); - if (aStream.streamError) { - [self _failWithError:aStream.streamError]; - } else { - dispatch_async(self->_workQueue, ^{ - if (self.readyState != RCTSR_CLOSED) { - self.readyState = RCTSR_CLOSED; - [self _scheduleCleanup]; - } - - if (!self->_sentClose && !self->_failed) { - self->_sentClose = YES; - // If we get closed in this state it's probably not clean because we should be sending this when we send messages - [self _performDelegateBlock:^{ - if ([self.delegate respondsToSelector:@selector(webSocket:didCloseWithCode:reason:wasClean:)]) { - [self.delegate webSocket:self didCloseWithCode:RCTSRStatusCodeGoingAway reason:@"Stream end encountered" wasClean:NO]; - } - }]; - } - }); - } - - break; - } - - case NSStreamEventHasBytesAvailable: { - RCTSRLog(@"NSStreamEventHasBytesAvailable %@", aStream); - const int bufferSize = 2048; - uint8_t buffer[bufferSize]; - - while (self->_inputStream.hasBytesAvailable) { - NSInteger bytes_read = [self->_inputStream read:buffer maxLength:bufferSize]; - - if (bytes_read > 0) { - [self->_readBuffer appendBytes:buffer length:bytes_read]; - } else if (bytes_read < 0) { - [self _failWithError:self->_inputStream.streamError]; - } - - if (bytes_read != bufferSize) { - break; - } - }; - [self _pumpScanner]; - break; - } - - case NSStreamEventHasSpaceAvailable: { - RCTSRLog(@"NSStreamEventHasSpaceAvailable %@", aStream); - [self _pumpWriting]; - break; - } - - default: - RCTSRLog(@"(default) %@", aStream); - break; - } -} - -- (void)_scheduleCleanup -{ - if (_cleanupScheduled) { - return; - } - - _cleanupScheduled = YES; - - // Cleanup NSStream's delegate in the same RunLoop used by the streams themselves: - // This way we'll prevent race conditions between handleEvent and SRWebsocket's dealloc - NSTimer *timer = [NSTimer timerWithTimeInterval:(0.0f) target:self selector:@selector(_cleanupSelfReference:) userInfo:nil repeats:NO]; - [[NSRunLoop RCTSR_networkRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode]; -} - -- (void)_cleanupSelfReference:(NSTimer *)timer -{ - // Remove the streams, right now, from the networkRunLoop - [_inputStream close]; - [_outputStream close]; - - // Unschedule from RunLoop - for (NSArray *runLoop in [_scheduledRunloops copy]) { - [self unscheduleFromRunLoop:runLoop[0] forMode:runLoop[1]]; - } - - // Nuke NSStream's delegate - _inputStream.delegate = nil; - _outputStream.delegate = nil; - - // Cleanup selfRetain in the same GCD queue as usual - dispatch_async(_workQueue, ^{ - self->_selfRetain = nil; - }); -} - -@end - -@implementation RCTSRIOConsumer - -- (void)setupWithScanner:(stream_scanner)scanner handler:(data_callback)handler bytesNeeded:(size_t)bytesNeeded readToCurrentFrame:(BOOL)readToCurrentFrame unmaskBytes:(BOOL)unmaskBytes; -{ - _consumer = [scanner copy]; - _handler = [handler copy]; - _bytesNeeded = bytesNeeded; - _readToCurrentFrame = readToCurrentFrame; - _unmaskBytes = unmaskBytes; - assert(_consumer || _bytesNeeded); -} - -@end - -@implementation RCTSRIOConsumerPool -{ - NSUInteger _poolSize; - NSMutableArray *_bufferedConsumers; -} - -- (instancetype)initWithBufferCapacity:(NSUInteger)poolSize; -{ - if ((self = [super init])) { - _poolSize = poolSize; - _bufferedConsumers = [[NSMutableArray alloc] initWithCapacity:poolSize]; - } - return self; -} - -- (instancetype)init -{ - return [self initWithBufferCapacity:8]; -} - -- (RCTSRIOConsumer *)consumerWithScanner:(stream_scanner)scanner handler:(data_callback)handler bytesNeeded:(size_t)bytesNeeded readToCurrentFrame:(BOOL)readToCurrentFrame unmaskBytes:(BOOL)unmaskBytes; -{ - RCTSRIOConsumer *consumer = nil; - if (_bufferedConsumers.count) { - consumer = _bufferedConsumers.lastObject; - [_bufferedConsumers removeLastObject]; - } else { - consumer = [RCTSRIOConsumer new]; - } - - [consumer setupWithScanner:scanner handler:handler bytesNeeded:bytesNeeded readToCurrentFrame:readToCurrentFrame unmaskBytes:unmaskBytes]; - - return consumer; -} - -- (void)returnConsumer:(RCTSRIOConsumer *)consumer; -{ - if (_bufferedConsumers.count < _poolSize) { - [_bufferedConsumers addObject:consumer]; - } -} - -@end - -@implementation NSURLRequest (CertificateAdditions) - -- (NSArray *)RCTSR_SSLPinnedCertificates; -{ - return [NSURLProtocol propertyForKey:@"RCTSR_SSLPinnedCertificates" inRequest:self]; -} - -@end - -@implementation NSMutableURLRequest (CertificateAdditions) - -- (NSArray *)RCTSR_SSLPinnedCertificates; -{ - return [NSURLProtocol propertyForKey:@"RCTSR_SSLPinnedCertificates" inRequest:self]; -} - -- (void)setRCTSR_SSLPinnedCertificates:(NSArray *)RCTSR_SSLPinnedCertificates; -{ - [NSURLProtocol setProperty:RCTSR_SSLPinnedCertificates forKey:@"RCTSR_SSLPinnedCertificates" inRequest:self]; -} - -@end - -@implementation NSURL (RCTSRWebSocket) - -- (NSString *)RCTSR_origin; -{ - NSString *scheme = self.scheme.lowercaseString; - - if ([scheme isEqualToString:@"wss"]) { - scheme = @"https"; - } else if ([scheme isEqualToString:@"ws"]) { - scheme = @"http"; - } - - int defaultPort = ([scheme isEqualToString:@"https"] ? 443 : - [scheme isEqualToString:@"http"] ? 80 : - -1); - int port = self.port.intValue; - if (port > 0 && port != defaultPort) { - return [NSString stringWithFormat:@"%@://%@:%d", scheme, self.host, port]; - } else { - return [NSString stringWithFormat:@"%@://%@", scheme, self.host]; - } -} - -@end - -static _RCTSRRunLoopThread *networkThread = nil; -static NSRunLoop *networkRunLoop = nil; - -@implementation NSRunLoop (RCTSRWebSocket) - -+ (NSRunLoop *)RCTSR_networkRunLoop -{ - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - networkThread = [_RCTSRRunLoopThread new]; - networkThread.name = @"com.squareup.SocketRocket.NetworkThread"; - [networkThread start]; - networkRunLoop = networkThread.runLoop; - }); - - return networkRunLoop; -} - -@end - -@implementation _RCTSRRunLoopThread -{ - dispatch_group_t _waitGroup; -} - -@synthesize runLoop = _runLoop; - -- (instancetype)init -{ - if ((self = [super init])) { - _waitGroup = dispatch_group_create(); - dispatch_group_enter(_waitGroup); - } - return self; -} - -- (void)main; -{ - @autoreleasepool { - _runLoop = [NSRunLoop currentRunLoop]; - dispatch_group_leave(_waitGroup); - - NSTimer *timer = [[NSTimer alloc] initWithFireDate:[NSDate distantFuture] interval:0.0 target:self selector:@selector(step) userInfo:nil repeats:NO]; - [_runLoop addTimer:timer forMode:NSDefaultRunLoopMode]; - - while ([_runLoop runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]) { } - assert(NO); - } -} - -- (void)step -{ - // Does nothing -} - -- (NSRunLoop *)runLoop; -{ - dispatch_group_wait(_waitGroup, DISPATCH_TIME_FOREVER); - return _runLoop; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj b/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj deleted file mode 100644 index 2fa18295..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj +++ /dev/null @@ -1,578 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 1338BBE01B04ACC80064A9C9 /* RCTSRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */; }; - 1338BBE11B04ACC80064A9C9 /* RCTWebSocketExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */; }; - 2D3ABDC220C7206E00DF56E9 /* libfishhook.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DBE0D001F3B181A0099AA32 /* libfishhook.a */; }; - 2D3B5F3D1D9B165B00451313 /* RCTSRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */; }; - 2D3B5F3E1D9B165B00451313 /* RCTWebSocketExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */; }; - 2D3B5F401D9B165B00451313 /* RCTWebSocketModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */; }; - 3C86DF7C1ADF695F0047B81A /* RCTWebSocketModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */; }; - 3DBE0D141F3B185A0099AA32 /* fishhook.c in Sources */ = {isa = PBXBuildFile; fileRef = 3DBE0D121F3B185A0099AA32 /* fishhook.c */; }; - 3DBE0D151F3B185A0099AA32 /* fishhook.c in Sources */ = {isa = PBXBuildFile; fileRef = 3DBE0D121F3B185A0099AA32 /* fishhook.c */; }; - 3DBE0D801F3B1AF00099AA32 /* fishhook.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3DBE0D131F3B185A0099AA32 /* fishhook.h */; }; - 3DBE0D821F3B1B0C0099AA32 /* fishhook.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3DBE0D131F3B185A0099AA32 /* fishhook.h */; }; - A12E9E2E1E5DEC4E0029001B /* RCTReconnectingWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = A12E9E2D1E5DEC4E0029001B /* RCTReconnectingWebSocket.m */; }; - A12E9E2F1E5DEC550029001B /* RCTReconnectingWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = A12E9E2D1E5DEC4E0029001B /* RCTReconnectingWebSocket.m */; }; - ED297176215062BA00B7C4FE /* libfishhook-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DBE0D0D1F3B181C0099AA32 /* libfishhook-tvOS.a */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 3DBE0D0E1F3B18490099AA32 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 3C86DF3E1ADF2C930047B81A /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3DBE0CF41F3B181A0099AA32; - remoteInfo = fishhook; - }; - 3DBE0D101F3B184D0099AA32 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 3C86DF3E1ADF2C930047B81A /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3DBE0D011F3B181C0099AA32; - remoteInfo = "fishhook-tvOS"; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 3DBE0D7F1F3B1AEC0099AA32 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/fishhook; - dstSubfolderSpec = 16; - files = ( - 3DBE0D801F3B1AF00099AA32 /* fishhook.h in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3DBE0D811F3B1B010099AA32 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/fishhook; - dstSubfolderSpec = 16; - files = ( - 3DBE0D821F3B1B0C0099AA32 /* fishhook.h in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 1338BBDC1B04ACC80064A9C9 /* RCTSRWebSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSRWebSocket.h; sourceTree = ""; }; - 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSRWebSocket.m; sourceTree = ""; }; - 1338BBDE1B04ACC80064A9C9 /* RCTWebSocketExecutor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebSocketExecutor.h; sourceTree = ""; }; - 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWebSocketExecutor.m; sourceTree = ""; }; - 13526A511F362F7F0008EF00 /* libfishhook.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libfishhook.a; sourceTree = ""; }; - 2D2A28881D9B049200D4039D /* libRCTWebSocket-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTWebSocket-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 2DC5E5271F3A6CFD000EE84B /* libfishhook-tvOS.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libfishhook-tvOS.a"; path = "../fishhook/build/Debug-appletvos/libfishhook-tvOS.a"; sourceTree = ""; }; - 3C86DF461ADF2C930047B81A /* libRCTWebSocket.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTWebSocket.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 3C86DF7A1ADF695F0047B81A /* RCTWebSocketModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebSocketModule.h; sourceTree = ""; }; - 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.objc; path = RCTWebSocketModule.m; sourceTree = ""; tabWidth = 2; }; - 3DBE0D001F3B181A0099AA32 /* libfishhook.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libfishhook.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 3DBE0D0D1F3B181C0099AA32 /* libfishhook-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libfishhook-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 3DBE0D121F3B185A0099AA32 /* fishhook.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fishhook.c; path = ../fishhook/fishhook.c; sourceTree = ""; }; - 3DBE0D131F3B185A0099AA32 /* fishhook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fishhook.h; path = ../fishhook/fishhook.h; 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 PBXFrameworksBuildPhase section */ - 13526A4F1F362F770008EF00 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D3ABDC220C7206E00DF56E9 /* libfishhook.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2DC5E5151F3A6C39000EE84B /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ED297176215062BA00B7C4FE /* libfishhook-tvOS.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 13526A501F362F7F0008EF00 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 2DC5E5271F3A6CFD000EE84B /* libfishhook-tvOS.a */, - 13526A511F362F7F0008EF00 /* libfishhook.a */, - ); - name = Frameworks; - sourceTree = ""; - }; - 3C86DF3D1ADF2C930047B81A = { - isa = PBXGroup; - children = ( - 3DBE0D121F3B185A0099AA32 /* fishhook.c */, - 3DBE0D131F3B185A0099AA32 /* fishhook.h */, - A12E9E2C1E5DEC4E0029001B /* RCTReconnectingWebSocket.h */, - A12E9E2D1E5DEC4E0029001B /* RCTReconnectingWebSocket.m */, - 1338BBDC1B04ACC80064A9C9 /* RCTSRWebSocket.h */, - 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */, - 1338BBDE1B04ACC80064A9C9 /* RCTWebSocketExecutor.h */, - 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */, - 3C86DF7A1ADF695F0047B81A /* RCTWebSocketModule.h */, - 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */, - 3C86DF471ADF2C930047B81A /* Products */, - 13526A501F362F7F0008EF00 /* Frameworks */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - usesTabs = 0; - }; - 3C86DF471ADF2C930047B81A /* Products */ = { - isa = PBXGroup; - children = ( - 3C86DF461ADF2C930047B81A /* libRCTWebSocket.a */, - 2D2A28881D9B049200D4039D /* libRCTWebSocket-tvOS.a */, - 3DBE0D001F3B181A0099AA32 /* libfishhook.a */, - 3DBE0D0D1F3B181C0099AA32 /* libfishhook-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 2D2A28871D9B049200D4039D /* RCTWebSocket-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D2A28901D9B049200D4039D /* Build configuration list for PBXNativeTarget "RCTWebSocket-tvOS" */; - buildPhases = ( - 2D2A28841D9B049200D4039D /* Sources */, - 2DC5E5151F3A6C39000EE84B /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 3DBE0D111F3B184D0099AA32 /* PBXTargetDependency */, - ); - name = "RCTWebSocket-tvOS"; - productName = "RCTWebSocket-tvOS"; - productReference = 2D2A28881D9B049200D4039D /* libRCTWebSocket-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; - 3C86DF451ADF2C930047B81A /* RCTWebSocket */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3C86DF5A1ADF2C930047B81A /* Build configuration list for PBXNativeTarget "RCTWebSocket" */; - buildPhases = ( - 3C86DF421ADF2C930047B81A /* Sources */, - 13526A4F1F362F770008EF00 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 3DBE0D0F1F3B18490099AA32 /* PBXTargetDependency */, - ); - name = RCTWebSocket; - productName = WebSocket; - productReference = 3C86DF461ADF2C930047B81A /* libRCTWebSocket.a */; - productType = "com.apple.product-type.library.static"; - }; - 3DBE0CF41F3B181A0099AA32 /* fishhook */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3DBE0CFD1F3B181A0099AA32 /* Build configuration list for PBXNativeTarget "fishhook" */; - buildPhases = ( - 3DBE0D7F1F3B1AEC0099AA32 /* CopyFiles */, - 3DBE0CF51F3B181A0099AA32 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = fishhook; - productName = WebSocket; - productReference = 3DBE0D001F3B181A0099AA32 /* libfishhook.a */; - productType = "com.apple.product-type.library.static"; - }; - 3DBE0D011F3B181C0099AA32 /* fishhook-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3DBE0D0A1F3B181C0099AA32 /* Build configuration list for PBXNativeTarget "fishhook-tvOS" */; - buildPhases = ( - 3DBE0D811F3B1B010099AA32 /* CopyFiles */, - 3DBE0D021F3B181C0099AA32 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "fishhook-tvOS"; - productName = "RCTWebSocket-tvOS"; - productReference = 3DBE0D0D1F3B181C0099AA32 /* libfishhook-tvOS.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 3C86DF3E1ADF2C930047B81A /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 2D2A28871D9B049200D4039D = { - CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Automatic; - }; - 3C86DF451ADF2C930047B81A = { - CreatedOnToolsVersion = 6.3; - }; - }; - }; - buildConfigurationList = 3C86DF411ADF2C930047B81A /* Build configuration list for PBXProject "RCTWebSocket" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 3C86DF3D1ADF2C930047B81A; - productRefGroup = 3C86DF471ADF2C930047B81A /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 3C86DF451ADF2C930047B81A /* RCTWebSocket */, - 2D2A28871D9B049200D4039D /* RCTWebSocket-tvOS */, - 3DBE0CF41F3B181A0099AA32 /* fishhook */, - 3DBE0D011F3B181C0099AA32 /* fishhook-tvOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 2D2A28841D9B049200D4039D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D3B5F3E1D9B165B00451313 /* RCTWebSocketExecutor.m in Sources */, - 2D3B5F401D9B165B00451313 /* RCTWebSocketModule.m in Sources */, - A12E9E2F1E5DEC550029001B /* RCTReconnectingWebSocket.m in Sources */, - 2D3B5F3D1D9B165B00451313 /* RCTSRWebSocket.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3C86DF421ADF2C930047B81A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1338BBE01B04ACC80064A9C9 /* RCTSRWebSocket.m in Sources */, - 3C86DF7C1ADF695F0047B81A /* RCTWebSocketModule.m in Sources */, - A12E9E2E1E5DEC4E0029001B /* RCTReconnectingWebSocket.m in Sources */, - 1338BBE11B04ACC80064A9C9 /* RCTWebSocketExecutor.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3DBE0CF51F3B181A0099AA32 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3DBE0D141F3B185A0099AA32 /* fishhook.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3DBE0D021F3B181C0099AA32 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3DBE0D151F3B185A0099AA32 /* fishhook.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 3DBE0D0F1F3B18490099AA32 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3DBE0CF41F3B181A0099AA32 /* fishhook */; - targetProxy = 3DBE0D0E1F3B18490099AA32 /* PBXContainerItemProxy */; - }; - 3DBE0D111F3B184D0099AA32 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3DBE0D011F3B181C0099AA32 /* fishhook-tvOS */; - targetProxy = 3DBE0D101F3B184D0099AA32 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 2D2A288E1D9B049200D4039D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 2D2A288F1D9B049200D4039D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; - 3C86DF581ADF2C930047B81A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Debug; - }; - 3C86DF591ADF2C930047B81A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - WARNING_CFLAGS = ( - "-Werror", - "-Wall", - ); - }; - name = Release; - }; - 3C86DF5B1ADF2C930047B81A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = lib; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "RCT_METRO_PORT=${RCT_METRO_PORT}", - "$(inherited)", - ); - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 3C86DF5C1ADF2C930047B81A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = lib; - GCC_PREPROCESSOR_DEFINITIONS = "RCT_METRO_PORT=${RCT_METRO_PORT}"; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - 3DBE0CFE1F3B181A0099AA32 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = lib; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 3DBE0CFF1F3B181A0099AA32 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = lib; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - 3DBE0D0B1F3B181C0099AA32 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 3DBE0D0C1F3B181C0099AA32 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2D2A28901D9B049200D4039D /* Build configuration list for PBXNativeTarget "RCTWebSocket-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D2A288E1D9B049200D4039D /* Debug */, - 2D2A288F1D9B049200D4039D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3C86DF411ADF2C930047B81A /* Build configuration list for PBXProject "RCTWebSocket" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3C86DF581ADF2C930047B81A /* Debug */, - 3C86DF591ADF2C930047B81A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3C86DF5A1ADF2C930047B81A /* Build configuration list for PBXNativeTarget "RCTWebSocket" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3C86DF5B1ADF2C930047B81A /* Debug */, - 3C86DF5C1ADF2C930047B81A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3DBE0CFD1F3B181A0099AA32 /* Build configuration list for PBXNativeTarget "fishhook" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3DBE0CFE1F3B181A0099AA32 /* Debug */, - 3DBE0CFF1F3B181A0099AA32 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3DBE0D0A1F3B181C0099AA32 /* Build configuration list for PBXNativeTarget "fishhook-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3DBE0D0B1F3B181C0099AA32 /* Debug */, - 3DBE0D0C1F3B181C0099AA32 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 3C86DF3E1ADF2C930047B81A /* Project object */; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTWebSocketExecutor.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTWebSocketExecutor.h deleted file mode 100644 index 98d6f8fa..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTWebSocketExecutor.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -#if RCT_DEV // Debug executors are only supported in dev mode - -@interface RCTWebSocketExecutor : NSObject - -- (instancetype)initWithURL:(NSURL *)URL; - -@end - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTWebSocketExecutor.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTWebSocketExecutor.m deleted file mode 100644 index 4d8daa32..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTWebSocketExecutor.m +++ /dev/null @@ -1,273 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTWebSocketExecutor.h" - -#import -#import -#import -#import -#import -#import - -#import "RCTSRWebSocket.h" - -#if RCT_DEV // Debug executors are only supported in dev mode - -typedef void (^RCTWSMessageCallback)(NSError *error, NSDictionary *reply); - -@interface RCTWebSocketExecutor () - -@end - -@implementation RCTWebSocketExecutor -{ - RCTSRWebSocket *_socket; - dispatch_queue_t _jsQueue; - NSMutableDictionary *_callbacks; - dispatch_semaphore_t _socketOpenSemaphore; - NSMutableDictionary *_injectedObjects; - NSURL *_url; - NSError *_setupError; -} - -RCT_EXPORT_MODULE() - -@synthesize bridge = _bridge; - -- (instancetype)initWithURL:(NSURL *)URL -{ - RCTAssertParam(URL); - - if ((self = [self init])) { - _url = URL; - } - return self; -} - -- (void)setUp -{ - if (!_url) { - NSInteger port = [[[_bridge bundleURL] port] integerValue] ?: RCT_METRO_PORT; - NSString *host = [[_bridge bundleURL] host] ?: @"localhost"; - NSString *URLString = [NSString stringWithFormat:@"http://%@:%lld/debugger-proxy?role=client", host, (long long)port]; - _url = [RCTConvert NSURL:URLString]; - } - - _jsQueue = dispatch_queue_create("com.facebook.react.WebSocketExecutor", DISPATCH_QUEUE_SERIAL); - _socket = [[RCTSRWebSocket alloc] initWithURL:_url]; - _socket.delegate = self; - _callbacks = [NSMutableDictionary new]; - _injectedObjects = [NSMutableDictionary new]; - [_socket setDelegateDispatchQueue:_jsQueue]; - - NSURL *startDevToolsURL = [NSURL URLWithString:@"/launch-js-devtools" relativeToURL:_url]; - - NSURLSession *session = [NSURLSession sharedSession]; - NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:[NSURLRequest requestWithURL:startDevToolsURL] - completionHandler:^(NSData *data, NSURLResponse *response, NSError *error){}]; - [dataTask resume]; - if (![self connectToProxy]) { - [self invalidate]; - NSString *error = [NSString stringWithFormat:@"Connection to %@ timed out. Are you " - "running node proxy? If you are running on the device, check if " - "you have the right IP address in `RCTWebSocketExecutor.m`.", _url]; - _setupError = RCTErrorWithMessage(error); - RCTFatal(_setupError); - return; - } - - NSInteger retries = 3; - BOOL runtimeIsReady = [self prepareJSRuntime]; - while (!runtimeIsReady && retries > 0) { - runtimeIsReady = [self prepareJSRuntime]; - retries--; - } - if (!runtimeIsReady) { - [self invalidate]; - NSString *error = @"Runtime is not ready for debugging.\n " - "- Make sure Packager server is running.\n" - "- Make sure the JavaScript Debugger is running and not paused on a " - "breakpoint or exception and try reloading again."; - _setupError = RCTErrorWithMessage(error); - RCTFatal(_setupError); - return; - } -} - -- (BOOL)connectToProxy -{ - _socketOpenSemaphore = dispatch_semaphore_create(0); - [_socket open]; - long connected = dispatch_semaphore_wait(_socketOpenSemaphore, dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * 15)); - return connected == 0 && _socket.readyState == RCTSR_OPEN; -} - -- (BOOL)prepareJSRuntime -{ - __block NSError *initError; - dispatch_semaphore_t s = dispatch_semaphore_create(0); - [self sendMessage:@{@"method": @"prepareJSRuntime"} onReply:^(NSError *error, NSDictionary *reply) { - initError = error; - dispatch_semaphore_signal(s); - }]; - long runtimeIsReady = dispatch_semaphore_wait(s, dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * 10)); - if (initError) { - RCTLogInfo(@"Websocket runtime setup failed: %@", initError); - } - return runtimeIsReady == 0 && initError == nil; -} - -- (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message -{ - NSError *error = nil; - NSDictionary *reply = RCTJSONParse(message, &error); - NSNumber *messageID = reply[@"replyID"]; - RCTWSMessageCallback callback = _callbacks[messageID]; - if (callback) { - callback(error, reply); - [_callbacks removeObjectForKey:messageID]; - } -} - -- (void)webSocketDidOpen:(RCTSRWebSocket *)webSocket -{ - dispatch_semaphore_signal(_socketOpenSemaphore); -} - -- (void)webSocket:(RCTSRWebSocket *)webSocket didFailWithError:(NSError *)error -{ - dispatch_semaphore_signal(_socketOpenSemaphore); - RCTLogInfo(@"WebSocket connection failed with error %@", error); -} - -- (void)sendMessage:(NSDictionary *)message onReply:(RCTWSMessageCallback)callback -{ - static NSUInteger lastID = 10000; - - if (_setupError) { - callback(_setupError, nil); - return; - } - - dispatch_async(_jsQueue, ^{ - if (!self.valid) { - callback(RCTErrorWithMessage(@"Runtime is not ready for debugging. Make sure Packager server is running."), nil); - return; - } - - NSNumber *expectedID = @(lastID++); - self->_callbacks[expectedID] = [callback copy]; - NSMutableDictionary *messageWithID = [message mutableCopy]; - messageWithID[@"id"] = expectedID; - [self->_socket send:RCTJSONStringify(messageWithID, NULL)]; - }); -} - -- (void)executeApplicationScript:(NSData *)script sourceURL:(NSURL *)URL onComplete:(RCTJavaScriptCompleteBlock)onComplete -{ - // Hack: the bridge transitions out of loading state as soon as this method returns, which prevents us - // from completely invalidating the bridge and preventing an endless barage of RCTLog.logIfNoNativeHook - // calls if the JS execution environment is broken. We therefore block this thread until this message has returned. - dispatch_semaphore_t scriptSem = dispatch_semaphore_create(0); - - NSDictionary *message = @{ - @"method": @"executeApplicationScript", - @"url": RCTNullIfNil(URL.absoluteString), - @"inject": _injectedObjects, - }; - [self sendMessage:message onReply:^(NSError *socketError, NSDictionary *reply) { - if (socketError) { - onComplete(socketError); - } else { - NSString *error = reply[@"error"]; - onComplete(error ? RCTErrorWithMessage(error) : nil); - } - dispatch_semaphore_signal(scriptSem); - }]; - - dispatch_semaphore_wait(scriptSem, DISPATCH_TIME_FOREVER); -} - -- (void)flushedQueue:(RCTJavaScriptCallback)onComplete -{ - [self _executeJSCall:@"flushedQueue" arguments:@[] callback:onComplete]; -} - -- (void)callFunctionOnModule:(NSString *)module - method:(NSString *)method - arguments:(NSArray *)args - callback:(RCTJavaScriptCallback)onComplete -{ - [self _executeJSCall:@"callFunctionReturnFlushedQueue" arguments:@[module, method, args] callback:onComplete]; -} - -- (void)invokeCallbackID:(NSNumber *)cbID - arguments:(NSArray *)args - callback:(RCTJavaScriptCallback)onComplete -{ - [self _executeJSCall:@"invokeCallbackAndReturnFlushedQueue" arguments:@[cbID, args] callback:onComplete]; -} - -- (void)_executeJSCall:(NSString *)method arguments:(NSArray *)arguments callback:(RCTJavaScriptCallback)onComplete -{ - RCTAssert(onComplete != nil, @"callback was missing for exec JS call"); - NSDictionary *message = @{ - @"method": method, - @"arguments": arguments - }; - [self sendMessage:message onReply:^(NSError *socketError, NSDictionary *reply) { - if (socketError) { - onComplete(nil, socketError); - return; - } - - NSError *jsonError; - id result = RCTJSONParse(reply[@"result"], &jsonError); - NSString *error = reply[@"error"]; - onComplete(result, error ? RCTErrorWithMessage(error) : jsonError); - }]; -} - -- (void)injectJSONText:(NSString *)script asGlobalObjectNamed:(NSString *)objectName callback:(RCTJavaScriptCompleteBlock)onComplete -{ - dispatch_async(_jsQueue, ^{ - self->_injectedObjects[objectName] = script; - onComplete(nil); - }); -} - -- (void)executeBlockOnJavaScriptQueue:(dispatch_block_t)block -{ - RCTExecuteOnMainQueue(block); -} - -- (void)executeAsyncBlockOnJavaScriptQueue:(dispatch_block_t)block -{ - dispatch_async(dispatch_get_main_queue(), block); -} - -- (void)invalidate -{ - _socket.delegate = nil; - [_socket closeWithCode:1000 reason:@"Invalidated"]; - _socket = nil; -} - -- (BOOL)isValid -{ - return _socket != nil && _socket.readyState == RCTSR_OPEN; -} - -- (void)dealloc -{ - RCTAssert(!self.valid, @"-invalidate must be called before -dealloc"); -} - -@end - -#endif diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTWebSocketModule.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTWebSocketModule.h deleted file mode 100644 index 88dbdcbf..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTWebSocketModule.h +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTWebSocketContentHandler - -- (id)processWebsocketMessage:(id __nullable)message - forSocketID:(NSNumber *)socketID - withType:(NSString *__nonnull __autoreleasing *__nonnull)type; - -@end - -@interface RCTWebSocketModule : RCTEventEmitter - -// Register a custom handler for a specific websocket. The handler will be strongly held by the WebSocketModule. -- (void)setContentHandler:(id __nullable)handler forSocketID:(NSNumber *)socketID; - -- (void)sendData:(NSData *)data forSocketID:(nonnull NSNumber *)socketID; - -@end - -@interface RCTBridge (RCTWebSocketModule) - -- (RCTWebSocketModule *)webSocketModule; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTWebSocketModule.m b/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTWebSocketModule.m deleted file mode 100644 index af8e7706..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/RCTWebSocketModule.m +++ /dev/null @@ -1,198 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTWebSocketModule.h" - -#import - -#import -#import - -#import "RCTSRWebSocket.h" - -@implementation RCTSRWebSocket (React) - -- (NSNumber *)reactTag -{ - return objc_getAssociatedObject(self, _cmd); -} - -- (void)setReactTag:(NSNumber *)reactTag -{ - objc_setAssociatedObject(self, @selector(reactTag), reactTag, OBJC_ASSOCIATION_COPY_NONATOMIC); -} - -@end - -@interface RCTWebSocketModule () - -@end - -@implementation RCTWebSocketModule -{ - NSMutableDictionary *_sockets; - NSMutableDictionary> *_contentHandlers; -} - -RCT_EXPORT_MODULE() - -// Used by RCTBlobModule -@synthesize methodQueue = _methodQueue; - -- (NSArray *)supportedEvents -{ - return @[@"websocketMessage", - @"websocketOpen", - @"websocketFailed", - @"websocketClosed"]; -} - -- (void)invalidate -{ - _contentHandlers = nil; - for (RCTSRWebSocket *socket in _sockets.allValues) { - socket.delegate = nil; - [socket close]; - } -} - -RCT_EXPORT_METHOD(connect:(NSURL *)URL protocols:(NSArray *)protocols options:(NSDictionary *)options socketID:(nonnull NSNumber *)socketID) -{ - NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL]; - - // We load cookies from sharedHTTPCookieStorage (shared with XHR and - // fetch). To get secure cookies for wss URLs, replace wss with https - // in the URL. - NSURLComponents *components = [NSURLComponents componentsWithURL:URL resolvingAgainstBaseURL:true]; - if ([components.scheme.lowercaseString isEqualToString:@"wss"]) { - components.scheme = @"https"; - } - - // Load and set the cookie header. - NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:components.URL]; - request.allHTTPHeaderFields = [NSHTTPCookie requestHeaderFieldsWithCookies:cookies]; - - // Load supplied headers - [options[@"headers"] enumerateKeysAndObjectsUsingBlock:^(NSString *key, id value, BOOL *stop) { - [request addValue:[RCTConvert NSString:value] forHTTPHeaderField:key]; - }]; - - RCTSRWebSocket *webSocket = [[RCTSRWebSocket alloc] initWithURLRequest:request protocols:protocols]; - [webSocket setDelegateDispatchQueue:_methodQueue]; - webSocket.delegate = self; - webSocket.reactTag = socketID; - if (!_sockets) { - _sockets = [NSMutableDictionary new]; - } - _sockets[socketID] = webSocket; - [webSocket open]; -} - -RCT_EXPORT_METHOD(send:(NSString *)message forSocketID:(nonnull NSNumber *)socketID) -{ - [_sockets[socketID] send:message]; -} - -RCT_EXPORT_METHOD(sendBinary:(NSString *)base64String forSocketID:(nonnull NSNumber *)socketID) -{ - [self sendData:[[NSData alloc] initWithBase64EncodedString:base64String options:0] forSocketID:socketID]; -} - -- (void)sendData:(NSData *)data forSocketID:(nonnull NSNumber *)socketID -{ - [_sockets[socketID] send:data]; -} - -RCT_EXPORT_METHOD(ping:(nonnull NSNumber *)socketID) -{ - [_sockets[socketID] sendPing:NULL]; -} - -RCT_EXPORT_METHOD(close:(nonnull NSNumber *)socketID) -{ - [_sockets[socketID] close]; - [_sockets removeObjectForKey:socketID]; -} - -- (void)setContentHandler:(id)handler forSocketID:(NSString *)socketID -{ - if (!_contentHandlers) { - _contentHandlers = [NSMutableDictionary new]; - } - _contentHandlers[socketID] = handler; -} - -#pragma mark - RCTSRWebSocketDelegate methods - -- (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message -{ - NSString *type; - - NSNumber *socketID = [webSocket reactTag]; - id contentHandler = _contentHandlers[socketID]; - if (contentHandler) { - message = [contentHandler processWebsocketMessage:message forSocketID:socketID withType:&type]; - } else { - if ([message isKindOfClass:[NSData class]]) { - type = @"binary"; - message = [message base64EncodedStringWithOptions:0]; - } else { - type = @"text"; - } - } - - [self sendEventWithName:@"websocketMessage" body:@{ - @"data": message, - @"type": type, - @"id": webSocket.reactTag - }]; -} - -- (void)webSocketDidOpen:(RCTSRWebSocket *)webSocket -{ - [self sendEventWithName:@"websocketOpen" body:@{ - @"id": webSocket.reactTag - }]; -} - -- (void)webSocket:(RCTSRWebSocket *)webSocket didFailWithError:(NSError *)error -{ - NSNumber *socketID = [webSocket reactTag]; - _contentHandlers[socketID] = nil; - _sockets[socketID] = nil; - [self sendEventWithName:@"websocketFailed" body:@{ - @"message": error.localizedDescription, - @"id": socketID - }]; -} - -- (void)webSocket:(RCTSRWebSocket *)webSocket - didCloseWithCode:(NSInteger)code - reason:(NSString *)reason - wasClean:(BOOL)wasClean -{ - NSNumber *socketID = [webSocket reactTag]; - _contentHandlers[socketID] = nil; - _sockets[socketID] = nil; - [self sendEventWithName:@"websocketClosed" body:@{ - @"code": @(code), - @"reason": RCTNullIfNil(reason), - @"clean": @(wasClean), - @"id": socketID - }]; -} - -@end - -@implementation RCTBridge (RCTWebSocketModule) - -- (RCTWebSocketModule *)webSocketModule -{ - return [self moduleForClass:[RCTWebSocketModule class]]; -} - -@end diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/WebSocket.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/WebSocket.js deleted file mode 100644 index 52cbbf6c..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/WebSocket.js +++ /dev/null @@ -1,302 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const Blob = require('Blob'); -const EventTarget = require('event-target-shim'); -const NativeEventEmitter = require('NativeEventEmitter'); -const BlobManager = require('BlobManager'); -const NativeModules = require('NativeModules'); -const Platform = require('Platform'); -const WebSocketEvent = require('WebSocketEvent'); - -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ -const base64 = require('base64-js'); -const binaryToBase64 = require('binaryToBase64'); -const invariant = require('invariant'); - -const {WebSocketModule} = NativeModules; - -import type EventSubscription from 'EventSubscription'; - -type ArrayBufferView = - | Int8Array - | Uint8Array - | Uint8ClampedArray - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | Float32Array - | Float64Array - | DataView; - -type BinaryType = 'blob' | 'arraybuffer'; - -const CONNECTING = 0; -const OPEN = 1; -const CLOSING = 2; -const CLOSED = 3; - -const CLOSE_NORMAL = 1000; - -const WEBSOCKET_EVENTS = ['close', 'error', 'message', 'open']; - -let nextWebSocketId = 0; - -/** - * Browser-compatible WebSockets implementation. - * - * See https://developer.mozilla.org/en-US/docs/Web/API/WebSocket - * See https://github.com/websockets/ws - */ -class WebSocket extends EventTarget(...WEBSOCKET_EVENTS) { - static CONNECTING = CONNECTING; - static OPEN = OPEN; - static CLOSING = CLOSING; - static CLOSED = CLOSED; - - CONNECTING: number = CONNECTING; - OPEN: number = OPEN; - CLOSING: number = CLOSING; - CLOSED: number = CLOSED; - - _socketId: number; - _eventEmitter: NativeEventEmitter; - _subscriptions: Array; - _binaryType: ?BinaryType; - - onclose: ?Function; - onerror: ?Function; - onmessage: ?Function; - onopen: ?Function; - - bufferedAmount: number; - extension: ?string; - protocol: ?string; - readyState: number = CONNECTING; - url: ?string; - - // This module depends on the native `WebSocketModule` module. If you don't include it, - // `WebSocket.isAvailable` will return `false`, and WebSocket constructor will throw an error - static isAvailable: boolean = !!WebSocketModule; - - constructor( - url: string, - protocols: ?string | ?Array, - options: ?{headers?: {origin?: string}}, - ) { - super(); - if (typeof protocols === 'string') { - protocols = [protocols]; - } - - const {headers = {}, ...unrecognized} = options || {}; - - // Preserve deprecated backwards compatibility for the 'origin' option - /* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an - * error found when Flow v0.68 was deployed. To see the error delete this - * comment and run Flow. */ - if (unrecognized && typeof unrecognized.origin === 'string') { - console.warn( - 'Specifying `origin` as a WebSocket connection option is deprecated. Include it under `headers` instead.', - ); - /* $FlowFixMe(>=0.54.0 site=react_native_fb,react_native_oss) This - * comment suppresses an error found when Flow v0.54 was deployed. To see - * the error delete this comment and run Flow. */ - headers.origin = unrecognized.origin; - /* $FlowFixMe(>=0.54.0 site=react_native_fb,react_native_oss) This - * comment suppresses an error found when Flow v0.54 was deployed. To see - * the error delete this comment and run Flow. */ - delete unrecognized.origin; - } - - // Warn about and discard anything else - if (Object.keys(unrecognized).length > 0) { - console.warn( - 'Unrecognized WebSocket connection option(s) `' + - Object.keys(unrecognized).join('`, `') + - '`. ' + - 'Did you mean to put these under `headers`?', - ); - } - - if (!Array.isArray(protocols)) { - protocols = null; - } - - if (!WebSocket.isAvailable) { - throw new Error( - 'Cannot initialize WebSocket module. ' + - 'Native module WebSocketModule is missing.', - ); - } - - this._eventEmitter = new NativeEventEmitter(WebSocketModule); - this._socketId = nextWebSocketId++; - this._registerEvents(); - WebSocketModule.connect( - url, - protocols, - {headers}, - this._socketId, - ); - } - - get binaryType(): ?BinaryType { - return this._binaryType; - } - - set binaryType(binaryType: BinaryType): void { - if (binaryType !== 'blob' && binaryType !== 'arraybuffer') { - throw new Error("binaryType must be either 'blob' or 'arraybuffer'"); - } - if (this._binaryType === 'blob' || binaryType === 'blob') { - invariant( - BlobManager.isAvailable, - 'Native module BlobModule is required for blob support', - ); - if (binaryType === 'blob') { - BlobManager.addWebSocketHandler(this._socketId); - } else { - BlobManager.removeWebSocketHandler(this._socketId); - } - } - this._binaryType = binaryType; - } - - close(code?: number, reason?: string): void { - if (this.readyState === this.CLOSING || this.readyState === this.CLOSED) { - return; - } - - this.readyState = this.CLOSING; - this._close(code, reason); - } - - send(data: string | ArrayBuffer | ArrayBufferView | Blob): void { - if (this.readyState === this.CONNECTING) { - throw new Error('INVALID_STATE_ERR'); - } - - if (data instanceof Blob) { - invariant( - BlobManager.isAvailable, - 'Native module BlobModule is required for blob support', - ); - BlobManager.sendOverSocket(data, this._socketId); - return; - } - - if (typeof data === 'string') { - WebSocketModule.send(data, this._socketId); - return; - } - - if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) { - WebSocketModule.sendBinary(binaryToBase64(data), this._socketId); - return; - } - - throw new Error('Unsupported data type'); - } - - ping(): void { - if (this.readyState === this.CONNECTING) { - throw new Error('INVALID_STATE_ERR'); - } - - WebSocketModule.ping(this._socketId); - } - - _close(code?: number, reason?: string): void { - if (Platform.OS === 'android') { - // See https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent - const statusCode = typeof code === 'number' ? code : CLOSE_NORMAL; - const closeReason = typeof reason === 'string' ? reason : ''; - WebSocketModule.close(statusCode, closeReason, this._socketId); - } else { - WebSocketModule.close(this._socketId); - } - - if (BlobManager.isAvailable && this._binaryType === 'blob') { - BlobManager.removeWebSocketHandler(this._socketId); - } - } - - _unregisterEvents(): void { - this._subscriptions.forEach(e => e.remove()); - this._subscriptions = []; - } - - _registerEvents(): void { - this._subscriptions = [ - this._eventEmitter.addListener('websocketMessage', ev => { - if (ev.id !== this._socketId) { - return; - } - let data = ev.data; - switch (ev.type) { - case 'binary': - data = base64.toByteArray(ev.data).buffer; - break; - case 'blob': - data = BlobManager.createFromOptions(ev.data); - break; - } - this.dispatchEvent(new WebSocketEvent('message', {data})); - }), - this._eventEmitter.addListener('websocketOpen', ev => { - if (ev.id !== this._socketId) { - return; - } - this.readyState = this.OPEN; - this.dispatchEvent(new WebSocketEvent('open')); - }), - this._eventEmitter.addListener('websocketClosed', ev => { - if (ev.id !== this._socketId) { - return; - } - this.readyState = this.CLOSED; - this.dispatchEvent( - new WebSocketEvent('close', { - code: ev.code, - reason: ev.reason, - }), - ); - this._unregisterEvents(); - this.close(); - }), - this._eventEmitter.addListener('websocketFailed', ev => { - if (ev.id !== this._socketId) { - return; - } - this.readyState = this.CLOSED; - this.dispatchEvent( - new WebSocketEvent('error', { - message: ev.message, - }), - ); - this.dispatchEvent( - new WebSocketEvent('close', { - message: ev.message, - }), - ); - this._unregisterEvents(); - this.close(); - }), - ]; - } -} - -module.exports = WebSocket; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/WebSocketEvent.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/WebSocketEvent.js deleted file mode 100644 index d174ac27..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/WebSocketEvent.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -/** - * Event object passed to the `onopen`, `onclose`, `onmessage`, `onerror` - * callbacks of `WebSocket`. - * - * The `type` property is "open", "close", "message", "error" respectively. - * - * In case of "message", the `data` property contains the incoming data. - */ -class WebSocketEvent { - constructor(type, eventInitDict) { - this.type = type.toString(); - Object.assign(this, eventInitDict); - } -} - -module.exports = WebSocketEvent; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/WebSocketInterceptor.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/WebSocketInterceptor.js deleted file mode 100644 index 29b4a9c5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/WebSocketInterceptor.js +++ /dev/null @@ -1,222 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const RCTWebSocketModule = require('NativeModules').WebSocketModule; -const NativeEventEmitter = require('NativeEventEmitter'); - -const base64 = require('base64-js'); - -const originalRCTWebSocketConnect = RCTWebSocketModule.connect; -const originalRCTWebSocketSend = RCTWebSocketModule.send; -const originalRCTWebSocketSendBinary = RCTWebSocketModule.sendBinary; -const originalRCTWebSocketClose = RCTWebSocketModule.close; - -let eventEmitter: NativeEventEmitter; -let subscriptions: Array; - -let closeCallback; -let sendCallback; -let connectCallback; -let onOpenCallback; -let onMessageCallback; -let onErrorCallback; -let onCloseCallback; - -let isInterceptorEnabled = false; - -/** - * A network interceptor which monkey-patches RCTWebSocketModule methods - * to gather all websocket network requests/responses, in order to show - * their information in the React Native inspector development tool. - */ - -const WebSocketInterceptor = { - /** - * Invoked when RCTWebSocketModule.close(...) is called. - */ - setCloseCallback(callback) { - closeCallback = callback; - }, - - /** - * Invoked when RCTWebSocketModule.send(...) or sendBinary(...) is called. - */ - setSendCallback(callback) { - sendCallback = callback; - }, - - /** - * Invoked when RCTWebSocketModule.connect(...) is called. - */ - setConnectCallback(callback) { - connectCallback = callback; - }, - - /** - * Invoked when event "websocketOpen" happens. - */ - setOnOpenCallback(callback) { - onOpenCallback = callback; - }, - - /** - * Invoked when event "websocketMessage" happens. - */ - setOnMessageCallback(callback) { - onMessageCallback = callback; - }, - - /** - * Invoked when event "websocketFailed" happens. - */ - setOnErrorCallback(callback) { - onErrorCallback = callback; - }, - - /** - * Invoked when event "websocketClosed" happens. - */ - setOnCloseCallback(callback) { - onCloseCallback = callback; - }, - - isInterceptorEnabled() { - return isInterceptorEnabled; - }, - - _unregisterEvents() { - subscriptions.forEach(e => e.remove()); - subscriptions = []; - }, - - /** - * Add listeners to the RCTWebSocketModule events to intercept them. - */ - _registerEvents() { - subscriptions = [ - eventEmitter.addListener('websocketMessage', ev => { - if (onMessageCallback) { - onMessageCallback( - ev.id, - ev.type === 'binary' - ? WebSocketInterceptor._arrayBufferToString(ev.data) - : ev.data, - ); - } - }), - eventEmitter.addListener('websocketOpen', ev => { - if (onOpenCallback) { - onOpenCallback(ev.id); - } - }), - eventEmitter.addListener('websocketClosed', ev => { - if (onCloseCallback) { - onCloseCallback(ev.id, {code: ev.code, reason: ev.reason}); - } - }), - eventEmitter.addListener('websocketFailed', ev => { - if (onErrorCallback) { - onErrorCallback(ev.id, {message: ev.message}); - } - }), - ]; - }, - - enableInterception() { - if (isInterceptorEnabled) { - return; - } - eventEmitter = new NativeEventEmitter(RCTWebSocketModule); - WebSocketInterceptor._registerEvents(); - - // Override `connect` method for all RCTWebSocketModule requests - // to intercept the request url, protocols, options and socketId, - // then pass them through the `connectCallback`. - RCTWebSocketModule.connect = function(url, protocols, options, socketId) { - if (connectCallback) { - connectCallback(url, protocols, options, socketId); - } - originalRCTWebSocketConnect.apply(this, arguments); - }; - - // Override `send` method for all RCTWebSocketModule requests to intercept - // the data sent, then pass them through the `sendCallback`. - RCTWebSocketModule.send = function(data, socketId) { - if (sendCallback) { - sendCallback(data, socketId); - } - originalRCTWebSocketSend.apply(this, arguments); - }; - - // Override `sendBinary` method for all RCTWebSocketModule requests to - // intercept the data sent, then pass them through the `sendCallback`. - RCTWebSocketModule.sendBinary = function(data, socketId) { - if (sendCallback) { - sendCallback(WebSocketInterceptor._arrayBufferToString(data), socketId); - } - originalRCTWebSocketSendBinary.apply(this, arguments); - }; - - // Override `close` method for all RCTWebSocketModule requests to intercept - // the close information, then pass them through the `closeCallback`. - RCTWebSocketModule.close = function() { - if (closeCallback) { - if (arguments.length === 3) { - closeCallback(arguments[0], arguments[1], arguments[2]); - } else { - closeCallback(null, null, arguments[0]); - } - } - originalRCTWebSocketClose.apply(this, arguments); - }; - - isInterceptorEnabled = true; - }, - - _arrayBufferToString(data) { - const value = base64.toByteArray(data).buffer; - if (value === undefined || value === null) { - return '(no value)'; - } - if ( - typeof ArrayBuffer !== 'undefined' && - typeof Uint8Array !== 'undefined' && - value instanceof ArrayBuffer - ) { - return `ArrayBuffer {${String(Array.from(new Uint8Array(value)))}}`; - } - return value; - }, - - // Unpatch RCTWebSocketModule methods and remove the callbacks. - disableInterception() { - if (!isInterceptorEnabled) { - return; - } - isInterceptorEnabled = false; - RCTWebSocketModule.send = originalRCTWebSocketSend; - RCTWebSocketModule.sendBinary = originalRCTWebSocketSendBinary; - RCTWebSocketModule.close = originalRCTWebSocketClose; - RCTWebSocketModule.connect = originalRCTWebSocketConnect; - - connectCallback = null; - closeCallback = null; - sendCallback = null; - onOpenCallback = null; - onMessageCallback = null; - onCloseCallback = null; - onErrorCallback = null; - - WebSocketInterceptor._unregisterEvents(); - }, -}; - -module.exports = WebSocketInterceptor; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/__mocks__/event-target-shim.js b/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/__mocks__/event-target-shim.js deleted file mode 100644 index 10dc6808..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/WebSocket/__mocks__/event-target-shim.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -// Jest fatals for the following statement (minimal repro case) -// -// exports.something = Symbol; -// -// Until it is fixed, mocking the entire node module makes the -// problem go away. - -'use strict'; - -function EventTarget() { - // Support both EventTarget and EventTarget(...) - // as a super class, just like the original module does. - if (arguments.length > 0) { - return EventTarget; - } -} - -module.exports = EventTarget; diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/fishhook/LICENSE b/ios/ElectrodeApiImpl/Libraries/ReactNative/fishhook/LICENSE deleted file mode 100644 index c45bb7c0..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/fishhook/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2013, Facebook, Inc. -// All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name Facebook nor the names of its contributors may be used to -// endorse or promote products derived from this software without specific -// prior written permission. -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/fishhook/README.md b/ios/ElectrodeApiImpl/Libraries/ReactNative/fishhook/README.md deleted file mode 100644 index 1374fba5..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/fishhook/README.md +++ /dev/null @@ -1,75 +0,0 @@ -# fishhook - -__fishhook__ is a very simple library that enables dynamically rebinding symbols in Mach-O binaries running on iOS in the simulator and on device. This provides functionality that is similar to using [`DYLD_INTERPOSE`][interpose] on OS X. At Facebook, we've found it useful as a way to hook calls in libSystem for debugging/tracing purposes (for example, auditing for double-close issues with file descriptors). - -[interpose]: http://opensource.apple.com/source/dyld/dyld-210.2.3/include/mach-o/dyld-interposing.h "" - -## Usage - -Once you add `fishhook.h`/`fishhook.c` to your project, you can rebind symbols as follows: -```Objective-C -#import - -#import - -#import "AppDelegate.h" -#import "fishhook.h" - -static int (*orig_close)(int); -static int (*orig_open)(const char *, int, ...); - -int my_close(int fd) { - printf("Calling real close(%d)\n", fd); - return orig_close(fd); -} - -int my_open(const char *path, int oflag, ...) { - va_list ap = {0}; - mode_t mode = 0; - - if ((oflag & O_CREAT) != 0) { - // mode only applies to O_CREAT - va_start(ap, oflag); - mode = va_arg(ap, int); - va_end(ap); - printf("Calling real open('%s', %d, %d)\n", path, oflag, mode); - return orig_open(path, oflag, mode); - } else { - printf("Calling real open('%s', %d)\n", path, oflag); - return orig_open(path, oflag, mode); - } -} - -int main(int argc, char * argv[]) -{ - @autoreleasepool { - rebind_symbols((struct rebinding[2]){{"close", my_close, (void *)&orig_close}, {"open", my_open, (void *)&orig_open}}, 2); - - // Open our own binary and print out first 4 bytes (which is the same - // for all Mach-O binaries on a given architecture) - int fd = open(argv[0], O_RDONLY); - uint32_t magic_number = 0; - read(fd, &magic_number, 4); - printf("Mach-O Magic Number: %x \n", magic_number); - close(fd); - - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} -``` -### Sample output -``` -Calling real open('/var/mobile/Applications/161DA598-5B83-41F5-8A44-675491AF6A2C/Test.app/Test', 0) -Mach-O Magic Number: feedface -Calling real close(3) -... -``` - -## How it works - -`dyld` binds lazy and non-lazy symbols by updating pointers in particular sections of the `__DATA` segment of a Mach-O binary. __fishhook__ re-binds these symbols by determining the locations to update for each of the symbol names passed to `rebind_symbols` and then writing out the corresponding replacements. - -For a given image, the `__DATA` segment may contain two sections that are relevant for dynamic symbol bindings: `__nl_symbol_ptr` and `__la_symbol_ptr`. `__nl_symbol_ptr` is an array of pointers to non-lazily bound data (these are bound at the time a library is loaded) and `__la_symbol_ptr` is an array of pointers to imported functions that is generally filled by a routine called `dyld_stub_binder` during the first call to that symbol (it's also possible to tell `dyld` to bind these at launch). In order to find the name of the symbol that corresponds to a particular location in one of these sections, we have to jump through several layers of indirection. For the two relevant sections, the section headers (`struct section`s from ``) provide an offset (in the `reserved1` field) into what is known as the indirect symbol table. The indirect symbol table, which is located in the `__LINKEDIT` segment of the binary, is just an array of indexes into the symbol table (also in `__LINKEDIT`) whose order is identical to that of the pointers in the non-lazy and lazy symbol sections. So, given `struct section nl_symbol_ptr`, the corresponding index in the symbol table of the first address in that section is `indirect_symbol_table[nl_symbol_ptr->reserved1]`. The symbol table itself is an array of `struct nlist`s (see ``), and each `nlist` contains an index into the string table in `__LINKEDIT` which where the actual symbol names are stored. So, for each pointer `__nl_symbol_ptr` and `__la_symbol_ptr`, we are able to find the corresponding symbol and then the corresponding string to compare against the requested symbol names, and if there is a match, we replace the pointer in the section with the replacement. - -The process of looking up the name of a given entry in the lazy or non-lazy pointer tables looks like this: -![Visual explanation](http://i.imgur.com/HVXqHCz.png) \ No newline at end of file diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/fishhook/fishhook.c b/ios/ElectrodeApiImpl/Libraries/ReactNative/fishhook/fishhook.c deleted file mode 100644 index 205ee82b..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/fishhook/fishhook.c +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) 2013, Facebook, Inc. -// All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name Facebook nor the names of its contributors may be used to -// endorse or promote products derived from this software without specific -// prior written permission. -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#import "fishhook.h" - -#import -#import -#import -#import -#import -#import -#import - -#ifdef __LP64__ -typedef struct mach_header_64 mach_header_t; -typedef struct segment_command_64 segment_command_t; -typedef struct section_64 section_t; -typedef struct nlist_64 nlist_t; -#define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT_64 -#else -typedef struct mach_header mach_header_t; -typedef struct segment_command segment_command_t; -typedef struct section section_t; -typedef struct nlist nlist_t; -#define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT -#endif - -#ifndef SEG_DATA_CONST -#define SEG_DATA_CONST "__DATA_CONST" -#endif - -struct rebindings_entry { - struct rebinding *rebindings; - size_t rebindings_nel; - struct rebindings_entry *next; -}; - -static struct rebindings_entry *_rebindings_head; - -static int prepend_rebindings(struct rebindings_entry **rebindings_head, - struct rebinding rebindings[], - size_t nel) { - struct rebindings_entry *new_entry = (struct rebindings_entry *) malloc(sizeof(struct rebindings_entry)); - if (!new_entry) { - return -1; - } - new_entry->rebindings = (struct rebinding *) malloc(sizeof(struct rebinding) * nel); - if (!new_entry->rebindings) { - free(new_entry); - return -1; - } - memcpy(new_entry->rebindings, rebindings, sizeof(struct rebinding) * nel); - new_entry->rebindings_nel = nel; - new_entry->next = *rebindings_head; - *rebindings_head = new_entry; - return 0; -} - -static void perform_rebinding_with_section(struct rebindings_entry *rebindings, - section_t *section, - intptr_t slide, - nlist_t *symtab, - char *strtab, - uint32_t *indirect_symtab) { - uint32_t *indirect_symbol_indices = indirect_symtab + section->reserved1; - void **indirect_symbol_bindings = (void **)((uintptr_t)slide + section->addr); - for (uint i = 0; i < section->size / sizeof(void *); i++) { - uint32_t symtab_index = indirect_symbol_indices[i]; - if (symtab_index == INDIRECT_SYMBOL_ABS || symtab_index == INDIRECT_SYMBOL_LOCAL || - symtab_index == (INDIRECT_SYMBOL_LOCAL | INDIRECT_SYMBOL_ABS)) { - continue; - } - uint32_t strtab_offset = symtab[symtab_index].n_un.n_strx; - char *symbol_name = strtab + strtab_offset; - if (strnlen(symbol_name, 2) < 2) { - continue; - } - struct rebindings_entry *cur = rebindings; - while (cur) { - for (uint j = 0; j < cur->rebindings_nel; j++) { - if (strcmp(&symbol_name[1], cur->rebindings[j].name) == 0) { - if (cur->rebindings[j].replaced != NULL && - indirect_symbol_bindings[i] != cur->rebindings[j].replacement) { - *(cur->rebindings[j].replaced) = indirect_symbol_bindings[i]; - } - indirect_symbol_bindings[i] = cur->rebindings[j].replacement; - goto symbol_loop; - } - } - cur = cur->next; - } - symbol_loop:; - } -} - -static void rebind_symbols_for_image(struct rebindings_entry *rebindings, - const struct mach_header *header, - intptr_t slide) { - Dl_info info; - if (dladdr(header, &info) == 0) { - return; - } - - segment_command_t *cur_seg_cmd; - segment_command_t *linkedit_segment = NULL; - struct symtab_command* symtab_cmd = NULL; - struct dysymtab_command* dysymtab_cmd = NULL; - - uintptr_t cur = (uintptr_t)header + sizeof(mach_header_t); - for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) { - cur_seg_cmd = (segment_command_t *)cur; - if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) { - if (strcmp(cur_seg_cmd->segname, SEG_LINKEDIT) == 0) { - linkedit_segment = cur_seg_cmd; - } - } else if (cur_seg_cmd->cmd == LC_SYMTAB) { - symtab_cmd = (struct symtab_command*)cur_seg_cmd; - } else if (cur_seg_cmd->cmd == LC_DYSYMTAB) { - dysymtab_cmd = (struct dysymtab_command*)cur_seg_cmd; - } - } - - if (!symtab_cmd || !dysymtab_cmd || !linkedit_segment || - !dysymtab_cmd->nindirectsyms) { - return; - } - - // Find base symbol/string table addresses - uintptr_t linkedit_base = (uintptr_t)slide + linkedit_segment->vmaddr - linkedit_segment->fileoff; - nlist_t *symtab = (nlist_t *)(linkedit_base + symtab_cmd->symoff); - char *strtab = (char *)(linkedit_base + symtab_cmd->stroff); - - // Get indirect symbol table (array of uint32_t indices into symbol table) - uint32_t *indirect_symtab = (uint32_t *)(linkedit_base + dysymtab_cmd->indirectsymoff); - - cur = (uintptr_t)header + sizeof(mach_header_t); - for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) { - cur_seg_cmd = (segment_command_t *)cur; - if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) { - if (strcmp(cur_seg_cmd->segname, SEG_DATA) != 0 && - strcmp(cur_seg_cmd->segname, SEG_DATA_CONST) != 0) { - continue; - } - for (uint j = 0; j < cur_seg_cmd->nsects; j++) { - section_t *sect = - (section_t *)(cur + sizeof(segment_command_t)) + j; - if ((sect->flags & SECTION_TYPE) == S_LAZY_SYMBOL_POINTERS) { - perform_rebinding_with_section(rebindings, sect, slide, symtab, strtab, indirect_symtab); - } - if ((sect->flags & SECTION_TYPE) == S_NON_LAZY_SYMBOL_POINTERS) { - perform_rebinding_with_section(rebindings, sect, slide, symtab, strtab, indirect_symtab); - } - } - } - } -} - -static void _rebind_symbols_for_image(const struct mach_header *header, - intptr_t slide) { - rebind_symbols_for_image(_rebindings_head, header, slide); -} - -int rebind_symbols_image(void *header, - intptr_t slide, - struct rebinding rebindings[], - size_t rebindings_nel) { - struct rebindings_entry *rebindings_head = NULL; - int retval = prepend_rebindings(&rebindings_head, rebindings, rebindings_nel); - rebind_symbols_for_image(rebindings_head, (const struct mach_header *) header, slide); - free(rebindings_head); - return retval; -} - -int rebind_symbols(struct rebinding rebindings[], size_t rebindings_nel) { - int retval = prepend_rebindings(&_rebindings_head, rebindings, rebindings_nel); - if (retval < 0) { - return retval; - } - // If this was the first call, register callback for image additions (which is also invoked for - // existing images, otherwise, just run on existing images - if (!_rebindings_head->next) { - _dyld_register_func_for_add_image(_rebind_symbols_for_image); - } else { - uint32_t c = _dyld_image_count(); - for (uint32_t i = 0; i < c; i++) { - _rebind_symbols_for_image(_dyld_get_image_header(i), _dyld_get_image_vmaddr_slide(i)); - } - } - return retval; -} diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/fishhook/fishhook.h b/ios/ElectrodeApiImpl/Libraries/ReactNative/fishhook/fishhook.h deleted file mode 100644 index 0d8e36a9..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/fishhook/fishhook.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2013, Facebook, Inc. -// All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name Facebook nor the names of its contributors may be used to -// endorse or promote products derived from this software without specific -// prior written permission. -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef fishhook_h -#define fishhook_h - -#include -#include - -#if !defined(FISHHOOK_EXPORT) -#define FISHHOOK_VISIBILITY __attribute__((visibility("hidden"))) -#else -#define FISHHOOK_VISIBILITY __attribute__((visibility("default"))) -#endif - -#ifdef __cplusplus -extern "C" { -#endif //__cplusplus - -/* - * A structure representing a particular intended rebinding from a symbol - * name to its replacement - */ -struct rebinding { - const char *name; - void *replacement; - void **replaced; -}; - -/* - * For each rebinding in rebindings, rebinds references to external, indirect - * symbols with the specified name to instead point at replacement for each - * image in the calling process as well as for all future images that are loaded - * by the process. If rebind_functions is called more than once, the symbols to - * rebind are added to the existing list of rebindings, and if a given symbol - * is rebound more than once, the later rebinding will take precedence. - */ -FISHHOOK_VISIBILITY -int rebind_symbols(struct rebinding rebindings[], size_t rebindings_nel); - -/* - * Rebinds as above, but only in the specified image. The header should point - * to the mach-o header, the slide should be the slide offset. Others as above. - */ -FISHHOOK_VISIBILITY -int rebind_symbols_image(void *header, - intptr_t slide, - struct rebinding rebindings[], - size_t rebindings_nel); - -#ifdef __cplusplus -} -#endif //__cplusplus - -#endif //fishhook_h - diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/scripts/ios-configure-glog.sh b/ios/ElectrodeApiImpl/Libraries/ReactNative/scripts/ios-configure-glog.sh deleted file mode 100755 index 73a892c9..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/scripts/ios-configure-glog.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -set -e - -PLATFORM_NAME="${PLATFORM_NAME:-iphoneos}" -CURRENT_ARCH="${CURRENT_ARCH}" - -if [ -z "$CURRENT_ARCH" ] || [ "$CURRENT_ARCH" == "undefined_arch" ]; then - # Xcode 10 beta sets CURRENT_ARCH to "undefined_arch", this leads to incorrect linker arg. - # it's better to rely on platform name as fallback because architecture differs between simulator and device - - if [[ "$PLATFORM_NAME" == *"simulator"* ]]; then - CURRENT_ARCH="x86_64" - else - CURRENT_ARCH="armv7" - fi -fi - -export CC="$(xcrun -find -sdk $PLATFORM_NAME cc) -arch $CURRENT_ARCH -isysroot $(xcrun -sdk $PLATFORM_NAME --show-sdk-path)" -export CXX="$CC" - -# Remove automake symlink if it exists -if [ -h "test-driver" ]; then - rm test-driver -fi - -./configure --host arm-apple-darwin - -# Fix build for tvOS -cat << EOF >> src/config.h - -/* Add in so we have Apple Target Conditionals */ -#ifdef __APPLE__ -#include -#include -#endif - -/* Special configuration for AppleTVOS */ -#if TARGET_OS_TV -#undef HAVE_SYSCALL_H -#undef HAVE_SYS_SYSCALL_H -#undef OS_MACOSX -#endif - -/* Special configuration for ucontext */ -#undef HAVE_UCONTEXT_H -#undef PC_FROM_UCONTEXT -#if defined(__x86_64__) -#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip -#elif defined(__i386__) -#define PC_FROM_UCONTEXT uc_mcontext->__ss.__eip -#endif -EOF - -# Prepare exported header include -EXPORTED_INCLUDE_DIR="exported/glog" -mkdir -p exported/glog -cp -f src/glog/log_severity.h "$EXPORTED_INCLUDE_DIR/" -cp -f src/glog/logging.h "$EXPORTED_INCLUDE_DIR/" -cp -f src/glog/raw_logging.h "$EXPORTED_INCLUDE_DIR/" -cp -f src/glog/stl_logging.h "$EXPORTED_INCLUDE_DIR/" -cp -f src/glog/vlog_is_on.h "$EXPORTED_INCLUDE_DIR/" diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/scripts/ios-install-third-party.sh b/ios/ElectrodeApiImpl/Libraries/ReactNative/scripts/ios-install-third-party.sh deleted file mode 100755 index 1cd1cd20..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/scripts/ios-install-third-party.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -if [ -d "$HOME/.rncache" ]; then - cachedir="$HOME/.rncache" # react-native 0.57.8 and older -else - cachedir="$HOME/Library/Caches/com.facebook.ReactNativeBuild" -fi -mkdir -p "$cachedir" - -function file_fail () { - cachefile=$1 - msg=$2 - - echo "$msg. Debug info:" 2>&1 - ls -l "$cachefile" 2>&1 - shasum "$cachefile" 2>&1 - exit 1 -} - -function fetch_and_unpack () { - file=$1 - url=$2 - hash=$3 - cmd=$4 - - retries=4 - fetched=no - - while true; do - if [ -f "$cachedir/$file" ]; then - if shasum -p "$cachedir/$file" | - awk -v hash="$hash" '{exit $1 != hash}'; then - break - else - echo "Incorrect hash:" 2>&1 - shasum -p "$cachedir/$file" 2>&1 - echo "Retrying..." 2>&1 - fi - fi - - (( retries = retries - 1 )) - if (( retries < 0 )); then - file_fail "$cachedir/$file" "Failed to successfully download '$file'" - fi - - rm -f "$cachedir/$file" - (cd "$cachedir"; curl -J -L -O "$url") - fetched=yes - done - - dir=$(basename "$file" .tar.gz) - if [ "$fetched" = "yes" ] || [ ! -f "third-party/$dir/.installed" ]; then - (cd third-party; - rm -rf "$dir" - echo Unpacking "$cachedir/$file"... - if ! tar zxf "$cachedir/$file"; then - file_fail "$cachedir/$file" "Unpacking '$cachedir/$file' failed" - fi - cd "$dir" - eval "${cmd:-true}" && touch .installed) - fi -} - -mkdir -p third-party - -SCRIPTDIR=$(dirname "$0") - -fetch_and_unpack glog-0.3.5.tar.gz https://github.com/google/glog/archive/v0.3.5.tar.gz 61067502c5f9769d111ea1ee3f74e6ddf0a5f9cc "\"$SCRIPTDIR/ios-configure-glog.sh\"" -fetch_and_unpack double-conversion-1.1.6.tar.gz https://github.com/google/double-conversion/archive/v1.1.6.tar.gz 1c7d88afde3aaeb97bb652776c627b49e132e8e0 -fetch_and_unpack boost_1_63_0.tar.gz https://github.com/react-native-community/boost-for-react-native/releases/download/v1.63.0-0/boost_1_63_0.tar.gz c3f57e1d22a995e608983effbb752b54b6eab741 -fetch_and_unpack folly-2018.10.22.00.tar.gz https://github.com/facebook/folly/archive/v2018.10.22.00.tar.gz f70a75bfeb394363d2049a846bba118ffb3b368a diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/scripts/launchPackager.bat b/ios/ElectrodeApiImpl/Libraries/ReactNative/scripts/launchPackager.bat deleted file mode 100644 index 377d1f7d..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/scripts/launchPackager.bat +++ /dev/null @@ -1,11 +0,0 @@ -:: Copyright (c) Facebook, Inc. and its affiliates. -:: -:: This source code is licensed under the MIT license found in the -:: LICENSE file in the root directory of this source tree. - -@echo off -title Metro Bundler -call .packager.bat -node "%~dp0..\cli.js" --reactNativePath ../ --projectRoot ../../../ start -pause -exit diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/scripts/launchPackager.command b/ios/ElectrodeApiImpl/Libraries/ReactNative/scripts/launchPackager.command deleted file mode 100755 index 7feb061e..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/scripts/launchPackager.command +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -# Set terminal title -echo -en "\\033]0;Metro Bundler\\a" -clear - -THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) - -# shellcheck source=/dev/null -. "$THIS_DIR/packager.sh" - -echo "Process terminated. Press to close the window" -read -r diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/scripts/packager.sh b/ios/ElectrodeApiImpl/Libraries/ReactNative/scripts/packager.sh deleted file mode 100755 index e5bb1e90..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/scripts/packager.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -# scripts directory -THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) -REACT_NATIVE_ROOT="$THIS_DIR/.." -# Application root directory - General use case: react-native is a dependency -PROJECT_ROOT="$THIS_DIR/../../.." - -# shellcheck source=/dev/null -source "${THIS_DIR}/.packager.env" - -# When running react-native tests, react-native doesn't live in node_modules but in the PROJECT_ROOT -if [ ! -d "$PROJECT_ROOT/node_modules/react-native" ]; -then - PROJECT_ROOT="$THIS_DIR/.." -fi -# Start packager from PROJECT_ROOT -cd "$PROJECT_ROOT" || exit -node "$REACT_NATIVE_ROOT/cli.js" start "$@" diff --git a/ios/ElectrodeApiImpl/Libraries/ReactNative/scripts/react-native-xcode.sh b/ios/ElectrodeApiImpl/Libraries/ReactNative/scripts/react-native-xcode.sh deleted file mode 100755 index d684e89f..00000000 --- a/ios/ElectrodeApiImpl/Libraries/ReactNative/scripts/react-native-xcode.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. -# -# Bundle React Native app's code and image assets. -# This script is supposed to be invoked as part of Xcode build process -# and relies on environment variables (including PWD) set by Xcode - -# Print commands before executing them (useful for troubleshooting) -set -x -DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH - -# Enables iOS devices to get the IP address of the machine running Metro Bundler -if [[ "$CONFIGURATION" = *Debug* && ! "$PLATFORM_NAME" == *simulator ]]; then - IP=$(ipconfig getifaddr en0) - if [ -z "$IP" ]; then - IP=$(ifconfig | grep 'inet ' | grep -v ' 127.' | cut -d\ -f2 | awk 'NR==1{print $1}') - fi - - echo "$IP" > "$DEST/ip.txt" -fi - -if [[ "$SKIP_BUNDLING" ]]; then - echo "SKIP_BUNDLING enabled; skipping." - exit 0; -fi - -case "$CONFIGURATION" in - *Debug*) - if [[ "$PLATFORM_NAME" == *simulator ]]; then - if [[ "$FORCE_BUNDLING" ]]; then - echo "FORCE_BUNDLING enabled; continuing to bundle." - else - echo "Skipping bundling in Debug for the Simulator (since the packager bundles for you). Use the FORCE_BUNDLING flag to change this behavior." - exit 0; - fi - else - echo "Bundling for physical device. Use the SKIP_BUNDLING flag to change this behavior." - fi - - DEV=true - ;; - "") - echo "$0 must be invoked by Xcode" - exit 1 - ;; - *) - DEV=false - ;; -esac - -# Path to react-native folder inside node_modules -REACT_NATIVE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -# The project should be located next to where react-native is installed -# in node_modules. -PROJECT_ROOT=${PROJECT_ROOT:-"$REACT_NATIVE_DIR/../.."} - -cd $PROJECT_ROOT - -# Define NVM_DIR and source the nvm.sh setup script -[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm" - -# Define entry file -if [[ -s "index.ios.js" ]]; then - ENTRY_FILE=${1:-index.ios.js} -else - ENTRY_FILE=${1:-index.js} -fi - -if [[ -s "$HOME/.nvm/nvm.sh" ]]; then - . "$HOME/.nvm/nvm.sh" -elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]]; then - . "$(brew --prefix nvm)/nvm.sh" -fi - -# Set up the nodenv node version manager if present -if [[ -x "$HOME/.nodenv/bin/nodenv" ]]; then - eval "$("$HOME/.nodenv/bin/nodenv" init -)" -elif [[ -x "$(command -v brew)" && -x "$(brew --prefix nodenv)/bin/nodenv" ]]; then - eval "$("$(brew --prefix nodenv)/bin/nodenv" init -)" -fi - -# Set up the ndenv of anyenv if preset -if [[ ! -x node && -d ${HOME}/.anyenv/bin ]]; then - export PATH=${HOME}/.anyenv/bin:${PATH} - if [[ "$(anyenv envs | grep -c ndenv )" -eq 1 ]]; then - eval "$(anyenv init -)" - fi -fi - -[ -z "$NODE_BINARY" ] && export NODE_BINARY="node" - -[ -z "$NODE_ARGS" ] && export NODE_ARGS="" - -[ -z "$CLI_PATH" ] && export CLI_PATH="$REACT_NATIVE_DIR/cli.js" - -[ -z "$BUNDLE_COMMAND" ] && BUNDLE_COMMAND="bundle" - -if [[ -z "$BUNDLE_CONFIG" ]]; then - CONFIG_ARG="" -else - CONFIG_ARG="--config $BUNDLE_CONFIG" -fi - -nodejs_not_found() -{ - echo "error: Can't find '$NODE_BINARY' binary to build React Native bundle" >&2 - echo "If you have non-standard nodejs installation, select your project in Xcode," >&2 - echo "find 'Build Phases' - 'Bundle React Native code and images'" >&2 - echo "and change NODE_BINARY to absolute path to your node executable" >&2 - echo "(you can find it by invoking 'which node' in the terminal)" >&2 - exit 2 -} - -type "$NODE_BINARY" >/dev/null 2>&1 || nodejs_not_found - -BUNDLE_FILE="$DEST/main.jsbundle" - -"$NODE_BINARY" $NODE_ARGS "$CLI_PATH" $BUNDLE_COMMAND \ - $CONFIG_ARG \ - --entry-file "$ENTRY_FILE" \ - --platform ios \ - --dev $DEV \ - --reset-cache \ - --bundle-output "$BUNDLE_FILE" \ - --assets-dest "$DEST" \ - $EXTRA_PACKAGER_ARGS - -if [[ $DEV != true && ! -f "$BUNDLE_FILE" ]]; then - echo "error: File $BUNDLE_FILE does not exist. This must be a bug with" >&2 - echo "React Native, please report it here: https://github.com/facebook/react-native/issues" - exit 2 -fi diff --git a/package.json b/package.json index 8c352bed..fe301944 100644 --- a/package.json +++ b/package.json @@ -81,5 +81,9 @@ }, "keywords": [ "ern-native-api-impl" - ] + ], + "devDependencies": { + "react": "16.8.3", + "react-native": "0.59.10" + } } diff --git a/yarn.lock b/yarn.lock index 934fbf42..3cf1bf6a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,17 +2,3521 @@ # yarn lockfile v1 +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d" + integrity sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw== + dependencies: + "@babel/highlight" "^7.0.0" + +"@babel/core@^7.0.0": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.7.5.tgz#ae1323cd035b5160293307f50647e83f8ba62f7e" + integrity sha512-M42+ScN4+1S9iB6f+TL7QBpoQETxbclx+KNoKJABghnKYE+fMzSGqst0BZJc8CpI625bwPwYgUyRvxZ+0mZzpw== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.7.4" + "@babel/helpers" "^7.7.4" + "@babel/parser" "^7.7.5" + "@babel/template" "^7.7.4" + "@babel/traverse" "^7.7.4" + "@babel/types" "^7.7.4" + convert-source-map "^1.7.0" + debug "^4.1.0" + json5 "^2.1.0" + lodash "^4.17.13" + resolve "^1.3.2" + semver "^5.4.1" + source-map "^0.5.0" + +"@babel/generator@^7.0.0", "@babel/generator@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.7.4.tgz#db651e2840ca9aa66f327dcec1dc5f5fa9611369" + integrity sha512-m5qo2WgdOJeyYngKImbkyQrnUN1mPceaG5BV+G0E3gWsa4l/jCSryWJdM2x8OuGAOyh+3d5pVYfZWCiNFtynxg== + dependencies: + "@babel/types" "^7.7.4" + jsesc "^2.5.1" + lodash "^4.17.13" + source-map "^0.5.0" + +"@babel/helper-annotate-as-pure@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.7.4.tgz#bb3faf1e74b74bd547e867e48f551fa6b098b6ce" + integrity sha512-2BQmQgECKzYKFPpiycoF9tlb5HA4lrVyAmLLVK177EcQAqjVLciUb2/R+n1boQ9y5ENV3uz2ZqiNw7QMBBw1Og== + dependencies: + "@babel/types" "^7.7.4" + +"@babel/helper-builder-binary-assignment-operator-visitor@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.7.4.tgz#5f73f2b28580e224b5b9bd03146a4015d6217f5f" + integrity sha512-Biq/d/WtvfftWZ9Uf39hbPBYDUo986m5Bb4zhkeYDGUllF43D+nUe5M6Vuo6/8JDK/0YX/uBdeoQpyaNhNugZQ== + dependencies: + "@babel/helper-explode-assignable-expression" "^7.7.4" + "@babel/types" "^7.7.4" + +"@babel/helper-builder-react-jsx@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.7.4.tgz#da188d247508b65375b2c30cf59de187be6b0c66" + integrity sha512-kvbfHJNN9dg4rkEM4xn1s8d1/h6TYNvajy9L1wx4qLn9HFg0IkTsQi4rfBe92nxrPUFcMsHoMV+8rU7MJb3fCA== + dependencies: + "@babel/types" "^7.7.4" + esutils "^2.0.0" + +"@babel/helper-call-delegate@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.7.4.tgz#621b83e596722b50c0066f9dc37d3232e461b801" + integrity sha512-8JH9/B7J7tCYJ2PpWVpw9JhPuEVHztagNVuQAFBVFYluRMlpG7F1CgKEgGeL6KFqcsIa92ZYVj6DSc0XwmN1ZA== + dependencies: + "@babel/helper-hoist-variables" "^7.7.4" + "@babel/traverse" "^7.7.4" + "@babel/types" "^7.7.4" + +"@babel/helper-create-class-features-plugin@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.7.4.tgz#fce60939fd50618610942320a8d951b3b639da2d" + integrity sha512-l+OnKACG4uiDHQ/aJT8dwpR+LhCJALxL0mJ6nzjB25e5IPwqV1VOsY7ah6UB1DG+VOXAIMtuC54rFJGiHkxjgA== + dependencies: + "@babel/helper-function-name" "^7.7.4" + "@babel/helper-member-expression-to-functions" "^7.7.4" + "@babel/helper-optimise-call-expression" "^7.7.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.7.4" + "@babel/helper-split-export-declaration" "^7.7.4" + +"@babel/helper-create-regexp-features-plugin@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.7.4.tgz#6d5762359fd34f4da1500e4cff9955b5299aaf59" + integrity sha512-Mt+jBKaxL0zfOIWrfQpnfYCN7/rS6GKx6CCCfuoqVVd+17R8zNDlzVYmIi9qyb2wOk002NsmSTDymkIygDUH7A== + dependencies: + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.6.0" + +"@babel/helper-define-map@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.7.4.tgz#2841bf92eb8bd9c906851546fe6b9d45e162f176" + integrity sha512-v5LorqOa0nVQUvAUTUF3KPastvUt/HzByXNamKQ6RdJRTV7j8rLL+WB5C/MzzWAwOomxDhYFb1wLLxHqox86lg== + dependencies: + "@babel/helper-function-name" "^7.7.4" + "@babel/types" "^7.7.4" + lodash "^4.17.13" + +"@babel/helper-explode-assignable-expression@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.7.4.tgz#fa700878e008d85dc51ba43e9fb835cddfe05c84" + integrity sha512-2/SicuFrNSXsZNBxe5UGdLr+HZg+raWBLE9vC98bdYOKX/U6PY0mdGlYUJdtTDPSU0Lw0PNbKKDpwYHJLn2jLg== + dependencies: + "@babel/traverse" "^7.7.4" + "@babel/types" "^7.7.4" + +"@babel/helper-function-name@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.7.4.tgz#ab6e041e7135d436d8f0a3eca15de5b67a341a2e" + integrity sha512-AnkGIdiBhEuiwdoMnKm7jfPfqItZhgRaZfMg1XX3bS25INOnLPjPG1Ppnajh8eqgt5kPJnfqrRHqFqmjKDZLzQ== + dependencies: + "@babel/helper-get-function-arity" "^7.7.4" + "@babel/template" "^7.7.4" + "@babel/types" "^7.7.4" + +"@babel/helper-get-function-arity@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.4.tgz#cb46348d2f8808e632f0ab048172130e636005f0" + integrity sha512-QTGKEdCkjgzgfJ3bAyRwF4yyT3pg+vDgan8DSivq1eS0gwi+KGKE5x8kRcbeFTb/673mkO5SN1IZfmCfA5o+EA== + dependencies: + "@babel/types" "^7.7.4" + +"@babel/helper-hoist-variables@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.7.4.tgz#612384e3d823fdfaaf9fce31550fe5d4db0f3d12" + integrity sha512-wQC4xyvc1Jo/FnLirL6CEgPgPCa8M74tOdjWpRhQYapz5JC7u3NYU1zCVoVAGCE3EaIP9T1A3iW0WLJ+reZlpQ== + dependencies: + "@babel/types" "^7.7.4" + +"@babel/helper-member-expression-to-functions@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.7.4.tgz#356438e2569df7321a8326644d4b790d2122cb74" + integrity sha512-9KcA1X2E3OjXl/ykfMMInBK+uVdfIVakVe7W7Lg3wfXUNyS3Q1HWLFRwZIjhqiCGbslummPDnmb7vIekS0C1vw== + dependencies: + "@babel/types" "^7.7.4" + +"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.7.4.tgz#e5a92529f8888bf319a6376abfbd1cebc491ad91" + integrity sha512-dGcrX6K9l8258WFjyDLJwuVKxR4XZfU0/vTUgOQYWEnRD8mgr+p4d6fCUMq/ys0h4CCt/S5JhbvtyErjWouAUQ== + dependencies: + "@babel/types" "^7.7.4" + +"@babel/helper-module-transforms@^7.7.5": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.7.5.tgz#d044da7ffd91ec967db25cd6748f704b6b244835" + integrity sha512-A7pSxyJf1gN5qXVcidwLWydjftUN878VkalhXX5iQDuGyiGK3sOrrKKHF4/A4fwHtnsotv/NipwAeLzY4KQPvw== + dependencies: + "@babel/helper-module-imports" "^7.7.4" + "@babel/helper-simple-access" "^7.7.4" + "@babel/helper-split-export-declaration" "^7.7.4" + "@babel/template" "^7.7.4" + "@babel/types" "^7.7.4" + lodash "^4.17.13" + +"@babel/helper-optimise-call-expression@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.7.4.tgz#034af31370d2995242aa4df402c3b7794b2dcdf2" + integrity sha512-VB7gWZ2fDkSuqW6b1AKXkJWO5NyNI3bFL/kK79/30moK57blr6NbH8xcl2XcKCwOmJosftWunZqfO84IGq3ZZg== + dependencies: + "@babel/types" "^7.7.4" + +"@babel/helper-plugin-utils@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250" + integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA== + +"@babel/helper-regex@^7.0.0", "@babel/helper-regex@^7.4.4": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.5.5.tgz#0aa6824f7100a2e0e89c1527c23936c152cab351" + integrity sha512-CkCYQLkfkiugbRDO8eZn6lRuR8kzZoGXCg3149iTk5se7g6qykSpy3+hELSwquhu+TgHn8nkLiBwHvNX8Hofcw== + dependencies: + lodash "^4.17.13" + +"@babel/helper-remap-async-to-generator@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.7.4.tgz#c68c2407350d9af0e061ed6726afb4fff16d0234" + integrity sha512-Sk4xmtVdM9sA/jCI80f+KS+Md+ZHIpjuqmYPk1M7F/upHou5e4ReYmExAiu6PVe65BhJPZA2CY9x9k4BqE5klw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.7.4" + "@babel/helper-wrap-function" "^7.7.4" + "@babel/template" "^7.7.4" + "@babel/traverse" "^7.7.4" + "@babel/types" "^7.7.4" + +"@babel/helper-replace-supers@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.7.4.tgz#3c881a6a6a7571275a72d82e6107126ec9e2cdd2" + integrity sha512-pP0tfgg9hsZWo5ZboYGuBn/bbYT/hdLPVSS4NMmiRJdwWhP0IznPwN9AE1JwyGsjSPLC364I0Qh5p+EPkGPNpg== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.7.4" + "@babel/helper-optimise-call-expression" "^7.7.4" + "@babel/traverse" "^7.7.4" + "@babel/types" "^7.7.4" + +"@babel/helper-simple-access@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.7.4.tgz#a169a0adb1b5f418cfc19f22586b2ebf58a9a294" + integrity sha512-zK7THeEXfan7UlWsG2A6CI/L9jVnI5+xxKZOdej39Y0YtDYKx9raHk5F2EtK9K8DHRTihYwg20ADt9S36GR78A== + dependencies: + "@babel/template" "^7.7.4" + "@babel/types" "^7.7.4" + +"@babel/helper-split-export-declaration@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.4.tgz#57292af60443c4a3622cf74040ddc28e68336fd8" + integrity sha512-guAg1SXFcVr04Guk9eq0S4/rWS++sbmyqosJzVs8+1fH5NI+ZcmkaSkc7dmtAFbHFva6yRJnjW3yAcGxjueDug== + dependencies: + "@babel/types" "^7.7.4" + +"@babel/helper-wrap-function@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.7.4.tgz#37ab7fed5150e22d9d7266e830072c0cdd8baace" + integrity sha512-VsfzZt6wmsocOaVU0OokwrIytHND55yvyT4BPB9AIIgwr8+x7617hetdJTsuGwygN5RC6mxA9EJztTjuwm2ofg== + dependencies: + "@babel/helper-function-name" "^7.7.4" + "@babel/template" "^7.7.4" + "@babel/traverse" "^7.7.4" + "@babel/types" "^7.7.4" + +"@babel/helpers@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.7.4.tgz#62c215b9e6c712dadc15a9a0dcab76c92a940302" + integrity sha512-ak5NGZGJ6LV85Q1Zc9gn2n+ayXOizryhjSUBTdu5ih1tlVCJeuQENzc4ItyCVhINVXvIT/ZQ4mheGIsfBkpskg== + dependencies: + "@babel/template" "^7.7.4" + "@babel/traverse" "^7.7.4" + "@babel/types" "^7.7.4" + +"@babel/highlight@^7.0.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.5.0.tgz#56d11312bd9248fa619591d02472be6e8cb32540" + integrity sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ== + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^4.0.0" + +"@babel/parser@^7.0.0", "@babel/parser@^7.7.4", "@babel/parser@^7.7.5": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.5.tgz#cbf45321619ac12d83363fcf9c94bb67fa646d71" + integrity sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig== + +"@babel/plugin-external-helpers@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-external-helpers/-/plugin-external-helpers-7.7.4.tgz#8aa7aa402f0e2ecb924611cbf30942a497dfd17e" + integrity sha512-RVGNajLaFlknbZLutaP/uv7Q+xmVs2LMlEWFXbcjLnwtBdPqAVpV3nzYIAJqri/VjJCUrhG5nALijtg0aND+XA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-proposal-class-properties@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.7.4.tgz#2f964f0cb18b948450362742e33e15211e77c2ba" + integrity sha512-EcuXeV4Hv1X3+Q1TsuOmyyxeTRiSqurGJ26+I/FW1WbymmRRapVORm6x1Zl3iDIHyRxEs+VXWp6qnlcfcJSbbw== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.7.4" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-proposal-export-default-from@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-default-from/-/plugin-proposal-export-default-from-7.7.4.tgz#890de3c0c475374638292df31f6582160b54d639" + integrity sha512-1t6dh7BHYUz4zD1m4pozYYEZy/3m8dgOr9owx3r0mPPI3iGKRUKUbIxfYmcJ4hwljs/dhd0qOTr1ZDUp43ix+w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-export-default-from" "^7.7.4" + +"@babel/plugin-proposal-nullish-coalescing-operator@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.7.4.tgz#7db302c83bc30caa89e38fee935635ef6bd11c28" + integrity sha512-TbYHmr1Gl1UC7Vo2HVuj/Naci5BEGNZ0AJhzqD2Vpr6QPFWpUmBRLrIDjedzx7/CShq0bRDS2gI4FIs77VHLVQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.7.4" + +"@babel/plugin-proposal-object-rest-spread@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.7.4.tgz#cc57849894a5c774214178c8ab64f6334ec8af71" + integrity sha512-rnpnZR3/iWKmiQyJ3LKJpSwLDcX/nSXhdLk4Aq/tXOApIvyu7qoabrige0ylsAJffaUC51WiBu209Q0U+86OWQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-object-rest-spread" "^7.7.4" + +"@babel/plugin-proposal-optional-catch-binding@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.7.4.tgz#ec21e8aeb09ec6711bc0a39ca49520abee1de379" + integrity sha512-DyM7U2bnsQerCQ+sejcTNZh8KQEUuC3ufzdnVnSiUv/qoGJp2Z3hanKL18KDhsBT5Wj6a7CMT5mdyCNJsEaA9w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.7.4" + +"@babel/plugin-proposal-optional-chaining@^7.0.0": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.7.5.tgz#f0835f044cef85b31071a924010a2a390add11d4" + integrity sha512-sOwFqT8JSchtJeDD+CjmWCaiFoLxY4Ps7NjvwHC/U7l4e9i5pTRNt8nDMIFSOUL+ncFbYSwruHM8WknYItWdXw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-optional-chaining" "^7.7.4" + +"@babel/plugin-syntax-class-properties@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.7.4.tgz#6048c129ea908a432a1ff85f1dc794dc62ddaa5e" + integrity sha512-JH3v5ZOeKT0qqdJ9BeBcZTFQiJOMax8RopSr1bH6ASkZKo2qWsvBML7W1mp89sszBRDBBRO8snqcByGdrMTdMg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-dynamic-import@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.7.4.tgz#29ca3b4415abfe4a5ec381e903862ad1a54c3aec" + integrity sha512-jHQW0vbRGvwQNgyVxwDh4yuXu4bH1f5/EICJLAhl1SblLs2CDhrsmCk+v5XLdE9wxtAFRyxx+P//Iw+a5L/tTg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-export-default-from@^7.0.0", "@babel/plugin-syntax-export-default-from@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-default-from/-/plugin-syntax-export-default-from-7.7.4.tgz#897f05808298060b52873fa804ff853540790ea1" + integrity sha512-j888jpjATLEzOWhKawq46UrpXnCRDbdhBd5io4jgwjJ3+CHHGCRb6PNAVEgs+BXIb+dNRAmnkv36zfB992PRVw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-flow@^7.0.0", "@babel/plugin-syntax-flow@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.7.4.tgz#6d91b59e1a0e4c17f36af2e10dd64ef220919d7b" + integrity sha512-2AMAWl5PsmM5KPkB22cvOkUyWk6MjUaqhHNU5nSPUl/ns3j5qLfw2SuYP5RbVZ0tfLvePr4zUScbICtDP2CUNw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-jsx@^7.0.0", "@babel/plugin-syntax-jsx@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.7.4.tgz#dab2b56a36fb6c3c222a1fbc71f7bf97f327a9ec" + integrity sha512-wuy6fiMe9y7HeZBWXYCGt2RGxZOj0BImZ9EyXJVnVGBKO/Br592rbR3rtIQn0eQhAk9vqaKP5n8tVqEFBQMfLg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-nullish-coalescing-operator@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.7.4.tgz#e53b751d0c3061b1ba3089242524b65a7a9da12b" + integrity sha512-XKh/yIRPiQTOeBg0QJjEus5qiSKucKAiApNtO1psqG7D17xmE+X2i5ZqBEuSvo0HRuyPaKaSN/Gy+Ha9KFQolw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.7.4.tgz#47cf220d19d6d0d7b154304701f468fc1cc6ff46" + integrity sha512-mObR+r+KZq0XhRVS2BrBKBpr5jqrqzlPvS9C9vuOf5ilSwzloAl7RPWLrgKdWS6IreaVrjHxTjtyqFiOisaCwg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-optional-catch-binding@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.7.4.tgz#a3e38f59f4b6233867b4a92dcb0ee05b2c334aa6" + integrity sha512-4ZSuzWgFxqHRE31Glu+fEr/MirNZOMYmD/0BhBWyLyOOQz/gTAl7QmWm2hX1QxEIXsr2vkdlwxIzTyiYRC4xcQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-optional-chaining@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.7.4.tgz#c91fdde6de85d2eb8906daea7b21944c3610c901" + integrity sha512-2MqYD5WjZSbJdUagnJvIdSfkb/ucOC9/1fRJxm7GAxY6YQLWlUvkfxoNbUPcPLHJyetKUDQ4+yyuUyAoc0HriA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-typescript@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.7.4.tgz#5d037ffa10f3b25a16f32570ebbe7a8c2efa304b" + integrity sha512-77blgY18Hud4NM1ggTA8xVT/dBENQf17OpiToSa2jSmEY3fWXD2jwrdVlO4kq5yzUTeF15WSQ6b4fByNvJcjpQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-arrow-functions@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.7.4.tgz#76309bd578addd8aee3b379d809c802305a98a12" + integrity sha512-zUXy3e8jBNPiffmqkHRNDdZM2r8DWhCB7HhcoyZjiK1TxYEluLHAvQuYnTT+ARqRpabWqy/NHkO6e3MsYB5YfA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-async-to-generator@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.7.4.tgz#694cbeae6d613a34ef0292713fa42fb45c4470ba" + integrity sha512-zpUTZphp5nHokuy8yLlyafxCJ0rSlFoSHypTUWgpdwoDXWQcseaect7cJ8Ppk6nunOM6+5rPMkod4OYKPR5MUg== + dependencies: + "@babel/helper-module-imports" "^7.7.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-remap-async-to-generator" "^7.7.4" + +"@babel/plugin-transform-block-scoped-functions@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.7.4.tgz#d0d9d5c269c78eaea76227ace214b8d01e4d837b" + integrity sha512-kqtQzwtKcpPclHYjLK//3lH8OFsCDuDJBaFhVwf8kqdnF6MN4l618UDlcA7TfRs3FayrHj+svYnSX8MC9zmUyQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-block-scoping@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.7.4.tgz#200aad0dcd6bb80372f94d9e628ea062c58bf224" + integrity sha512-2VBe9u0G+fDt9B5OV5DQH4KBf5DoiNkwFKOz0TCvBWvdAN2rOykCTkrL+jTLxfCAm76l9Qo5OqL7HBOx2dWggg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + lodash "^4.17.13" + +"@babel/plugin-transform-classes@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.7.4.tgz#c92c14be0a1399e15df72667067a8f510c9400ec" + integrity sha512-sK1mjWat7K+buWRuImEzjNf68qrKcrddtpQo3swi9j7dUcG6y6R6+Di039QN2bD1dykeswlagupEmpOatFHHUg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.7.4" + "@babel/helper-define-map" "^7.7.4" + "@babel/helper-function-name" "^7.7.4" + "@babel/helper-optimise-call-expression" "^7.7.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.7.4" + "@babel/helper-split-export-declaration" "^7.7.4" + globals "^11.1.0" + +"@babel/plugin-transform-computed-properties@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.7.4.tgz#e856c1628d3238ffe12d668eb42559f79a81910d" + integrity sha512-bSNsOsZnlpLLyQew35rl4Fma3yKWqK3ImWMSC/Nc+6nGjC9s5NFWAer1YQ899/6s9HxO2zQC1WoFNfkOqRkqRQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-destructuring@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.7.4.tgz#2b713729e5054a1135097b6a67da1b6fe8789267" + integrity sha512-4jFMXI1Cu2aXbcXXl8Lr6YubCn6Oc7k9lLsu8v61TZh+1jny2BWmdtvY9zSUlLdGUvcy9DMAWyZEOqjsbeg/wA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-exponentiation-operator@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.7.4.tgz#dd30c0191e3a1ba19bcc7e389bdfddc0729d5db9" + integrity sha512-MCqiLfCKm6KEA1dglf6Uqq1ElDIZwFuzz1WH5mTf8k2uQSxEJMbOIEh7IZv7uichr7PMfi5YVSrr1vz+ipp7AQ== + dependencies: + "@babel/helper-builder-binary-assignment-operator-visitor" "^7.7.4" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-flow-strip-types@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.7.4.tgz#cc73f85944782df1d77d80977bc097920a8bf31a" + integrity sha512-w9dRNlHY5ElNimyMYy0oQowvQpwt/PRHI0QS98ZJCTZU2bvSnKXo5zEiD5u76FBPigTm8TkqzmnUTg16T7qbkA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-flow" "^7.7.4" + +"@babel/plugin-transform-for-of@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.7.4.tgz#248800e3a5e507b1f103d8b4ca998e77c63932bc" + integrity sha512-zZ1fD1B8keYtEcKF+M1TROfeHTKnijcVQm0yO/Yu1f7qoDoxEIc/+GX6Go430Bg84eM/xwPFp0+h4EbZg7epAA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-function-name@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.7.4.tgz#75a6d3303d50db638ff8b5385d12451c865025b1" + integrity sha512-E/x09TvjHNhsULs2IusN+aJNRV5zKwxu1cpirZyRPw+FyyIKEHPXTsadj48bVpc1R5Qq1B5ZkzumuFLytnbT6g== + dependencies: + "@babel/helper-function-name" "^7.7.4" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-literals@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.7.4.tgz#27fe87d2b5017a2a5a34d1c41a6b9f6a6262643e" + integrity sha512-X2MSV7LfJFm4aZfxd0yLVFrEXAgPqYoDG53Br/tCKiKYfX0MjVjQeWPIhPHHsCqzwQANq+FLN786fF5rgLS+gw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-member-expression-literals@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.7.4.tgz#aee127f2f3339fc34ce5e3055d7ffbf7aa26f19a" + integrity sha512-9VMwMO7i69LHTesL0RdGy93JU6a+qOPuvB4F4d0kR0zyVjJRVJRaoaGjhtki6SzQUu8yen/vxPKN6CWnCUw6bA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-modules-commonjs@^7.0.0": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.7.5.tgz#1d27f5eb0bcf7543e774950e5b2fa782e637b345" + integrity sha512-9Cq4zTFExwFhQI6MT1aFxgqhIsMWQWDVwOgLzl7PTWJHsNaqFvklAU+Oz6AQLAS0dJKTwZSOCo20INwktxpi3Q== + dependencies: + "@babel/helper-module-transforms" "^7.7.5" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-simple-access" "^7.7.4" + babel-plugin-dynamic-import-node "^2.3.0" + +"@babel/plugin-transform-object-assign@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-assign/-/plugin-transform-object-assign-7.7.4.tgz#a31b70c434a00a078b2d4d10dbd59992fa70afca" + integrity sha512-0TpeUlnhQDwKxPLTIckdaWt46L2s61c/5w5snw1OUod5ehOJywZD98Ha3dFHVjeqkfOFtOTH7cqxddjxUuvcmg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-object-super@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.7.4.tgz#48488937a2d586c0148451bf51af9d7dda567262" + integrity sha512-ho+dAEhC2aRnff2JCA0SAK7V2R62zJd/7dmtoe7MHcso4C2mS+vZjn1Pb1pCVZvJs1mgsvv5+7sT+m3Bysb6eg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.7.4" + +"@babel/plugin-transform-parameters@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.7.4.tgz#da4555c97f39b51ac089d31c7380f03bca4075ce" + integrity sha512-VJwhVePWPa0DqE9vcfptaJSzNDKrWU/4FbYCjZERtmqEs05g3UMXnYMZoXja7JAJ7Y7sPZipwm/pGApZt7wHlw== + dependencies: + "@babel/helper-call-delegate" "^7.7.4" + "@babel/helper-get-function-arity" "^7.7.4" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-property-literals@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.7.4.tgz#2388d6505ef89b266103f450f9167e6bd73f98c2" + integrity sha512-MatJhlC4iHsIskWYyawl53KuHrt+kALSADLQQ/HkhTjX954fkxIEh4q5slL4oRAnsm/eDoZ4q0CIZpcqBuxhJQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-react-display-name@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.7.4.tgz#9f2b80b14ebc97eef4a9b29b612c58ed9c0d10dd" + integrity sha512-sBbIvqYkthai0X0vkD2xsAwluBp+LtNHH+/V4a5ydifmTtb8KOVOlrMIk/MYmIc4uTYDnjZUHQildYNo36SRJw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-react-jsx-source@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.7.4.tgz#8994b1bf6014b133f5a46d3b7d1ee5f5e3e72c10" + integrity sha512-5ZU9FnPhqtHsOXxutRtXZAzoEJwDaP32QcobbMP1/qt7NYcsCNK8XgzJcJfoEr/ZnzVvUNInNjIW22Z6I8p9mg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.7.4" + +"@babel/plugin-transform-react-jsx@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.7.4.tgz#d91205717fae4e2f84d020cd3057ec02a10f11da" + integrity sha512-LixU4BS95ZTEAZdPaIuyg/k8FiiqN9laQ0dMHB4MlpydHY53uQdWCUrwjLr5o6ilS6fAgZey4Q14XBjl5tL6xw== + dependencies: + "@babel/helper-builder-react-jsx" "^7.7.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.7.4" + +"@babel/plugin-transform-regenerator@^7.0.0": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.7.5.tgz#3a8757ee1a2780f390e89f246065ecf59c26fce9" + integrity sha512-/8I8tPvX2FkuEyWbjRCt4qTAgZK0DVy8QRguhA524UH48RfGJy94On2ri+dCuwOpcerPRl9O4ebQkRcVzIaGBw== + dependencies: + regenerator-transform "^0.14.0" + +"@babel/plugin-transform-runtime@^7.0.0": + version "7.7.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.7.6.tgz#4f2b548c88922fb98ec1c242afd4733ee3e12f61" + integrity sha512-tajQY+YmXR7JjTwRvwL4HePqoL3DYxpYXIHKVvrOIvJmeHe2y1w4tz5qz9ObUDC9m76rCzIMPyn4eERuwA4a4A== + dependencies: + "@babel/helper-module-imports" "^7.7.4" + "@babel/helper-plugin-utils" "^7.0.0" + resolve "^1.8.1" + semver "^5.5.1" + +"@babel/plugin-transform-shorthand-properties@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.7.4.tgz#74a0a9b2f6d67a684c6fbfd5f0458eb7ba99891e" + integrity sha512-q+suddWRfIcnyG5YiDP58sT65AJDZSUhXQDZE3r04AuqD6d/XLaQPPXSBzP2zGerkgBivqtQm9XKGLuHqBID6Q== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-spread@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.7.4.tgz#aa673b356fe6b7e70d69b6e33a17fef641008578" + integrity sha512-8OSs0FLe5/80cndziPlg4R0K6HcWSM0zyNhHhLsmw/Nc5MaA49cAsnoJ/t/YZf8qkG7fD+UjTRaApVDB526d7Q== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-sticky-regex@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.7.4.tgz#ffb68c05090c30732076b1285dc1401b404a123c" + integrity sha512-Ls2NASyL6qtVe1H1hXts9yuEeONV2TJZmplLONkMPUG158CtmnrzW5Q5teibM5UVOFjG0D3IC5mzXR6pPpUY7A== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.0.0" + +"@babel/plugin-transform-template-literals@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.7.4.tgz#1eb6411736dd3fe87dbd20cc6668e5121c17d604" + integrity sha512-sA+KxLwF3QwGj5abMHkHgshp9+rRz+oY9uoRil4CyLtgEuE/88dpkeWgNk5qKVsJE9iSfly3nvHapdRiIS2wnQ== + dependencies: + "@babel/helper-annotate-as-pure" "^7.7.4" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-typescript@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.7.4.tgz#2974fd05f4e85c695acaf497f432342de9fc0636" + integrity sha512-X8e3tcPEKnwwPVG+vP/vSqEShkwODOEeyQGod82qrIuidwIrfnsGn11qPM1jBLF4MqguTXXYzm58d0dY+/wdpg== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.7.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-typescript" "^7.7.4" + +"@babel/plugin-transform-unicode-regex@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.7.4.tgz#a3c0f65b117c4c81c5b6484f2a5e7b95346b83ae" + integrity sha512-N77UUIV+WCvE+5yHw+oks3m18/umd7y392Zv7mYTpFqHtkpcc+QUz+gLJNTWVlWROIWeLqY0f3OjZxV5TcXnRw== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.7.4" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/register@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.7.4.tgz#45a4956471a9df3b012b747f5781cc084ee8f128" + integrity sha512-/fmONZqL6ZMl9KJUYajetCrID6m0xmL4odX7v+Xvoxcv0DdbP/oO0TWIeLUCHqczQ6L6njDMqmqHFy2cp3FFsA== + dependencies: + find-cache-dir "^2.0.0" + lodash "^4.17.13" + make-dir "^2.1.0" + pirates "^4.0.0" + source-map-support "^0.5.16" + +"@babel/runtime@^7.0.0": + version "7.7.6" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.7.6.tgz#d18c511121aff1b4f2cd1d452f1bac9601dd830f" + integrity sha512-BWAJxpNVa0QlE5gZdWjSxXtemZyZ9RmrmVozxt3NUXeZhVIJ5ANyqmMc0JDrivBZyxUuQvFxlvH4OWWOogGfUw== + dependencies: + regenerator-runtime "^0.13.2" + +"@babel/template@^7.0.0", "@babel/template@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.7.4.tgz#428a7d9eecffe27deac0a98e23bf8e3675d2a77b" + integrity sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.7.4" + "@babel/types" "^7.7.4" + +"@babel/traverse@^7.0.0", "@babel/traverse@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.7.4.tgz#9c1e7c60fb679fe4fcfaa42500833333c2058558" + integrity sha512-P1L58hQyupn8+ezVA2z5KBm4/Zr4lCC8dwKCMYzsa5jFMDMQAzaBNy9W5VjB+KAmBjb40U7a/H6ao+Xo+9saIw== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.7.4" + "@babel/helper-function-name" "^7.7.4" + "@babel/helper-split-export-declaration" "^7.7.4" + "@babel/parser" "^7.7.4" + "@babel/types" "^7.7.4" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.13" + +"@babel/types@^7.0.0", "@babel/types@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.7.4.tgz#516570d539e44ddf308c07569c258ff94fde9193" + integrity sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA== + dependencies: + esutils "^2.0.2" + lodash "^4.17.13" + to-fast-properties "^2.0.0" + +"@react-native-community/cli@^1.2.1": + version "1.12.0" + resolved "https://registry.yarnpkg.com/@react-native-community/cli/-/cli-1.12.0.tgz#f4cbc2204af63a87d5736d2fa6a018c1fd5efd44" + integrity sha512-GAs4JgVP8QkEYeZks/T7cCrBuwFJKxd9ksBLRdQ058uvLGkOEeS4g3y4GsVM/9C1zat5h6Z6QwU0h/hj7G3tzg== + dependencies: + chalk "^1.1.1" + commander "^2.19.0" + compression "^1.7.1" + connect "^3.6.5" + denodeify "^1.2.1" + envinfo "^5.7.0" + errorhandler "^1.5.0" + escape-string-regexp "^1.0.5" + execa "^1.0.0" + fs-extra "^7.0.1" + glob "^7.1.1" + graceful-fs "^4.1.3" + inquirer "^3.0.6" + lodash "^4.17.5" + metro "^0.51.0" + metro-config "^0.51.0" + metro-core "^0.51.0" + metro-memory-fs "^0.51.0" + metro-react-native-babel-transformer "^0.51.0" + mime "^1.3.4" + minimist "^1.2.0" + mkdirp "^0.5.1" + morgan "^1.9.0" + node-fetch "^2.2.0" + node-notifier "^5.2.1" + opn "^3.0.2" + plist "^3.0.0" + semver "^5.0.3" + serve-static "^1.13.1" + shell-quote "1.6.1" + slash "^2.0.0" + ws "^1.1.0" + xcode "^2.0.0" + xmldoc "^0.4.0" + +abbrev@1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== + +absolute-path@^0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/absolute-path/-/absolute-path-0.0.0.tgz#a78762fbdadfb5297be99b15d35a785b2f095bf7" + integrity sha1-p4di+9rftSl76ZsV01p4Wy8JW/c= + +accepts@~1.3.5, accepts@~1.3.7: + version "1.3.7" + resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" + integrity sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA== + dependencies: + mime-types "~2.1.24" + negotiator "0.6.2" + +ansi-colors@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-1.1.0.tgz#6374b4dd5d4718ff3ce27a671a3b1cad077132a9" + integrity sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA== + dependencies: + ansi-wrap "^0.1.0" + +ansi-cyan@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-cyan/-/ansi-cyan-0.1.1.tgz#538ae528af8982f28ae30d86f2f17456d2609873" + integrity sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM= + dependencies: + ansi-wrap "0.1.0" + +ansi-escapes@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" + integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== + +ansi-gray@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-gray/-/ansi-gray-0.1.1.tgz#2962cf54ec9792c48510a3deb524436861ef7251" + integrity sha1-KWLPVOyXksSFEKPetSRDaGHvclE= + dependencies: + ansi-wrap "0.1.0" + +ansi-red@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-red/-/ansi-red-0.1.1.tgz#8c638f9d1080800a353c9c28c8a81ca4705d946c" + integrity sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw= + dependencies: + ansi-wrap "0.1.0" + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + +ansi-regex@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= + +ansi-styles@^3.2.0, ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +ansi-wrap@0.1.0, ansi-wrap@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/ansi-wrap/-/ansi-wrap-0.1.0.tgz#a82250ddb0015e9a27ca82e82ea603bbfa45efaf" + integrity sha1-qCJQ3bABXponyoLoLqYDu/pF768= + +ansi@^0.3.0, ansi@~0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/ansi/-/ansi-0.3.1.tgz#0c42d4fb17160d5a9af1e484bace1c66922c1b21" + integrity sha1-DELU+xcWDVqa8eSEus4cZpIsGyE= + +anymatch@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" + integrity sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw== + dependencies: + micromatch "^3.1.4" + normalize-path "^2.1.1" + +aproba@^1.0.3: + version "1.2.0" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" + integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== + +are-we-there-yet@~1.1.2: + version "1.1.5" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" + integrity sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== + dependencies: + delegates "^1.0.0" + readable-stream "^2.0.6" + +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +arr-diff@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-1.1.0.tgz#687c32758163588fef7de7b36fabe495eb1a399a" + integrity sha1-aHwydYFjWI/vfeezb6vklesaOZo= + dependencies: + arr-flatten "^1.0.1" + array-slice "^0.2.3" + +arr-diff@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" + integrity sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8= + dependencies: + arr-flatten "^1.0.1" + +arr-diff@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= + +arr-flatten@^1.0.1, arr-flatten@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== + +arr-union@^2.0.1: + version "2.1.0" + resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-2.1.0.tgz#20f9eab5ec70f5c7d215b1077b1c39161d292c7d" + integrity sha1-IPnqtexw9cfSFbEHexw5Fh0pLH0= + +arr-union@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= + +array-filter@~0.0.0: + version "0.0.1" + resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-0.0.1.tgz#7da8cf2e26628ed732803581fd21f67cacd2eeec" + integrity sha1-fajPLiZijtcygDWB/SH2fKzS7uw= + +array-map@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/array-map/-/array-map-0.0.0.tgz#88a2bab73d1cf7bcd5c1b118a003f66f665fa662" + integrity sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI= + +array-reduce@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/array-reduce/-/array-reduce-0.0.0.tgz#173899d3ffd1c7d9383e4479525dbe278cab5f2b" + integrity sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys= + +array-slice@^0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/array-slice/-/array-slice-0.2.3.tgz#dd3cfb80ed7973a75117cdac69b0b99ec86186f5" + integrity sha1-3Tz7gO15c6dRF82sabC5nshhhvU= + +array-unique@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" + integrity sha1-odl8yvy8JiXMcPrc6zalDFiwGlM= + +array-unique@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= + +art@^0.10.0: + version "0.10.3" + resolved "https://registry.yarnpkg.com/art/-/art-0.10.3.tgz#b01d84a968ccce6208df55a733838c96caeeaea2" + integrity sha512-HXwbdofRTiJT6qZX/FnchtldzJjS3vkLJxQilc3Xj+ma2MXjY4UAyQ0ls1XZYVnDvVIBiFZbC6QsvtW86TD6tQ== + +asap@~2.0.3: + version "2.0.6" + resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" + integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= + +assign-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= + +async-limiter@~1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" + integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== + +async@^2.4.0: + version "2.6.3" + resolved "https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff" + integrity sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg== + dependencies: + lodash "^4.17.14" + +atob@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== + +babel-plugin-dynamic-import-node@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz#f00f507bdaa3c3e3ff6e7e5e98d90a7acab96f7f" + integrity sha512-o6qFkpeQEBxcqt0XYlWzAVxNCSCZdUgcR8IRlhD/8DylxjjO4foPcvTW0GGKa/cVt3rvxZ7o5ippJ+/0nvLhlQ== + dependencies: + object.assign "^4.1.0" + +babel-plugin-syntax-trailing-function-commas@^7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-beta.0.tgz#aa213c1435e2bffeb6fca842287ef534ad05d5cf" + integrity sha512-Xj9XuRuz3nTSbaTXWv3itLOcxyF4oPD8douBBmj7U9BBC6nEBYfyOJYQMf/8PJAFotC62UY5dFfIGEPr7WswzQ== + +babel-preset-fbjs@^3.0.1, babel-preset-fbjs@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/babel-preset-fbjs/-/babel-preset-fbjs-3.3.0.tgz#a6024764ea86c8e06a22d794ca8b69534d263541" + integrity sha512-7QTLTCd2gwB2qGoi5epSULMHugSVgpcVt5YAeiFO9ABLrutDQzKfGwzxgZHLpugq8qMdg/DhRZDZ5CLKxBkEbw== + dependencies: + "@babel/plugin-proposal-class-properties" "^7.0.0" + "@babel/plugin-proposal-object-rest-spread" "^7.0.0" + "@babel/plugin-syntax-class-properties" "^7.0.0" + "@babel/plugin-syntax-flow" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.0.0" + "@babel/plugin-syntax-object-rest-spread" "^7.0.0" + "@babel/plugin-transform-arrow-functions" "^7.0.0" + "@babel/plugin-transform-block-scoped-functions" "^7.0.0" + "@babel/plugin-transform-block-scoping" "^7.0.0" + "@babel/plugin-transform-classes" "^7.0.0" + "@babel/plugin-transform-computed-properties" "^7.0.0" + "@babel/plugin-transform-destructuring" "^7.0.0" + "@babel/plugin-transform-flow-strip-types" "^7.0.0" + "@babel/plugin-transform-for-of" "^7.0.0" + "@babel/plugin-transform-function-name" "^7.0.0" + "@babel/plugin-transform-literals" "^7.0.0" + "@babel/plugin-transform-member-expression-literals" "^7.0.0" + "@babel/plugin-transform-modules-commonjs" "^7.0.0" + "@babel/plugin-transform-object-super" "^7.0.0" + "@babel/plugin-transform-parameters" "^7.0.0" + "@babel/plugin-transform-property-literals" "^7.0.0" + "@babel/plugin-transform-react-display-name" "^7.0.0" + "@babel/plugin-transform-react-jsx" "^7.0.0" + "@babel/plugin-transform-shorthand-properties" "^7.0.0" + "@babel/plugin-transform-spread" "^7.0.0" + "@babel/plugin-transform-template-literals" "^7.0.0" + babel-plugin-syntax-trailing-function-commas "^7.0.0-beta.0" + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + +base64-js@^1.1.2, base64-js@^1.2.3: + version "1.3.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1" + integrity sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g== + +base@^0.11.1: + version "0.11.2" + resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== + dependencies: + cache-base "^1.0.1" + class-utils "^0.3.5" + component-emitter "^1.2.1" + define-property "^1.0.0" + isobject "^3.0.1" + mixin-deep "^1.2.0" + pascalcase "^0.1.1" + +basic-auth@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/basic-auth/-/basic-auth-2.0.1.tgz#b998279bf47ce38344b4f3cf916d4679bbf51e3a" + integrity sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg== + dependencies: + safe-buffer "5.1.2" + +big-integer@^1.6.44: + version "1.6.48" + resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.48.tgz#8fd88bd1632cba4a1c8c3e3d7159f08bb95b4b9e" + integrity sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w== + +bplist-creator@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/bplist-creator/-/bplist-creator-0.0.8.tgz#56b2a6e79e9aec3fc33bf831d09347d73794e79c" + integrity sha512-Za9JKzD6fjLC16oX2wsXfc+qBEhJBJB1YPInoAQpMLhDuj5aVOv1baGeIQSq1Fr3OCqzvsoQcSBSwGId/Ja2PA== + dependencies: + stream-buffers "~2.2.0" + +bplist-parser@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/bplist-parser/-/bplist-parser-0.2.0.tgz#43a9d183e5bf9d545200ceac3e712f79ebbe8d0e" + integrity sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw== + dependencies: + big-integer "^1.6.44" + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@^1.8.2: + version "1.8.5" + resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" + integrity sha1-uneWLhLf+WnWt2cR6RS3N4V79qc= + dependencies: + expand-range "^1.8.1" + preserve "^0.2.0" + repeat-element "^1.1.2" + +braces@^2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== + dependencies: + arr-flatten "^1.1.0" + array-unique "^0.3.2" + extend-shallow "^2.0.1" + fill-range "^4.0.0" + isobject "^3.0.1" + repeat-element "^1.1.2" + snapdragon "^0.8.1" + snapdragon-node "^2.0.1" + split-string "^3.0.2" + to-regex "^3.0.1" + +bser@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" + integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== + dependencies: + node-int64 "^0.4.0" + +buffer-crc32@^0.2.13: + version "0.2.13" + resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" + integrity sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI= + +buffer-from@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + +bytes@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" + integrity sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg= + +cache-base@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== + dependencies: + collection-visit "^1.0.0" + component-emitter "^1.2.1" + get-value "^2.0.6" + has-value "^1.0.0" + isobject "^3.0.1" + set-value "^2.0.0" + to-object-path "^0.3.0" + union-value "^1.0.0" + unset-value "^1.0.0" + +caller-callsite@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/caller-callsite/-/caller-callsite-2.0.0.tgz#847e0fce0a223750a9a027c54b33731ad3154134" + integrity sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ= + dependencies: + callsites "^2.0.0" + +caller-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-2.0.0.tgz#468f83044e369ab2010fac5f06ceee15bb2cb1f4" + integrity sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ= + dependencies: + caller-callsite "^2.0.0" + +callsites@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50" + integrity sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA= + +camelcase@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= + +capture-exit@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-1.2.0.tgz#1c5fcc489fd0ab00d4f1ac7ae1072e3173fbab6f" + integrity sha1-HF/MSJ/QqwDU8ax64QcuMXP7q28= + dependencies: + rsvp "^3.3.3" + +chalk@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +chalk@^2.0.0, chalk@^2.4.1: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chardet@^0.4.0: + version "0.4.2" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" + integrity sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I= + +chownr@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.3.tgz#42d837d5239688d55f303003a508230fa6727142" + integrity sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw== + +class-utils@^0.3.5: + version "0.3.6" + resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== + dependencies: + arr-union "^3.1.0" + define-property "^0.2.5" + isobject "^3.0.0" + static-extend "^0.1.1" + +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + integrity sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU= + dependencies: + restore-cursor "^2.0.0" + +cli-width@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" + integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= + +cliui@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" + integrity sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0= + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + wrap-ansi "^2.0.0" + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= + +collection-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= + dependencies: + map-visit "^1.0.0" + object-visit "^1.0.0" + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + +color-support@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" + integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== + +commander@^2.19.0, commander@^2.9.0: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + +commander@~2.13.0: + version "2.13.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c" + integrity sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA== + +commondir@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" + integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= + +component-emitter@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" + integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== + +compressible@~2.0.16: + version "2.0.17" + resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.17.tgz#6e8c108a16ad58384a977f3a482ca20bff2f38c1" + integrity sha512-BGHeLCK1GV7j1bSmQQAi26X+GgWcTjLr/0tzSvMCl3LH1w1IJ4PFSPoV5316b30cneTziC+B1a+3OjoSUcQYmw== + dependencies: + mime-db ">= 1.40.0 < 2" + +compression@^1.7.1: + version "1.7.4" + resolved "https://registry.yarnpkg.com/compression/-/compression-1.7.4.tgz#95523eff170ca57c29a0ca41e6fe131f41e5bb8f" + integrity sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ== + dependencies: + accepts "~1.3.5" + bytes "3.0.0" + compressible "~2.0.16" + debug "2.6.9" + on-headers "~1.0.2" + safe-buffer "5.1.2" + vary "~1.1.2" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + +concat-stream@^1.6.0: + version "1.6.2" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" + integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== + dependencies: + buffer-from "^1.0.0" + inherits "^2.0.3" + readable-stream "^2.2.2" + typedarray "^0.0.6" + +connect@^3.6.5: + version "3.7.0" + resolved "https://registry.yarnpkg.com/connect/-/connect-3.7.0.tgz#5d49348910caa5e07a01800b030d0c35f20484f8" + integrity sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ== + dependencies: + debug "2.6.9" + finalhandler "1.1.2" + parseurl "~1.3.3" + utils-merge "1.0.1" + +console-control-strings@^1.0.0, console-control-strings@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= + +convert-source-map@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" + integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== + dependencies: + safe-buffer "~5.1.1" + +copy-descriptor@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= + +core-js@^1.0.0: + version "1.2.7" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" + integrity sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY= + +core-js@^2.2.2, core-js@^2.4.1: + version "2.6.11" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.11.tgz#38831469f9922bded8ee21c9dc46985e0399308c" + integrity sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg== + +core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + +cosmiconfig@^5.0.5: + version "5.2.1" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.2.1.tgz#040f726809c591e77a17c0a3626ca45b4f168b1a" + integrity sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA== + dependencies: + import-fresh "^2.0.0" + is-directory "^0.3.1" + js-yaml "^3.13.1" + parse-json "^4.0.0" + +create-react-class@^15.6.3: + version "15.6.3" + resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.3.tgz#2d73237fb3f970ae6ebe011a9e66f46dbca80036" + integrity sha512-M+/3Q6E6DLO6Yx3OwrWjwHBnvfXXYA7W+dFjt/ZDBemHO1DDZhsalX/NUtnTYclN6GfnBDRh4qRHjcDHmlJBJg== + dependencies: + fbjs "^0.8.9" + loose-envify "^1.3.1" + object-assign "^4.1.1" + +cross-spawn@^5.0.1, cross-spawn@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= + dependencies: + lru-cache "^4.0.1" + shebang-command "^1.2.0" + which "^1.2.9" + +cross-spawn@^6.0.0: + version "6.0.5" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" + +debug@2.6.9, debug@^2.2.0, debug@^2.3.3: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +debug@^3.2.6: + version "3.2.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== + dependencies: + ms "^2.1.1" + +debug@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" + integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== + dependencies: + ms "^2.1.1" + +decamelize@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= + +decode-uri-component@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= + +deep-extend@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== + +define-properties@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" + integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== + dependencies: + object-keys "^1.0.12" + +define-property@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= + dependencies: + is-descriptor "^0.1.0" + +define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= + dependencies: + is-descriptor "^1.0.0" + +define-property@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== + dependencies: + is-descriptor "^1.0.2" + isobject "^3.0.1" + +delegates@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= + +denodeify@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/denodeify/-/denodeify-1.2.1.tgz#3a36287f5034e699e7577901052c2e6c94251631" + integrity sha1-OjYof1A05pnnV3kBBSwubJQlFjE= + +depd@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" + integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= + +destroy@~1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" + integrity sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA= + +detect-libc@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= + +dom-walk@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018" + integrity sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg= + +ee-first@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" + integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= + +encodeurl@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" + integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= + +encoding@^0.1.11: + version "0.1.12" + resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" + integrity sha1-U4tm8+5izRq1HsMjgp0flIDHS+s= + dependencies: + iconv-lite "~0.4.13" + +end-of-stream@^1.1.0: + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + +envinfo@^5.7.0: + version "5.12.1" + resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-5.12.1.tgz#83068c33e0972eb657d6bc69a6df30badefb46ef" + integrity sha512-pwdo0/G3CIkQ0y6PCXq4RdkvId2elvtPCJMG0konqlrfkWQbf1DWeH9K2b/cvu2YgGvPPTOnonZxXM1gikFu1w== + ernnavigation-api@1.2.1: version "1.2.1" - resolved "https://registry.yarnpkg.com/ernnavigation-api/-/ernnavigation-api-1.2.1.tgz#5e44cd4dcfc89544e2283d9e40ab1be18d80e243" - integrity sha512-Kyv63hJ+tb0RsXnX7iEB4xtxdgJTKD7ksqSP7L4oeCBfLDTOtBpy63VUywcjW7WUgZ3Bcyxr1xiuPpASw6k3pA== + resolved "https://registry.yarnpkg.com/ernnavigation-api/-/ernnavigation-api-1.2.1.tgz#5e44cd4dcfc89544e2283d9e40ab1be18d80e243" + integrity sha512-Kyv63hJ+tb0RsXnX7iEB4xtxdgJTKD7ksqSP7L4oeCBfLDTOtBpy63VUywcjW7WUgZ3Bcyxr1xiuPpASw6k3pA== + dependencies: + react-native-electrode-bridge "1.5.x" + +error-ex@^1.2.0, error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + dependencies: + is-arrayish "^0.2.1" + +errorhandler@^1.5.0: + version "1.5.1" + resolved "https://registry.yarnpkg.com/errorhandler/-/errorhandler-1.5.1.tgz#b9ba5d17cf90744cd1e851357a6e75bf806a9a91" + integrity sha512-rcOwbfvP1WTViVoUjcfZicVzjhjTuhSMntHh6mW3IrEiyE6mJyXvsToJUJGlGlw/2xU9P5whlWNGlIDVeCiT4A== + dependencies: + accepts "~1.3.7" + escape-html "~1.0.3" + +escape-html@~1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" + integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= + +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +esprima@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +esutils@^2.0.0, esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +etag@~1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" + integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= + +event-target-shim@^1.0.5: + version "1.1.1" + resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-1.1.1.tgz#a86e5ee6bdaa16054475da797ccddf0c55698491" + integrity sha1-qG5e5r2qFgVEddp5fM3fDFVphJE= + +eventemitter3@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" + integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q== + +events@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" + integrity sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ= + +exec-sh@^0.2.0: + version "0.2.2" + resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.2.2.tgz#2a5e7ffcbd7d0ba2755bdecb16e5a427dfbdec36" + integrity sha512-FIUCJz1RbuS0FKTdaAafAByGS0CPvU3R0MeHxgtl+djzCc//F8HakL8GzmVNZanasTbTAY/3DRFA0KpVqj/eAw== + dependencies: + merge "^1.2.0" + +execa@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" + integrity sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c= + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + +execa@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" + integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA== + dependencies: + cross-spawn "^6.0.0" + get-stream "^4.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + +expand-brackets@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" + integrity sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s= + dependencies: + is-posix-bracket "^0.1.0" + +expand-brackets@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= + dependencies: + debug "^2.3.3" + define-property "^0.2.5" + extend-shallow "^2.0.1" + posix-character-classes "^0.1.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +expand-range@^1.8.1: + version "1.8.2" + resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" + integrity sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc= + dependencies: + fill-range "^2.1.0" + +extend-shallow@^1.1.2: + version "1.1.4" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-1.1.4.tgz#19d6bf94dfc09d76ba711f39b872d21ff4dd9071" + integrity sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE= + dependencies: + kind-of "^1.1.0" + +extend-shallow@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= + dependencies: + is-extendable "^0.1.0" + +extend-shallow@^3.0.0, extend-shallow@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= + dependencies: + assign-symbols "^1.0.0" + is-extendable "^1.0.1" + +external-editor@^2.0.4: + version "2.2.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.2.0.tgz#045511cfd8d133f3846673d1047c154e214ad3d5" + integrity sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A== + dependencies: + chardet "^0.4.0" + iconv-lite "^0.4.17" + tmp "^0.0.33" + +extglob@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" + integrity sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE= + dependencies: + is-extglob "^1.0.0" + +extglob@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== + dependencies: + array-unique "^0.3.2" + define-property "^1.0.0" + expand-brackets "^2.1.4" + extend-shallow "^2.0.1" + fragment-cache "^0.2.1" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +fancy-log@^1.3.2: + version "1.3.3" + resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.3.tgz#dbc19154f558690150a23953a0adbd035be45fc7" + integrity sha512-k9oEhlyc0FrVh25qYuSELjr8oxsCoc4/LEZfg2iJJrfEk/tZL9bCoJE47gqAvI2m/AUjluCS4+3I0eTx8n3AEw== + dependencies: + ansi-gray "^0.1.1" + color-support "^1.1.3" + parse-node-version "^1.0.0" + time-stamp "^1.0.0" + +fb-watchman@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.1.tgz#fc84fb39d2709cf3ff6d743706157bb5708a8a85" + integrity sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg== + dependencies: + bser "2.1.1" + +fbjs-css-vars@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/fbjs-css-vars/-/fbjs-css-vars-1.0.2.tgz#216551136ae02fe255932c3ec8775f18e2c078b8" + integrity sha512-b2XGFAFdWZWg0phtAWLHCk836A1Xann+I+Dgd3Gk64MHKZO44FfoD1KxyvbSh0qZsIoXQGGlVztIY+oitJPpRQ== + +fbjs-scripts@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/fbjs-scripts/-/fbjs-scripts-1.2.0.tgz#069a0c0634242d10031c6460ef1fccefcdae8b27" + integrity sha512-5krZ8T0Bf8uky0abPoCLrfa7Orxd8UH4Qq8hRUF2RZYNMu+FmEOrBc7Ib3YVONmxTXTlLAvyrrdrVmksDb2OqQ== + dependencies: + "@babel/core" "^7.0.0" + ansi-colors "^1.0.1" + babel-preset-fbjs "^3.2.0" + core-js "^2.4.1" + cross-spawn "^5.1.0" + fancy-log "^1.3.2" + object-assign "^4.0.1" + plugin-error "^0.1.2" + semver "^5.1.0" + through2 "^2.0.0" + +fbjs@^0.8.9: + version "0.8.17" + resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.17.tgz#c4d598ead6949112653d6588b01a5cdcd9f90fdd" + integrity sha1-xNWY6taUkRJlPWWIsBpc3Nn5D90= + dependencies: + core-js "^1.0.0" + isomorphic-fetch "^2.1.1" + loose-envify "^1.0.0" + object-assign "^4.1.0" + promise "^7.1.1" + setimmediate "^1.0.5" + ua-parser-js "^0.7.18" + +fbjs@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-1.0.0.tgz#52c215e0883a3c86af2a7a776ed51525ae8e0a5a" + integrity sha512-MUgcMEJaFhCaF1QtWGnmq9ZDRAzECTCRAF7O6UZIlAlkTs1SasiX9aP0Iw7wfD2mJ7wDTNfg2w7u5fSCwJk1OA== + dependencies: + core-js "^2.4.1" + fbjs-css-vars "^1.0.0" + isomorphic-fetch "^2.1.1" + loose-envify "^1.0.0" + object-assign "^4.1.0" + promise "^7.1.1" + setimmediate "^1.0.5" + ua-parser-js "^0.7.18" + +figures@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + integrity sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI= + dependencies: + escape-string-regexp "^1.0.5" + +filename-regex@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" + integrity sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY= + +fill-range@^2.1.0: + version "2.2.4" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.4.tgz#eb1e773abb056dcd8df2bfdf6af59b8b3a936565" + integrity sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q== + dependencies: + is-number "^2.1.0" + isobject "^2.0.0" + randomatic "^3.0.0" + repeat-element "^1.1.2" + repeat-string "^1.5.2" + +fill-range@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= + dependencies: + extend-shallow "^2.0.1" + is-number "^3.0.0" + repeat-string "^1.6.1" + to-regex-range "^2.1.0" + +finalhandler@1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d" + integrity sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA== + dependencies: + debug "2.6.9" + encodeurl "~1.0.2" + escape-html "~1.0.3" + on-finished "~2.3.0" + parseurl "~1.3.3" + statuses "~1.5.0" + unpipe "~1.0.0" + +find-cache-dir@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.1.0.tgz#8d0f94cd13fe43c6c7c261a0d86115ca918c05f7" + integrity sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ== + dependencies: + commondir "^1.0.1" + make-dir "^2.0.0" + pkg-dir "^3.0.0" + +find-up@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= + dependencies: + locate-path "^2.0.0" + +find-up@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== + dependencies: + locate-path "^3.0.0" + +for-in@^1.0.1, for-in@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= + +for-own@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" + integrity sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4= + dependencies: + for-in "^1.0.1" + +fragment-cache@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= + dependencies: + map-cache "^0.2.2" + +fresh@0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" + integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= + +fs-extra@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-1.0.0.tgz#cd3ce5f7e7cb6145883fcae3191e9877f8587950" + integrity sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA= + dependencies: + graceful-fs "^4.1.2" + jsonfile "^2.1.0" + klaw "^1.0.0" + +fs-extra@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" + integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + +fs-minipass@^1.2.5: + version "1.2.7" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" + integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== + dependencies: + minipass "^2.6.0" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +fsevents@^1.2.3: + version "1.2.9" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.9.tgz#3f5ed66583ccd6f400b5a00db6f7e861363e388f" + integrity sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw== + dependencies: + nan "^2.12.1" + node-pre-gyp "^0.12.0" + +function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== + +gauge@~1.2.5: + version "1.2.7" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-1.2.7.tgz#e9cec5483d3d4ee0ef44b60a7d99e4935e136d93" + integrity sha1-6c7FSD09TuDvRLYKfZnkk14TbZM= + dependencies: + ansi "^0.3.0" + has-unicode "^2.0.0" + lodash.pad "^4.1.0" + lodash.padend "^4.1.0" + lodash.padstart "^4.1.0" + +gauge@~2.7.3: + version "2.7.4" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" + integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= + dependencies: + aproba "^1.0.3" + console-control-strings "^1.0.0" + has-unicode "^2.0.0" + object-assign "^4.1.0" + signal-exit "^3.0.0" + string-width "^1.0.1" + strip-ansi "^3.0.1" + wide-align "^1.1.0" + +get-caller-file@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" + integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== + +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ= + +get-stream@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" + integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w== + dependencies: + pump "^3.0.0" + +get-value@^2.0.3, get-value@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= + +glob-base@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" + integrity sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q= + dependencies: + glob-parent "^2.0.0" + is-glob "^2.0.0" + +glob-parent@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" + integrity sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg= + dependencies: + is-glob "^2.0.0" + +glob@^7.1.1, glob@^7.1.3: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +global@^4.3.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/global/-/global-4.4.0.tgz#3e7b105179006a323ed71aafca3e9c57a5cc6406" + integrity sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w== + dependencies: + min-document "^2.19.0" + process "^0.11.10" + +globals@^11.1.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== + +graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.1.9: + version "4.2.3" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" + integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== + +growly@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" + integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= + dependencies: + ansi-regex "^2.0.0" + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + +has-symbols@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" + integrity sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== + +has-unicode@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= + +has-value@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= + dependencies: + get-value "^2.0.3" + has-values "^0.1.4" + isobject "^2.0.0" + +has-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= + dependencies: + get-value "^2.0.6" + has-values "^1.0.0" + isobject "^3.0.0" + +has-values@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= + +has-values@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= + dependencies: + is-number "^3.0.0" + kind-of "^4.0.0" + +hosted-git-info@^2.1.4: + version "2.8.5" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.5.tgz#759cfcf2c4d156ade59b0b2dfabddc42a6b9c70c" + integrity sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg== + +http-errors@~1.7.2: + version "1.7.3" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.3.tgz#6c619e4f9c60308c38519498c14fbb10aacebb06" + integrity sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw== + dependencies: + depd "~1.1.2" + inherits "2.0.4" + setprototypeof "1.1.1" + statuses ">= 1.5.0 < 2" + toidentifier "1.0.0" + +iconv-lite@^0.4.17, iconv-lite@^0.4.4, iconv-lite@~0.4.13: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + +ignore-walk@^3.0.1: + version "3.0.3" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37" + integrity sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw== + dependencies: + minimatch "^3.0.4" + +image-size@^0.6.0: + version "0.6.3" + resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.6.3.tgz#e7e5c65bb534bd7cdcedd6cb5166272a85f75fb2" + integrity sha512-47xSUiQioGaB96nqtp5/q55m0aBQSQdyIloMOc/x+QVTDZLNmXE892IIDrJ0hM1A5vcNUDD5tDffkSP5lCaIIA== + +import-fresh@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-2.0.0.tgz#d81355c15612d386c61f9ddd3922d4304822a546" + integrity sha1-2BNVwVYS04bGH53dOSLUMEgipUY= + dependencies: + caller-path "^2.0.0" + resolve-from "^3.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@2.0.4, inherits@^2.0.3, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +ini@~1.3.0: + version "1.3.5" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" + integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== + +inquirer@^3.0.6: + version "3.3.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9" + integrity sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ== + dependencies: + ansi-escapes "^3.0.0" + chalk "^2.0.0" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^2.0.4" + figures "^2.0.0" + lodash "^4.3.0" + mute-stream "0.0.7" + run-async "^2.2.0" + rx-lite "^4.0.8" + rx-lite-aggregates "^4.0.8" + string-width "^2.1.0" + strip-ansi "^4.0.0" + through "^2.3.6" + +invariant@^2.2.4: + version "2.2.4" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== + dependencies: + loose-envify "^1.0.0" + +invert-kv@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + integrity sha1-EEqOSqym09jNFXqO+L+rLXo//bY= + +is-accessor-descriptor@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= + dependencies: + kind-of "^3.0.2" + +is-accessor-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== + dependencies: + kind-of "^6.0.0" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= + +is-buffer@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== + +is-data-descriptor@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= + dependencies: + kind-of "^3.0.2" + +is-data-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== + dependencies: + kind-of "^6.0.0" + +is-descriptor@^0.1.0: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== + dependencies: + is-accessor-descriptor "^0.1.6" + is-data-descriptor "^0.1.4" + kind-of "^5.0.0" + +is-descriptor@^1.0.0, is-descriptor@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== + dependencies: + is-accessor-descriptor "^1.0.0" + is-data-descriptor "^1.0.0" + kind-of "^6.0.2" + +is-directory@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" + integrity sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE= + +is-dotfile@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" + integrity sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE= + +is-equal-shallow@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" + integrity sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ= + dependencies: + is-primitive "^2.0.0" + +is-extendable@^0.1.0, is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= + +is-extendable@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== + dependencies: + is-plain-object "^2.0.4" + +is-extglob@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" + integrity sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA= + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +is-glob@^2.0.0, is-glob@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" + integrity sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM= + dependencies: + is-extglob "^1.0.0" + +is-number@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" + integrity sha1-Afy7s5NGOlSPL0ZszhbezknbkI8= + dependencies: + kind-of "^3.0.2" + +is-number@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= + dependencies: + kind-of "^3.0.2" + +is-number@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff" + integrity sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ== + +is-plain-object@^2.0.3, is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== + dependencies: + isobject "^3.0.1" + +is-posix-bracket@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" + integrity sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q= + +is-primitive@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" + integrity sha1-IHurkWOEmcB7Kt8kCkGochADRXU= + +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o= + +is-stream@^1.0.1, is-stream@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= + +is-windows@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== + +is-wsl@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" + integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= + +isarray@1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + +isobject@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= + dependencies: + isarray "1.0.0" + +isobject@^3.0.0, isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= + +isomorphic-fetch@^2.1.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" + integrity sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk= + dependencies: + node-fetch "^1.0.1" + whatwg-fetch ">=0.10.0" + +jest-haste-map@24.0.0-alpha.6: + version "24.0.0-alpha.6" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.0.0-alpha.6.tgz#fb2c785080f391b923db51846b86840d0d773076" + integrity sha512-+NO2HMbjvrG8BC39ieLukdpFrcPhhjCJGhpbHodHNZygH1Tt06WrlNYGpZtWKx/zpf533tCtMQXO/q59JenjNw== + dependencies: + fb-watchman "^2.0.0" + graceful-fs "^4.1.11" + invariant "^2.2.4" + jest-serializer "^24.0.0-alpha.6" + jest-worker "^24.0.0-alpha.6" + micromatch "^2.3.11" + sane "^3.0.0" + +jest-serializer@24.0.0-alpha.6: + version "24.0.0-alpha.6" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.0.0-alpha.6.tgz#27d2fee4b1a85698717a30c3ec2ab80767312597" + integrity sha512-IPA5T6/GhlE6dedSk7Cd7YfuORnYjN0VD5iJVFn1Q81RJjpj++Hen5kJbKcg547vXsQ1TddV15qOA/zeIfOCLw== + +jest-serializer@^24.0.0-alpha.6: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.9.0.tgz#e6d7d7ef96d31e8b9079a714754c5d5c58288e73" + integrity sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ== + +jest-worker@24.0.0-alpha.6: + version "24.0.0-alpha.6" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.0.0-alpha.6.tgz#463681b92c117c57107135c14b9b9d6cd51d80ce" + integrity sha512-iXtH7MR9bjWlNnlnRBcrBRrb4cSVxML96La5vsnmBvDI+mJnkP5uEt6Fgpo5Y8f3z9y2Rd7wuPnKRxqQsiU/dA== + dependencies: + merge-stream "^1.0.1" + +jest-worker@^24.0.0-alpha.6: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.9.0.tgz#5dbfdb5b2d322e98567898238a9697bcce67b3e5" + integrity sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw== + dependencies: + merge-stream "^2.0.0" + supports-color "^6.1.0" + +"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-yaml@^3.13.1: + version "3.13.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" + integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +jsesc@^2.5.1: + version "2.5.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== + +jsesc@~0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" + integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= + +json-parse-better-errors@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" + integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== + +json-stable-stringify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" + integrity sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8= + dependencies: + jsonify "~0.0.0" + +json5@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.1.tgz#81b6cb04e9ba496f1c7005d07b4368a2638f90b6" + integrity sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ== + dependencies: + minimist "^1.2.0" + +jsonfile@^2.1.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" + integrity sha1-NzaitCi4e72gzIO1P6PWM6NcKug= + optionalDependencies: + graceful-fs "^4.1.6" + +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= + optionalDependencies: + graceful-fs "^4.1.6" + +jsonify@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" + integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= + +kind-of@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-1.1.0.tgz#140a3d2d41a36d2efcfa9377b62c24f8495a5c44" + integrity sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ= + +kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= + dependencies: + is-buffer "^1.1.5" + +kind-of@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= + dependencies: + is-buffer "^1.1.5" + +kind-of@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== + +kind-of@^6.0.0, kind-of@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== + +klaw@^1.0.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439" + integrity sha1-QIhDO0azsbolnXh4XY6W9zugJDk= + optionalDependencies: + graceful-fs "^4.1.9" + +lcid@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + integrity sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU= + dependencies: + invert-kv "^1.0.0" + +load-json-file@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" + integrity sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg= + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + strip-bom "^3.0.0" + +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + +locate-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== + dependencies: + p-locate "^3.0.0" + path-exists "^3.0.0" + +lodash.pad@^4.1.0: + version "4.5.1" + resolved "https://registry.yarnpkg.com/lodash.pad/-/lodash.pad-4.5.1.tgz#4330949a833a7c8da22cc20f6a26c4d59debba70" + integrity sha1-QzCUmoM6fI2iLMIPaibE1Z3runA= + +lodash.padend@^4.1.0: + version "4.6.1" + resolved "https://registry.yarnpkg.com/lodash.padend/-/lodash.padend-4.6.1.tgz#53ccba047d06e158d311f45da625f4e49e6f166e" + integrity sha1-U8y6BH0G4VjTEfRdpiX05J5vFm4= + +lodash.padstart@^4.1.0: + version "4.6.1" + resolved "https://registry.yarnpkg.com/lodash.padstart/-/lodash.padstart-4.6.1.tgz#d2e3eebff0d9d39ad50f5cbd1b52a7bce6bb611b" + integrity sha1-0uPuv/DZ05rVD1y9G1KnvOa7YRs= + +lodash.throttle@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4" + integrity sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ= + +lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.5, lodash@^4.3.0, lodash@^4.6.1: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + +loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1, loose-envify@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== + dependencies: + js-tokens "^3.0.0 || ^4.0.0" + +lru-cache@^4.0.1: + version "4.1.5" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" + integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + +make-dir@^2.0.0, make-dir@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" + integrity sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA== + dependencies: + pify "^4.0.1" + semver "^5.6.0" + +makeerror@1.0.x: + version "1.0.11" + resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" + integrity sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw= + dependencies: + tmpl "1.0.x" + +map-cache@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= + +map-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= + dependencies: + object-visit "^1.0.0" + +math-random@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.4.tgz#5dd6943c938548267016d4e34f057583080c514c" + integrity sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A== + +mem@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" + integrity sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y= + dependencies: + mimic-fn "^1.0.0" + +merge-stream@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-1.0.1.tgz#4041202d508a342ba00174008df0c251b8c135e1" + integrity sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE= + dependencies: + readable-stream "^2.0.1" + +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +merge@^1.2.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.1.tgz#38bebf80c3220a8a487b6fcfb3941bb11720c145" + integrity sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ== + +metro-babel-register@0.51.0: + version "0.51.0" + resolved "https://registry.yarnpkg.com/metro-babel-register/-/metro-babel-register-0.51.0.tgz#d86d3f2d90b45c7a3c6ae67a53bd1e50bad7a24d" + integrity sha512-rhdvHFOZ7/ub019A3+aYs8YeLydb02/FAMsKr2Nz2Jlf6VUxWrMnrcT0NYX16F9TGdi2ulRlJ9dwvUmdhkk+Bw== + dependencies: + "@babel/core" "^7.0.0" + "@babel/plugin-proposal-class-properties" "^7.0.0" + "@babel/plugin-proposal-nullish-coalescing-operator" "^7.0.0" + "@babel/plugin-proposal-object-rest-spread" "^7.0.0" + "@babel/plugin-proposal-optional-catch-binding" "^7.0.0" + "@babel/plugin-proposal-optional-chaining" "^7.0.0" + "@babel/plugin-transform-async-to-generator" "^7.0.0" + "@babel/plugin-transform-flow-strip-types" "^7.0.0" + "@babel/plugin-transform-modules-commonjs" "^7.0.0" + "@babel/register" "^7.0.0" + core-js "^2.2.2" + escape-string-regexp "^1.0.5" + +metro-babel-transformer@0.51.0: + version "0.51.0" + resolved "https://registry.yarnpkg.com/metro-babel-transformer/-/metro-babel-transformer-0.51.0.tgz#9ee5199163ac46b2057527b3f8cbd8b089ffc03e" + integrity sha512-M7KEY/hjD3E8tJEliWgI0VOSaJtqaznC0ItM6FiMrhoGDqqa1BvGofl+EPcKqjBSOV1UgExua/T1VOIWbjwQsw== + dependencies: + "@babel/core" "^7.0.0" + +metro-babel-transformer@0.51.1: + version "0.51.1" + resolved "https://registry.yarnpkg.com/metro-babel-transformer/-/metro-babel-transformer-0.51.1.tgz#97be9e2b96c78aa202b52ae05fb86f71327aef72" + integrity sha512-+tOnZZzOzufB86ASdfimUEGB1jBKsdsVpPdjNJZkueTFyvYlGqWDQKHM1w9bwKMeM/czPQ48Y6m8Bou6le0X4w== + dependencies: + "@babel/core" "^7.0.0" + +metro-babel7-plugin-react-transform@0.51.0: + version "0.51.0" + resolved "https://registry.yarnpkg.com/metro-babel7-plugin-react-transform/-/metro-babel7-plugin-react-transform-0.51.0.tgz#af27dd81666b91f05d2b371b0d6d283c585e38b6" + integrity sha512-dZ95kXcE2FJMoRsYhxr7YLCbOlHWKwe0bOpihRhfImDTgFfuKIzU4ROQwMUbE0NCbzB+ATFsa2FZ3pHDJ5GI0w== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + +metro-babel7-plugin-react-transform@0.51.1: + version "0.51.1" + resolved "https://registry.yarnpkg.com/metro-babel7-plugin-react-transform/-/metro-babel7-plugin-react-transform-0.51.1.tgz#9cce2c340cc4006fc82aa6dfab27af22d592607e" + integrity sha512-wzn4X9KgmAMZ7Bi6v9KxA7dw+AHGL0RODPxU5NDJ3A6d0yERvzfZ3qkzWhz8jbFkVBK12cu5DTho3HBazKQDOw== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + +metro-cache@0.51.1: + version "0.51.1" + resolved "https://registry.yarnpkg.com/metro-cache/-/metro-cache-0.51.1.tgz#d0b296eab8e009214413bba87e4eac3d9b44cd04" + integrity sha512-0m1+aicsw77LVAehNuTxDpE1c/7Xv/ajRD+UL/lFCWUxnrjSbxVtIKr8l5DxEY11082c1axVRuaV9e436W+eXg== + dependencies: + jest-serializer "24.0.0-alpha.6" + metro-core "0.51.1" + mkdirp "^0.5.1" + rimraf "^2.5.4" + +metro-config@0.51.1, metro-config@^0.51.0: + version "0.51.1" + resolved "https://registry.yarnpkg.com/metro-config/-/metro-config-0.51.1.tgz#8f1a241ce2c0b521cd492c39bc5c6c69e3397b82" + integrity sha512-WCNd0tTI9gb/ubgTqK1+ljZL4b3hsXVinsOAtep4nHiVb6DSDdbO2yXDD2rpYx3NE6hDRMFS9HHg6G0139pAqQ== + dependencies: + cosmiconfig "^5.0.5" + metro "0.51.1" + metro-cache "0.51.1" + metro-core "0.51.1" + pretty-format "24.0.0-alpha.6" + +metro-core@0.51.1, metro-core@^0.51.0: + version "0.51.1" + resolved "https://registry.yarnpkg.com/metro-core/-/metro-core-0.51.1.tgz#e7227fb1dd1bb3f953272fad9876e6201140b038" + integrity sha512-sG1yACjdFqmIzZN50HqLTKUMp1oy0AehHhmIuYeIllo1DjX6Y2o3UAT3rGP8U+SAqJGXf/OWzl6VNyRPGDENfA== + dependencies: + jest-haste-map "24.0.0-alpha.6" + lodash.throttle "^4.1.1" + metro-resolver "0.51.1" + wordwrap "^1.0.0" + +metro-memory-fs@^0.51.0: + version "0.51.1" + resolved "https://registry.yarnpkg.com/metro-memory-fs/-/metro-memory-fs-0.51.1.tgz#624291f5956b0fd11532d80b1b85d550926f96c9" + integrity sha512-dXVUpLPLwfQcYHd1HlqHGVzBsiwvUdT92TDSbdc10152TP+iynHBqLDWbxt0MAtd6c/QXwOuGZZ1IcX3+lv5iw== + +metro-minify-uglify@0.51.1: + version "0.51.1" + resolved "https://registry.yarnpkg.com/metro-minify-uglify/-/metro-minify-uglify-0.51.1.tgz#60cd8fe4d3e82d6670c717b8ddb52ae63199c0e4" + integrity sha512-HAqd/rFrQ6mnbqVAszDXIKTg2rqHlY9Fm8DReakgbkAeyMbF2mH3kEgtesPmTrhajdFk81UZcNSm6wxj1JMgVg== + dependencies: + uglify-es "^3.1.9" + +metro-react-native-babel-preset@0.51.0: + version "0.51.0" + resolved "https://registry.yarnpkg.com/metro-react-native-babel-preset/-/metro-react-native-babel-preset-0.51.0.tgz#978d960acf2d214bbbe43e59145878d663bd07de" + integrity sha512-Y/aPeLl4RzY8IEAneOyDcpdjto/8yjIuX9eUWRngjSqdHYhGQtqiSBpfTpo0BvXpwNRLwCLHyXo58gNpckTJFw== + dependencies: + "@babel/plugin-proposal-class-properties" "^7.0.0" + "@babel/plugin-proposal-export-default-from" "^7.0.0" + "@babel/plugin-proposal-nullish-coalescing-operator" "^7.0.0" + "@babel/plugin-proposal-object-rest-spread" "^7.0.0" + "@babel/plugin-proposal-optional-catch-binding" "^7.0.0" + "@babel/plugin-proposal-optional-chaining" "^7.0.0" + "@babel/plugin-syntax-dynamic-import" "^7.0.0" + "@babel/plugin-syntax-export-default-from" "^7.0.0" + "@babel/plugin-transform-arrow-functions" "^7.0.0" + "@babel/plugin-transform-block-scoping" "^7.0.0" + "@babel/plugin-transform-classes" "^7.0.0" + "@babel/plugin-transform-computed-properties" "^7.0.0" + "@babel/plugin-transform-destructuring" "^7.0.0" + "@babel/plugin-transform-exponentiation-operator" "^7.0.0" + "@babel/plugin-transform-flow-strip-types" "^7.0.0" + "@babel/plugin-transform-for-of" "^7.0.0" + "@babel/plugin-transform-function-name" "^7.0.0" + "@babel/plugin-transform-literals" "^7.0.0" + "@babel/plugin-transform-modules-commonjs" "^7.0.0" + "@babel/plugin-transform-object-assign" "^7.0.0" + "@babel/plugin-transform-parameters" "^7.0.0" + "@babel/plugin-transform-react-display-name" "^7.0.0" + "@babel/plugin-transform-react-jsx" "^7.0.0" + "@babel/plugin-transform-react-jsx-source" "^7.0.0" + "@babel/plugin-transform-regenerator" "^7.0.0" + "@babel/plugin-transform-runtime" "^7.0.0" + "@babel/plugin-transform-shorthand-properties" "^7.0.0" + "@babel/plugin-transform-spread" "^7.0.0" + "@babel/plugin-transform-sticky-regex" "^7.0.0" + "@babel/plugin-transform-template-literals" "^7.0.0" + "@babel/plugin-transform-typescript" "^7.0.0" + "@babel/plugin-transform-unicode-regex" "^7.0.0" + "@babel/template" "^7.0.0" + metro-babel7-plugin-react-transform "0.51.0" + react-transform-hmr "^1.0.4" + +metro-react-native-babel-preset@0.51.1: + version "0.51.1" + resolved "https://registry.yarnpkg.com/metro-react-native-babel-preset/-/metro-react-native-babel-preset-0.51.1.tgz#44aeeedfea37f7c2ab8f6f273fa71b90fe65f089" + integrity sha512-e9tsYDFhU70gar0jQWcZXRPJVCv4k7tEs6Pm74wXO2OO/T1MEumbvniDIGwGG8bG8RUnYdHhjcaiub2Vc5BRWw== + dependencies: + "@babel/plugin-proposal-class-properties" "^7.0.0" + "@babel/plugin-proposal-export-default-from" "^7.0.0" + "@babel/plugin-proposal-nullish-coalescing-operator" "^7.0.0" + "@babel/plugin-proposal-object-rest-spread" "^7.0.0" + "@babel/plugin-proposal-optional-catch-binding" "^7.0.0" + "@babel/plugin-proposal-optional-chaining" "^7.0.0" + "@babel/plugin-syntax-dynamic-import" "^7.0.0" + "@babel/plugin-syntax-export-default-from" "^7.0.0" + "@babel/plugin-transform-arrow-functions" "^7.0.0" + "@babel/plugin-transform-block-scoping" "^7.0.0" + "@babel/plugin-transform-classes" "^7.0.0" + "@babel/plugin-transform-computed-properties" "^7.0.0" + "@babel/plugin-transform-destructuring" "^7.0.0" + "@babel/plugin-transform-exponentiation-operator" "^7.0.0" + "@babel/plugin-transform-flow-strip-types" "^7.0.0" + "@babel/plugin-transform-for-of" "^7.0.0" + "@babel/plugin-transform-function-name" "^7.0.0" + "@babel/plugin-transform-literals" "^7.0.0" + "@babel/plugin-transform-modules-commonjs" "^7.0.0" + "@babel/plugin-transform-object-assign" "^7.0.0" + "@babel/plugin-transform-parameters" "^7.0.0" + "@babel/plugin-transform-react-display-name" "^7.0.0" + "@babel/plugin-transform-react-jsx" "^7.0.0" + "@babel/plugin-transform-react-jsx-source" "^7.0.0" + "@babel/plugin-transform-regenerator" "^7.0.0" + "@babel/plugin-transform-runtime" "^7.0.0" + "@babel/plugin-transform-shorthand-properties" "^7.0.0" + "@babel/plugin-transform-spread" "^7.0.0" + "@babel/plugin-transform-sticky-regex" "^7.0.0" + "@babel/plugin-transform-template-literals" "^7.0.0" + "@babel/plugin-transform-typescript" "^7.0.0" + "@babel/plugin-transform-unicode-regex" "^7.0.0" + "@babel/template" "^7.0.0" + metro-babel7-plugin-react-transform "0.51.1" + react-transform-hmr "^1.0.4" + +metro-react-native-babel-transformer@0.51.0: + version "0.51.0" + resolved "https://registry.yarnpkg.com/metro-react-native-babel-transformer/-/metro-react-native-babel-transformer-0.51.0.tgz#57a695e97a19d95de63c9633f9d0dc024ee8e99a" + integrity sha512-VFnqtE0qrVmU1HV9B04o53+NZHvDwR+CWCoEx4+7vCqJ9Tvas741biqCjah9xtifoKdElQELk6x0soOAWCDFJA== + dependencies: + "@babel/core" "^7.0.0" + babel-preset-fbjs "^3.0.1" + metro-babel-transformer "0.51.0" + metro-react-native-babel-preset "0.51.0" + +metro-react-native-babel-transformer@^0.51.0: + version "0.51.1" + resolved "https://registry.yarnpkg.com/metro-react-native-babel-transformer/-/metro-react-native-babel-transformer-0.51.1.tgz#bac34f988c150c725cd1875c13701cc2032615f9" + integrity sha512-D0KU+JPb/Z76nUWt3+bkjKggOlGvqAVI2BpIH2JFKprpUyBjWaCRqHnkBfZGixYwUfmu93MIlKJWr6iKzzFrlg== + dependencies: + "@babel/core" "^7.0.0" + babel-preset-fbjs "^3.0.1" + metro-babel-transformer "0.51.1" + metro-react-native-babel-preset "0.51.1" + +metro-resolver@0.51.1: + version "0.51.1" + resolved "https://registry.yarnpkg.com/metro-resolver/-/metro-resolver-0.51.1.tgz#4c26f0baee47d30250187adca3d34c902e627611" + integrity sha512-zmWbD/287NDA/jLPuPV0hne/YMMSG0dljzu21TYMg2lXRLur/zROJHHhyepZvuBHgInXBi4Vhr2wvuSnY39SuA== + dependencies: + absolute-path "^0.0.0" + +metro-source-map@0.51.1: + version "0.51.1" + resolved "https://registry.yarnpkg.com/metro-source-map/-/metro-source-map-0.51.1.tgz#1a8da138e98e184304d5558b4f92a5c2141822d0" + integrity sha512-JyrE+RV4YumrboHPHTGsUUGERjQ681ImRLrSYDGcmNv4tfpk9nvAK26UAas4IvBYFCC9oW90m0udt3kaQGv59Q== + dependencies: + source-map "^0.5.6" + +metro@0.51.1, metro@^0.51.0: + version "0.51.1" + resolved "https://registry.yarnpkg.com/metro/-/metro-0.51.1.tgz#b0aad4731593b9f244261bad1abb2a006d1c8969" + integrity sha512-nM0dqn8LQlMjhChl2fzTUq2EWiUebZM7nkesD9vQe47W10bj/tbRLPiIIAxht6SRDbPd/hRA+t39PxLhPSKEKg== + dependencies: + "@babel/core" "^7.0.0" + "@babel/generator" "^7.0.0" + "@babel/parser" "^7.0.0" + "@babel/plugin-external-helpers" "^7.0.0" + "@babel/template" "^7.0.0" + "@babel/traverse" "^7.0.0" + "@babel/types" "^7.0.0" + absolute-path "^0.0.0" + async "^2.4.0" + babel-preset-fbjs "^3.0.1" + buffer-crc32 "^0.2.13" + chalk "^2.4.1" + concat-stream "^1.6.0" + connect "^3.6.5" + debug "^2.2.0" + denodeify "^1.2.1" + eventemitter3 "^3.0.0" + fbjs "^1.0.0" + fs-extra "^1.0.0" + graceful-fs "^4.1.3" + image-size "^0.6.0" + invariant "^2.2.4" + jest-haste-map "24.0.0-alpha.6" + jest-worker "24.0.0-alpha.6" + json-stable-stringify "^1.0.1" + lodash.throttle "^4.1.1" + merge-stream "^1.0.1" + metro-babel-transformer "0.51.1" + metro-cache "0.51.1" + metro-config "0.51.1" + metro-core "0.51.1" + metro-minify-uglify "0.51.1" + metro-react-native-babel-preset "0.51.1" + metro-resolver "0.51.1" + metro-source-map "0.51.1" + mime-types "2.1.11" + mkdirp "^0.5.1" + node-fetch "^2.2.0" + nullthrows "^1.1.0" + react-transform-hmr "^1.0.4" + resolve "^1.5.0" + rimraf "^2.5.4" + serialize-error "^2.1.0" + source-map "^0.5.6" + temp "0.8.3" + throat "^4.1.0" + wordwrap "^1.0.0" + write-file-atomic "^1.2.0" + ws "^1.1.5" + xpipe "^1.0.5" + yargs "^9.0.0" + +micromatch@^2.3.11: + version "2.3.11" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" + integrity sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU= + dependencies: + arr-diff "^2.0.0" + array-unique "^0.2.1" + braces "^1.8.2" + expand-brackets "^0.1.4" + extglob "^0.3.1" + filename-regex "^2.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.1" + kind-of "^3.0.2" + normalize-path "^2.0.1" + object.omit "^2.0.0" + parse-glob "^3.0.4" + regex-cache "^0.4.2" + +micromatch@^3.1.4: + version "3.1.10" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" + integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + braces "^2.3.1" + define-property "^2.0.2" + extend-shallow "^3.0.2" + extglob "^2.0.4" + fragment-cache "^0.2.1" + kind-of "^6.0.2" + nanomatch "^1.2.9" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.2" + +mime-db@1.42.0, "mime-db@>= 1.40.0 < 2": + version "1.42.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.42.0.tgz#3e252907b4c7adb906597b4b65636272cf9e7bac" + integrity sha512-UbfJCR4UAVRNgMpfImz05smAXK7+c+ZntjaA26ANtkXLlOe947Aag5zdIcKQULAiF9Cq4WxBi9jUs5zkA84bYQ== + +mime-db@~1.23.0: + version "1.23.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.23.0.tgz#a31b4070adaea27d732ea333740a64d0ec9a6659" + integrity sha1-oxtAcK2uon1zLqMzdApk0OyaZlk= + +mime-types@2.1.11: + version "2.1.11" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.11.tgz#c259c471bda808a85d6cd193b430a5fae4473b3c" + integrity sha1-wlnEcb2oCKhdbNGTtDCl+uRHOzw= + dependencies: + mime-db "~1.23.0" + +mime-types@~2.1.24: + version "2.1.25" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.25.tgz#39772d46621f93e2a80a856c53b86a62156a6437" + integrity sha512-5KhStqB5xpTAeGqKBAMgwaYMnQik7teQN4IAzC7npDv6kzeU6prfkR67bc87J1kWMPGkoaZSq1npmexMgkmEVg== + dependencies: + mime-db "1.42.0" + +mime@1.6.0, mime@^1.3.4: + version "1.6.0" + resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" + integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== + +mimic-fn@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== + +min-document@^2.19.0: + version "2.19.0" + resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685" + integrity sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU= + dependencies: + dom-walk "^0.1.0" + +minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + dependencies: + brace-expansion "^1.1.7" + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= + +minimist@^1.1.1, minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= + +minimist@~0.0.1: + version "0.0.10" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" + integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= + +minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" + integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== + dependencies: + safe-buffer "^5.1.2" + yallist "^3.0.0" + +minizlib@^1.2.1: + version "1.3.3" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" + integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== + dependencies: + minipass "^2.9.0" + +mixin-deep@^1.2.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" + integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA== + dependencies: + for-in "^1.0.2" + is-extendable "^1.0.1" + +mkdirp@^0.5.0, mkdirp@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= + dependencies: + minimist "0.0.8" + +morgan@^1.9.0: + version "1.9.1" + resolved "https://registry.yarnpkg.com/morgan/-/morgan-1.9.1.tgz#0a8d16734a1d9afbc824b99df87e738e58e2da59" + integrity sha512-HQStPIV4y3afTiCYVxirakhlCfGkI161c76kKFca7Fk1JusM//Qeo1ej2XaMniiNeaZklMVrh3vTtIzpzwbpmA== + dependencies: + basic-auth "~2.0.0" + debug "2.6.9" + depd "~1.1.2" + on-finished "~2.3.0" + on-headers "~1.0.1" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +ms@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" + integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== + +ms@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= + +nan@^2.12.1: + version "2.14.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" + integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== + +nanomatch@^1.2.9: + version "1.2.13" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + define-property "^2.0.2" + extend-shallow "^3.0.2" + fragment-cache "^0.2.1" + is-windows "^1.0.2" + kind-of "^6.0.2" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +needle@^2.2.1: + version "2.4.0" + resolved "https://registry.yarnpkg.com/needle/-/needle-2.4.0.tgz#6833e74975c444642590e15a750288c5f939b57c" + integrity sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg== + dependencies: + debug "^3.2.6" + iconv-lite "^0.4.4" + sax "^1.2.4" + +negotiator@0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" + integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw== + +nice-try@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== + +node-fetch@^1.0.1: + version "1.7.3" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" + integrity sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ== + dependencies: + encoding "^0.1.11" + is-stream "^1.0.1" + +node-fetch@^2.2.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" + integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== + +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= + +node-modules-regexp@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" + integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= + +node-notifier@^5.2.1: + version "5.4.3" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.4.3.tgz#cb72daf94c93904098e28b9c590fd866e464bd50" + integrity sha512-M4UBGcs4jeOK9CjTsYwkvH6/MzuUmGCyTW+kCY7uO+1ZVr0+FHGdPdIf5CCLqAaxnRrWidyoQlNkMIIVwbKB8Q== + dependencies: + growly "^1.3.0" + is-wsl "^1.1.0" + semver "^5.5.0" + shellwords "^0.1.1" + which "^1.3.0" + +node-pre-gyp@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.12.0.tgz#39ba4bb1439da030295f899e3b520b7785766149" + integrity sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A== + dependencies: + detect-libc "^1.0.2" + mkdirp "^0.5.1" + needle "^2.2.1" + nopt "^4.0.1" + npm-packlist "^1.1.6" + npmlog "^4.0.2" + rc "^1.2.7" + rimraf "^2.6.1" + semver "^5.3.0" + tar "^4" + +nopt@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" + integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00= + dependencies: + abbrev "1" + osenv "^0.1.4" + +normalize-package-data@^2.3.2: + version "2.5.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== + dependencies: + hosted-git-info "^2.1.4" + resolve "^1.10.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +normalize-path@^2.0.1, normalize-path@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= + dependencies: + remove-trailing-separator "^1.0.1" + +npm-bundled@^1.0.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.1.tgz#1edd570865a94cdb1bc8220775e29466c9fb234b" + integrity sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA== + dependencies: + npm-normalize-package-bin "^1.0.1" + +npm-normalize-package-bin@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz#6e79a41f23fd235c0623218228da7d9c23b8f6e2" + integrity sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA== + +npm-packlist@^1.1.6: + version "1.4.7" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.7.tgz#9e954365a06b80b18111ea900945af4f88ed4848" + integrity sha512-vAj7dIkp5NhieaGZxBJB8fF4R0078rqsmhJcAfXZ6O7JJhjhPK96n5Ry1oZcfLXgfun0GWTZPOxaEyqv8GBykQ== + dependencies: + ignore-walk "^3.0.1" + npm-bundled "^1.0.1" + +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= + dependencies: + path-key "^2.0.0" + +npmlog@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-2.0.4.tgz#98b52530f2514ca90d09ec5b22c8846722375692" + integrity sha1-mLUlMPJRTKkNCexbIsiEZyI3VpI= + dependencies: + ansi "~0.3.1" + are-we-there-yet "~1.1.2" + gauge "~1.2.5" + +npmlog@^4.0.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" + integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== + dependencies: + are-we-there-yet "~1.1.2" + console-control-strings "~1.1.0" + gauge "~2.7.3" + set-blocking "~2.0.0" + +nullthrows@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/nullthrows/-/nullthrows-1.1.1.tgz#7818258843856ae971eae4208ad7d7eb19a431b1" + integrity sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw== + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= + +object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + +object-copy@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= + dependencies: + copy-descriptor "^0.1.0" + define-property "^0.2.5" + kind-of "^3.0.3" + +object-keys@^1.0.11, object-keys@^1.0.12: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== + +object-visit@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= + dependencies: + isobject "^3.0.0" + +object.assign@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" + integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== + dependencies: + define-properties "^1.1.2" + function-bind "^1.1.1" + has-symbols "^1.0.0" + object-keys "^1.0.11" + +object.omit@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" + integrity sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo= + dependencies: + for-own "^0.1.4" + is-extendable "^0.1.1" + +object.pick@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= + dependencies: + isobject "^3.0.1" + +on-finished@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" + integrity sha1-IPEzZIGwg811M3mSoWlxqi2QaUc= + dependencies: + ee-first "1.1.1" + +on-headers@~1.0.1, on-headers@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.0.2.tgz#772b0ae6aaa525c399e489adfad90c403eb3c28f" + integrity sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA== + +once@^1.3.0, once@^1.3.1, once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + integrity sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ= + dependencies: + mimic-fn "^1.0.0" + +opn@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/opn/-/opn-3.0.3.tgz#b6d99e7399f78d65c3baaffef1fb288e9b85243a" + integrity sha1-ttmec5n3jWXDuq/+8fsojpuFJDo= + dependencies: + object-assign "^4.0.1" + +optimist@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY= + dependencies: + minimist "~0.0.1" + wordwrap "~0.0.2" + +options@>=0.0.5: + version "0.0.6" + resolved "https://registry.yarnpkg.com/options/-/options-0.0.6.tgz#ec22d312806bb53e731773e7cdaefcf1c643128f" + integrity sha1-7CLTEoBrtT5zF3Pnza788cZDEo8= + +os-homedir@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= + +os-locale@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" + integrity sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA== + dependencies: + execa "^0.7.0" + lcid "^1.0.0" + mem "^1.1.0" + +os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= + +osenv@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" + integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== + dependencies: + os-homedir "^1.0.0" + os-tmpdir "^1.0.0" + +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= + +p-limit@^1.1.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== + dependencies: + p-try "^1.0.0" + +p-limit@^2.0.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.1.tgz#aa07a788cc3151c939b5131f63570f0dd2009537" + integrity sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg== + dependencies: + p-try "^2.0.0" + +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= + dependencies: + p-limit "^1.1.0" + +p-locate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== + dependencies: + p-limit "^2.0.0" + +p-try@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= + +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +parse-glob@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" + integrity sha1-ssN2z7EfNVE7rdFz7wu246OIORw= + dependencies: + glob-base "^0.3.0" + is-dotfile "^1.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.0" + +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + integrity sha1-9ID0BDTvgHQfhGkJn43qGPVaTck= + dependencies: + error-ex "^1.2.0" + +parse-json@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" + integrity sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA= + dependencies: + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + +parse-node-version@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parse-node-version/-/parse-node-version-1.0.1.tgz#e2b5dbede00e7fa9bc363607f53327e8b073189b" + integrity sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA== + +parseurl@~1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" + integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== + +pascalcase@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +path-key@^2.0.0, path-key@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= + +path-parse@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== + +path-type@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" + integrity sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM= + dependencies: + pify "^2.0.0" + +pify@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw= + +pify@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" + integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== + +pirates@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" + integrity sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA== + dependencies: + node-modules-regexp "^1.0.0" + +pkg-dir@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" + integrity sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw== + dependencies: + find-up "^3.0.0" + +plist@^3.0.0, plist@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/plist/-/plist-3.0.1.tgz#a9b931d17c304e8912ef0ba3bdd6182baf2e1f8c" + integrity sha512-GpgvHHocGRyQm74b6FWEZZVRroHKE1I0/BTjAmySaohK+cUn+hZpbqXkc3KWgW3gQYkqcQej35FohcT0FRlkRQ== + dependencies: + base64-js "^1.2.3" + xmlbuilder "^9.0.7" + xmldom "0.1.x" + +plugin-error@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/plugin-error/-/plugin-error-0.1.2.tgz#3b9bb3335ccf00f425e07437e19276967da47ace" + integrity sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4= + dependencies: + ansi-cyan "^0.1.1" + ansi-red "^0.1.1" + arr-diff "^1.0.1" + arr-union "^2.0.1" + extend-shallow "^1.1.2" + +posix-character-classes@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= + +preserve@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= + +pretty-format@24.0.0-alpha.6: + version "24.0.0-alpha.6" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.0.0-alpha.6.tgz#25ad2fa46b342d6278bf241c5d2114d4376fbac1" + integrity sha512-zG2m6YJeuzwBFqb5EIdmwYVf30sap+iMRuYNPytOccEXZMAJbPIFGKVJ/U0WjQegmnQbRo9CI7j6j3HtDaifiA== + dependencies: + ansi-regex "^4.0.0" + ansi-styles "^3.2.0" + +private@^0.1.6: + version "0.1.8" + resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" + integrity sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg== + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +process@^0.11.10: + version "0.11.10" + resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= + +promise@^7.1.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" + integrity sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg== + dependencies: + asap "~2.0.3" + +prop-types@^15.5.8, prop-types@^15.6.2: + version "15.7.2" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" + integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== + dependencies: + loose-envify "^1.4.0" + object-assign "^4.1.1" + react-is "^16.8.1" + +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +randomatic@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed" + integrity sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw== + dependencies: + is-number "^4.0.0" + kind-of "^6.0.0" + math-random "^1.0.1" + +range-parser@~1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" + integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== + +rc@^1.2.7: + version "1.2.8" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== dependencies: - react-native-electrode-bridge "1.5.x" + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" -events@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" - integrity sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ= +react-clone-referenced-element@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/react-clone-referenced-element/-/react-clone-referenced-element-1.1.0.tgz#9cdda7f2aeb54fea791f3ab8c6ab96c7a77d0158" + integrity sha512-FKOsfKbBkPxYE8576EM6uAfHC4rnMpLyH6/TJUL4WcHUEB3EUn8AxPjnnV/IiwSSzsClvHYK+sDELKN/EJ0WYg== + +react-deep-force-update@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/react-deep-force-update/-/react-deep-force-update-1.1.2.tgz#3d2ae45c2c9040cbb1772be52f8ea1ade6ca2ee1" + integrity sha512-WUSQJ4P/wWcusaH+zZmbECOk7H5N2pOIl0vzheeornkIMhu+qrNdGFm0bDZLCb0hSF0jf/kH1SgkNGfBdTc4wA== + +react-devtools-core@^3.6.0: + version "3.6.3" + resolved "https://registry.yarnpkg.com/react-devtools-core/-/react-devtools-core-3.6.3.tgz#977d95b684c6ad28205f0c62e1e12c5f16675814" + integrity sha512-+P+eFy/yo8Z/UH9J0DqHZuUM5+RI2wl249TNvMx3J2jpUomLQa4Zxl56GEotGfw3PIP1eI+hVf1s53FlUONStQ== + dependencies: + shell-quote "^1.6.1" + ws "^3.3.1" + +react-is@^16.8.1: + version "16.12.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c" + integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q== react-native-electrode-bridge@1.5.x: version "1.5.19" @@ -22,7 +3526,1026 @@ react-native-electrode-bridge@1.5.x: events "^1.1.1" uuid "^3.0.0" -uuid@^3.0.0: +react-native@0.59.10: + version "0.59.10" + resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.59.10.tgz#352f381e382f93a0403be499c9e384bf51c2591c" + integrity sha512-guB9YW+pBqS1dnfZ4ntzjINopiCUAbdmshU2wMWD1W32fRczLAopi/7Q2iHKP8LTCdxuYZV3fa9Mew5PSuANAw== + dependencies: + "@babel/runtime" "^7.0.0" + "@react-native-community/cli" "^1.2.1" + absolute-path "^0.0.0" + art "^0.10.0" + base64-js "^1.1.2" + chalk "^2.4.1" + commander "^2.9.0" + compression "^1.7.1" + connect "^3.6.5" + create-react-class "^15.6.3" + debug "^2.2.0" + denodeify "^1.2.1" + errorhandler "^1.5.0" + escape-string-regexp "^1.0.5" + event-target-shim "^1.0.5" + fbjs "^1.0.0" + fbjs-scripts "^1.0.0" + fs-extra "^1.0.0" + glob "^7.1.1" + graceful-fs "^4.1.3" + inquirer "^3.0.6" + invariant "^2.2.4" + lodash "^4.17.5" + metro-babel-register "0.51.0" + metro-react-native-babel-transformer "0.51.0" + mime "^1.3.4" + minimist "^1.2.0" + mkdirp "^0.5.1" + morgan "^1.9.0" + node-fetch "^2.2.0" + node-notifier "^5.2.1" + npmlog "^2.0.4" + nullthrows "^1.1.0" + opn "^3.0.2" + optimist "^0.6.1" + plist "^3.0.0" + pretty-format "24.0.0-alpha.6" + promise "^7.1.1" + prop-types "^15.5.8" + react-clone-referenced-element "^1.0.1" + react-devtools-core "^3.6.0" + regenerator-runtime "^0.11.0" + rimraf "^2.5.4" + semver "^5.0.3" + serve-static "^1.13.1" + shell-quote "1.6.1" + stacktrace-parser "^0.1.3" + ws "^1.1.5" + xmldoc "^0.4.0" + yargs "^9.0.0" + +react-proxy@^1.1.7: + version "1.1.8" + resolved "https://registry.yarnpkg.com/react-proxy/-/react-proxy-1.1.8.tgz#9dbfd9d927528c3aa9f444e4558c37830ab8c26a" + integrity sha1-nb/Z2SdSjDqp9ETkVYw3gwq4wmo= + dependencies: + lodash "^4.6.1" + react-deep-force-update "^1.0.0" + +react-transform-hmr@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/react-transform-hmr/-/react-transform-hmr-1.0.4.tgz#e1a40bd0aaefc72e8dfd7a7cda09af85066397bb" + integrity sha1-4aQL0Krvxy6N/Xp82gmvhQZjl7s= + dependencies: + global "^4.3.0" + react-proxy "^1.1.7" + +react@16.8.3: + version "16.8.3" + resolved "https://registry.yarnpkg.com/react/-/react-16.8.3.tgz#c6f988a2ce895375de216edcfaedd6b9a76451d9" + integrity sha512-3UoSIsEq8yTJuSu0luO1QQWYbgGEILm+eJl2QN/VLDi7hL+EN18M3q3oVZwmVzzBJ3DkM7RMdRwBmZZ+b4IzSA== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + prop-types "^15.6.2" + scheduler "^0.13.3" + +read-pkg-up@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" + integrity sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4= + dependencies: + find-up "^2.0.0" + read-pkg "^2.0.0" + +read-pkg@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" + integrity sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg= + dependencies: + load-json-file "^2.0.0" + normalize-package-data "^2.3.2" + path-type "^2.0.0" + +readable-stream@^2.0.1, readable-stream@^2.0.6, readable-stream@^2.2.2, readable-stream@~2.3.6: + version "2.3.6" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" + integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +regenerate-unicode-properties@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz#ef51e0f0ea4ad424b77bf7cb41f3e015c70a3f0e" + integrity sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA== + dependencies: + regenerate "^1.4.0" + +regenerate@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11" + integrity sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg== + +regenerator-runtime@^0.11.0: + version "0.11.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== + +regenerator-runtime@^0.13.2: + version "0.13.3" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5" + integrity sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw== + +regenerator-transform@^0.14.0: + version "0.14.1" + resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.1.tgz#3b2fce4e1ab7732c08f665dfdb314749c7ddd2fb" + integrity sha512-flVuee02C3FKRISbxhXl9mGzdbWUVHubl1SMaknjxkFB1/iqpJhArQUvRxOOPEc/9tAiX0BaQ28FJH10E4isSQ== + dependencies: + private "^0.1.6" + +regex-cache@^0.4.2: + version "0.4.4" + resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" + integrity sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ== + dependencies: + is-equal-shallow "^0.1.3" + +regex-not@^1.0.0, regex-not@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== + dependencies: + extend-shallow "^3.0.2" + safe-regex "^1.1.0" + +regexpu-core@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.6.0.tgz#2037c18b327cfce8a6fea2a4ec441f2432afb8b6" + integrity sha512-YlVaefl8P5BnFYOITTNzDvan1ulLOiXJzCNZxduTIosN17b87h3bvG9yHMoHaRuo88H4mQ06Aodj5VtYGGGiTg== + dependencies: + regenerate "^1.4.0" + regenerate-unicode-properties "^8.1.0" + regjsgen "^0.5.0" + regjsparser "^0.6.0" + unicode-match-property-ecmascript "^1.0.4" + unicode-match-property-value-ecmascript "^1.1.0" + +regjsgen@^0.5.0: + version "0.5.1" + resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.5.1.tgz#48f0bf1a5ea205196929c0d9798b42d1ed98443c" + integrity sha512-5qxzGZjDs9w4tzT3TPhCJqWdCc3RLYwy9J2NB0nm5Lz+S273lvWcpjaTGHsT1dc6Hhfq41uSEOw8wBmxrKOuyg== + +regjsparser@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.6.0.tgz#f1e6ae8b7da2bae96c99399b868cd6c933a2ba9c" + integrity sha512-RQ7YyokLiQBomUJuUG8iGVvkgOLxwyZM8k6d3q5SAXpg4r5TZJZigKFvC6PpD+qQ98bCDC5YelPeA3EucDoNeQ== + dependencies: + jsesc "~0.5.0" + +remove-trailing-separator@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" + integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= + +repeat-element@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== + +repeat-string@^1.5.2, repeat-string@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= + +require-main-filename@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= + +resolve-from@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" + integrity sha1-six699nWiBvItuZTM17rywoYh0g= + +resolve-url@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= + +resolve@^1.10.0, resolve@^1.3.2, resolve@^1.5.0, resolve@^1.8.1: + version "1.13.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.13.1.tgz#be0aa4c06acd53083505abb35f4d66932ab35d16" + integrity sha512-CxqObCX8K8YtAhOBRg+lrcdn+LK+WYOS8tSjqSFbjtrI5PnS63QPhZl4+yKfrU9tdsbMu9Anr/amegT87M9Z6w== + dependencies: + path-parse "^1.0.6" + +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + integrity sha1-n37ih/gv0ybU/RYpI9YhKe7g368= + dependencies: + onetime "^2.0.0" + signal-exit "^3.0.2" + +ret@~0.1.10: + version "0.1.15" + resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== + +rimraf@^2.5.4, rimraf@^2.6.1: + version "2.7.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== + dependencies: + glob "^7.1.3" + +rimraf@~2.2.6: + version "2.2.8" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.2.8.tgz#e439be2aaee327321952730f99a8929e4fc50582" + integrity sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI= + +rsvp@^3.3.3: + version "3.6.2" + resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-3.6.2.tgz#2e96491599a96cde1b515d5674a8f7a91452926a" + integrity sha512-OfWGQTb9vnwRjwtA2QwpG2ICclHC3pgXZO5xt8H2EfgDquO0qVdSb5T88L4qJVAEugbS56pAuV4XZM58UX8ulw== + +run-async@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" + integrity sha1-A3GrSuC91yDUFm19/aZP96RFpsA= + dependencies: + is-promise "^2.1.0" + +rx-lite-aggregates@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" + integrity sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74= + dependencies: + rx-lite "*" + +rx-lite@*, rx-lite@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" + integrity sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ= + +safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +safe-buffer@^5.1.2: + version "5.2.0" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" + integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== + +safe-regex@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= + dependencies: + ret "~0.1.10" + +"safer-buffer@>= 2.1.2 < 3": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +sane@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/sane/-/sane-3.1.0.tgz#995193b7dc1445ef1fe41ddfca2faf9f111854c6" + integrity sha512-G5GClRRxT1cELXfdAq7UKtUsv8q/ZC5k8lQGmjEm4HcAl3HzBy68iglyNCmw4+0tiXPCBZntslHlRhbnsSws+Q== + dependencies: + anymatch "^2.0.0" + capture-exit "^1.2.0" + exec-sh "^0.2.0" + execa "^1.0.0" + fb-watchman "^2.0.0" + micromatch "^3.1.4" + minimist "^1.1.1" + walker "~1.0.5" + watch "~0.18.0" + optionalDependencies: + fsevents "^1.2.3" + +sax@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" + integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== + +sax@~1.1.1: + version "1.1.6" + resolved "https://registry.yarnpkg.com/sax/-/sax-1.1.6.tgz#5d616be8a5e607d54e114afae55b7eaf2fcc3240" + integrity sha1-XWFr6KXmB9VOEUr65Vt+ry/MMkA= + +scheduler@^0.13.3: + version "0.13.6" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.13.6.tgz#466a4ec332467b31a91b9bf74e5347072e4cd889" + integrity sha512-IWnObHt413ucAYKsD9J1QShUKkbKLQQHdxRyw73sw4FN26iWr3DY/H34xGPe4nmL1DwXyWmSWmMrA9TfQbE/XQ== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + +"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + +send@0.17.1: + version "0.17.1" + resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" + integrity sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg== + dependencies: + debug "2.6.9" + depd "~1.1.2" + destroy "~1.0.4" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + fresh "0.5.2" + http-errors "~1.7.2" + mime "1.6.0" + ms "2.1.1" + on-finished "~2.3.0" + range-parser "~1.2.1" + statuses "~1.5.0" + +serialize-error@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/serialize-error/-/serialize-error-2.1.0.tgz#50b679d5635cdf84667bdc8e59af4e5b81d5f60a" + integrity sha1-ULZ51WNc34Rme9yOWa9OW4HV9go= + +serve-static@^1.13.1: + version "1.14.1" + resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.14.1.tgz#666e636dc4f010f7ef29970a88a674320898b2f9" + integrity sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg== + dependencies: + encodeurl "~1.0.2" + escape-html "~1.0.3" + parseurl "~1.3.3" + send "0.17.1" + +set-blocking@^2.0.0, set-blocking@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= + +set-value@^2.0.0, set-value@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" + integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw== + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.3" + split-string "^3.0.1" + +setimmediate@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" + integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= + +setprototypeof@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683" + integrity sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw== + +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= + dependencies: + shebang-regex "^1.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= + +shell-quote@1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.6.1.tgz#f4781949cce402697127430ea3b3c5476f481767" + integrity sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c= + dependencies: + array-filter "~0.0.0" + array-map "~0.0.0" + array-reduce "~0.0.0" + jsonify "~0.0.0" + +shell-quote@^1.6.1: + version "1.7.2" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2" + integrity sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg== + +shellwords@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" + integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== + +signal-exit@^3.0.0, signal-exit@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= + +simple-plist@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/simple-plist/-/simple-plist-1.1.0.tgz#8354ab63eb3922a054c78ce96c209c532e907a23" + integrity sha512-2i5Tc0BYAqppM7jVzmNrI+aEUntPolIq4fDgji6WuNNn1D/qYdn2KwoLhZdzQkE04lu9L5tUoeJsjuJAvd+lFg== + dependencies: + bplist-creator "0.0.8" + bplist-parser "0.2.0" + plist "^3.0.1" + +slash@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" + integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== + +slide@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" + integrity sha1-VusCfWW00tzmyy4tMsTUr8nh1wc= + +snapdragon-node@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== + dependencies: + define-property "^1.0.0" + isobject "^3.0.0" + snapdragon-util "^3.0.1" + +snapdragon-util@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== + dependencies: + kind-of "^3.2.0" + +snapdragon@^0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== + dependencies: + base "^0.11.1" + debug "^2.2.0" + define-property "^0.2.5" + extend-shallow "^2.0.1" + map-cache "^0.2.2" + source-map "^0.5.6" + source-map-resolve "^0.5.0" + use "^3.1.0" + +source-map-resolve@^0.5.0: + version "0.5.2" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" + integrity sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA== + dependencies: + atob "^2.1.1" + decode-uri-component "^0.2.0" + resolve-url "^0.2.1" + source-map-url "^0.4.0" + urix "^0.1.0" + +source-map-support@^0.5.16: + version "0.5.16" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" + integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map-url@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= + +source-map@^0.5.0, source-map@^0.5.6: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= + +source-map@^0.6.0, source-map@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +spdx-correct@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4" + integrity sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q== + dependencies: + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" + +spdx-exceptions@^2.1.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz#2ea450aee74f2a89bfb94519c07fcd6f41322977" + integrity sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA== + +spdx-expression-parse@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" + integrity sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg== + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-license-ids@^3.0.0: + version "3.0.5" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz#3694b5804567a458d3c8045842a6358632f62654" + integrity sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q== + +split-string@^3.0.1, split-string@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== + dependencies: + extend-shallow "^3.0.0" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= + +stacktrace-parser@^0.1.3: + version "0.1.8" + resolved "https://registry.yarnpkg.com/stacktrace-parser/-/stacktrace-parser-0.1.8.tgz#28b0272bd9aeb41636f0c8265c03ba270c865e1b" + integrity sha512-ig5rHJSdJrAsVqdb3oAI/8C6aQ7dEwJXoy/TIEIOTzdJHssmn12o6RsFoeQSLHoKjq0lX+kqhmnLDpyQTuWiJA== + dependencies: + type-fest "^0.7.1" + +static-extend@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= + dependencies: + define-property "^0.2.5" + object-copy "^0.1.0" + +"statuses@>= 1.5.0 < 2", statuses@~1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" + integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= + +stream-buffers@~2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/stream-buffers/-/stream-buffers-2.2.0.tgz#91d5f5130d1cef96dcfa7f726945188741d09ee4" + integrity sha1-kdX1Ew0c75bc+n9yaUUYh0HQnuQ= + +string-width@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= + dependencies: + ansi-regex "^3.0.0" + +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= + +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= + +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= + +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.1.0.tgz#0764abc69c63d5ac842dd4867e8d025e880df8f3" + integrity sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ== + dependencies: + has-flag "^3.0.0" + +tar@^4: + version "4.4.13" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" + integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== + dependencies: + chownr "^1.1.1" + fs-minipass "^1.2.5" + minipass "^2.8.6" + minizlib "^1.2.1" + mkdirp "^0.5.0" + safe-buffer "^5.1.2" + yallist "^3.0.3" + +temp@0.8.3: + version "0.8.3" + resolved "https://registry.yarnpkg.com/temp/-/temp-0.8.3.tgz#e0c6bc4d26b903124410e4fed81103014dfc1f59" + integrity sha1-4Ma8TSa5AxJEEOT+2BEDAU38H1k= + dependencies: + os-tmpdir "^1.0.0" + rimraf "~2.2.6" + +throat@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" + integrity sha1-iQN8vJLFarGJJua6TLsgDhVnKmo= + +through2@^2.0.0: + version "2.0.5" + resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" + integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== + dependencies: + readable-stream "~2.3.6" + xtend "~4.0.1" + +through@^2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= + +time-stamp@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-1.1.0.tgz#764a5a11af50561921b133f3b44e618687e0f5c3" + integrity sha1-dkpaEa9QVhkhsTPztE5hhofg9cM= + +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== + dependencies: + os-tmpdir "~1.0.2" + +tmpl@1.0.x: + version "1.0.4" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" + integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= + +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= + +to-object-path@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= + dependencies: + kind-of "^3.0.2" + +to-regex-range@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= + dependencies: + is-number "^3.0.0" + repeat-string "^1.6.1" + +to-regex@^3.0.1, to-regex@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== + dependencies: + define-property "^2.0.2" + extend-shallow "^3.0.2" + regex-not "^1.0.2" + safe-regex "^1.1.0" + +toidentifier@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" + integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw== + +type-fest@^0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.7.1.tgz#8dda65feaf03ed78f0a3f9678f1869147f7c5c48" + integrity sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg== + +typedarray@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= + +ua-parser-js@^0.7.18: + version "0.7.20" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.20.tgz#7527178b82f6a62a0f243d1f94fd30e3e3c21098" + integrity sha512-8OaIKfzL5cpx8eCMAhhvTlft8GYF8b2eQr6JkCyVdrgjcytyOmPCXrqXFcUnhonRpLlh5yxEZVohm6mzaowUOw== + +uglify-es@^3.1.9: + version "3.3.9" + resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.9.tgz#0c1c4f0700bed8dbc124cdb304d2592ca203e677" + integrity sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ== + dependencies: + commander "~2.13.0" + source-map "~0.6.1" + +ultron@1.0.x: + version "1.0.2" + resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.0.2.tgz#ace116ab557cd197386a4e88f4685378c8b2e4fa" + integrity sha1-rOEWq1V80Zc4ak6I9GhTeMiy5Po= + +ultron@~1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.1.tgz#9fe1536a10a664a65266a1e3ccf85fd36302bc9c" + integrity sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og== + +unicode-canonical-property-names-ecmascript@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818" + integrity sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ== + +unicode-match-property-ecmascript@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz#8ed2a32569961bce9227d09cd3ffbb8fed5f020c" + integrity sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg== + dependencies: + unicode-canonical-property-names-ecmascript "^1.0.4" + unicode-property-aliases-ecmascript "^1.0.4" + +unicode-match-property-value-ecmascript@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.1.0.tgz#5b4b426e08d13a80365e0d657ac7a6c1ec46a277" + integrity sha512-hDTHvaBk3RmFzvSl0UVrUmC3PuW9wKVnpoUDYH0JDkSIovzw+J5viQmeYHxVSBptubnr7PbH2e0fnpDRQnQl5g== + +unicode-property-aliases-ecmascript@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.5.tgz#a9cc6cc7ce63a0a3023fc99e341b94431d405a57" + integrity sha512-L5RAqCfXqAwR3RriF8pM0lU0w4Ryf/GgzONwi6KnL1taJQa7x1TCxdJnILX59WIGOwR57IVxn7Nej0fz1Ny6fw== + +union-value@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" + integrity sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg== + dependencies: + arr-union "^3.1.0" + get-value "^2.0.6" + is-extendable "^0.1.1" + set-value "^2.0.1" + +universalify@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== + +unpipe@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" + integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw= + +unset-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= + dependencies: + has-value "^0.3.1" + isobject "^3.0.0" + +urix@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= + +use@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== + +util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +utils-merge@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" + integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= + +uuid@^3.0.0, uuid@^3.3.2: version "3.3.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== + +validate-npm-package-license@^3.0.1: + version "3.0.4" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== + dependencies: + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" + +vary@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" + integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= + +walker@~1.0.5: + version "1.0.7" + resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" + integrity sha1-L3+bj9ENZ3JisYqITijRlhjgKPs= + dependencies: + makeerror "1.0.x" + +watch@~0.18.0: + version "0.18.0" + resolved "https://registry.yarnpkg.com/watch/-/watch-0.18.0.tgz#28095476c6df7c90c963138990c0a5423eb4b986" + integrity sha1-KAlUdsbffJDJYxOJkMClQj60uYY= + dependencies: + exec-sh "^0.2.0" + minimist "^1.2.0" + +whatwg-fetch@>=0.10.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb" + integrity sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q== + +which-module@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= + +which@^1.2.9, which@^1.3.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== + dependencies: + isexe "^2.0.0" + +wide-align@^1.1.0: + version "1.1.3" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" + integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== + dependencies: + string-width "^1.0.2 || 2" + +wordwrap@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= + +wordwrap@~0.0.2: + version "0.0.3" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" + integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc= + +wrap-ansi@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +write-file-atomic@^1.2.0: + version "1.3.4" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.4.tgz#f807a4f0b1d9e913ae7a48112e6cc3af1991b45f" + integrity sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8= + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + slide "^1.1.5" + +ws@^1.1.0, ws@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/ws/-/ws-1.1.5.tgz#cbd9e6e75e09fc5d2c90015f21f0c40875e0dd51" + integrity sha512-o3KqipXNUdS7wpQzBHSe180lBGO60SoK0yVo3CYJgb2MkobuWuBX6dhkYP5ORCLd55y+SaflMOV5fqAB53ux4w== + dependencies: + options ">=0.0.5" + ultron "1.0.x" + +ws@^3.3.1: + version "3.3.3" + resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2" + integrity sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA== + dependencies: + async-limiter "~1.0.0" + safe-buffer "~5.1.0" + ultron "~1.1.0" + +xcode@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/xcode/-/xcode-2.0.0.tgz#134f1f94c26fbfe8a9aaa9724bfb2772419da1a2" + integrity sha512-5xF6RCjAdDEiEsbbZaS/gBRt3jZ/177otZcpoLCjGN/u1LrfgH7/Sgeeavpr/jELpyDqN2im3AKosl2G2W8hfw== + dependencies: + simple-plist "^1.0.0" + uuid "^3.3.2" + +xmlbuilder@^9.0.7: + version "9.0.7" + resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d" + integrity sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0= + +xmldoc@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/xmldoc/-/xmldoc-0.4.0.tgz#d257224be8393eaacbf837ef227fd8ec25b36888" + integrity sha1-0lciS+g5PqrL+DfvIn/Y7CWzaIg= + dependencies: + sax "~1.1.1" + +xmldom@0.1.x: + version "0.1.27" + resolved "https://registry.yarnpkg.com/xmldom/-/xmldom-0.1.27.tgz#d501f97b3bdb403af8ef9ecc20573187aadac0e9" + integrity sha1-1QH5ezvbQDr4757MIFcxh6rawOk= + +xpipe@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/xpipe/-/xpipe-1.0.5.tgz#8dd8bf45fc3f7f55f0e054b878f43a62614dafdf" + integrity sha1-jdi/Rfw/f1Xw4FS4ePQ6YmFNr98= + +xtend@~4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + +y18n@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" + integrity sha1-bRX7qITAhnnA136I53WegR4H+kE= + +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= + +yallist@^3.0.0, yallist@^3.0.3: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== + +yargs-parser@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9" + integrity sha1-jQrELxbqVd69MyyvTEA4s+P139k= + dependencies: + camelcase "^4.1.0" + +yargs@^9.0.0: + version "9.0.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-9.0.1.tgz#52acc23feecac34042078ee78c0c007f5085db4c" + integrity sha1-UqzCP+7Kw0BCB47njAwAf1CF20w= + dependencies: + camelcase "^4.1.0" + cliui "^3.2.0" + decamelize "^1.1.1" + get-caller-file "^1.0.1" + os-locale "^2.0.0" + read-pkg-up "^2.0.0" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^2.0.0" + which-module "^2.0.0" + y18n "^3.2.1" + yargs-parser "^7.0.0"