Skip to content

Commit

Permalink
Update UI
Browse files Browse the repository at this point in the history
  • Loading branch information
gantunesr committed Nov 26, 2022
1 parent 988b4c6 commit 4daa547
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions app/components/Views/Wallet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,39 @@ const Wallet = ({ navigation }: any) => {
};

const sendMessageToWebview = () => {
stream.write('HELLO');
// eslint-disable-next-line no-console
console.log('LOG: sendMessageToWebview executed');
stream.write(
JSON.stringify({
method: 'hello',
snapId: 'jobId-1',
args: { origin: 'origin', request: { method: 'hello' } },
}),
);
};

const createJob = () => {
// eslint-disable-next-line no-console
console.log('LOG: createJob executed');
stream.write(
JSON.stringify({
method: 'start-snap',
snapId: 'jobId-1',
args: { origin: 'origin', request: { method: 'hello' } },
}),
);
};

const passDataToStream = () => {
// eslint-disable-next-line no-console
console.log('LOG: passDataToStream executed');
stream.write(
JSON.stringify({
method: 'stream-to-iframe',
snapId: 'jobId-0',
args: { origin: 'origin', request: { method: 'hello' } },
}),
);
};

return (
Expand All @@ -372,12 +404,16 @@ const Wallet = ({ navigation }: any) => {
>
{selectedAddress ? renderContent() : renderLoader()}
</ScrollView>
<Button onPress={sendMessageToWebview}>Send message to webview</Button>
<Button onPress={sendMessageToWebview}>Test stream to WebView</Button>
<Button onPress={createJob}>Create new job with iframe+stream</Button>
<Button onPress={passDataToStream}>Pass data to job stream</Button>
<WebView
ref={webviewRef}
source={{ uri: 'http://localhost:3000/' }}
onMessage={messageFromWebview}
onLoadEnd={setWebviewPostMessage}
originWhitelist={['*']}
javaScriptEnabled
/>
{renderOnboardingWizard()}
</View>
Expand Down

0 comments on commit 4daa547

Please sign in to comment.