From 70ced1dfa7e56f5548fbfb03f2e46af583869244 Mon Sep 17 00:00:00 2001 From: Made Baruna Date: Mon, 5 Apr 2021 00:49:18 +0800 Subject: [PATCH] Fix firebase import bug --- src/locales/en.json | 1 + src/routes/reminder.svelte | 5 ++++- src/stores/firebase.js | 4 ---- src/template.html | 3 +++ 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index cb8a1ae9..c3d98f7e 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -473,6 +473,7 @@ "blocked": "Notification is blocked, the reminder notification will not work! Please enable it on your browser.", "desktop": "Desktop browser cannot receive notification if the browser is not running!", "early": "The notification may arrive earlier (about 1-10 minutes) because of the way we send the notification", + "allowNotification": "Please allow the notification prompt that shows up!", "transformer": "Parametric Transformer Reminder", "last": "Enter when you last used the Parametric Transformer", "countdown": "Enter countdown time of the Parametric Transformer (If you don't remember the exact time, you need to approximate it)", diff --git a/src/routes/reminder.svelte b/src/routes/reminder.svelte index 2a3fe406..e04be710 100644 --- a/src/routes/reminder.svelte +++ b/src/routes/reminder.svelte @@ -17,9 +17,9 @@ import { pushToast } from '../stores/toast'; import { + loading, firebaseToken, firstLoadNotification, - loading, loadingFirst, notificationAllowed, notificationSupported, @@ -198,6 +198,9 @@ {#if loadingSave}{/if} {$t('reminder.set')} + {#if $loading} +

{$t('reminder.allowNotification')}

+ {/if}
diff --git a/src/stores/firebase.js b/src/stores/firebase.js index f0a169e7..e1f23b7b 100644 --- a/src/stores/firebase.js +++ b/src/stores/firebase.js @@ -15,7 +15,6 @@ const firebaseConfig = { appId: __paimon.env.FIREBASE_APP_ID, }; -let firebase; let messaging; export async function firstLoadNotification() { @@ -65,9 +64,6 @@ async function initFirebase() { console.log('init firebase'); if (!messaging) { - firebase = (await import('firebase/app')).default; - await import('firebase/messaging'); - firebase.initializeApp(firebaseConfig); messaging = firebase.messaging(); } diff --git a/src/template.html b/src/template.html index 412b18c0..00f9764d 100644 --- a/src/template.html +++ b/src/template.html @@ -21,6 +21,9 @@ + + +