Skip to content

Commit

Permalink
feat: render verification
Browse files Browse the repository at this point in the history
  • Loading branch information
phoebus-84 committed Jan 22, 2024
1 parent 0caa990 commit b17c1e4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
2 changes: 0 additions & 2 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<script lang="ts">
import { setupIonicBase } from 'ionic-svelte';
setupIonicBase();
import '@fontsource/poppins';
import 'ionic-svelte/components/all';
import '../theme/variables.css';
Expand Down
23 changes: 19 additions & 4 deletions src/routes/verify/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
//@ts-ignore
import { qrcode } from '@slangroom/qrcode';
import { onMount } from 'svelte';
import { thumbsDownOutline, thumbsUpOutline } from 'ionicons/icons';
let qr: any;
let error: string;
let tok: string;
const scriptCreate = `
Rule unknown ignore
Expand All @@ -18,9 +20,11 @@ Given I have a 'string' named 'qrcode'
Then print data
`;
const slangroom = new Slangroom(qrcode);
let incomingNotification: any;
const addListeners = async () => {
await PushNotifications.addListener('registration', async (token) => {
tok = token.value;
const text = JSON.stringify({
url: 'http://localhost:3000',
name: 'over18',
Expand All @@ -37,6 +41,11 @@ Then print data
await PushNotifications.addListener('registrationError', (err) => {
error = err.error;
});
await PushNotifications.addListener('pushNotificationReceived', (notification) => {
incomingNotification = notification;
console.log('Push notification received: ', notification);
});
};
const registerNotifications = async () => {
Expand Down Expand Up @@ -72,8 +81,14 @@ Then print data
</ion-header>

<ion-content fullscreen class="ion-padding">
<ion-button href="/">back</ion-button>
{#if qr}
<img src={qr.result.qrcode} alt="qrCode" class="w-full pt-20" />
{/if}
<ion-button href="/">back</ion-button>
<div class="flex flex-col">
{#if incomingNotification}
<ion-icon icon={(incomingNotification.data.message === 'ok')?thumbsUpOutline : thumbsDownOutline} class="text-9xl my-6 mx-auto"></ion-icon>
{:else if qr}
<img src={qr.result.qrcode} alt="qrCode" class="w-full pt-20" />
{/if}
</div>
{JSON.stringify(incomingNotification)}
<ion-input value={tok}></ion-input>
</ion-content>

0 comments on commit b17c1e4

Please sign in to comment.