Skip to content

Commit

Permalink
fix: remove all ECHO plugin instance
Browse files Browse the repository at this point in the history
  • Loading branch information
phoebus-84 committed Feb 12, 2024
1 parent fdc6f26 commit 4eb53a7
Showing 1 changed file with 22 additions and 35 deletions.
57 changes: 22 additions & 35 deletions src/routes/(tests)/native/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,42 +1,39 @@
<script lang="ts">
import { listOutline, pencilOutline, phonePortrait, star } from "ionicons/icons";
import Echo from '$lib/nativeHooks/EchoPlugin';
import TEE from '$lib/nativeHooks/TEEPlugin';
let response= "Push the button to test native functionality"
const callNativeCode = async ()=> {
const { value } = await Echo.echo({ value: 'Hello From your phone!' });
response = value
}
const callGenerateKey = async ()=> {
import { listOutline, pencilOutline, phonePortrait, star } from 'ionicons/icons';
import TEE from '$lib/nativeHooks/TEEPlugin';
let response = 'Push the button to test native functionality';
const callGenerateKey = async () => {
try {
const res = await TEE.generateKey();
response = res.success ? `Success: ${res.result}` : `Error: ${res.error}`;
} catch(e) {
response = "Error" + e;
} catch (e) {
response = 'Error' + e;
}
}
const callListAliases = async ()=> {
};
const callListAliases = async () => {
try {
const res = await TEE.listAliases();
response = res.success ? `Success: ${res.result.join(',')}` : `Error: ${res.error}`;
} catch(e) {
response = "Error" + e;
} catch (e) {
response = 'Error' + e;
}
}
const callEncrypt = async ()=> {
};
const callEncrypt = async () => {
try {
const res = await TEE.doEncrypt({ msg: "Muy bien!" });
if(res.success) {
const res = await TEE.doEncrypt({ msg: 'Muy bien!' });
if (res.success) {
const res2 = await TEE.doDecrypt({ msg: res.result });
response = res2.success ? `Success: ${res.result} --> ${res2.result}` : `Error(decrypt): ${res2.error}`;
response = res2.success
? `Success: ${res.result} --> ${res2.result}`
: `Error(decrypt): ${res2.error}`;
} else {
response = `Error(encrypt): ${res.error}`;
}
} catch(e) {
response = "Error" + e;
} catch (e) {
response = 'Error' + e;
}
}
};
</script>

<ion-tab tab="native">
Expand All @@ -50,18 +47,8 @@
</ion-header>

<ion-content fullscreen class="ion-padding">
<ion-Text>{response}</ion-Text>
<ion-Text>{response}</ion-Text>
<ion-fab vertical="bottom" horizontal="center" slot="fixed">
<ion-fab-button
role="button"
tabindex="0"
on:click={callNativeCode}
on:keypress={(e) => {
if (e.key === 'Enter') callNativeCode();
}}
>
<ion-icon icon={phonePortrait} />
</ion-fab-button>
<ion-fab-button
role="button"
tabindex="0"
Expand Down

0 comments on commit 4eb53a7

Please sign in to comment.