refactor: pwa install prompt (#1932)

This commit is contained in:
Andrew Bastin 2021-11-03 23:44:01 +05:30 committed by GitHub
parent 8edad7ded7
commit 45e508fc36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -128,7 +128,7 @@ const t = i18n.t.bind(i18n)
* that can be called to show the user the installation
* prompt.
*/
const showInstallPrompt = ref<undefined | null>(null)
const showInstallPrompt = ref(() => Promise.resolve()) // Async no-op till it is initialized
const showSupport = ref(false)
const showSearch = ref(false)
@ -156,9 +156,7 @@ onMounted(async () => {
// Initializes the PWA code - checks if the app is installed,
// etc.
// TODO: @liyasthomas, check this out (initializePwa is a () => Promise<void>)
await intializePwa()
showInstallPrompt.value = undefined
showInstallPrompt.value = intializePwa()
const cookiesAllowed = getLocalConfig("cookiesAllowed") === "yes"
if (!cookiesAllowed) {