@react-native-ohos/clipboard 1.16.3-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/LICENSE +21 -0
  2. package/README.OpenSource +11 -0
  3. package/README.md +13 -0
  4. package/RNCClipboard.podspec +37 -0
  5. package/dist/Clipboard.d.ts +159 -0
  6. package/dist/Clipboard.js +232 -0
  7. package/dist/index.d.ts +3 -0
  8. package/dist/index.js +7 -0
  9. package/harmony/clipboard/LICENSE +21 -0
  10. package/harmony/clipboard/NOTICE +33 -0
  11. package/harmony/clipboard/OAT.xml +38 -0
  12. package/harmony/clipboard/README.OpenSource +11 -0
  13. package/harmony/clipboard/README.md +307 -0
  14. package/harmony/clipboard/build-profile.json5 +8 -0
  15. package/harmony/clipboard/hvigorfile.ts +1 -0
  16. package/harmony/clipboard/index.ets +25 -0
  17. package/harmony/clipboard/oh-package.json5 +12 -0
  18. package/harmony/clipboard/src/main/cpp/CMakeLists.txt +7 -0
  19. package/harmony/clipboard/src/main/cpp/ClipboardPackage.h +58 -0
  20. package/harmony/clipboard/src/main/cpp/RNCClipboardTurboModule.cpp +198 -0
  21. package/harmony/clipboard/src/main/cpp/RNCClipboardTurboModule.h +39 -0
  22. package/harmony/clipboard/src/main/ets/ClipboardPackage.ts +46 -0
  23. package/harmony/clipboard/src/main/ets/Logger.ts +64 -0
  24. package/harmony/clipboard/src/main/ets/RNCClipboardTurboModule.ts +482 -0
  25. package/harmony/clipboard/src/main/module.json5 +7 -0
  26. package/harmony/clipboard/src/main/resources/base/element/string.json +8 -0
  27. package/harmony/clipboard/src/main/resources/en_US/element/string.json +8 -0
  28. package/harmony/clipboard/src/main/resources/zh_CN/element/string.json +8 -0
  29. package/harmony/clipboard/ts.ts +26 -0
  30. package/harmony/clipboard.har +0 -0
  31. package/package.json +90 -0
  32. package/src/Clipboard.ts +211 -0
  33. package/src/index.ts +3 -0
