Browse Source

await all of the db.settings updates

Trent Larson 4 months ago
parent
commit
f362f19cbb
  1. 12
      src/components/FeedFilters.vue
  2. 4
      src/db/index.ts
  3. 4
      src/views/ContactQRScanShowView.vue
  4. 6
      src/views/ContactsView.vue
  5. 6
      src/views/HomeView.vue
  6. 2
      src/views/ImportAccountView.vue
  7. 2
      src/views/ImportDerivedAccountView.vue
  8. 4
      src/views/NewEditAccountView.vue
  9. 4
      src/views/SearchAreaView.vue
  10. 2
      src/views/SharedPhotoView.vue

12
src/components/FeedFilters.vue

@ -133,18 +133,18 @@ export default class FeedFilters extends Vue {
this.visible = true;
}
toggleHasVisibleDid() {
async toggleHasVisibleDid() {
this.settingChanged = true;
this.hasVisibleDid = !this.hasVisibleDid;
db.settings.update(MASTER_SETTINGS_KEY, {
await db.settings.update(MASTER_SETTINGS_KEY, {
filterFeedByVisible: this.hasVisibleDid,
});
}
toggleNearby() {
async toggleNearby() {
this.settingChanged = true;
this.isNearby = !this.isNearby;
db.settings.update(MASTER_SETTINGS_KEY, {
await db.settings.update(MASTER_SETTINGS_KEY, {
filterFeedByNearby: this.isNearby,
});
}
@ -154,7 +154,7 @@ export default class FeedFilters extends Vue {
this.settingChanged = true;
}
db.settings.update(MASTER_SETTINGS_KEY, {
await db.settings.update(MASTER_SETTINGS_KEY, {
filterFeedByNearby: false,
filterFeedByVisible: false,
});
@ -168,7 +168,7 @@ export default class FeedFilters extends Vue {
this.settingChanged = true;
}
db.settings.update(MASTER_SETTINGS_KEY, {
await db.settings.update(MASTER_SETTINGS_KEY, {
filterFeedByNearby: true,
filterFeedByVisible: true,
});

4
src/db/index.ts

@ -51,8 +51,8 @@ db.version(2).stores({
db.version(3).stores(TempSchema);
// Event handler to initialize the non-sensitive database with default settings
db.on("populate", () => {
db.settings.add({
db.on("populate", async () => {
await db.settings.add({
id: MASTER_SETTINGS_KEY,
apiServer: DEFAULT_ENDORSER_API_SERVER,
});

4
src/views/ContactQRScanShowView.vue

@ -278,7 +278,7 @@ export default class ContactQRScanShow extends Vue {
text: "Do you want to register them?",
onCancel: async (stopAsking: boolean) => {
if (stopAsking) {
db.settings.update(MASTER_SETTINGS_KEY, {
await db.settings.update(MASTER_SETTINGS_KEY, {
hideRegisterPromptOnNewContact: stopAsking,
});
this.hideRegisterPromptOnNewContact = stopAsking;
@ -286,7 +286,7 @@ export default class ContactQRScanShow extends Vue {
},
onNo: async (stopAsking: boolean) => {
if (stopAsking) {
db.settings.update(MASTER_SETTINGS_KEY, {
await db.settings.update(MASTER_SETTINGS_KEY, {
hideRegisterPromptOnNewContact: stopAsking,
});
this.hideRegisterPromptOnNewContact = stopAsking;

6
src/views/ContactsView.vue

@ -691,7 +691,7 @@ export default class ContactsView extends Vue {
text: "Do you want to register them?",
onCancel: async (stopAsking: boolean) => {
if (stopAsking) {
db.settings.update(MASTER_SETTINGS_KEY, {
await db.settings.update(MASTER_SETTINGS_KEY, {
hideRegisterPromptOnNewContact: stopAsking,
});
this.hideRegisterPromptOnNewContact = stopAsking;
@ -699,7 +699,7 @@ export default class ContactsView extends Vue {
},
onNo: async (stopAsking: boolean) => {
if (stopAsking) {
db.settings.update(MASTER_SETTINGS_KEY, {
await db.settings.update(MASTER_SETTINGS_KEY, {
hideRegisterPromptOnNewContact: stopAsking,
});
this.hideRegisterPromptOnNewContact = stopAsking;
@ -1109,7 +1109,7 @@ export default class ContactsView extends Vue {
const newShowValue = !this.showGiveNumbers;
try {
await db.open();
db.settings.update(MASTER_SETTINGS_KEY, {
await db.settings.update(MASTER_SETTINGS_KEY, {
showContactGivesInline: newShowValue,
});
} catch (err) {

6
src/views/HomeView.vue

@ -89,7 +89,7 @@
:to="{ name: 'contact-qr' }"
class="block text-center 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 Default Identifier Info
Show Them {{ PASSKEYS_ENABLED ? "Default" : "Your" }} Identifier Info
</router-link>
<div v-if="PASSKEYS_ENABLED" class="flex justify-end w-full">
<router-link
@ -435,7 +435,7 @@ export default class HomeView extends Vue {
if (resp.status === 200) {
// we just needed to know that they're registered
await db.open();
db.settings.update(MASTER_SETTINGS_KEY, {
await db.settings.update(MASTER_SETTINGS_KEY, {
isRegistered: true,
});
this.isRegistered = true;
@ -597,7 +597,7 @@ export default class HomeView extends Vue {
this.feedLastViewedClaimId < results.data[0].jwtId
) {
await db.open();
db.settings.update(MASTER_SETTINGS_KEY, {
await db.settings.update(MASTER_SETTINGS_KEY, {
lastViewedClaimId: results.data[0].jwtId,
});
}

2
src/views/ImportAccountView.vue

@ -143,7 +143,7 @@ export default class ImportAccountView extends Vue {
// record that as the active DID
await db.open();
db.settings.update(MASTER_SETTINGS_KEY, {
await db.settings.update(MASTER_SETTINGS_KEY, {
activeDid: newId.did,
});
this.$router.push({ name: "account" });

2
src/views/ImportDerivedAccountView.vue

@ -144,7 +144,7 @@ export default class ImportAccountView extends Vue {
// record that as the active DID
await db.open();
db.settings.update(MASTER_SETTINGS_KEY, {
await db.settings.update(MASTER_SETTINGS_KEY, {
activeDid: newId.did,
});
this.$router.push({ name: "account" });

4
src/views/NewEditAccountView.vue

@ -63,8 +63,8 @@ export default class NewEditAccountView extends Vue {
(settings?.lastName ? ` ${settings.lastName}` : ""); // deprecated, pre v 0.1.3
}
onClickSaveChanges() {
db.settings.update(MASTER_SETTINGS_KEY, {
async onClickSaveChanges() {
await db.settings.update(MASTER_SETTINGS_KEY, {
firstName: this.givenName,
lastName: "", // deprecated, pre v 0.1.3
});

4
src/views/SearchAreaView.vue

@ -198,7 +198,7 @@ export default class DiscoverView extends Vue {
},
};
await db.open();
db.settings.update(MASTER_SETTINGS_KEY, {
await db.settings.update(MASTER_SETTINGS_KEY, {
searchBoxes: [newSearchBox],
});
this.searchBox = newSearchBox;
@ -245,7 +245,7 @@ export default class DiscoverView extends Vue {
public async forgetSearchBox() {
try {
await db.open();
db.settings.update(MASTER_SETTINGS_KEY, {
await db.settings.update(MASTER_SETTINGS_KEY, {
searchBoxes: [],
filterFeedByNearby: false,
});

2
src/views/SharedPhotoView.vue

@ -127,7 +127,7 @@ export default class SharedPhotoView extends Vue {
recordProfile() {
(this.$refs.photoDialog as PhotoDialog).open(
async (imgUrl) => {
db.settings.update(MASTER_SETTINGS_KEY, {
await db.settings.update(MASTER_SETTINGS_KEY, {
profileImageUrl: imgUrl,
});
this.$router.push({ name: "account" });

Loading…
Cancel
Save