@react-native-ohos/react-native-default-preference 1.4.5-rc.2 → 1.5.0-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 (22) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/COMMITTERS.md +1 -5
  3. package/harmony/react_native_default_preference/BuildProfile.ets +17 -0
  4. package/harmony/react_native_default_preference/Index.ets +2 -3
  5. package/harmony/react_native_default_preference/oh-package.json5 +1 -1
  6. package/harmony/react_native_default_preference/src/main/cpp/CMakeLists.txt +1 -1
  7. package/harmony/react_native_default_preference/src/main/cpp/DefaultPreferencePackage.h +19 -0
  8. package/harmony/react_native_default_preference/src/main/cpp/generated/RNOH/generated/BaseReactNativeDefaultPreferencePackage.h +8 -1
  9. package/harmony/react_native_default_preference/src/main/cpp/generated/react/renderer/components/react_native_default_preference/ComponentDescriptors.h +24 -0
  10. package/harmony/react_native_default_preference/src/main/cpp/generated/react/renderer/components/react_native_default_preference/EventEmitters.cpp +16 -0
  11. package/harmony/react_native_default_preference/src/main/cpp/generated/react/renderer/components/react_native_default_preference/EventEmitters.h +17 -0
  12. package/harmony/react_native_default_preference/src/main/cpp/generated/react/renderer/components/react_native_default_preference/Props.cpp +19 -0
  13. package/harmony/react_native_default_preference/src/main/cpp/generated/react/renderer/components/react_native_default_preference/Props.h +18 -0
  14. package/harmony/react_native_default_preference/src/main/cpp/generated/react/renderer/components/react_native_default_preference/ShadowNodes.cpp +17 -0
  15. package/harmony/react_native_default_preference/src/main/cpp/generated/react/renderer/components/react_native_default_preference/ShadowNodes.h +23 -0
  16. package/harmony/react_native_default_preference/src/main/cpp/generated/react/renderer/components/react_native_default_preference/States.cpp +16 -0
  17. package/harmony/react_native_default_preference/src/main/cpp/generated/react/renderer/components/react_native_default_preference/States.h +19 -0
  18. package/harmony/react_native_default_preference/src/main/ets/{RNDefaultPreferencePackage.ets → RNDefaultPreferencePackage.ts} +1 -2
  19. package/harmony/react_native_default_preference.har +0 -0
  20. package/package.json +9 -18
  21. package/harmony/react_native_default_preference/src/main/cpp/RNDefaultPreferencePackage.h +0 -36
  22. /package/harmony/react_native_default_preference/{ts.ets → ts.ts} +0 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ # v1.4.5-rc.1
2
+ ## 更新内容
3
+ * 修改组织名为@react-native-ohos
4
+ * 内置Codegen生成代码
package/COMMITTERS.md CHANGED
@@ -4,8 +4,4 @@
4
4
 
5
5
  不区分先后顺序
6
6
 
