From 5cbf917ada5d85becf14e176982c1e60d8779657 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Mon, 4 Dec 2023 09:34:27 -0700 Subject: [PATCH 01/10] don't show non-message to user; fix API server setting; misc doc & task stuff --- project.task.yaml | 7 ++----- src/views/HomeView.vue | 2 +- sw_scripts/additional-scripts.js | 26 +++++++++++++++----------- sw_scripts/safari-notifications.js | 11 +++++------ 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/project.task.yaml b/project.task.yaml index 9b56584..aff2cca 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -1,11 +1,6 @@ tasks: -- remove hard-coded anomalistlabs.com - -- don't show "Give" & "Offer" on project screen if they don't have an identifier -- allow some gives even if they aren't registered - - in endorser-push-server - mount folder for persistent sqlite DB outside of container - extract private_key_hex in webpush.py - 40 notifications : @@ -40,6 +35,7 @@ tasks: - bug (that is hard to reproduce) - on the second 'give' recorded on prod it showed me as the agent - make identicons for contacts into more-memorable faces (and maybe change project identicons, too) - allow download of each VC (to show that they can actually own their data) +- allow some gives even if they aren't registered - contacts v+ : - 01 Import all the non-sensitive data (ie. contacts & settings). @@ -69,6 +65,7 @@ tasks: - .5 show seed phrase in a QR code for transfer to another device - .5 on DiscoverView, switch to a filter UI (eg. just from friend +- .5 don't show "Offer" on project screen if they aren't registered - 24 Move to Vite - 32 accept images for projects diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index af00edc..21b6ac9 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -104,7 +104,7 @@ class="border-b border-dashed border-slate-400 text-orange-400 pb-2 mb-2 font-bold uppercase text-sm" v-if="record.jwtId == feedLastViewedId" > - You've seen all the following before + You've seen all the following
diff --git a/sw_scripts/additional-scripts.js b/sw_scripts/additional-scripts.js index e39c527..76aad46 100644 --- a/sw_scripts/additional-scripts.js +++ b/sw_scripts/additional-scripts.js @@ -5,7 +5,7 @@ importScripts( ); self.addEventListener("install", (event) => { - console.error(event); + console.error("Adding event listener for:", event); importScripts( "safari-notifications.js", "nacl.js", @@ -23,16 +23,20 @@ self.addEventListener("push", function (event) { payload = JSON.parse(event.data.text()); } const message = await self.getNotificationCount(); - console.error(message); - const title = payload ? payload.title : "Custom Title"; - const options = { - body: message, - icon: payload ? payload.icon : "icon.png", - badge: payload ? payload.badge : "badge.png", - }; - await self.registration.showNotification(title, options); + if (message) { + console.log("Will notify user:", message); + const title = payload ? payload.title : "Custom Title"; + const options = { + body: message, + icon: payload ? payload.icon : "icon.png", + badge: payload ? payload.badge : "badge.png", + }; + await self.registration.showNotification(title, options); + } else { + console.log("No notification message, so will not tell the user."); + } } catch (error) { - console.error("Error in processing the push event:", error); + console.error("Error processing the push event:", error); } })(), ); @@ -51,7 +55,7 @@ self.addEventListener("activate", (event) => { }); self.addEventListener("fetch", (event) => { - console.log(event.request); + console.log("Got fetch event", event.request); }); self.addEventListener("error", (event) => { diff --git a/sw_scripts/safari-notifications.js b/sw_scripts/safari-notifications.js index f0baf83..fb31f18 100644 --- a/sw_scripts/safari-notifications.js +++ b/sw_scripts/safari-notifications.js @@ -466,6 +466,7 @@ async function getNotificationCount() { if ("secret" in self) { secret = self.secret; const secretUint8Array = self.decodeBase64(secret); + // 1 is our master settings ID; see MASTER_SETTINGS_KEY const settings = await getSettingById(1); let lastNotifiedClaimId = null; if ("lastNotifiedClaimId" in settings) { @@ -496,7 +497,7 @@ async function getNotificationCount() { headers["Authorization"] = "Bearer " + (await accessToken(identifier)); let response = await fetch( - "https://test-api.endorser.ch/api/v2/report/claims", + settings["apiServer"] + "/api/v2/report/claims", { method: "GET", headers: headers, @@ -513,15 +514,13 @@ async function getNotificationCount() { } newClaims++; } - if (newClaims === 0) { - result = "You have no new claims today."; - } else { - result = `${newClaims} have been shared with you`; + if (newClaims > 0) { + result = `There are ${newClaims} new activities on TimeSafari`; } const most_recent_notified = claims[0]["id"]; await setMostRecentNotified(most_recent_notified); } else { - console.error(response.status); + console.error("The service worker got a bad response status when fetching claims:", response.status, response); } break; } From ce5933f6455508dd996cab5f3b36637946baef2c Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Mon, 4 Dec 2023 13:29:16 -0700 Subject: [PATCH 02/10] remove visibility to contact operations where there is no activeDid --- project.task.yaml | 3 -- src/views/ContactsView.vue | 100 ++++++++++++++++++++----------------- 2 files changed, 54 insertions(+), 49 deletions(-) diff --git a/project.task.yaml b/project.task.yaml index aff2cca..f22b95d 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -1,13 +1,10 @@ tasks: -- in endorser-push-server - mount folder for persistent sqlite DB outside of container - extract private_key_hex in webpush.py - 40 notifications : - push, where we trigger a ServiceWorker(?) in the app to reach out and check for new data assignee:matthew -- .2 change the "claims" verbiage in feeds (eg. safari-notifications.js) -- .5 allow to manage their notifications even without an identity - 01 Ensure each action sent to the server has a confirmation - eg registration (ie a toast something that dismisses after 5-10s) - .3 fix the Project-location-selection map display to not show on top of bottom icons (and any other UI tweaks on the map flow) assignee-group:ui diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue index c7ca1df..0e75ad0 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -110,48 +110,50 @@
- - - - - - + + class="text-sm uppercase bg-slate-500 text-white px-2 py-1.5 rounded-md" + @click="setVisibility(contact, true, true)" + title="They cannot see you" + > + + + + +