Skip to content

Commit f9d876a

Browse files
authored
refactor: turbo module adapt to old versions of rnoh (#251)
1 parent 524f873 commit f9d876a

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

harmony/rn_webview/src/main/ets/RNCWebView.ets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ export struct RNCWebView {
364364
}
365365

366366
let lockIdentifier = this.webViewBaseOperate?.getLockIdentifier()
367-
let webViewTurboModule = this.ctx.rnInstance.getUITurboModule<WebViewTurboModule>(TM.RNCWebViewModule.NAME)
367+
let webViewTurboModule = this.ctx.rnInstance.getTurboModule<WebViewTurboModule>(TM.RNCWebViewModule.NAME)
368368
this.callLoadTimer = setTimeout(()=>{
369369
Logger.debug(TAG, "call setTimeout")
370370
webViewTurboModule.callLoadFunction(lockIdentifier)
@@ -402,7 +402,7 @@ export struct RNCWebView {
402402

403403
resetIntercept() {
404404
Logger.debug(TAG,"resetIntercept")
405-
this.ctx.rnInstance.getUITurboModule<WebViewTurboModule>(TM.RNCWebViewModule.NAME)
405+
this.ctx.rnInstance.getTurboModule<WebViewTurboModule>(TM.RNCWebViewModule.NAME)
406406
.clearLoadFunction(this.webViewBaseOperate?.getLockIdentifier())
407407
clearTimeout(this.callLoadTimer)
408408
this.shouldInterceptLoad = true

harmony/rn_webview/src/main/ets/RNCWebViewPackage.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ import type {
2626
DescriptorWrapperFactoryByDescriptorType,
2727
DescriptorWrapperFactoryByDescriptorTypeCtx,
2828
} from '@rnoh/react-native-openharmony/ts';
29-
import { RNPackage, UITurboModuleFactory, UITurboModule } from '@rnoh/react-native-openharmony/ts';
29+
import { RNPackage, TurboModulesFactory, TurboModule } from '@rnoh/react-native-openharmony/ts';
3030
import { RNC, TM } from '@rnoh/react-native-openharmony/generated/ts';
3131
import { WebViewTurboModule } from './WebViewTurboModule'
32-
import { UITurboModuleContext } from '@rnoh/react-native-openharmony/src/main/ets/RNOH/RNOHContext';
32+
import { TurboModuleContext } from '@rnoh/react-native-openharmony/src/main/ets/RNOH/RNOHContext';
3333

3434
export class RNCWebViewPackage extends RNPackage {
3535
createDescriptorWrapperFactoryByDescriptorType(ctx: DescriptorWrapperFactoryByDescriptorTypeCtx): DescriptorWrapperFactoryByDescriptorType {
@@ -38,13 +38,13 @@ export class RNCWebViewPackage extends RNPackage {
3838
}
3939
}
4040

41-
createUITurboModuleFactory(ctx: UITurboModuleContext): UITurboModuleFactory {
41+
createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
4242
return new WebViewTurboModulesFactory(ctx);
4343
}
4444
}
4545

46-
class WebViewTurboModulesFactory extends UITurboModuleFactory {
47-
createTurboModule(name: string): UITurboModule | null {
46+
class WebViewTurboModulesFactory extends TurboModulesFactory {
47+
createTurboModule(name: string): TurboModule | null {
4848
if (name === TM.RNCWebViewModule.NAME) {
4949
return new WebViewTurboModule(this.ctx);
5050
}

harmony/rn_webview/src/main/ets/WebViewTurboModule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { UITurboModule } from '@rnoh/react-native-openharmony/ts';
1+
import { TurboModule } from '@rnoh/react-native-openharmony/ts';
22
import { TM } from '@rnoh/react-native-openharmony/generated/ts';
33
import Logger from './Logger';
44

55
const TAG = "WebViewTurboModule"
66

7-
export class WebViewTurboModule extends UITurboModule implements TM.RNCWebViewModule.Spec {
7+
export class WebViewTurboModule extends TurboModule implements TM.RNCWebViewModule.Spec {
88
private loadCallbackMap : Map<number,()=> void> = new Map();
99

1010
isFileUploadSupported(): Promise<boolean> {

0 commit comments

Comments
 (0)