From 0bbadfec6d8f3417e76bc27f6a48a6d0dec12990 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Mon, 4 Dec 2023 19:21:03 -0700 Subject: [PATCH] add contact import by URL, add error notification, refine tasks --- project.task.yaml | 6 +++--- src/views/ContactsView.vue | 11 +++++++++-- src/views/NewEditProjectView.vue | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/project.task.yaml b/project.task.yaml index 2c8feab..778787d 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -1,12 +1,12 @@ tasks: -- extract private_key_hex in py-push-server webpush.py -- lock down regenerate_vapid endpoint (so only we admins can do it on demand) - 40 notifications : - push, where we trigger a ServiceWorker(?) in the app to reach out and check for new data assignee:matthew + - extract private_key_hex in py-push-server webpush.py + - lock down regenerate_vapid endpoint (so only we admins can do it on demand) + - remove sleep in py-push-server app.py -- 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 - .5 Add infinite scroll to gifts on the home page diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue index 216a907..7502599 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -27,7 +27,7 @@ @@ -265,6 +265,7 @@ import { SimpleSigner, } from "@/libs/crypto"; import { + CONTACT_URL_PREFIX, GiveServerRecord, GiveVerifiableCredential, RegisterVerifiableCredential, @@ -479,6 +480,12 @@ export default class ContactsView extends Vue { ); return; } + + if (this.contactInput.startsWith(CONTACT_URL_PREFIX)) { + await this.newContactFromScan(this.contactInput); + return; + } + let did = this.contactInput; let name, publicKeyBase64; const commaPos1 = this.contactInput.indexOf(","); @@ -497,7 +504,7 @@ export default class ContactsView extends Vue { publicKeyBase64 = Buffer.from(publicKeyBase64, "hex").toString("base64"); } const newContact = { did, name, publicKeyBase64 }; - return this.addContact(newContact); + await this.addContact(newContact); } async newContactFromScan(url: string): Promise { diff --git a/src/views/NewEditProjectView.vue b/src/views/NewEditProjectView.vue index e02427a..9208ced 100644 --- a/src/views/NewEditProjectView.vue +++ b/src/views/NewEditProjectView.vue @@ -293,6 +293,20 @@ export default class NewEditProjectView extends Vue { 2000, this, ); + } else { + console.log( + "Got unexpected 'data' inside response from server", + resp, + ); + this.$notify( + { + group: "alert", + type: "danger", + title: "Error Saving Project", + text: "Server did not save the project. Try again.", + }, + -1, + ); } } catch (error) { let userMessage = "There was an error saving the project.";