@@ -0,0 +1,307 @@
1
+ > 模板版本:v0.2.2
2
+
3
+ <p align="center">
4
+ <h1 align="center"> <code>@react-native-clipboard/clipboard</code> </h1>
5
+ </p>
6
+ <p align="center">
7
+ <a href="https://github.com/react-native-clipboard/clipboard">
8
+ <img src="https://img.shields.io/badge/platforms-android%20|%20ios%20|%20macos%20|%20windows%20|%20harmony%20-lightgrey.svg" alt="Supported platforms" />
9
+ </a>
10
+ <a href="https://github.com/react-native-clipboard/clipboard/blob/master/LICENSE">
11
+ <img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License" />
12
+ </a>
13
+ </p>
14
+
15
+ > [!TIP] [Github 地址](https://github.com/react-native-oh-library/clipboard/tree/sig)
16
+
17
+ ## 安装与使用
18
+
19
+ 请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-ohos/clipboard Releases](https://github.com/react-native-oh-library/clipboard/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。
20
+
21
+ 进入到工程目录并输入以下命令:
22
+
23
+ <!-- tabs:start -->
24
+
25
+ #### **npm**
26
+
27
+ ```bash
28
+ npm install @react-native-ohos/clipboard
29
+ ```
30
+
31
+ #### **yarn**
32
+
33
+ ```bash
34
+ yarn add @react-native-ohos/clipboard
35
+ ```
36
+
37
+ <!-- tabs:end -->
38
+
39
+ 下面的代码展示了这个库的基本使用场景:
40
+
41
+ > [!WARNING] 使用时 import 的库名不变。
42
+
43
+ ```js
44
+ import React, { useState } from 'react';
45
+ import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
46
+ import Clipboard from "@react-native-clipboard/clipboard";
47
+
48
+ const App = () => {
49
+ const [copiedText, setCopiedText] = useState("");
50
+
51
+ const copyToClipboard = () => {
52
+ Clipboard.setString("hello world");
53
+ };
54
+
55
+ const fetchCopiedText = async () => {
56
+ const text = await Clipboard.getString();
57
+ setCopiedText(text);
58
+ };
59
+
60
+ return (
61
+ <View style={styles.container}>
62
+ <TouchableOpacity onPress={copyToClipboard}>
63
+ <Text>Click here to copy to Clipboard</Text>
64
+ </TouchableOpacity>
65
+ <TouchableOpacity onPress={fetchCopiedText}>
66
+ <Text>View copied text</Text>
67
+ </TouchableOpacity>
68
+
69
+ <Text style={styles.copiedText}>{copiedText}</Text>
70
+ </View>
71
+ );
72
+ };
73
+
74
+ const styles = StyleSheet.create({
75
+ container: {
76
+ flex: 1,
77
+ justifyContent: "center",
78
+ alignItems: "center",
79
+ padding: 20,
80
+ },
81
+ copiedText: {
82
+ marginTop: 20,
83
+ fontSize: 18,
84
+ },
85
+ });
86
+
87
+ export default App;
88
+ ```
89
+
90
+ ## Link
91
+
92
+ 目前 HarmonyOS 暂不支持 AutoLink,所以 Link 步骤需要手动配置。
93
+
94
+ 首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony`
95
+
96
+ ### 1.在工程根目录的 `oh-package.json5` 添加 overrides 字段
97
+
98
+ ```json
99
+ {
100
+ ...
101
+ "overrides": {
102
+ "@rnoh/react-native-openharmony" : "./react_native_openharmony"
103
+ }
104
+ }
105
+ ```
106
+
107
+ ### 2.引入原生端代码
108
+
109
+ 目前有两种方法:
110
+
111
+ 1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
112
+ 2. 直接链接源码。
113
+
114
+ 方法一:通过 har 包引入
115
+
116
+ > [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。
117
+
118
+ 打开 `entry/oh-package.json5`,添加以下依赖
119
+
120
+ ```json
121
+ "dependencies": {
122
+ "@rnoh/react-native-openharmony": "file:../react_native_openharmony",
123
+
124
+ "@react-native-ohos/clipboard": "file:../../node_modules/@react-native-ohos/clipboard/harmony/clipboard.har"
125
+ }
126
+ ```
127
+
128
+ 点击右上角的 `sync` 按钮
129
+
130
+ 或者在终端执行:
131
+
132
+ ```bash
133
+ cd entry
134
+ ohpm install
135
+ ```
136
+
137
+ 方法二:直接链接源码
138
+
139
+ > [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](/zh-cn/link-source-code.md)
140
+
141
+ ### 3.配置 CMakeLists 和引入 ClipboardPackage
142
+
143
+ 打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
144
+
145
+ ```diff
146
+ project(rnapp)
147
+ cmake_minimum_required(VERSION 3.4.1)
148
+ set(CMAKE_SKIP_BUILD_RPATH TRUE)
149
+ set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
150
+ set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules")
151
+ + set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
152
+ set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
153
+ set(LOG_VERBOSITY_LEVEL 1)
154
+ set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments")
155
+ set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie")
156
+ set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use
157
+ add_compile_definitions(WITH_HITRACE_SYSTRACE)
158
+
159
+ add_subdirectory("${RNOH_CPP_DIR}" ./rn)
160
+
161
+ # RNOH_BEGIN: manual_package_linking_1
162
+ add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
163
+ + add_subdirectory("${OH_MODULES}/@react-native-ohos/clipboard/src/main/cpp" ./clipboard)
164
+ # RNOH_END: manual_package_linking_1
165
+
166
+ file(GLOB GENERATED_CPP_FILES "./generated/*.cpp")
167
+
168
+ add_library(rnoh_app SHARED
169
+ ${GENERATED_CPP_FILES}
170
+ "./PackageProvider.cpp"
171
+ "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
172
+ )
173
+ target_link_libraries(rnoh_app PUBLIC rnoh)
174
+
175
+ # RNOH_BEGIN: manual_package_linking_2
176
+ target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
177
+ + target_link_libraries(rnoh_app PUBLIC rnoh_clipboard)
178
+ # RNOH_END: manual_package_linking_2
179
+ ```
180
+
181
+ 打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
182
+
183
+ ```diff
184
+ #include "RNOH/PackageProvider.h"
185
+ #include "generated/RNOHGeneratedPackage.h"
186
+ #include "SamplePackage.h"
187
+ + #include "ClipboardPackage.h"
188
+
189
+ using namespace rnoh;
190
+
191
+ std::vector<std::shared_ptr<Package>> PackageProvider::getPackages(Package::Context ctx) {
192
+ return {
193
+ std::make_shared<RNOHGeneratedPackage>(ctx),
194
+ std::make_shared<SamplePackage>(ctx),
195
+ + std::make_shared<ClipboardPackage>(ctx),
196
+ };
197
+ }
198
+ ```
199
+
200
+ ### 4.在 ArkTs 侧引入 ClipboardPackage
201
+
202
+ 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加:
203
+
204
+ ```diff
205
+ import type {RNPackageContext, RNPackage} from 'rnoh/ts';
206
+ import {SamplePackage} from 'rnoh-sample-package/ts';
207
+ + import {ClipboardPackage} from '@react-native-ohos/clipboard/ts';
208
+
209
+ export function createRNPackages(ctx: RNPackageContext): RNPackage[] {
210
+ return [
211
+ new SamplePackage(ctx),
212
+ + new ClipboardPackage(ctx)
213
+ ];
214
+ }
215
+
216
+ ```
217
+
218
+ ### 5.运行
219
+
220
+ 点击右上角的 `sync` 按钮
221
+
222
+ 或者在终端执行:
223
+
224
+ ```bash
225
+ cd entry
226
+ ohpm install
227
+ ```
228
+
229
+ 然后编译、运行即可。
230
+
231
+ ## 约束与限制
232
+
233
+ ### 兼容性
234
+
235
+ 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
236
+
237
+ 请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-ohos/clipboard Releases](https://github.com/react-native-oh-library/clipboard/releases)
238
+
239
+ ### 权限要求
240
+
241
+ > [!TIP] "ohos.permission.READ_PASTEBOARD"权限等级为<B>system_basic</B>,授权方式为<B>user_grant</B>,[使用 ACL 签名的配置指导](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/signing-0000001587684945-V3#section157591551175916)
242
+
243
+ #### 在 entry 目录下的module.json5中添加权限
244
+
245
+ 打开 `entry/src/main/module.json5`,添加:
246
+
247
+ ```diff
248
+ ...
249
+ "requestPermissions": [
250
+ + {
251
+ + "name": "ohos.permission.READ_PASTEBOARD",
252
+ + "reason": "$string:Access_clipboard",
253
+ + "usedScene": {
254
+ + "abilities": [
255
+ + "EntryAbility"
256
+ + ],
257
+ + "when":"always"
258
+ + }
259
+ + },
260
+ ]
261
+ ```
262
+
263
+ #### 在 entry 目录下添加申请剪切板权限的原因
264
+
265
+ 打开 `entry/src/main/resources/base/element/string.json`,添加:
266
+
267
+ ```diff
268
+ ...
269
+ {
270
+ "string": [
271
+ + {
272
+ + "name": "Access_clipboard",
273
+ + "value": "access clipboard"
274
+ + }
275
+ ]
276
+ }
277
+ ```
278
+
279
+ ## 属性
280
+
281
+ > [!TIP] "Platform"列表示该属性在原三方库上支持的平台。
282
+
283
+ > [!TIP] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
284
+
285
+ | Name | Description | Type | Required | Platform | HarmonyOS Support |
286
+ | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------- | ----------- | ----------------- |
287
+ | getString | Get content of string type, this method returns a Promise, so you can use following code to get clipboard content | function | NO | iOS,Android | yes |
288
+ | setString | Set content of string type. You can use following code to set clipboard content | function | NO | iOS,Android | yes |
289
+ | hasString | Returns whether the clipboard has content or is empty. | function | NO | iOS,Android | yes |
290
+ | getImage | Get content of image in base64 string type, this method returns a Promise, so you can use following code to get clipboard content (iOS and Android only) | function | NO | iOS,Android | no |
291
+ | getStrings | (iOS only) Get contents of string array type, this method returns a Promise, so you can use following code to get clipboard content | function | NO | iOS | yes |
292
+ | setStrings | (iOS only) Set content of string array type. You can use following code to set clipboard content | function | NO | iOS | yes |
293
+ | hasNumber | (iOS 14+ only) Returns whether the clipboard has a Number(UIPasteboardDetectionPatternNumber) content. Can check if there is a Number content in clipboard without triggering PasteBoard notification for iOS 14+ | function | NO | iOS | yes |
294
+ | hasImage | Returns whether the clipboard has a Image | function | NO | iOS | yes |
295
+ | hasUrl | (iOS only) Returns whether the clipboard has a URL content. Can check if there is a URL content in clipboard without triggering PasteBoard notification for iOS 14+ | function | NO | iOS | yes |
296
+ | hasWebUrl | (iOS 14+ only) Returns whether the clipboard has a WebURL(UIPasteboardDetectionPatternProbableWebURL) content. Can check if there is a WebURL content in clipboard without triggering PasteBoard notification for iOS 14+ | function | NO | iOS | yes |
297
+ | setImage | Set content of Image type.(base64 string) | function | NO | iOS | yes |
298
+ | getImageJPG | get base64 string of JPG Image | function | NO | iOS | yes |
299
+ | getImagePNG | get base64 string of PNG Image | function | NO | iOS | yes |
300
+
301
+ ## 遗留问题
302
+
303
+ ## 其他
304
+
305
+ ## 开源协议
306
+
307
+ 本项目基于 [The MIT License (MIT)](https://github.com/react-native-clipboard/clipboard/blob/master/LICENSE) ,请自由地享受和参与开源。
@@ -0,0 +1,8 @@
1
+ {
2
+ "apiType": "stageMode",
3
+ "targets": [
4
+ {
5
+ "name": "default",
6
+ }
7
+ ]
8
+ }
@@ -0,0 +1 @@
1
+ export { harTasks } from '@ohos/hvigor-ohos-plugin';
@@ -0,0 +1,25 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2025 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ export * from './ts'
@@ -0,0 +1,12 @@
1
+ {
2
+ "license": "ISC",
3
+ "types": "",
4
+ "devDependencies": {},
5
+ "name": "@react-native-ohos/clipboard",
6
+ "version": "1.16.3-rc.1",
7
+ "description": "",
8
+ "main": "index.ets",
9
+ "dependencies": {
10
+ "@rnoh/react-native-openharmony": "file:../../example/node_modules/react-native-harmony/harmony/react_native_openharmony.har"
11
+ }
12
+ }
@@ -0,0 +1,7 @@
1
+ cmake_minimum_required(VERSION 3.13)
2
+ set(CMAKE_VERBOSE_MAKEFILE on)
3
+
4
+ file(GLOB rnoh_clipboard_SRC CONFIGURE_DEPENDS *.cpp)
5
+ add_library(rnoh_clipboard SHARED ${rnoh_clipboard_SRC})
6
+ target_include_directories(rnoh_clipboard PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
7
+ target_link_libraries(rnoh_clipboard PUBLIC rnoh)
@@ -0,0 +1,58 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2025 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ #ifndef CLIPBOARD_PACKAGE_H
26
+ #define CLIPBOARD_PACKAGE_H
27
+
28
+ #include "RNOH/Package.h"
29
+ #include "RNCClipboardTurboModule.h"
30
+
31
+ using namespace rnoh;
32
+ using namespace facebook;
33
+
34
+ class ClipboardTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
35
+ public:
36
+ SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override
37
+ {
38
+ if (name == "RNCClipboard") {
39
+ return std::make_shared<RNCClipboardTurboModule>(ctx, name);
40
+ }
41
+ return nullptr;
42
+ };
43
+ };
44
+
45
+ namespace rnoh {
46
+
47
+ class ClipboardPackage : public Package {
48
+ public:
49
+ ClipboardPackage(Package::Context ctx) : Package(ctx) {}
50
+
51
+ std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override
52
+ {
53
+ return std::make_unique<ClipboardTurboModuleFactoryDelegate>();
54
+ }
55
+ };
56
+ } // namespace rnoh
57
+
58
+ #endif
@@ -0,0 +1,198 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2025 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ #include "RNCClipboardTurboModule.h"
26
+
27
+ using namespace rnoh;
28
+ using namespace facebook;
29
+
30
+ static jsi::Value _hostFunction_RNCClipboardTurboModule_getConstants(
31
+ jsi::Runtime &rt,
32
+ react::TurboModule & turboModule,
33
+ const jsi::Value* args,
34
+ size_t count)
35
+ {
36
+ return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).call(rt, "getConstants", args, count));
37
+ }
38
+
39
+ static jsi::Value _hostFunction_RNCClipboardTurboModule_getString(
40
+ jsi::Runtime &rt,
41
+ react::TurboModule & turboModule,
42
+ const jsi::Value* args,
43
+ size_t count)
44
+ {
45
+ return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).callAsync(rt, "getString", args, count));
46
+ }
47
+
48
+ static jsi::Value _hostFunction_RNCClipboardTurboModule_getStrings(
49
+ jsi::Runtime &rt,
50
+ react::TurboModule & turboModule,
51
+ const jsi::Value* args,
52
+ size_t count)
53
+ {
54
+ return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).callAsync(rt, "getStrings", args, count));
55
+ }
56
+
57
+ static jsi::Value _hostFunction_RNCClipboardTurboModule_setString(
58
+ jsi::Runtime &rt,
59
+ react::TurboModule & turboModule,
60
+ const jsi::Value* args,
61
+ size_t count)
62
+ {
63
+ return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).call(rt, "setString", args, count));
64
+ }
65
+
66
+ static jsi::Value _hostFunction_RNCClipboardTurboModule_hasString(
67
+ jsi::Runtime &rt,
68
+ react::TurboModule & turboModule,
69
+ const jsi::Value* args,
70
+ size_t count)
71
+ {
72
+ return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).callAsync(rt, "hasString", args, count));
73
+ }
74
+
75
+ static jsi::Value _hostFunction_RNCClipboardTurboModule_hasNumber(
76
+ jsi::Runtime &rt,
77
+ react::TurboModule & turboModule,
78
+ const jsi::Value* args,
79
+ size_t count)
80
+ {
81
+ return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).callAsync(rt, "hasNumber", args, count));
82
+ }
83
+
84
+ static jsi::Value _hostFunction_RNCClipboardTurboModule_getImagePNG(
85
+ jsi::Runtime &rt,
86
+ react::TurboModule & turboModule,
87
+ const jsi::Value* args,
88
+ size_t count)
89
+ {
90
+ return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).callAsync(rt, "getImagePNG", args, count));
91
+ }
92
+
93
+ static jsi::Value _hostFunction_RNCClipboardTurboModule_getImageJPG(
94
+ jsi::Runtime &rt,
95
+ react::TurboModule & turboModule,
96
+ const jsi::Value* args,
97
+ size_t count)
98
+ {
99
+ return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).callAsync(rt, "getImageJPG", args, count));
100
+ }
101
+
102
+ static jsi::Value _hostFunction_RNCClipboardTurboModule_setImage(
103
+ jsi::Runtime &rt,
104
+ react::TurboModule & turboModule,
105
+ const jsi::Value* args,
106
+ size_t count)
107
+ {
108
+ return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).call(rt, "setImage", args, count));
109
+ }
110
+
111
+ static jsi::Value _hostFunction_RNCClipboardTurboModule_getImage(
112
+ jsi::Runtime &rt,
113
+ react::TurboModule & turboModule,
114
+ const jsi::Value* args,
115
+ size_t count)
116
+ {
117
+ return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).callAsync(rt, "getImage", args, count));
118
+ }
119
+
120
+ static jsi::Value _hostFunction_RNCClipboardTurboModule_setStrings(
121
+ jsi::Runtime &rt,
122
+ react::TurboModule & turboModule,
123
+ const jsi::Value* args,
124
+ size_t count)
125
+ {
126
+ return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).call(rt, "setStrings", args, count));
127
+ }
128
+
129
+ static jsi::Value _hostFunction_RNCClipboardTurboModule_hasImage(
130
+ jsi::Runtime &rt,
131
+ react::TurboModule & turboModule,
132
+ const jsi::Value* args,
133
+ size_t count)
134
+ {
135
+ return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).callAsync(rt, "hasImage", args, count));
136
+ }
137
+
138
+ static jsi::Value _hostFunction_RNCClipboardTurboModule_hasURL(
139
+ jsi::Runtime &rt,
140
+ react::TurboModule & turboModule,
141
+ const jsi::Value* args,
142
+ size_t count)
143
+ {
144
+ return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).callAsync(rt, "hasURL", args, count));
145
+ }
146
+
147
+ static jsi::Value _hostFunction_RNCClipboardTurboModule_hasWebURL(
148
+ jsi::Runtime &rt,
149
+ react::TurboModule & turboModule,
150
+ const jsi::Value* args,
151
+ size_t count)
152
+ {
153
+ return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).callAsync(rt, "hasWebURL", args, count));
154
+ }
155
+
156
+ static jsi::Value _hostFunction_RNCClipboardTurboModule_addListener(
157
+ jsi::Runtime &rt,
158
+ react::TurboModule & turboModule,
159
+ const jsi::Value* args,
160
+ size_t count)
161
+ {
162
+ return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).call(rt, "addListener", args, count));
163
+ }
164
+
165
+ static jsi::Value _hostFunction_RNCClipboardTurboModule_removeListeners(
166
+ jsi::Runtime &rt,
167
+ react::TurboModule & turboModule,
168
+ const jsi::Value* args,
169
+ size_t count)
170
+ {
171
+ return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).call(rt, "removeListeners", args, count));
172
+ }
173
+
174
+ RNCClipboardTurboModule::RNCClipboardTurboModule(const ArkTSTurboModule::Context ctx, const std::string name)
175
+ : ArkTSTurboModule(ctx, name)
176
+ {
177
+ methodMap_["getConstants"]= MethodMetadata{0, _hostFunction_RNCClipboardTurboModule_getConstants};
178
+ methodMap_["getString"]= MethodMetadata{0, _hostFunction_RNCClipboardTurboModule_getString};
179
+ methodMap_["getStrings"]= MethodMetadata{0, _hostFunction_RNCClipboardTurboModule_getStrings};
180
+
181
+ methodMap_["setString"]= MethodMetadata{1, _hostFunction_RNCClipboardTurboModule_setString};
182
+ methodMap_["hasString"]= MethodMetadata{0, _hostFunction_RNCClipboardTurboModule_hasString};
183
+
184
+ methodMap_["hasNumber"]= MethodMetadata{0, _hostFunction_RNCClipboardTurboModule_hasNumber};
185
+ methodMap_["getImagePNG"]= MethodMetadata{0, _hostFunction_RNCClipboardTurboModule_getImagePNG};
186
+ methodMap_["getImageJPG"]= MethodMetadata{0, _hostFunction_RNCClipboardTurboModule_getImageJPG};
187
+
188
+ methodMap_["setImage"]= MethodMetadata{1, _hostFunction_RNCClipboardTurboModule_setImage};
189
+ methodMap_["getImage"]= MethodMetadata{0, _hostFunction_RNCClipboardTurboModule_getImage};
190
+
191
+ methodMap_["setStrings"]= MethodMetadata{1, _hostFunction_RNCClipboardTurboModule_setStrings};
192
+ methodMap_["hasImage"]= MethodMetadata{0, _hostFunction_RNCClipboardTurboModule_hasImage};
193
+ methodMap_["hasURL"]= MethodMetadata{0, _hostFunction_RNCClipboardTurboModule_hasURL};
194
+ methodMap_["hasWebURL"]= MethodMetadata{0, _hostFunction_RNCClipboardTurboModule_hasWebURL};
195
+
196
+ methodMap_["addListener"]= MethodMetadata{1, _hostFunction_RNCClipboardTurboModule_addListener};
197
+ methodMap_["removeListeners"]= MethodMetadata{1, _hostFunction_RNCClipboardTurboModule_removeListeners};
198
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2025 Huawei Device Co., Ltd.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ #ifndef CLIPBOARD_TURBOMODULE_H
26
+ #define CLIPBOARD_TURBOMODULE_H
27
+
28
+ #include <ReactCommon/TurboModule.h>
29
+ #include "RNOH/ArkTSTurboModule.h"
30
+
31
+ namespace rnoh {
32
+
33
+ class JSI_EXPORT RNCClipboardTurboModule : public ArkTSTurboModule {
34
+ public:
35
+ RNCClipboardTurboModule(const ArkTSTurboModule::Context ctx, const std::string name);
36
+ };
37
+ } // namespace rnoh
38
+
39
+ #endif