From 1f13bf772c7404c9d35dc8a1ce43b59469803b7a Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Mon, 1 Jan 2024 20:36:23 -0700 Subject: [PATCH] move wait for service-worker initialization into the notification modal --- project.task.yaml | 2 +- src/App.vue | 14 +++++++++++++- src/views/AccountViewView.vue | 11 ++--------- src/views/HelpNotificationsView.vue | 12 ++++++++---- src/views/HomeView.vue | 6 ++++-- 5 files changed, 28 insertions(+), 17 deletions(-) diff --git a/project.task.yaml b/project.task.yaml index 86ac243..7921f11 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -3,10 +3,10 @@ tasks: - 08 notifications : - .2 after turning on notification, don't wait in push server but wait in client for message test (so that users don't have to wait 10 seconds for confirmation for some kind of confirmation) - - if navigator.serviceWorker is null, then tell the user to wait - Make sure instructions note - Local install works after cleared out cache in Chrome - fix maskable icon +- change all list-inside to list-outside - 04 generate & store next public key hash, and give to contacts for storage diff --git a/src/App.vue b/src/App.vue index b8481b8..f34557a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -156,11 +156,17 @@ class="flex w-11/12 max-w-sm mx-auto mb-3 overflow-hidden bg-white rounded-lg shadow-lg" >
-

+

Would you like to turn on notifications for this app?

+

+ Waiting for system initialization, which may take up to 10 + seconds... + +

-
+
Notification status may have changed. Revisit this page to see the latest setting.
-
- Waiting for system initialization... - -
Test your notification setup. @@ -519,7 +515,6 @@ export default class AccountViewView extends Vue { limits: RateLimits | null = null; limitsMessage = ""; loadingLimits = true; // might as well now that we do it on mount, to avoid flashing the registration message - serviceWorkerReady = false; showContactGives = false; showDidCopy = false; @@ -567,8 +562,6 @@ export default class AccountViewView extends Vue { async mounted() { try { const registration = await navigator.serviceWorker.ready; - // there may be a long pause here on first initialization - this.serviceWorkerReady = true; this.subscription = await registration.pushManager.getSubscription(); this.isSubscribed = !!this.subscription; } catch (error) { diff --git a/src/views/HelpNotificationsView.vue b/src/views/HelpNotificationsView.vue index 4c53035..8400747 100644 --- a/src/views/HelpNotificationsView.vue +++ b/src/views/HelpNotificationsView.vue @@ -38,7 +38,10 @@

-

If this app is not installed...

+

+ If this is not installed as an app... + +

For best results on mobile, install this app on your device (as @@ -54,13 +57,13 @@

- If "you must enable notifications"... + If you must enable notifications... +

- Wait for about 10 seconds (for the service worker to activate), then

@@ -273,6 +276,7 @@ export default class HelpNotificationsView extends Vue { group: "alert", type: "danger", title: "Not Subscribed", + // Note that this exact verbiage shows in help text. text: "You must enable notifications before testing the web push.", }, -1, diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 45177c7..69b39ce 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -15,12 +15,14 @@ class="bg-amber-200 rounded-md overflow-hidden text-center px-4 py-3 mb-4" >

- You should install this as an app. + This is not installed as an app. + + Look for an "install" prompt or action. - Go here for instructions. + Go here for more help.