7
- - [MaDiXin](https://gitee.com/MaDiXin)
8
- - [xiafeng_xf_admin](https://gitee.com/xiafeng_xf_admin)
9
- - [ChenLixi](https://gitee.com/Louis-C7)
10
- - [LinJiacheng](https://gitee.com/LLLLLLin)
11
- - [ZhengJinshou](https://gitee.com/longziz)
7
+ - [xiafeng_xf_admin](https://gitee.com/xiafeng_xf_admin)
@@ -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.4.5';
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
+ }
@@ -3,6 +3,5 @@
3
3
  * Use of this source code is governed by a MIT license that can be
4
4
  * found in the LICENSE file.
5
5
  */
6
- import { RNDefaultPreferencePackage as DefaultPreferencePackage } from './src/main/ets/RNDefaultPreferencePackage';
7
- export * from "./ts"
8
- export default DefaultPreferencePackage
6
+
7
+ export * from "./ts"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-ohos/react-native-default-preference",
3
- "version": "1.4.5-rc.2",
3
+ "version": "1.5.0-rc.1",
4
4
  "description": "Keep the screen from going to sleep",
5
5
  "main": "Index.ets",
6
6
  "author": "",
@@ -5,5 +5,5 @@ set(rnoh_default_preference_generated_dir "${CMAKE_CURRENT_SOURCE_DIR}/generated
5
5
  file(GLOB_RECURSE rnoh_default_preference_generated_SRC "${rnoh_default_preference_generated_dir}/**/*.cpp")
6
6
  file(GLOB rnoh_default_preference_SRC CONFIGURE_DEPENDS *.cpp)
7
7
  add_library(rnoh_default_preference SHARED ${rnoh_default_preference_SRC} ${rnoh_default_preference_generated_SRC})
8
- target_include_directories(rnoh_default_preference PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${rnoh_default_preference_generated_dir})
8
+ target_include_directories(rnoh_default_preference PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${rnoh_default_preference_generated_dir} ${CMAKE_CURRENT_SOURCE_DIR}/generated/RNOH/generated)
9
9
  target_link_libraries(rnoh_default_preference PUBLIC rnoh)
@@ -0,0 +1,19 @@
1
+ // Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
2
+ // Use of this source code is governed by a MIT license that can be
3
+ // found in the LICENSE file.
4
+
5
+ #ifndef DEFAULTPREFERENCEPACKAGE_H
6
+ #define DEFAULTPREFERENCEPACKAGE_H
7
+
8
+
9
+ #include "generated/RNOH/generated/BaseReactNativeDefaultPreferencePackage.h"
10
+ #pragma once
11
+
12
+
13
+ namespace rnoh {
14
+ class DefaultPreferencePackage : public BaseReactNativeDefaultPreferencePackage {
15
+ using Super = BaseReactNativeDefaultPreferencePackage;
16
+ using Super::Super;
17
+ };
18
+ } // namespace rnoh
19
+ #endif //DEFAULTPREFERENCEPACKAGE_H
@@ -24,13 +24,20 @@ class BaseReactNativeDefaultPreferencePackageEventEmitRequestHandler : public Ev
24
24
  public:
25
25
  void handleEvent(Context const &ctx) override {
26
26
  auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
27
+ auto componentName = ctx.shadowViewRegistry->getComponentName(ctx.tag);
28
+
27
29
  if (eventEmitter == nullptr) {
28
30
  return;
29
31
  }
30
32
 
33
+ std::vector<std::string> supportedComponentNames = {
34
+ };
35
+
31
36
  std::vector<std::string> supportedEventNames = {
32
37
  };
33
- if (std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
38
+
39
+ if (std::find(supportedComponentNames.begin(), supportedComponentNames.end(), componentName) != supportedComponentNames.end() &&
40
+ std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
34
41
  eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
35
42
  }
36
43
  }
@@ -0,0 +1,24 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateComponentDescriptorH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include "ShadowNodes.h"
14
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
15
+ #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
16
+
17
+ namespace facebook::react {
18
+
19
+
20
+
21
+ void react_native_default_preference_registerComponentDescriptorsFromCodegen(
22
+ std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
23
+
24
+ } // namespace facebook::react
@@ -0,0 +1,16 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateEventEmitterCpp.js
9
+ */
10
+
11
+ #include "EventEmitters.h"
12
+
13
+
14
+ namespace facebook::react {
15
+
16
+ } // namespace facebook::react
@@ -0,0 +1,17 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateEventEmitterH.js
9
+ */
10
+ #pragma once
11
+
12
+ #include <react/renderer/components/view/ViewEventEmitter.h>
13
+
14
+
15
+ namespace facebook::react {
16
+
17
+ } // namespace facebook::react
@@ -0,0 +1,19 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GeneratePropsCpp.js
9
+ */
10
+
11
+ #include "Props.h"
12
+ #include <react/renderer/core/PropsParserContext.h>
13
+ #include <react/renderer/core/propsConversions.h>
14
+
15
+ namespace facebook::react {
16
+
17
+
18
+
19
+ } // namespace facebook::react
@@ -0,0 +1,18 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GeneratePropsH.js
9
+ */
10
+ #pragma once
11
+
12
+
13
+
14
+ namespace facebook::react {
15
+
16
+
17
+
18
+ } // namespace facebook::react
@@ -0,0 +1,17 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateShadowNodeCpp.js
9
+ */
10
+
11
+ #include "ShadowNodes.h"
12
+
13
+ namespace facebook::react {
14
+
15
+
16
+
17
+ } // namespace facebook::react
@@ -0,0 +1,23 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateShadowNodeH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include "EventEmitters.h"
14
+ #include "Props.h"
15
+ #include "States.h"
16
+ #include <react/renderer/components/view/ConcreteViewShadowNode.h>
17
+ #include <jsi/jsi.h>
18
+
19
+ namespace facebook::react {
20
+
21
+
22
+
23
+ } // namespace facebook::react
@@ -0,0 +1,16 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateStateCpp.js
9
+ */
10
+ #include "States.h"
11
+
12
+ namespace facebook::react {
13
+
14
+
15
+
16
+ } // namespace facebook::react
@@ -0,0 +1,19 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateStateH.js
8
+ */
9
+ #pragma once
10
+
11
+ #ifdef ANDROID
12
+ #include <folly/dynamic.h>
13
+ #endif
14
+
15
+ namespace facebook::react {
16
+
17
+
18
+
19
+ } // namespace facebook::react
@@ -6,7 +6,6 @@
6
6
 
7
7
  import { RNPackage, TurboModulesFactory } from '@rnoh/react-native-openharmony/ts';
8
8
  import type { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
9
- import {RNOHPackage} from "@rnoh/react-native-openharmony";
10
9
  import { TM } from './generated/ts'
11
10
  import { RNDefaultPreferenceTurboModule } from './RNDefaultPreferenceTurboModule';
12
11
 
@@ -22,7 +21,7 @@ class RNDefaultPreferenceTurboModuleFactory extends TurboModulesFactory {
22
21
  }
23
22
  }
24
23
 
25
- export class RNDefaultPreferencePackage extends RNOHPackage {
24
+ export class RNDefaultPreferencePackage extends RNPackage {
26
25
  createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
27
26
  return new RNDefaultPreferenceTurboModuleFactory(ctx);
28
27
  }
package/package.json CHANGED
@@ -1,28 +1,22 @@
1
1
  {
2
2
  "name": "@react-native-ohos/react-native-default-preference",
3
- "version": "1.4.5-rc.2",
3
+ "version": "1.5.0-rc.1",
4
4
  "description": "Use SharedPreference (Android) and UserDefaults (iOS) with React Native over a unified interface",
5
5
  "main": "index.js",
6
-
7
- "scripts": {
8
- "codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-default-preference --cpp-output-path ./harmony/react_native_default_preference/src/main/cpp/generated --ets-output-path ./harmony/react_native_default_preference/src/main/ets/generated --turbo-modules-spec-paths ./src --arkts-components-spec-paths ./src"
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-default-preference --cpp-output-path ./harmony/react_native_default_preference/src/main/cpp/generated --ets-output-path ./harmony/react_native_default_preference/src/main/ets/generated --turbo-modules-spec-paths ./src/NativeDefaultPreference.ts"
9
9
  },
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "https://gitcode.com/openharmony-sig/rntpc_react-native-default-preference.git"
13
13
  },
14
14
  "harmony": {
15
- "alias": "react-native-default-preference",
16
- "autolinking": {
17
- "etsPackageClassName":"RNDefaultPreferencePackage",
18
- "cppPackageClassName":"RNDefaultPreferencePackage",
19
- "cmakeLibraryTargetName": "rnoh_default_preference",
20
- "ohPackageName": "@react-native-ohos/react-native-default-preference"
21
- }
15
+ "alias": "react-native-default-preference"
22
16
  },
23
- "publishConfig": {
24
- "registry": "https://registry.npmjs.org/",
25
- "access": "public"
17
+ "devDependencies": {
18
+ "@react-native-community/cli": "latest",
19
+ "react-native-harmony-cli": "npm:@react-native-oh/react-native-harmony-cli@^0.0.27"
26
20
  },
27
21
  "keywords": [
28
22
  "harmony",
@@ -37,8 +31,5 @@
37
31
  "peerDependencies": {
38
32
  "react-native": ">=0.47.0"
39
33
  },
40
- "devDependencies": {
41
- },
42
- "homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-default-preference"
43
-
34
+ "homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-default-preference#readme"
44
35
  }
@@ -1,36 +0,0 @@
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 RNDEFAULTPREFERENCEPACKAGE_H
25
- #define RNDEFAULTPREFERENCEPACKAGE_H
26
-
27
- #include "generated/RNOH/generated/BaseReactNativeDefaultPreferencePackage.h"
28
- #pragma once
29
-
30
- namespace rnoh {
31
- class RNDefaultPreferencePackage : public BaseReactNativeDefaultPreferencePackage {
32
- using Super = BaseReactNativeDefaultPreferencePackage;
33
- using Super::Super;
34
- };
35
- } // namespace rnoh
36
- #endif