Skip to content
This repository was archived by the owner on Nov 27, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion harmony/rn_webview/src/main/ets/RNCWebView.ets
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export interface WebViewProps extends ViewBaseProps {
webviewDebuggingEnabled: boolean
// nestedScrollEnabled: boolean
scrollEnabled: boolean
incognito: boolean
}

export class RNCWebViewBridge {
Expand Down Expand Up @@ -190,6 +191,15 @@ export struct RNCWebView {
))

this.registerCommandCallback()

if (this.hasIncognito()) {
this.cacheMode = CacheMode.Online;
webview.WebCookieManager.putAcceptCookieEnabled(false);
}
}

hasIncognito(): boolean {
return this.descriptorWrapper.props.incognito === true
}

private initVariable() {
Expand Down Expand Up @@ -268,6 +278,9 @@ export struct RNCWebView {
this.controller.deleteJavaScriptRegister(JAVASCRIPT_INTERFACE)
this.controller.refresh()
this.hasRegisterJavaScriptProxy = false
if (this.hasIncognito()) {
this.controller.clearHistory()
}
} catch (error) {
Logger.error(TAG, `[RNOH]Errorcode: ${error.code}, Message: ${error.message}`);
}
Expand Down Expand Up @@ -623,4 +636,4 @@ export struct RNCWebView {
.height(this.descriptorWrapper.height)
.position({ x: this.descriptorWrapper.positionRelativeToParent.x, y: this.descriptorWrapper.positionRelativeToParent.y })
}
}
}