Back out D17720575 -- D17724498

Summary: This stack caused FB4A builds to start failing, complaining about `RCTImageApple`.

Reviewed By: RSNara

Differential Revision: D17855088

fbshipit-source-id: 21ecedc3725dde65fab20f414d07b32c3548447c
This commit is contained in:
Ashok Menon
2019-10-10 09:41:33 -07:00
committed by Facebook Github Bot
parent a5ad0bf124
commit df96de78bb
22 changed files with 48 additions and 213 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
export type Args = {|
title?: string,
message?: string,
buttons?: Array<Object>, // TODO: have a better type
buttons?: Object, // TODO: have a better type
type?: string,
defaultValue?: string,
cancelButtonKey?: string,
@@ -196,7 +196,7 @@ namespace JS {
struct Args {
NSString *title() const;
NSString *message() const;
folly::Optional<facebook::react::LazyVector<id<NSObject>>> buttons() const;
id<NSObject> _Nullable buttons() const;
NSString *type() const;
NSString *defaultValue() const;
NSString *cancelButtonKey() const;
@@ -2502,10 +2502,10 @@ inline NSString *JS::NativeAlertManager::Args::message() const
id const p = _v[@"message"];
return RCTBridgingToString(p);
}
inline folly::Optional<facebook::react::LazyVector<id<NSObject>>> JS::NativeAlertManager::Args::buttons() const
inline id<NSObject> _Nullable JS::NativeAlertManager::Args::buttons() const
{
id const p = _v[@"buttons"];
return RCTBridgingToOptionalVec(p, ^id<NSObject>(id itemValue_0) { return itemValue_0; });
return p;
}
inline NSString *JS::NativeAlertManager::Args::type() const
{
@@ -9,14 +9,9 @@
#import <ImageIO/ImageIO.h>
#import <QuartzCore/QuartzCore.h>
#import <React/RCTAnimatedImage.h>
#import <React/RCTUtils.h>
#import <ReactCommon/RCTTurboModule.h>
#import "RCTImagePlugins.h"
@interface RCTGIFImageDecoder() <RCTTurboModule>
@end
#import <React/RCTAnimatedImage.h>
@implementation RCTGIFImageDecoder
@@ -37,18 +32,14 @@ RCT_EXPORT_MODULE()
completionHandler:(RCTImageLoaderCompletionBlock)completionHandler
{
RCTAnimatedImage *image = [[RCTAnimatedImage alloc] initWithData:imageData scale:scale];
if (!image) {
completionHandler(nil, nil);
return ^{};
}
completionHandler(nil, image);
return ^{};
}
@end
Class RCTGIFImageDecoderCls() {
return RCTGIFImageDecoder.class;
}
-44
View File
@@ -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.
*
* @generated by an internal plugin build system
*/
#ifdef RN_DISABLE_OSS_PLUGIN_HEADER
// FB Internal: FBRCTImagePlugins.h is autogenerated by the build system.
#import "FBRCTImagePlugins.h"
#else
// OSS-compatibility layer
#import <Foundation/Foundation.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wreturn-type-c-linkage"
#ifdef __cplusplus
extern "C" {
#endif
// RCTTurboModuleManagerDelegate should call this to resolve module classes.
Class RCTImageClassProvider(const char *name);
// Lookup functions
Class RCTGIFImageDecoderCls(void) __attribute__((used));
Class RCTImageEditingManagerCls(void) __attribute__((used));
Class RCTImageLoaderCls(void) __attribute__((used));
Class RCTImageStoreManagerCls(void) __attribute__((used));
Class RCTLocalAssetImageLoaderCls(void) __attribute__((used));
#ifdef __cplusplus
}
#endif
#pragma GCC diagnostic pop
#endif // RN_DISABLE_OSS_PLUGIN_HEADER
-36
View File
@@ -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.
*
* @generated by an internal plugin build system
*/
#ifndef RN_DISABLE_OSS_PLUGIN_HEADER
// OSS-compatibility layer
#import "RCTImagePlugins.h"
#import <string>
#import <unordered_map>
Class RCTImageClassProvider(const char *name) {
static std::unordered_map<std::string, Class (*)(void)> sCoreModuleClassMap = {
{"GIFImageDecoder", RCTGIFImageDecoderCls},
{"ImageEditingManager", RCTImageEditingManagerCls},
{"ImageLoader", RCTImageLoaderCls},
{"ImageStoreManager", RCTImageStoreManagerCls},
{"LocalAssetImageLoader", RCTLocalAssetImageLoaderCls},
};
auto p = sCoreModuleClassMap.find(name);
if (p != sCoreModuleClassMap.end()) {
auto classFunc = p->second;
return classFunc();
}
return nil;
}
#endif // RN_DISABLE_OSS_PLUGIN_HEADER
@@ -7,16 +7,9 @@
#import <React/RCTLocalAssetImageLoader.h>
#import <atomic>
#import <memory>
#import <stdatomic.h>
#import <React/RCTUtils.h>
#import <ReactCommon/RCTTurboModule.h>
#import "RCTImagePlugins.h"
@interface RCTLocalAssetImageLoader() <RCTTurboModule>
@end
@implementation RCTLocalAssetImageLoader
@@ -49,9 +42,9 @@ RCT_EXPORT_MODULE()
partialLoadHandler:(RCTImageLoaderPartialLoadBlock)partialLoadHandler
completionHandler:(RCTImageLoaderCompletionBlock)completionHandler
{
__block auto cancelled = std::make_shared<std::atomic<bool>>(false);
__block atomic_bool cancelled = ATOMIC_VAR_INIT(NO);
RCTExecuteOnMainQueue(^{
if (cancelled->load()) {
if (atomic_load(&cancelled)) {
return;
}
@@ -69,12 +62,8 @@ RCT_EXPORT_MODULE()
});
return ^{
cancelled->store(true);
atomic_store(&cancelled, YES);
};
}
@end
Class RCTLocalAssetImageLoaderCls(void) {
return RCTLocalAssetImageLoader.class;
}
+1 -12
View File
@@ -17,9 +17,6 @@ else
source[:tag] = "v#{version}"
end
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
folly_version = '2018.10.22.00'
Pod::Spec.new do |s|
s.name = "React-RCTImage"
s.version = version
@@ -29,19 +26,11 @@ Pod::Spec.new do |s|
s.license = package["license"]
s.author = "Facebook, Inc. and its affiliates"
s.platforms = { :ios => "9.0", :tvos => "9.2" }
s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness'
s.source = source
s.source_files = "*.{m,mm}"
s.source_files = "*.{m}"
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
s.header_dir = "RCTImage"
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Folly\""
}
s.dependency "Folly", folly_version
s.dependency "FBReactNativeSpec", version
s.dependency "React-Core/RCTImageHeaders", version
s.dependency "React-RCTNetwork", version
end
+1 -3
View File
@@ -212,8 +212,6 @@ PODS:
- React-jsi (= 1000.0.0)
- React-RCTNetwork (= 1000.0.0)
- React-RCTImage (1000.0.0):
- FBReactNativeSpec (= 1000.0.0)
- Folly (= 2018.10.22.00)
- React-Core/RCTImageHeaders (= 1000.0.0)
- React-RCTNetwork (= 1000.0.0)
- React-RCTLinking (1000.0.0):
@@ -374,7 +372,7 @@ SPEC CHECKSUMS:
React-RCTActionSheet: 090e7bd7c5774d919c47c4eeff78223a7fd8c19c
React-RCTAnimation: 73d536fff417a101724d9529189c95a94263710c
React-RCTBlob: acd519b1d6ec5d66f98b7cf8e70d0cd76642426f
React-RCTImage: 4d2a090c491e29665f27f87c58feb4dfcb2f4cfa
React-RCTImage: 7f5c9bff34905f1bc216be512ba0ae68f872208a
React-RCTLinking: d7d7f792e63a8d57380cecbb9b7a3b31f92d1bb6
React-RCTNetwork: c8f9d40297f35ea3792ea81866f33e8b45c25935
React-RCTPushNotification: acffa8af6a20e6d41b041a8c4cb4bea0de9df0dd
+4 -6
View File
@@ -51,6 +51,9 @@ rn_apple_library(
) + react_module_plugin_providers(
name = "ExceptionsManager",
native_class_func = "RCTExceptionsManagerCls",
) + react_module_plugin_providers(
name = "ImageLoader",
native_class_func = "RCTImageLoaderCls",
) + react_module_plugin_providers(
name = "PlatformConstants",
native_class_func = "RCTPlatformCls",
@@ -66,12 +69,6 @@ rn_apple_library(
) + react_module_plugin_providers(
name = "ActionSheetManager",
native_class_func = "RCTActionSheetManagerCls",
) + react_module_plugin_providers(
name = "AlertManager",
native_class_func = "RCTAlertManagerCls",
) + react_module_plugin_providers(
name = "AsyncLocalStorage",
native_class_func = "RCTAsyncLocalStorageCls",
),
plugins_header = "FBCoreModulesPlugins.h",
preprocessor_flags = OBJC_ARC_PREPROCESSOR_FLAGS + get_debug_preprocessor_flags() + rn_extra_build_flags() + [
@@ -80,6 +77,7 @@ rn_apple_library(
reexport_all_header_dependencies = True,
visibility = ["PUBLIC"],
exported_deps = [
"fbsource//xplat/js:RCTImageApple",
"fbsource//xplat/js/react-native-github:ReactInternalApple",
"fbsource//xplat/js/react-native-github/Libraries/FBReactNativeSpec:FBReactNativeSpecApple",
],
+1 -2
View File
@@ -33,13 +33,12 @@ Class RCTAccessibilityManagerCls(void) __attribute__((used));
Class RCTAppearanceCls(void) __attribute__((used));
Class RCTDeviceInfoCls(void) __attribute__((used));
Class RCTExceptionsManagerCls(void) __attribute__((used));
Class RCTImageLoaderCls(void) __attribute__((used));
Class RCTPlatformCls(void) __attribute__((used));
Class RCTClipboardCls(void) __attribute__((used));
Class RCTI18nManagerCls(void) __attribute__((used));
Class RCTSourceCodeCls(void) __attribute__((used));
Class RCTActionSheetManagerCls(void) __attribute__((used));
Class RCTAlertManagerCls(void) __attribute__((used));
Class RCTAsyncLocalStorageCls(void) __attribute__((used));
#ifdef __cplusplus
}
+1 -2
View File
@@ -22,13 +22,12 @@ Class RCTCoreModulesClassProvider(const char *name) {
{"Appearance", RCTAppearanceCls},
{"DeviceInfo", RCTDeviceInfoCls},
{"ExceptionsManager", RCTExceptionsManagerCls},
{"ImageLoader", RCTImageLoaderCls},
{"PlatformConstants", RCTPlatformCls},
{"Clipboard", RCTClipboardCls},
{"I18nManager", RCTI18nManagerCls},
{"SourceCode", RCTSourceCodeCls},
{"ActionSheetManager", RCTActionSheetManagerCls},
{"AlertManager", RCTAlertManagerCls},
{"AsyncLocalStorage", RCTAsyncLocalStorageCls},
};
auto p = sCoreModuleClassMap.find(name);
@@ -7,6 +7,8 @@
#import <React/RCTImageEditingManager.h>
#import <UIKit/UIKit.h>
#import <React/RCTConvert.h>
#import <React/RCTImageLoader.h>
#import <React/RCTImageStoreManager.h>
@@ -14,11 +16,6 @@
#import <React/RCTImageLoaderProtocol.h>
#import <React/RCTLog.h>
#import <React/RCTUtils.h>
#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h>
#import "RCTImagePlugins.h"
@implementation RCTImageEditingManager
@@ -82,7 +79,3 @@ RCT_EXPORT_METHOD(cropImage:(NSURLRequest *)imageRequest
}
@end
Class RCTImageEditingManagerCls() {
return RCTImageEditingManager.class;
}
@@ -20,7 +20,7 @@
#import <React/RCTNetworking.h>
#import <React/RCTUtils.h>
#import "RCTImagePlugins.h"
#import "CoreModulesPlugins.h"
static NSInteger RCTImageBytesForImage(UIImage *image)
{
@@ -7,17 +7,16 @@
#import <React/RCTImageStoreManager.h>
#import <atomic>
#import <memory>
#import <stdatomic.h>
#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/UTType.h>
#import <React/RCTAssert.h>
#import <React/RCTLog.h>
#import <React/RCTUtils.h>
#import <React/RCTImageUtils.h>
#import "RCTImagePlugins.h"
#import <React/RCTImageUtils.h>
static NSString *const RCTImageStoreURLScheme = @"rct-image-store";
@@ -141,14 +140,14 @@ RCT_EXPORT_METHOD(addImageFromBase64:(NSString *)base64String
- (id)sendRequest:(NSURLRequest *)request withDelegate:(id<RCTURLRequestDelegate>)delegate
{
__block auto cancelled = std::make_shared<std::atomic<bool>>(false);
__block atomic_bool cancelled = ATOMIC_VAR_INIT(NO);
void (^cancellationBlock)(void) = ^{
cancelled->store(true);
atomic_store(&cancelled, YES);
};
// Dispatch async to give caller time to cancel the request
dispatch_async(_methodQueue, ^{
if (cancelled->load()) {
if (atomic_load(&cancelled)) {
return;
}
@@ -239,7 +238,3 @@ RCT_EXPORT_METHOD(addImageFromBase64:(NSString *)base64String
}
@end
Class RCTImageStoreManagerCls(void) {
return RCTImageStoreManager.class;
}
@@ -7,14 +7,10 @@
#import "RCTAlertManager.h"
#import <FBReactNativeSpec/FBReactNativeSpec.h>
#import <RCTTypeSafety/RCTConvertHelpers.h>
#import <React/RCTAssert.h>
#import <React/RCTConvert.h>
#import <React/RCTLog.h>
#import <React/RCTUtils.h>
#import "CoreModulesPlugins.h"
#import "RCTAssert.h"
#import "RCTConvert.h"
#import "RCTLog.h"
#import "RCTUtils.h"
@implementation RCTConvert (UIAlertViewStyle)
@@ -27,7 +23,7 @@ RCT_ENUM_CONVERTER(RCTAlertViewStyle, (@{
@end
@interface RCTAlertManager() <NativeAlertManagerSpec>
@interface RCTAlertManager()
@end
@@ -64,17 +60,17 @@ RCT_EXPORT_MODULE()
* 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:(JS::NativeAlertManager::Args &)args
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<NSDictionary *> *buttons = [RCTConvert NSDictionaryArray:RCTConvertOptionalVecToArray(args.buttons(), ^id(id<NSObject> element) { return element; })];
NSString *defaultValue = [RCTConvert NSString:args.defaultValue()];
NSString *cancelButtonKey = [RCTConvert NSString:args.cancelButtonKey()];
NSString *destructiveButtonKey = [RCTConvert NSString:args.destructiveButtonKey()];
UIKeyboardType keyboardType = [RCTConvert UIKeyboardType:args.keyboardType()];
NSString *title = [RCTConvert NSString:args[@"title"]];
NSString *message = [RCTConvert NSString:args[@"message"]];
RCTAlertViewStyle type = [RCTConvert RCTAlertViewStyle:args[@"type"]];
NSArray<NSDictionary *> *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");
@@ -96,16 +92,7 @@ RCT_EXPORT_METHOD(alertWithArgs:(JS::NativeAlertManager::Args &)args
UIViewController *presentingController = RCTPresentedViewController();
if (presentingController == nil) {
RCTLogError(@"Tried to display alert view but there is no application window. args: %@", @{
@"title": args.title() ?: [NSNull null],
@"message": args.message() ?: [NSNull null],
@"buttons": RCTConvertOptionalVecToArray(args.buttons(), ^id(id<NSObject> element) { return element; }) ?: [NSNull null],
@"type": args.type() ?: [NSNull null],
@"defaultValue": args.defaultValue() ?: [NSNull null],
@"cancelButtonKey": args.cancelButtonKey() ?: [NSNull null],
@"destructiveButtonKey": args.destructiveButtonKey() ?: [NSNull null],
@"keyboardType": args.keyboardType() ?: [NSNull null],
});
RCTLogError(@"Tried to display alert view but there is no application window. args: %@", args);
return;
}
@@ -195,13 +182,4 @@ RCT_EXPORT_METHOD(alertWithArgs:(JS::NativeAlertManager::Args &)args
});
}
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModuleWithJsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
{
return std::make_shared<facebook::react::NativeAlertManagerSpecJSI>(self, jsInvoker);
}
@end
Class RCTAlertManagerCls(void) {
return RCTAlertManager.class;
}
@@ -9,15 +9,12 @@
#import <Foundation/Foundation.h>
#import <FBReactNativeSpec/FBReactNativeSpec.h>
#import <CommonCrypto/CommonCryptor.h>
#import <CommonCrypto/CommonDigest.h>
#import <React/RCTConvert.h>
#import <React/RCTLog.h>
#import <React/RCTUtils.h>
#import "CoreModulesPlugins.h"
#import "RCTConvert.h"
#import "RCTLog.h"
#import "RCTUtils.h"
static NSString *const RCTStorageDirectory = @"RCTAsyncLocalStorage_V1";
static NSString *const RCTManifestFileName = @"manifest.json";
@@ -161,9 +158,6 @@ static NSDictionary *RCTDeleteStorageDirectory()
#pragma mark - RCTAsyncLocalStorage
@interface RCTAsyncLocalStorage() <NativeAsyncStorageSpec>
@end
@implementation RCTAsyncLocalStorage
{
BOOL _haveSetup;
@@ -461,13 +455,4 @@ RCT_EXPORT_METHOD(getAllKeys:(RCTResponseSenderBlock)callback)
}
}
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModuleWithJsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
{
return std::make_shared<facebook::react::NativeAsyncStorageSpecJSI>(self, jsInvoker);
}
@end
Class RCTAsyncLocalStorageCls(void) {
return RCTAsyncLocalStorage.class;
}
+1
View File
@@ -59,6 +59,7 @@ rn_xplat_cxx_library(
ios_deps = [
"fbsource//xplat/js:RCTImage",
"fbsource//xplat/js/react-native-github:RCTCxxBridge",
"fbsource//xplat/js/react-native-github/React/CoreModules:CoreModules",
],
ios_exported_headers = subdir_glob(
[