forked from jsnbuchanan/crowd-funder-for-time-pwa
modify the settings to allow account-specific settings, eg. for "isRegistered"
This commit is contained in:
@@ -84,11 +84,11 @@
|
||||
id="noticeSomeoneMustRegisterYou"
|
||||
class="bg-amber-200 rounded-md overflow-hidden text-center px-4 py-3 mb-4"
|
||||
>
|
||||
<!-- activeDid && !isRegistered -->
|
||||
<!-- !isCreatingIdentifier && !isRegistered -->
|
||||
To share, someone must register you.
|
||||
<div class="block text-center">
|
||||
<button
|
||||
@click="showNameDialog()"
|
||||
@click="showNameThenIdDialog()"
|
||||
class="text-md font-bold bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white mt-2 px-2 py-3 rounded-md"
|
||||
>
|
||||
Show them {{ PASSKEYS_ENABLED ? "default" : "your" }} identifier
|
||||
@@ -107,7 +107,7 @@
|
||||
</div>
|
||||
|
||||
<div v-else id="sectionRecordSomethingGiven">
|
||||
<!-- activeDid && isRegistered -->
|
||||
<!-- !isCreatingIdentifier && isRegistered -->
|
||||
|
||||
<!-- show the actions for recognizing a give -->
|
||||
<div class="flex justify-between">
|
||||
@@ -325,13 +325,17 @@ import {
|
||||
NotificationIface,
|
||||
PASSKEYS_ENABLED,
|
||||
} from "@/constants/app";
|
||||
import { db, accountsDB } from "@/db/index";
|
||||
import {
|
||||
db,
|
||||
accountsDB,
|
||||
updateAccountSettings,
|
||||
retrieveSettingsForActiveAccount,
|
||||
} from "@/db/index";
|
||||
import { Contact } from "@/db/tables/contacts";
|
||||
import {
|
||||
BoundingBox,
|
||||
isAnyFeedFilterOn,
|
||||
MASTER_SETTINGS_KEY,
|
||||
Settings,
|
||||
} from "@/db/tables/settings";
|
||||
import {
|
||||
contactForDid,
|
||||
@@ -420,18 +424,17 @@ export default class HomeView extends Vue {
|
||||
this.allMyDids = [newDid];
|
||||
}
|
||||
|
||||
await db.open();
|
||||
const settings = (await db.settings.get(MASTER_SETTINGS_KEY)) as Settings;
|
||||
this.apiServer = settings?.apiServer || "";
|
||||
this.activeDid = settings?.activeDid || "";
|
||||
const settings = await retrieveSettingsForActiveAccount();
|
||||
this.apiServer = settings.apiServer || "";
|
||||
this.activeDid = settings.activeDid || "";
|
||||
this.allContacts = await db.contacts.toArray();
|
||||
this.feedLastViewedClaimId = settings?.lastViewedClaimId;
|
||||
this.givenName = settings?.firstName || "";
|
||||
this.isFeedFilteredByVisible = !!settings?.filterFeedByVisible;
|
||||
this.isFeedFilteredByNearby = !!settings?.filterFeedByNearby;
|
||||
this.isRegistered = !!settings?.isRegistered;
|
||||
this.searchBoxes = settings?.searchBoxes || [];
|
||||
this.showShortcutBvc = !!settings?.showShortcutBvc;
|
||||
this.feedLastViewedClaimId = settings.lastViewedClaimId;
|
||||
this.givenName = settings.firstName || "";
|
||||
this.isFeedFilteredByVisible = !!settings.filterFeedByVisible;
|
||||
this.isFeedFilteredByNearby = !!settings.filterFeedByNearby;
|
||||
this.isRegistered = !!settings.isRegistered;
|
||||
this.searchBoxes = settings.searchBoxes || [];
|
||||
this.showShortcutBvc = !!settings.showShortcutBvc;
|
||||
|
||||
this.isAnyFeedFilterOn = isAnyFeedFilterOn(settings);
|
||||
|
||||
@@ -444,9 +447,7 @@ export default class HomeView extends Vue {
|
||||
this.activeDid,
|
||||
);
|
||||
if (resp.status === 200) {
|
||||
// we just needed to know that they're registered
|
||||
await db.open();
|
||||
await db.settings.update(MASTER_SETTINGS_KEY, {
|
||||
await updateAccountSettings(this.activeDid, {
|
||||
isRegistered: true,
|
||||
});
|
||||
this.isRegistered = true;
|
||||
@@ -495,10 +496,9 @@ export default class HomeView extends Vue {
|
||||
|
||||
// only called when a setting was changed
|
||||
async reloadFeedOnChange() {
|
||||
await db.open();
|
||||
const settings = (await db.settings.get(MASTER_SETTINGS_KEY)) as Settings;
|
||||
this.isFeedFilteredByVisible = !!settings?.filterFeedByVisible;
|
||||
this.isFeedFilteredByNearby = !!settings?.filterFeedByNearby;
|
||||
const settings = await retrieveSettingsForActiveAccount();
|
||||
this.isFeedFilteredByVisible = !!settings.filterFeedByVisible;
|
||||
this.isFeedFilteredByNearby = !!settings.filterFeedByNearby;
|
||||
this.isAnyFeedFilterOn = isAnyFeedFilterOn(settings);
|
||||
|
||||
this.feedData = [];
|
||||
@@ -555,7 +555,7 @@ export default class HomeView extends Vue {
|
||||
// This has indeed proven problematic. See loadMoreGives
|
||||
// We should display it immediately and then get the plan later.
|
||||
const plan = await getPlanFromCache(
|
||||
record.fulfillsPlanHandleId,
|
||||
record.fulfillsPlanHandleId || "",
|
||||
this.axios,
|
||||
this.apiServer,
|
||||
this.activeDid,
|
||||
@@ -782,7 +782,7 @@ export default class HomeView extends Vue {
|
||||
return known ? "text-slate-500" : "text-slate-100";
|
||||
}
|
||||
|
||||
showNameDialog() {
|
||||
showNameThenIdDialog() {
|
||||
if (!this.givenName) {
|
||||
(this.$refs.userNameDialog as UserNameDialog).open(() => {
|
||||
this.promptForShareMethod();
|
||||
|
||||
Reference in New Issue
Block a user