diff --git a/.changeset/moody-moose-glow.md b/.changeset/moody-moose-glow.md new file mode 100644 index 000000000000..4e314d7353d1 --- /dev/null +++ b/.changeset/moody-moose-glow.md @@ -0,0 +1,5 @@ +--- +"live-mobile": patch +--- + +fix: imageProcessor webview should have a source diff --git a/apps/ledger-live-mobile/src/components/CustomImage/ImageHexProcessor.tsx b/apps/ledger-live-mobile/src/components/CustomImage/ImageHexProcessor.tsx index 965ca4e605ce..e4a50b9f467b 100644 --- a/apps/ledger-live-mobile/src/components/CustomImage/ImageHexProcessor.tsx +++ b/apps/ledger-live-mobile/src/components/CustomImage/ImageHexProcessor.tsx @@ -3,7 +3,7 @@ import React from "react"; import { WebView, type WebViewMessageEvent } from "react-native-webview"; import { ImageProcessingError } from "@ledgerhq/live-common/customImage/errors"; import { ProcessorPreviewResult, ProcessorRawResult } from "./ImageProcessor"; -import { injectedCode } from "./injectedCode/imageHexToBase64Processing"; +import { injectedCode, htmlPage } from "./injectedCode/imageHexToBase64Processing"; import { InjectedCodeDebugger } from "./InjectedCodeDebugger"; export type Props = ProcessorRawResult & { @@ -100,12 +100,13 @@ export default class ImageHexProcessor extends React.Component { (this.webViewRef = c)} - injectedJavaScript={injectedCode} androidLayerType="software" - androidHardwareAccelerationDisabled onError={this.handleWebViewError} onLoadEnd={this.handleWebViewLoaded} onMessage={this.handleWebViewMessage} + originWhitelist={["*"]} + source={{ html: htmlPage }} + webviewDebuggingEnabled={__DEV__} /> diff --git a/apps/ledger-live-mobile/src/components/CustomImage/ImageProcessor.tsx b/apps/ledger-live-mobile/src/components/CustomImage/ImageProcessor.tsx index bcf65ec8f07d..d25f1190355e 100644 --- a/apps/ledger-live-mobile/src/components/CustomImage/ImageProcessor.tsx +++ b/apps/ledger-live-mobile/src/components/CustomImage/ImageProcessor.tsx @@ -2,7 +2,7 @@ import { Flex } from "@ledgerhq/native-ui"; import React from "react"; import { WebView, type WebViewMessageEvent } from "react-native-webview"; import { ImageProcessingError } from "@ledgerhq/live-common/customImage/errors"; -import { injectedCode } from "./injectedCode/imageBase64ToHexProcessing"; +import { injectedCode, htmlPage } from "./injectedCode/imageBase64ToHexProcessing"; import { InjectedCodeDebugger } from "./InjectedCodeDebugger"; import { ImageBase64Data, ImageDimensions } from "./types"; @@ -151,12 +151,13 @@ export default class ImageProcessor extends React.Component { (this.webViewRef = c)} - injectedJavaScript={injectedCode} androidLayerType="software" - androidHardwareAccelerationDisabled onError={this.handleWebViewError} onLoadEnd={this.handleWebViewLoaded} onMessage={this.handleWebViewMessage} + originWhitelist={["*"]} + source={{ html: htmlPage }} + webviewDebuggingEnabled={__DEV__} /> diff --git a/apps/ledger-live-mobile/src/components/CustomImage/injectedCode/imageBase64ToHexProcessing.ts b/apps/ledger-live-mobile/src/components/CustomImage/injectedCode/imageBase64ToHexProcessing.ts index e96b399b016f..b49751dacb11 100644 --- a/apps/ledger-live-mobile/src/components/CustomImage/injectedCode/imageBase64ToHexProcessing.ts +++ b/apps/ledger-live-mobile/src/components/CustomImage/injectedCode/imageBase64ToHexProcessing.ts @@ -268,3 +268,18 @@ function getFunctionBody(str: string) { } export const injectedCode = getFunctionBody(codeToInject.toString()); + +export const htmlPage = ` + + + + + + + + + + +`; diff --git a/apps/ledger-live-mobile/src/components/CustomImage/injectedCode/imageHexToBase64Processing.ts b/apps/ledger-live-mobile/src/components/CustomImage/injectedCode/imageHexToBase64Processing.ts index 4df77d2780c8..828d5b9317dc 100644 --- a/apps/ledger-live-mobile/src/components/CustomImage/injectedCode/imageHexToBase64Processing.ts +++ b/apps/ledger-live-mobile/src/components/CustomImage/injectedCode/imageHexToBase64Processing.ts @@ -100,3 +100,18 @@ function getFunctionBody(str: string) { } export const injectedCode = getFunctionBody(codeToInject.toString()); + +export const htmlPage = ` + + + + + + + + + + +`;