@react-native-ohos/ting 1.2.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 (53) hide show
  1. package/LICENSE +20 -0
  2. package/README.OpenSource +11 -0
  3. package/README.md +14 -0
  4. package/harmony/ting/build-profile.json5 +9 -0
  5. package/harmony/ting/hvigorfile.ts +2 -0
  6. package/harmony/ting/index.ets +3 -0
  7. package/harmony/ting/obfuscation-rules.txt +18 -0
  8. package/harmony/ting/oh-package.json5 +12 -0
  9. package/harmony/ting/src/main/cpp/CMakeLists.txt +9 -0
  10. package/harmony/ting/src/main/cpp/TingPackage.h +36 -0
  11. package/harmony/ting/src/main/cpp/generated/RNOH/generated/BaseTingPackage.h +65 -0
  12. package/harmony/ting/src/main/cpp/generated/RNOH/generated/turbo_modules/Ting.cpp +19 -0
  13. package/harmony/ting/src/main/cpp/generated/RNOH/generated/turbo_modules/Ting.h +16 -0
  14. package/harmony/ting/src/main/ets/Logger.ets +64 -0
  15. package/harmony/ting/src/main/ets/TingPackage.ets +47 -0
  16. package/harmony/ting/src/main/ets/TingTurboModule.ets +514 -0
  17. package/harmony/ting/src/main/ets/Type.ets +133 -0
  18. package/harmony/ting/src/main/ets/generated/components/ts.ts +5 -0
  19. package/harmony/ting/src/main/ets/generated/index.ets +5 -0
  20. package/harmony/ting/src/main/ets/generated/ts.ts +6 -0
  21. package/harmony/ting/src/main/ets/generated/turboModules/Ting.ts +20 -0
  22. package/harmony/ting/src/main/ets/generated/turboModules/ts.ts +5 -0
  23. package/harmony/ting/src/main/module.json5 +7 -0
  24. package/harmony/ting/src/main/resources/base/element/color.json +8 -0
  25. package/harmony/ting/src/main/resources/base/element/string.json +16 -0
  26. package/harmony/ting/src/main/resources/base/profile/backup_config.json +3 -0
  27. package/harmony/ting/src/main/resources/base/profile/main_pages.json +5 -0
  28. package/harmony/ting/src/main/resources/en_US/element/string.json +16 -0
  29. package/harmony/ting/src/main/resources/zh_CN/element/string.json +16 -0
  30. package/harmony/ting/ts.ets +7 -0
  31. package/harmony/ting.har +0 -0
  32. package/lib/commonjs/NativeTing.js +14 -0
  33. package/lib/commonjs/NativeTing.js.map +1 -0
  34. package/lib/commonjs/Type.js +2 -0
  35. package/lib/commonjs/Type.js.map +1 -0
  36. package/lib/commonjs/index.js +73 -0
  37. package/lib/commonjs/index.js.map +1 -0
  38. package/lib/module/NativeTing.js +9 -0
  39. package/lib/module/NativeTing.js.map +1 -0
  40. package/lib/module/Type.js +2 -0
  41. package/lib/module/Type.js.map +1 -0
  42. package/lib/module/index.js +47 -0
  43. package/lib/module/index.js.map +1 -0
  44. package/lib/typescript/NativeTing.d.ts +10 -0
  45. package/lib/typescript/NativeTing.d.ts.map +1 -0
  46. package/lib/typescript/Type.d.ts +98 -0
  47. package/lib/typescript/Type.d.ts.map +1 -0
  48. package/lib/typescript/index.d.ts +10 -0
  49. package/lib/typescript/index.d.ts.map +1 -0
  50. package/package.json +165 -0
  51. package/src/NativeTing.ts +17 -0
  52. package/src/Type.ts +108 -0
  53. package/src/index.tsx +64 -0
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Baron Ha.
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
@@ -0,0 +1,11 @@
1
+ [
2
+ {
3
+ "Name": "ting",
4
+ "License": "MIT License",
5
+ "License File": "https://github.com/baronha/ting/blob/main/LICENSE",
6
+ "Version Number": "1.2.2-0.0.3",
7
+ "Owner" : "xiafeng@huawei.com",
8
+ "Upstream URL": "https://github.com/baronha/ting",
9
+ "Description": "test"
10
+ }
11
+ ]
package/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # @react-native-ohos/ting
2
+
3
+ 本项目基于 [@baronha/ting](https://github.com/baronha/ting)@1.2.3
4
+
5
+ ## 文档地址 / Documentation URL
6
+
7
+ [中文 / Chinese](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/baronha-ting.md)
8
+
9
+ [英文 / English](https://gitee.com/react-native-oh-library/usage-docs/blob/master/en/baronha-ting.md)
10
+
11
+
12
+ ## 请悉知 / Acknowledgements
13
+
14
+ 本项目基于 [The MIT License(MIT)](https://github.com/baronha/ting/blob/main/LICENSE) ,请自由地享受和参与开源。
@@ -0,0 +1,9 @@
1
+ {
2
+ "apiType": "stageMode",
3
+ "targets": [
4
+ {
5
+ "name": "default",
6
+ "runtimeOS": "HarmonyOS"
7
+ }
8
+ ]
9
+ }
@@ -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';
@@ -0,0 +1,3 @@
1
+ import { RNTingPackage as TingPackage } from "./src/main/ets/TingPackage"
2
+ export * from "./src/main/ets/TingPackage";
3
+ export default TingPackage;
@@ -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://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
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
@@ -0,0 +1,12 @@
1
+ {
2
+ license: 'MIT',
3
+ types: '',
4
+ name: '@react-native-ohos/ting',
5
+ description: '',
6
+ main: 'index.ets',
7
+ type: 'module',
8
+ version: '1.2.3-rc.1',
9
+ dependencies: {
10
+ "@rnoh/react-native-openharmony": 'file:../react_native_openharmony'
11
+ },
12
+ }
@@ -0,0 +1,9 @@
1
+ cmake_minimum_required(VERSION 3.13)
2
+ set(CMAKE_VERBOSE_MAKEFILE on)
3
+
4
+ set(rnoh_ting_generated_dir "${CMAKE_CURRENT_SOURCE_DIR}/generated")
5
+ file(GLOB_RECURSE rnoh_ting_generated_SRC "${rnoh_ting_generated_dir}/**/*.cpp")
6
+ file(GLOB rnoh_ting_SRC CONFIGURE_DEPENDS *.cpp)
7
+ add_library(rnoh_ting SHARED ${rnoh_ting_SRC} ${rnoh_ting_generated_SRC})
8
+ target_include_directories(rnoh_ting PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${rnoh_ting_generated_dir})
9
+ target_link_libraries(rnoh_ting PUBLIC rnoh)
@@ -0,0 +1,36 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2024 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
+ #ifndef BASETINGPACKAGE_H
25
+ #define BASETINGPACKAGE_H
26
+
27
+ #include "generated/RNOH/generated/BaseTingPackage.h"
28
+ #pragma once
29
+
30
+ namespace rnoh {
31
+ class TingPackage : public BaseTingPackage {
32
+ using Super = BaseTingPackage;
33
+ using Super::Super;
34
+ };
35
+ } // namespace rnoh
36
+ #endif // BASETINGPACKAGE_H
@@ -0,0 +1,65 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ #pragma once
6
+
7
+ #include "RNOH/Package.h"
8
+ #include "RNOH/ArkTSTurboModule.h"
9
+ #include "RNOH/generated/turbo_modules/Ting.h"
10
+
11
+ namespace rnoh {
12
+
13
+ class BaseTingPackageTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
14
+ public:
15
+ SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
16
+ if (name == "Ting") {
17
+ return std::make_shared<Ting>(ctx, name);
18
+ }
19
+ return nullptr;
20
+ };
21
+ };
22
+
23
+ class BaseTingPackageEventEmitRequestHandler : public EventEmitRequestHandler {
24
+ public:
25
+ void handleEvent(Context const &ctx) override {
26
+ auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
27
+ if (eventEmitter == nullptr) {
28
+ return;
29
+ }
30
+
31
+ std::vector<std::string> supportedEventNames = {
32
+ };
33
+ if (std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
34
+ eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
35
+ }
36
+ }
37
+ };
38
+
39
+
40
+ class BaseTingPackage : public Package {
41
+ public:
42
+ BaseTingPackage(Package::Context ctx) : Package(ctx){};
43
+
44
+ std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override {
45
+ return std::make_unique<BaseTingPackageTurboModuleFactoryDelegate>();
46
+ }
47
+
48
+ std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override {
49
+ return {
50
+ };
51
+ }
52
+
53
+ ComponentJSIBinderByString createComponentJSIBinderByName() override {
54
+ return {
55
+ };
56
+ };
57
+
58
+ EventEmitRequestHandlers createEventEmitRequestHandlers() override {
59
+ return {
60
+ std::make_shared<BaseTingPackageEventEmitRequestHandler>(),
61
+ };
62
+ }
63
+ };
64
+
65
+ } // namespace rnoh
@@ -0,0 +1,19 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ #include "Ting.h"
6
+
7
+ namespace rnoh {
8
+ using namespace facebook;
9
+
10
+ Ting::Ting(const ArkTSTurboModule::Context ctx, const std::string name) : ArkTSTurboModule(ctx, name) {
11
+ methodMap_ = {
12
+ ARK_METHOD_METADATA(toast, 1),
13
+ ARK_METHOD_METADATA(alert, 1),
14
+ ARK_METHOD_METADATA(dismissAlert, 0),
15
+ ARK_METHOD_METADATA(setup, 1),
16
+ };
17
+ }
18
+
19
+ } // namespace rnoh
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ #pragma once
6
+
7
+ #include "RNOH/ArkTSTurboModule.h"
8
+
9
+ namespace rnoh {
10
+
11
+ class JSI_EXPORT Ting : public ArkTSTurboModule {
12
+ public:
13
+ Ting(const ArkTSTurboModule::Context ctx, const std::string name);
14
+ };
15
+
16
+ } // namespace rnoh
@@ -0,0 +1,64 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2024 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
+ import hilog from '@ohos.hilog';
26
+
27
+ class Logger {
28
+ private domain: number;
29
+ private prefix: string;
30
+ private format: string = '%{public}s, %{public}s';
31
+ private isDebug: boolean;
32
+
33
+ /**
34
+ * constructor.
35
+ *
36
+ * @param Prefix Identifies the log tag.
37
+ * @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF.
38
+ */
39
+ constructor(prefix: string = 'Ting', domain: number = 0xFF00, isDebug = false) {
40
+ this.prefix = prefix;
41
+ this.domain = domain;
42
+ this.isDebug = isDebug;
43
+ }
44
+
45
+ debug(...args: string[]): void {
46
+ if (this.isDebug) {
47
+ hilog.debug(this.domain, this.prefix, this.format, args);
48
+ }
49
+ }
50
+
51
+ info(...args: string[]): void {
52
+ hilog.info(this.domain, this.prefix, this.format, args);
53
+ }
54
+
55
+ warn(...args: string[]): void {
56
+ hilog.warn(this.domain, this.prefix, this.format, args);
57
+ }
58
+
59
+ error(...args: string[]): void {
60
+ hilog.error(this.domain, this.prefix, this.format, args);
61
+ }
62
+ }
63
+
64
+ export default new Logger('Ting', 0xFF00, false)
@@ -0,0 +1,47 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (C) 2024 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
+ import { RNPackage, TurboModulesFactory, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
26
+ import { RNOHPackage } from '@rnoh/react-native-openharmony'
27
+ import { TM } from './generated/ts'
28
+ import { TingTurboModule } from './TingTurboModule';
29
+
30
+ class TingTurboModulesFactory extends TurboModulesFactory {
31
+ createTurboModule(name: string) {
32
+ if (name === 'Ting' || name === TM.Ting.NAME) {
33
+ return new TingTurboModule(this.ctx);
34
+ }
35
+ return null;
36
+ }
37
+
38
+ hasTurboModule(name: string): boolean {
39
+ return name === 'Ting' || name === TM.Ting.NAME;
40
+ }
41
+ }
42
+
43
+ export class RNTingPackage extends RNOHPackage {
44
+ createTurboModulesFactory(ctx: TurboModuleContext) {
45
+ return new TingTurboModulesFactory(ctx);
46
+ }
47
+ }