Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove all ECHO plugin instance #142

Merged
merged 1 commit into from
Feb 12, 2024
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
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
Loading