@react-native-ohos/react-native-webview 13.10.6-beta.3 → 13.10.6
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.
- package/CHANGELOG.md +16 -0
- package/LICENSE +21 -21
- package/README.md +385 -393
- package/harmony/rn_webview/.gitignore +6 -0
- package/harmony/rn_webview/BuildProfile.ets +1 -1
- package/harmony/rn_webview/LICENSE +21 -21
- package/harmony/rn_webview/NOTICE +33 -33
- package/harmony/rn_webview/OAT.xml +44 -44
- package/harmony/rn_webview/README.OpenSource +10 -10
- package/harmony/rn_webview/build-profile.json5 +28 -28
- package/harmony/rn_webview/index.ets +33 -33
- package/harmony/rn_webview/obfuscation-rules.txt +17 -17
- package/harmony/rn_webview/oh-package-lock.json5 +18 -18
- package/harmony/rn_webview/oh-package.json5 +13 -13
- package/harmony/rn_webview/src/main/cpp/CMakeLists.txt +9 -9
- package/harmony/rn_webview/src/main/cpp/WebViewPackage.h +36 -36
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/BaseReactNativeWebviewPackage.h +94 -94
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/components/RNCWebViewJSIBinder.h +129 -128
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebView.cpp +20 -20
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebView.h +16 -16
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebViewModule.cpp +19 -19
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebViewModule.h +16 -16
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ComponentDescriptors.h +22 -22
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.cpp +240 -240
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.h +285 -285
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.cpp +156 -155
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.h +340 -339
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.cpp +19 -19
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.h +34 -34
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/States.cpp +16 -16
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/States.h +19 -19
- package/harmony/rn_webview/src/main/ets/CutomReference.ts +49 -49
- package/harmony/rn_webview/src/main/ets/Logger.ts +63 -63
- package/harmony/rn_webview/src/main/ets/Magic.ets +223 -221
- package/harmony/rn_webview/src/main/ets/RNCWebView.ets +1098 -903
- package/harmony/rn_webview/src/main/ets/RNCWebViewPackage.ets +65 -65
- package/harmony/rn_webview/src/main/ets/ShouldRequestUrl.ts +67 -67
- package/harmony/rn_webview/src/main/ets/WebViewBaseOperate.ets +490 -490
- package/harmony/rn_webview/src/main/ets/WebViewTurboModule.ets +81 -81
- package/harmony/rn_webview/src/main/ets/generated/components/RNCWebView.ts +516 -511
- package/harmony/rn_webview/src/main/ets/generated/components/ts.ts +5 -5
- package/harmony/rn_webview/src/main/ets/generated/index.ets +5 -5
- package/harmony/rn_webview/src/main/ets/generated/ts.ts +6 -6
- package/harmony/rn_webview/src/main/ets/generated/turboModules/RNCWebView.ts +18 -18
- package/harmony/rn_webview/src/main/ets/generated/turboModules/RNCWebViewModule.ts +16 -16
- package/harmony/rn_webview/src/main/ets/generated/turboModules/ts.ts +6 -6
- package/harmony/rn_webview/src/main/module.json5 +10 -10
- package/harmony/rn_webview/src/main/resources/base/element/string.json +39 -39
- package/harmony/rn_webview/src/main/resources/en_US/element/string.json +39 -39
- package/harmony/rn_webview/src/main/resources/zh_CN/element/string.json +39 -39
- package/harmony/rn_webview/src/test/List.test.ets +4 -4
- package/harmony/rn_webview/src/test/LocalUnit.test.ets +32 -32
- package/harmony/rn_webview/ts.ets +28 -28
- package/harmony/rn_webview.har +0 -0
- package/package.json +105 -104
- package/src/NativeRNCWebView.ts +15 -15
- package/src/NativeRNCWebViewModule.ts +17 -17
- package/src/RNCWebViewNativeComponent.ts +289 -288
- package/src/WebView.harmony.tsx +331 -331
- package/src/WebView.tsx +4 -4
- package/src/codegenUtils.ts +8 -8
- package/src/index.ts +4 -4
|
@@ -1,82 +1,82 @@
|
|
|
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
|
-
import { TM } from './generated/ts';
|
|
26
|
-
import { AnyThreadTurboModule } from '@rnoh/react-native-openharmony/ts';
|
|
27
|
-
import Logger from './Logger';
|
|
28
|
-
|
|
29
|
-
const TAG = "WebViewTurboModule"
|
|
30
|
-
|
|
31
|
-
export class WebViewTurboModule extends AnyThreadTurboModule implements TM.RNCWebViewModule.Spec {
|
|
32
|
-
private shouldStartParamsMap : Map<number,ShouldStartParams> = new Map();
|
|
33
|
-
|
|
34
|
-
isFileUploadSupported(): Promise<boolean> {
|
|
35
|
-
return Promise.resolve(true)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
shouldStartLoadWithLockIdentifier(shouldStart: boolean, lockIdentifier: number): void {
|
|
39
|
-
Logger.debug("shouldStartLoadWithLockIdentifier:" + shouldStart + " lockIdentifier:" + lockIdentifier)
|
|
40
|
-
let shouldStartParams = this.shouldStartParamsMap.get(lockIdentifier)
|
|
41
|
-
Logger.debug("shouldStartLoadWithLockIdentifier setShouldStartParams:" + JSON.stringify(shouldStartParams))
|
|
42
|
-
if (shouldStartParams) {
|
|
43
|
-
shouldStartParams.shouldStart = shouldStart
|
|
44
|
-
shouldStartParams.lockState = shouldStart ? ShouldOverrideCallbackState.ALLOW_LOADING : ShouldOverrideCallbackState.SHOULD_OVERRIDE;
|
|
45
|
-
}
|
|
46
|
-
this.shouldStartParamsMap.set(lockIdentifier,shouldStartParams || new ShouldStartParams())
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
setShouldStartParams(params: ShouldStartParams){
|
|
51
|
-
Logger.debug("setShouldStartParams:" + JSON.stringify(params))
|
|
52
|
-
this.shouldStartParamsMap.set(params.lockIdentifier,params)
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// 锁状态
|
|
57
|
-
export enum ShouldOverrideCallbackState {
|
|
58
|
-
/**
|
|
59
|
-
* 等待返回状态
|
|
60
|
-
*/
|
|
61
|
-
UNDECIDED,
|
|
62
|
-
/**
|
|
63
|
-
* 阻止加载
|
|
64
|
-
*/
|
|
65
|
-
SHOULD_OVERRIDE,
|
|
66
|
-
/**
|
|
67
|
-
* 允许加载
|
|
68
|
-
*/
|
|
69
|
-
ALLOW_LOADING,
|
|
70
|
-
/**
|
|
71
|
-
* 允许加载
|
|
72
|
-
*/
|
|
73
|
-
DEFAULT,
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
@Sendable
|
|
77
|
-
export class ShouldStartParams {
|
|
78
|
-
shouldStart: boolean = true
|
|
79
|
-
lockIdentifier: number = -1
|
|
80
|
-
// 对应ShouldOverrideCallbackState
|
|
81
|
-
lockState: number = ShouldOverrideCallbackState.DEFAULT
|
|
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
|
+
import { TM } from './generated/ts';
|
|
26
|
+
import { AnyThreadTurboModule } from '@rnoh/react-native-openharmony/ts';
|
|
27
|
+
import Logger from './Logger';
|
|
28
|
+
|
|
29
|
+
const TAG = "WebViewTurboModule"
|
|
30
|
+
|
|
31
|
+
export class WebViewTurboModule extends AnyThreadTurboModule implements TM.RNCWebViewModule.Spec {
|
|
32
|
+
private shouldStartParamsMap : Map<number,ShouldStartParams> = new Map();
|
|
33
|
+
|
|
34
|
+
isFileUploadSupported(): Promise<boolean> {
|
|
35
|
+
return Promise.resolve(true)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
shouldStartLoadWithLockIdentifier(shouldStart: boolean, lockIdentifier: number): void {
|
|
39
|
+
Logger.debug("shouldStartLoadWithLockIdentifier:" + shouldStart + " lockIdentifier:" + lockIdentifier)
|
|
40
|
+
let shouldStartParams = this.shouldStartParamsMap.get(lockIdentifier)
|
|
41
|
+
Logger.debug("shouldStartLoadWithLockIdentifier setShouldStartParams:" + JSON.stringify(shouldStartParams))
|
|
42
|
+
if (shouldStartParams) {
|
|
43
|
+
shouldStartParams.shouldStart = shouldStart
|
|
44
|
+
shouldStartParams.lockState = shouldStart ? ShouldOverrideCallbackState.ALLOW_LOADING : ShouldOverrideCallbackState.SHOULD_OVERRIDE;
|
|
45
|
+
}
|
|
46
|
+
this.shouldStartParamsMap.set(lockIdentifier,shouldStartParams || new ShouldStartParams())
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
setShouldStartParams(params: ShouldStartParams){
|
|
51
|
+
Logger.debug("setShouldStartParams:" + JSON.stringify(params))
|
|
52
|
+
this.shouldStartParamsMap.set(params.lockIdentifier,params)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// 锁状态
|
|
57
|
+
export enum ShouldOverrideCallbackState {
|
|
58
|
+
/**
|
|
59
|
+
* 等待返回状态
|
|
60
|
+
*/
|
|
61
|
+
UNDECIDED,
|
|
62
|
+
/**
|
|
63
|
+
* 阻止加载
|
|
64
|
+
*/
|
|
65
|
+
SHOULD_OVERRIDE,
|
|
66
|
+
/**
|
|
67
|
+
* 允许加载
|
|
68
|
+
*/
|
|
69
|
+
ALLOW_LOADING,
|
|
70
|
+
/**
|
|
71
|
+
* 允许加载
|
|
72
|
+
*/
|
|
73
|
+
DEFAULT,
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@Sendable
|
|
77
|
+
export class ShouldStartParams {
|
|
78
|
+
shouldStart: boolean = true
|
|
79
|
+
lockIdentifier: number = -1
|
|
80
|
+
// 对应ShouldOverrideCallbackState
|
|
81
|
+
lockState: number = ShouldOverrideCallbackState.DEFAULT
|
|
82
82
|
}
|