@react-native-ohos/react-native-qr-decode-image-camera 1.1.4-rc.1 → 1.1.5-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 (70) hide show
  1. package/.github/workflows/codeql-analysis.yml +68 -0
  2. package/COMMITTERS.md +6 -6
  3. package/LICENSE +21 -21
  4. package/OAT.xml +88 -88
  5. package/QrCode.podspec +14 -14
  6. package/README.OpenSource +10 -10
  7. package/README.md +13 -13
  8. package/SECURITY.md +21 -21
  9. package/harmony/qr_decode_image_camera/BuildProfile.ets +16 -16
  10. package/harmony/qr_decode_image_camera/Index.ets +9 -8
  11. package/harmony/qr_decode_image_camera/build-profile.json5 +27 -27
  12. package/harmony/qr_decode_image_camera/obfuscation-rules.txt +17 -17
  13. package/harmony/qr_decode_image_camera/oh-package-lock.json5 +17 -17
  14. package/harmony/qr_decode_image_camera/oh-package.json5 +12 -12
  15. package/harmony/qr_decode_image_camera/src/main/cpp/CMakeLists.txt +3 -2
  16. package/harmony/qr_decode_image_camera/src/main/cpp/QrDecodeImageCameraPackage.h +16 -10
  17. package/harmony/qr_decode_image_camera/src/main/cpp/generated/RNOH/generated/BaseReactNativeQrDecodeImageCameraPackage.h +70 -72
  18. package/harmony/qr_decode_image_camera/src/main/cpp/generated/RNOH/generated/components/NativeScanJSIBinder.h +30 -0
  19. package/harmony/qr_decode_image_camera/src/main/cpp/generated/RNOH/generated/turbo_modules/QrDecodeImageCameraNativeModule.cpp +16 -16
  20. package/harmony/qr_decode_image_camera/src/main/cpp/generated/RNOH/generated/turbo_modules/QrDecodeImageCameraNativeModule.h +16 -16
  21. package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/ComponentDescriptors.h +22 -24
  22. package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/EventEmitters.cpp +26 -16
  23. package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/EventEmitters.h +27 -17
  24. package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/Props.cpp +29 -19
  25. package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/Props.h +31 -18
  26. package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/ShadowNodes.cpp +19 -17
  27. package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/ShadowNodes.h +34 -23
  28. package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/States.cpp +18 -16
  29. package/harmony/qr_decode_image_camera/src/main/cpp/generated/react/renderer/components/react_native_qr_decode_image_camera/States.h +36 -19
  30. package/harmony/qr_decode_image_camera/src/main/ets/Logger.ts +45 -45
  31. package/harmony/qr_decode_image_camera/src/main/ets/NativeScan.ets +150 -150
  32. package/harmony/qr_decode_image_camera/src/main/ets/{RNQrDecodeImageCameraPackage.ts → RNQrDecodeImageCameraPackage.ets} +29 -28
  33. package/harmony/qr_decode_image_camera/src/main/ets/RNQrDecodeImageCameraTurboModule.ts +46 -46
  34. package/harmony/qr_decode_image_camera/src/main/ets/generated/components/NativeScan.ts +120 -125
  35. package/harmony/qr_decode_image_camera/src/main/ets/generated/components/ts.ts +5 -8
  36. package/harmony/qr_decode_image_camera/src/main/ets/generated/index.ets +5 -5
  37. package/harmony/qr_decode_image_camera/src/main/ets/generated/ts.ts +6 -6
  38. package/harmony/qr_decode_image_camera/src/main/ets/generated/turboModules/QrDecodeImageCameraNativeModule.ts +16 -16
  39. package/harmony/qr_decode_image_camera/src/main/ets/generated/turboModules/ts.ts +5 -5
  40. package/harmony/qr_decode_image_camera/src/main/ets/pages/Index.ets +25 -25
  41. package/harmony/qr_decode_image_camera/src/main/ets/qr_decode_image_camera/qr_decode_image_camera.ets +47 -47
  42. package/harmony/qr_decode_image_camera/src/main/module.json5 +10 -10
  43. package/harmony/qr_decode_image_camera/src/main/resources/base/element/color.json +7 -7
  44. package/harmony/qr_decode_image_camera/src/main/resources/base/element/string.json +15 -15
  45. package/harmony/qr_decode_image_camera/src/main/resources/base/media/layered_image.json +6 -6
  46. package/harmony/qr_decode_image_camera/src/main/resources/base/profile/main_pages.json +5 -5
  47. package/harmony/qr_decode_image_camera/src/main/resources/en_US/element/string.json +15 -15
  48. package/harmony/qr_decode_image_camera/src/main/resources/zh_CN/element/string.json +15 -15
  49. package/harmony/qr_decode_image_camera/src/mock/mock-config.json5 +1 -1
  50. package/harmony/qr_decode_image_camera/src/ohosTest/ets/test/Ability.test.ets +34 -34
  51. package/harmony/qr_decode_image_camera/src/ohosTest/ets/test/List.test.ets +4 -4
  52. package/harmony/qr_decode_image_camera/src/ohosTest/ets/testability/TestAbility.ets +46 -46
  53. package/harmony/qr_decode_image_camera/src/ohosTest/ets/testability/pages/Index.ets +16 -16
  54. package/harmony/qr_decode_image_camera/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ets +89 -89
  55. package/harmony/qr_decode_image_camera/src/ohosTest/module.json5 +36 -36
  56. package/harmony/qr_decode_image_camera/src/ohosTest/resources/base/element/color.json +7 -7
  57. package/harmony/qr_decode_image_camera/src/ohosTest/resources/base/element/string.json +15 -15
  58. package/harmony/qr_decode_image_camera/src/ohosTest/resources/base/profile/test_pages.json +5 -5
  59. package/harmony/qr_decode_image_camera/src/test/List.test.ets +4 -4
  60. package/harmony/qr_decode_image_camera/src/test/LocalUnit.test.ets +32 -32
  61. package/harmony/qr_decode_image_camera/{ts.ts → ts.ets} +7 -7
  62. package/harmony/qr_decode_image_camera.har +0 -0
  63. package/index.js +14 -14
  64. package/package.json +48 -39
  65. package/src/Camera.tsx +57 -57
  66. package/src/NativeQrDecodeImageCamera.ts +16 -16
  67. package/src/NativeScan.ts +24 -24
  68. package/src/QRScanner.harmony.jsx +225 -225
  69. package/src/QRScanner.jsx +281 -281
  70. package/src/QRScannerView.js +381 -381
