Skip to content

Commit ab06d7a

Browse files
authored
Merge pull request #3 from fQwQf/master
feat(entry): 集成 async-storage 模块
2 parents c3d0959 + 7234cfc commit ab06d7a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+6874
-641
lines changed

async_storage.har

8.22 KB
Binary file not shown.

async_storage/BuildProfile.ets

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Use these variables when you tailor your ArkTS code. They must be of the const type.
3+
*/
4+
export const HAR_VERSION = '1.21.0-0.2.2';
5+
export const BUILD_MODE_NAME = 'debug';
6+
export const DEBUG = true;
7+
export const TARGET_NAME = 'default';
8+
9+
/**
10+
* BuildProfile Class is used only for compatibility purposes.
11+
*/
12+
export default class BuildProfile {
13+
static readonly HAR_VERSION = HAR_VERSION;
14+
static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
15+
static readonly DEBUG = DEBUG;
16+
static readonly TARGET_NAME = TARGET_NAME;
17+
}

async_storage/build-profile.json5

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"apiType": "stageMode",
3+
"targets": [
4+
{
5+
"name": "default"
6+
}
7+
]
8+
}

async_storage/hvigorfile.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
2+
export { harTasks } from '@ohos/hvigor-ohos-plugin';

async_storage/index.ets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./ts"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Define project specific obfuscation rules here.
2+
# You can include the obfuscation configuration files in the current module's build-profile.json5.
3+
#
4+
# For more details, see
5+
# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md
6+
7+
# Obfuscation options:
8+
# -disable-obfuscation: disable all obfuscations
9+
# -enable-property-obfuscation: obfuscate the property names
10+
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
11+
# -compact: remove unnecessary blank spaces and all line feeds
12+
# -remove-log: remove all console.* statements
13+
# -print-namecache: print the name cache that contains the mapping from the old names to new names
14+
# -apply-namecache: reuse the given cache file
15+
16+
# Keep options:
17+
# -keep-property-name: specifies property names that you want to keep
18+
# -keep-global-name: specifies names that you want to keep in the global scope

async_storage/oh-package-lock.json5

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

async_storage/oh-package.json5

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"license": "",
3+
"devDependencies": {
4+
5+
},
6+
"author": "",
7+
"name": "@react-native-oh-tpl/async-storage",
8+
"version": "1.21.0-0.2.2",
9+
"description": "",
10+
"main": "ts.ts",
11+
"dependencies": {
12+
"@rnoh/react-native-openharmony": "0.72.75"
13+
}
14+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
3+
* Use of this source code is governed by a MIT license that can be
4+
* found in the LICENSE file.
5+
*/
6+
7+
#include "RNOH/Package.h"
8+
#include "RNCAsyncStorage.h"
9+
10+
using namespace rnoh;
11+
using namespace facebook;
12+
class NativeRNAsyncStorageFactoryDelegate : public TurboModuleFactoryDelegate {
13+
public:
14+
SharedTurboModule createTurboModule(Context ctx,const std::string &name) const override {
15+
if (name == "RNCAsyncStorage") {
16+
return std::make_shared<RNCAsyncStorage>(ctx, name);
17+
}
18+
return nullptr;
19+
};
20+
};
21+
22+
namespace rnoh {
23+
class AsyncStoragePackage : public Package {
24+
public:
25+
AsyncStoragePackage(Package::Context ctx) : Package(ctx) {}
26+
std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override {
27+
return std::make_unique<NativeRNAsyncStorageFactoryDelegate>();
28+
}
29+
};
30+
} // namespace rnoh
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# the minimum version of CMake.
2+
cmake_minimum_required(VERSION 3.13)
3+
set(CMAKE_VERBOSE_MAKEFILE on)
4+
5+
file(GLOB rnoh_async_storage_SRC CONFIGURE_DEPENDS *.cpp)
6+
add_library(rnoh_async_storage SHARED ${rnoh_async_storage_SRC})
7+
target_include_directories(rnoh_async_storage PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
8+
target_link_libraries(rnoh_async_storage PUBLIC rnoh)

0 commit comments

Comments
 (0)