Skip to content

Commit

Permalink
Merge branch 'master' into 174847319-IbanInsertionScreen
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziofff authored Oct 7, 2020
2 parents 9ee5fba + e2c180b commit f011eaf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "italia-app",
"version": "1.7.0-rc.7",
"version": "1.7.0-rc.8",
"io_backend_api": "https://raw.githubusercontent.com/pagopa/io-backend/v7.0.0/api_backend.yaml",
"io_public_api": "https://raw.githubusercontent.com/pagopa/io-backend/v7.0.0/api_public.yaml",
"io_content_specs": "https://raw.githubusercontent.com/pagopa/io-services-metadata/master/definitions.yml",
Expand Down
8 changes: 8 additions & 0 deletions ts/components/RegionServiceWebView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as React from "react";
import { Alert, StyleSheet } from "react-native";
import { heightPercentageToDP } from "react-native-responsive-screen";
import WebView, { WebViewMessageEvent } from "react-native-webview";
import URLParse from "url-parse";
import I18n from "../i18n";
import customVariables from "../theme/variables";
import { WebviewMessage } from "../types/WebviewMessage";
Expand Down Expand Up @@ -45,6 +46,8 @@ const RegionServiceWebView: React.FunctionComponent<Props> = (props: Props) => {
const [loading, setLoading] = React.useState(false);
const ref = React.createRef<WebView>();

const urlParsed = new URLParse(props.uri, true);

const showSuccessContent = (text: string, close: () => void) => (
<Container>
<AppHeader noLeft={true}>
Expand Down Expand Up @@ -99,6 +102,10 @@ const RegionServiceWebView: React.FunctionComponent<Props> = (props: Props) => {
);

const handleWebviewMessage = (event: WebViewMessageEvent) => {
if (!event.nativeEvent.url.startsWith(urlParsed.origin)) {
return;
}

if (props.handleWebMessage) {
props.handleWebMessage(event.nativeEvent.data);
}
Expand Down Expand Up @@ -162,6 +169,7 @@ const RegionServiceWebView: React.FunctionComponent<Props> = (props: Props) => {
<WebView
ref={ref}
source={{ uri: props.uri }}
originWhitelist={[urlParsed.origin]}
textZoom={100}
onLoadEnd={injectJS}
onMessage={handleWebviewMessage}
Expand Down

0 comments on commit f011eaf

Please sign in to comment.