From 85bd807bccac8914968c8bcf4ec5331d5cf2349b Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Sun, 5 Nov 2023 21:46:46 -0700 Subject: [PATCH] allow view of feed without an identifier --- project.task.yaml | 3 +- src/db/tables/settings.ts | 1 + src/router/index.ts | 2 - src/views/AccountViewView.vue | 25 ++++++- src/views/HomeView.vue | 115 ++++++++++++++++++----------- src/views/IdentitySwitcherView.vue | 2 +- 6 files changed, 97 insertions(+), 51 deletions(-) diff --git a/project.task.yaml b/project.task.yaml index 8a7b276..c370194 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -6,11 +6,10 @@ tasks: - 40 notifications : - push, where we trigger a ServiceWorker(?) in the app to reach out and check for new data assignee:matthew -- .1 don't allow to even see the claim actions if they're not registered - - 01 Replace Gifted/Give in ContactsView with GiftedDialog assignee:matthew - 01 fix the Discovery map display to not show on top of bottom icons (and any other UI tweaks on the map flow) assignee-group:ui +- .1 add instructions for map location selection - 01 Show pop-up or some message confirming that settings & contacts download has been initiated/finished assignee:matthew assignee-group:ui diff --git a/src/db/tables/settings.ts b/src/db/tables/settings.ts index dac9094..fb926c9 100644 --- a/src/db/tables/settings.ts +++ b/src/db/tables/settings.ts @@ -12,6 +12,7 @@ export type Settings = { activeDid?: string; apiServer?: string; firstName?: string; + isRegistered?: boolean; lastName?: string; // deprecated, pre v 0.1.3 lastViewedClaimId?: string; searchBoxes?: Array<{ diff --git a/src/router/index.ts b/src/router/index.ts index fa0e035..c06a5dc 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -33,7 +33,6 @@ const routes: Array = [ name: "home", component: () => import(/* webpackChunkName: "home" */ "../views/HomeView.vue"), - beforeEnter: enterOrStart, }, { path: "/account", @@ -79,7 +78,6 @@ const routes: Array = [ name: "contacts", component: () => import(/* webpackChunkName: "contacts" */ "../views/ContactsView.vue"), - beforeEnter: enterOrStart, }, { path: "/scan-contact", diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index f0b2559..f222fc3 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -166,7 +166,7 @@ -
+
@@ -387,6 +387,7 @@ export default class AccountViewView extends Vue { apiServerInput = ""; derivationPath = ""; givenName = ""; + isRegistered = false; numAccounts = 0; publicHex = ""; publicBase64 = ""; @@ -513,6 +514,7 @@ export default class AccountViewView extends Vue { this.givenName = (settings?.firstName || "") + (settings?.lastName ? ` ${settings.lastName}` : ""); // pre v 0.1.3 + this.isRegistered = !!settings?.isRegistered; this.showContactGives = !!settings?.showContactGivesInline; } @@ -699,6 +701,27 @@ export default class AccountViewView extends Vue { const resp = await this.fetchRateLimits(identity); if (resp.status === 200) { this.limits = resp.data; + if (!this.isRegistered) { + // the user is not known to be registered, but they are so let's record it + try { + await db.open(); + db.settings.update(MASTER_SETTINGS_KEY, { + isRegistered: true, + }); + this.isRegistered = true; + } catch (err) { + console.log("Got an error updating settings:", err); + this.$notify( + { + group: "alert", + type: "warning", + title: "Update Error", + text: "Unable to update your settings. Check claim limits again.", + }, + -1, + ); + } + } } } catch (error) { this.handleRateLimitsError(error); diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index f13e282..5aaeac6 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -6,55 +6,78 @@ Time Safari +
-

Record a Gift

- -
    -
  • - -

    - Anonymous/Unnamed -

    -
  • -
  • + To record others' giving, + + create your identifier. +
+ +
+ To record others' giving, someone must register your account, so show + them + + your identity info - -

+ check your limits. +

+ +
+ +

Record a Gift

+ +
    +
  • + +

    + Anonymous/Unnamed +

    +
  • +
  • - {{ contact.name || contact.did }} - -
  • -
+ +

+ {{ contact.name || contact.did }} +

+ + - - - Show More Contacts… - - - -
- (No contacts to show.) + + + Show More Contacts… + + + +
+ (No contacts to show.) +
@@ -129,6 +152,7 @@ export default class HomeView extends Vue { feedPreviousOldestId?: string; feedLastViewedId?: string; isHiddenSpinner = true; + isRegistered = false; numAccounts = 0; async beforeCreate() { @@ -173,6 +197,7 @@ export default class HomeView extends Vue { this.activeDid = settings?.activeDid || ""; this.allContacts = await db.contacts.toArray(); this.feedLastViewedId = settings?.lastViewedClaimId; + this.isRegistered = !!settings?.isRegistered; this.updateAllFeed(); // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (err: any) { diff --git a/src/views/IdentitySwitcherView.vue b/src/views/IdentitySwitcherView.vue index ecf7ba5..74d17c3 100644 --- a/src/views/IdentitySwitcherView.vue +++ b/src/views/IdentitySwitcherView.vue @@ -151,7 +151,7 @@ export default class IdentitySwitcherView extends Vue { did = undefined; } await db.open(); - db.settings.update(MASTER_SETTINGS_KEY, { + await db.settings.update(MASTER_SETTINGS_KEY, { activeDid: did, }); this.activeDid = did || "";