mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Make RCTAsyncLocalStorage TurboModule-compatible
Summary: **Note:** This was landed in D17724498 but reverted in D17855088. The revert had nothing to do with this NativeModule. Changelog: [iOS][Added] Make RCTAsyncLocalStorage TurboModule-compatible Reviewed By: PeteTheHeat Differential Revision: D17917841 fbshipit-source-id: 0f9dd5f592180d6512ca560007daa531a4da5b59
This commit is contained in:
committed by
Facebook Github Bot
parent
da6274ba76
commit
2b62bd7695
@@ -72,6 +72,9 @@ rn_apple_library(
|
||||
) + 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() + [
|
||||
|
||||
@@ -40,6 +40,7 @@ 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
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ Class RCTCoreModulesClassProvider(const char *name) {
|
||||
{"SourceCode", RCTSourceCodeCls},
|
||||
{"ActionSheetManager", RCTActionSheetManagerCls},
|
||||
{"AlertManager", RCTAlertManagerCls},
|
||||
{"AsyncLocalStorage", RCTAsyncLocalStorageCls},
|
||||
};
|
||||
|
||||
auto p = sCoreModuleClassMap.find(name);
|
||||
|
||||
@@ -9,12 +9,15 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <FBReactNativeSpec/FBReactNativeSpec.h>
|
||||
#import <CommonCrypto/CommonCryptor.h>
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
|
||||
#import "RCTConvert.h"
|
||||
#import "RCTLog.h"
|
||||
#import "RCTUtils.h"
|
||||
#import <React/RCTConvert.h>
|
||||
#import <React/RCTLog.h>
|
||||
#import <React/RCTUtils.h>
|
||||
|
||||
#import "CoreModulesPlugins.h"
|
||||
|
||||
static NSString *const RCTStorageDirectory = @"RCTAsyncLocalStorage_V1";
|
||||
static NSString *const RCTManifestFileName = @"manifest.json";
|
||||
@@ -158,6 +161,9 @@ static NSDictionary *RCTDeleteStorageDirectory()
|
||||
|
||||
#pragma mark - RCTAsyncLocalStorage
|
||||
|
||||
@interface RCTAsyncLocalStorage() <NativeAsyncStorageSpec>
|
||||
@end
|
||||
|
||||
@implementation RCTAsyncLocalStorage
|
||||
{
|
||||
BOOL _haveSetup;
|
||||
@@ -455,4 +461,13 @@ 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;
|
||||
}
|
||||
Reference in New Issue
Block a user