@@ -1,46 +1,46 @@
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
- import { TurboModule } from '@rnoh/react-native-openharmony/ts';
8
- import { TM } from './generated/ts';
9
- import window from '@ohos.window';
10
- import { scanCore, scanBarcode, detectBarcode } from '@kit.ScanKit';
11
- import { BusinessError } from '@kit.BasicServicesKit';
12
- import Logger from "./Logger"
13
-
14
- export class RNQrDecodeImageCameraTurboModule extends TurboModule implements TM.QrDecodeImageCameraNativeModule.Spec {
15
-
16
- constructor(ctx) {
17
- super(ctx);
18
- }
19
-
20
- QRreader(path: TM.QrDecodeImageCameraNativeModule.IPath): Promise<unknown> {
21
-
22
- return new Promise ((resolve,reject)=>{
23
- // 定义识码参数options
24
- let options: scanBarcode.ScanOptions = {
25
- scanTypes: [scanCore.ScanType.ALL],
26
- enableMultiMode: true,
27
- enableAlbum: true
28
- }
29
- // 调用图片识码接口
30
- detectBarcode.decode(path, options).then((result: Array<scanBarcode.ScanResult>) => {
31
- Logger.info( '[Scan Sample]', `Succeeded in getting ScanResult by promise with options, result is ${JSON.stringify(result)}`,'click success');
32
- resolve(result)
33
- }).catch((error: BusinessError) => {
34
- Logger.info( '[Scan Sample]', `Failed to get ScanResult by promise with options. Code: ${error.code}, message: ${error.message}`,"click fail");
35
- reject(error)
36
- });
37
- })
38
- }
39
-
40
- }
41
-
42
-
43
-
44
-
45
-
46
-
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
+ import { TurboModule } from '@rnoh/react-native-openharmony/ts';
8
+ import { TM } from './generated/ts';
9
+ import window from '@ohos.window';
10
+ import { scanCore, scanBarcode, detectBarcode } from '@kit.ScanKit';
11
+ import { BusinessError } from '@kit.BasicServicesKit';
12
+ import Logger from "./Logger"
13
+
14
+ export class RNQrDecodeImageCameraTurboModule extends TurboModule implements TM.QrDecodeImageCameraNativeModule.Spec {
15
+
16
+ constructor(ctx) {
17
+ super(ctx);
18
+ }
19
+
20
+ QRreader(path: TM.QrDecodeImageCameraNativeModule.IPath): Promise<unknown> {
21
+
22
+ return new Promise ((resolve,reject)=>{
23
+ // 定义识码参数options
24
+ let options: scanBarcode.ScanOptions = {
25
+ scanTypes: [scanCore.ScanType.ALL],
26
+ enableMultiMode: true,
27
+ enableAlbum: true
28
+ }
29
+ // 调用图片识码接口
30
+ detectBarcode.decode(path, options).then((result: Array<scanBarcode.ScanResult>) => {
31
+ Logger.info( '[Scan Sample]', `Succeeded in getting ScanResult by promise with options, result is ${JSON.stringify(result)}`,'click success');
32
+ resolve(result)
33
+ }).catch((error: BusinessError) => {
34
+ Logger.info( '[Scan Sample]', `Failed to get ScanResult by promise with options. Code: ${error.code}, message: ${error.message}`,"click fail");
35
+ reject(error)
36
+ });
37
+ })
38
+ }
39
+
40
+ }
41
+
42
+
43
+
44
+
45
+
46
+
@@ -1,125 +1,120 @@
1
- /**
2
- * This code was generated by "react-native codegen-harmony"
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be
5
- * lost once the code is regenerated.
6
- *
7
- * @generatorVersion: 1
8
- */
9
-
10
- import {
11
- Descriptor as ComponentDescriptor,
12
- ViewBaseProps,
13
- ViewRawProps,
14
- ViewDescriptorWrapperBase,
15
- ColorValue,
16
- Color,
17
- RNInstance,
18
- Tag,
19
- RNComponentCommandReceiver,
20
- ViewPropsSelector,
21
- } from '@rnoh/react-native-openharmony/ts';
22
-
23
-
24
- export namespace NativeScan {
25
- export const NAME = "NativeScan" as const
26
-
27
- export interface DirectRawProps {
28
- text?: string;
29
- flashMode?: boolean;
30
- zoom?: number;
31
- }
32
-
33
- export interface Props extends ViewBaseProps {}
34
-
35
- export interface State {}
36
-
37
- export interface RawProps extends ViewRawProps, DirectRawProps {}
38
-
39
- export class PropsSelector extends ViewPropsSelector<Props, RawProps> {
40
- get text() {
41
- return this.rawProps.text;
42
- }
43
-
44
- get flashMode() {
45
- return this.rawProps.flashMode ?? false;
46
- }
47
-
48
- get zoom() {
49
- return this.rawProps.zoom ?? 0;
50
- }
51
-
52
-
53
- }
54
-
55
- export type Descriptor = ComponentDescriptor<
56
- typeof NAME,
57
- Props,
58
- State,
59
- RawProps
60
- >;
61
-
62
- export class DescriptorWrapper extends ViewDescriptorWrapperBase<
63
- typeof NAME,
64
- Props,
65
- State,
66
- RawProps,
67
- PropsSelector
68
- > {
69
- protected createPropsSelector() {
70
- return new PropsSelector(this.descriptor.props, this.descriptor.rawProps)
71
- }
72
- }
73
-
74
- export interface EventPayloadByName {
75
- "read": {result: string}
76
- }
77
-
78
- export class EventEmitter {
79
- constructor(private rnInstance: RNInstance, private tag: Tag) {}
80
-
81
- emit<TEventName extends keyof EventPayloadByName>(eventName: TEventName, payload: EventPayloadByName[TEventName]) {
82
- this.rnInstance.emitComponentEvent(this.tag, eventName, payload)
83
- }
84
- }
85
-
86
- export interface CommandArgvByName {
87
- }
88
-
89
- export class CommandReceiver {
90
- private listenersByCommandName = new Map<string, Set<(...args: any[]) => void>>()
91
- private cleanUp: (() => void) | undefined = undefined
92
-
93
- constructor(private componentCommandReceiver: RNComponentCommandReceiver, private tag: Tag) {
94
- }
95
-
96
- subscribe<TCommandName extends keyof CommandArgvByName>(commandName: TCommandName, listener: (argv: CommandArgvByName[TCommandName]) => void) {
97
- if (!this.listenersByCommandName.has(commandName)) {
98
- this.listenersByCommandName.set(commandName, new Set())
99
- }
100
- this.listenersByCommandName.get(commandName)!.add(listener)
101
- const hasRegisteredCommandReceiver = !!this.cleanUp
102
- if (!hasRegisteredCommandReceiver) {
103
- this.cleanUp = this.componentCommandReceiver.registerCommandCallback(this.tag, (commandName: string, argv: any[]) => {
104
- if (this.listenersByCommandName.has(commandName)) {
105
- const listeners = this.listenersByCommandName.get(commandName)!
106
- listeners.forEach(listener => {
107
- listener(argv)
108
- })
109
- }
110
- })
111
- }
112
-
113
- return () => {
114
- this.listenersByCommandName.get(commandName)?.delete(listener)
115
- if (this.listenersByCommandName.get(commandName)?.size ?? 0 === 0) {
116
- this.listenersByCommandName.delete(commandName)
117
- }
118
- if (this.listenersByCommandName.size === 0) {
119
- this.cleanUp?.()
120
- }
121
- }
122
- }
123
- }
124
-
125
- }
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ import {
6
+ Descriptor as ComponentDescriptor,
7
+ ViewBaseProps,
8
+ ViewRawProps,
9
+ ViewDescriptorWrapperBase,
10
+ ColorValue,
11
+ Color,
12
+ RNInstance,
13
+ Tag,
14
+ RNComponentCommandReceiver,
15
+ ViewPropsSelector,
16
+ } from '@rnoh/react-native-openharmony/ts';
17
+
18
+
19
+ export namespace NativeScan {
20
+ export const NAME = "NativeScan" as const
21
+
22
+ export interface DirectRawProps {
23
+ text?: string;
24
+ flashMode?: boolean;
25
+ zoom?: number;
26
+ }
27
+
28
+ export interface Props extends ViewBaseProps {}
29
+
30
+ export interface State {}
31
+
32
+ export interface RawProps extends ViewRawProps, DirectRawProps {}
33
+
34
+ export class PropsSelector extends ViewPropsSelector<Props, RawProps> {
35
+ get text() {
36
+ return this.rawProps.text;
37
+ }
38
+
39
+ get flashMode() {
40
+ return this.rawProps.flashMode ?? false;
41
+ }
42
+
43
+ get zoom() {
44
+ return this.rawProps.zoom ?? 0;
45
+ }
46
+
47
+
48
+ }
49
+
50
+ export type Descriptor = ComponentDescriptor<
51
+ typeof NAME,
52
+ Props,
53
+ State,
54
+ RawProps
55
+ >;
56
+
57
+ export class DescriptorWrapper extends ViewDescriptorWrapperBase<
58
+ typeof NAME,
59
+ Props,
60
+ State,
61
+ RawProps,
62
+ PropsSelector
63
+ > {
64
+ protected createPropsSelector() {
65
+ return new PropsSelector(this.descriptor.props, this.descriptor.rawProps)
66
+ }
67
+ }
68
+
69
+ export interface EventPayloadByName {
70
+ "read": {result: string}
71
+ }
72
+
73
+ export class EventEmitter {
74
+ constructor(private rnInstance: RNInstance, private tag: Tag) {}
75
+
76
+ emit<TEventName extends keyof EventPayloadByName>(eventName: TEventName, payload: EventPayloadByName[TEventName]) {
77
+ this.rnInstance.emitComponentEvent(this.tag, eventName, payload)
78
+ }
79
+ }
80
+
81
+ export interface CommandArgvByName {
82
+ }
83
+
84
+ export class CommandReceiver {
85
+ private listenersByCommandName = new Map<string, Set<(...args: any[]) => void>>()
86
+ private cleanUp: (() => void) | undefined = undefined
87
+
88
+ constructor(private componentCommandReceiver: RNComponentCommandReceiver, private tag: Tag) {
89
+ }
90
+
91
+ subscribe<TCommandName extends keyof CommandArgvByName>(commandName: TCommandName, listener: (argv: CommandArgvByName[TCommandName]) => void) {
92
+ if (!this.listenersByCommandName.has(commandName)) {
93
+ this.listenersByCommandName.set(commandName, new Set())
94
+ }
95
+ this.listenersByCommandName.get(commandName)!.add(listener)
96
+ const hasRegisteredCommandReceiver = !!this.cleanUp
97
+ if (!hasRegisteredCommandReceiver) {
98
+ this.cleanUp = this.componentCommandReceiver.registerCommandCallback(this.tag, (commandName: string, argv: any[]) => {
99
+ if (this.listenersByCommandName.has(commandName)) {
100
+ const listeners = this.listenersByCommandName.get(commandName)!
101
+ listeners.forEach(listener => {
102
+ listener(argv)
103
+ })
104
+ }
105
+ })
106
+ }
107
+
108
+ return () => {
109
+ this.listenersByCommandName.get(commandName)?.delete(listener)
110
+ if (this.listenersByCommandName.get(commandName)?.size ?? 0 === 0) {
111
+ this.listenersByCommandName.delete(commandName)
112
+ }
113
+ if (this.listenersByCommandName.size === 0) {
114
+ this.cleanUp?.()
115
+ }
116
+ }
117
+ }
118
+ }
119
+
120
+ }
@@ -1,8 +1,5 @@
1
- /**
2
- * This code was generated by "react-native codegen-harmony"
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be
5
- * lost once the code is regenerated.
6
- */
7
-
8
- export * from "./NativeScan"
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ export * from "./NativeScan"
@@ -1,5 +1,5 @@
1
- /**
2
- * This code was generated by "react-native codegen-lib-harmony"
3
- */
4
-
5
- export * from "./ts"
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ export * from "./ts"
@@ -1,6 +1,6 @@
1
- /**
2
- * This code was generated by "react-native codegen-lib-harmony"
3
- */
4
-
5
- export * as RNC from "./components/ts"
6
- export * as TM from "./turboModules/ts"
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ export * as RNC from "./components/ts"
6
+ export * as TM from "./turboModules/ts"
@@ -1,16 +1,16 @@
1
- /**
2
- * This code was generated by "react-native codegen-lib-harmony"
3
- */
4
-
5
- import { Tag } from "@rnoh/react-native-openharmony/ts"
6
-
7
- export namespace QrDecodeImageCameraNativeModule {
8
- export const NAME = 'QrDecodeImageCameraNativeModule' as const
9
-
10
- export type IPath = {uri: string}
11
-
12
- export interface Spec {
13
- QRreader(path: IPath): Promise<unknown>;
14
-
15
- }
16
- }
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ import { Tag } from "@rnoh/react-native-openharmony/ts"
6
+
7
+ export namespace QrDecodeImageCameraNativeModule {
8
+ export const NAME = 'QrDecodeImageCameraNativeModule' as const
9
+
10
+ export type IPath = {uri: string}
11
+
12
+ export interface Spec {
13
+ QRreader(path: IPath): Promise<unknown>;
14
+
15
+ }
16
+ }
@@ -1,5 +1,5 @@
1
- /**
2
- * This code was generated by "react-native codegen-lib-harmony"
3
- */
4
-
5
- export * from "./QrDecodeImageCameraNativeModule"
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ export * from "./QrDecodeImageCameraNativeModule"
@@ -1,26 +1,26 @@
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
- @Entry
8
- @Component
9
- struct Index {
10
- @State message: string = 'Hello World';
11
-
12
- build() {
13
- RelativeContainer() {
14
- Text(this.message)
15
- .id('HelloWorld')
16
- .fontSize(50)
17
- .fontWeight(FontWeight.Bold)
18
- .alignRules({
19
- center: { anchor: '__container__', align: VerticalAlign.Center },
20
- middle: { anchor: '__container__', align: HorizontalAlign.Center }
21
- })
22
- }
23
- .height('100%')
24
- .width('100%')
25
- }
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
+ @Entry
8
+ @Component
9
+ struct Index {
10
+ @State message: string = 'Hello World';
11
+
12
+ build() {
13
+ RelativeContainer() {
14
+ Text(this.message)
15
+ .id('HelloWorld')
16
+ .fontSize(50)
17
+ .fontWeight(FontWeight.Bold)
18
+ .alignRules({
19
+ center: { anchor: '__container__', align: VerticalAlign.Center },
20
+ middle: { anchor: '__container__', align: HorizontalAlign.Center }
21
+ })
22
+ }
23
+ .height('100%')
24
+ .width('100%')
25
+ }
26
26
  }
@@ -1,47 +1,47 @@
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
- import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
8
- import { hilog } from '@kit.PerformanceAnalysisKit';
9
- import { window } from '@kit.ArkUI';
10
-
11
- export default class qr_decode_image_camera extends UIAbility {
12
- onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
13
- hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
14
- }
15
-
16
- onDestroy(): void {
17
- hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
18
- }
19
-
20
- onWindowStageCreate(windowStage: window.WindowStage): void {
21
- // Main window is created, set main page for this ability
22
- hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
23
-
24
- windowStage.loadContent('pages/Index', (err) => {
25
- if (err.code) {
26
- hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
27
- return;
28
- }
29
- hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
30
- });
31
- }
32
-
33
- onWindowStageDestroy(): void {
34
- // Main window is destroyed, release UI related resources
35
- hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
36
- }
37
-
38
- onForeground(): void {
39
- // Ability has brought to foreground
40
- hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
41
- }
42
-
43
- onBackground(): void {
44
- // Ability has back to background
45
- hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
46
- }
47
- }
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
+ import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
8
+ import { hilog } from '@kit.PerformanceAnalysisKit';
9
+ import { window } from '@kit.ArkUI';
10
+
11
+ export default class qr_decode_image_camera extends UIAbility {
12
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
13
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
14
+ }
15
+
16
+ onDestroy(): void {
17
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
18
+ }
19
+
20
+ onWindowStageCreate(windowStage: window.WindowStage): void {
21
+ // Main window is created, set main page for this ability
22
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
23
+
24
+ windowStage.loadContent('pages/Index', (err) => {
25
+ if (err.code) {
26
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
27
+ return;
28
+ }
29
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
30
+ });
31
+ }
32
+
33
+ onWindowStageDestroy(): void {
34
+ // Main window is destroyed, release UI related resources
35
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
36
+ }
37
+
38
+ onForeground(): void {
39
+ // Ability has brought to foreground
40
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
41
+ }
42
+
43
+ onBackground(): void {
44
+ // Ability has back to background
45
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
46
+ }
47
+ }
@@ -1,11 +1,11 @@
1
- {
2
- "module": {
3
- "name": "qr_decode_image_camera",
4
- "type": "har",
5
- "deviceTypes": [
6
- "default",
7
- "tablet",
8
- "2in1"
9
- ]
10
- }
1
+ {
2
+ "module": {
3
+ "name": "qr_decode_image_camera",
4
+ "type": "har",
5
+ "deviceTypes": [
6
+ "default",
7
+ "tablet",
8
+ "2in1"
9
+ ]
10
+ }
11
11
  }
@@ -1,8 +1,8 @@
1
- {
2
- "color": [
3
- {
4
- "name": "start_window_background",
5
- "value": "#FFFFFF"
6
- }
7
- ]
1
+ {
2
+ "color": [
3
+ {
4
+ "name": "start_window_background",
5
+ "value": "#FFFFFF"
6
+ }
7
+ ]
8
8
  }
@@ -1,16 +1,16 @@
1
- {
2
- "string": [
3
- {
4
- "name": "module_desc",
5
- "value": "module description"
6
- },
7
- {
8
- "name": "Qr_decode_image_cameraAbility_desc",
9
- "value": "description"
10
- },
11
- {
12
- "name": "Qr_decode_image_cameraAbility_label",
13
- "value": "label"
14
- }
15
- ]
1
+ {
2
+ "string": [
3
+ {
4
+ "name": "module_desc",
5
+ "value": "module description"
6
+ },
7
+ {
8
+ "name": "Qr_decode_image_cameraAbility_desc",
9
+ "value": "description"
10
+ },
11
+ {
12
+ "name": "Qr_decode_image_cameraAbility_label",
13
+ "value": "label"
14
+ }
15
+ ]
16
16
  }
@@ -1,7 +1,7 @@
1
- {
2
- "layered-image":
3
- {
4
- "background" : "$media:background",
5
- "foreground" : "$media:foreground"
6
- }
1
+ {
2
+ "layered-image":
3
+ {
4
+ "background" : "$media:background",
5
+ "foreground" : "$media:foreground"
6
+ }
7
7
  }