forked from jsnbuchanan/crowd-funder-for-time-pwa
Merge branch 'master' into ask-for-contacts-export
This commit is contained in:
@@ -107,7 +107,11 @@
|
||||
@copy-selected="copySelectedContacts"
|
||||
/>
|
||||
|
||||
<GiftedDialog ref="customGivenDialog" />
|
||||
<GiftedDialog
|
||||
ref="customGivenDialog"
|
||||
:giver-entity-type="'person'"
|
||||
:recipient-entity-type="'person'"
|
||||
/>
|
||||
<OfferDialog ref="customOfferDialog" />
|
||||
<ContactNameDialog ref="contactNameDialog" />
|
||||
|
||||
@@ -169,6 +173,7 @@ import { logger } from "../utils/logger";
|
||||
// No longer needed - using PlatformServiceMixin methods
|
||||
// import { PlatformServiceFactory } from "@/services/PlatformServiceFactory";
|
||||
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
||||
import { isDatabaseError } from "@/interfaces/common";
|
||||
import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify";
|
||||
import { APP_SERVER } from "@/constants/app";
|
||||
import { QRNavigationService } from "@/services/QRNavigationService";
|
||||
@@ -377,7 +382,11 @@ export default class ContactsView extends Vue {
|
||||
"",
|
||||
async (name) => {
|
||||
await this.addContact({
|
||||
did: (registration.vc.credentialSubject.agent as any).identifier,
|
||||
did: (
|
||||
registration.vc.credentialSubject.agent as {
|
||||
identifier: string;
|
||||
}
|
||||
).identifier,
|
||||
name: name,
|
||||
registered: true,
|
||||
});
|
||||
@@ -388,7 +397,11 @@ export default class ContactsView extends Vue {
|
||||
async () => {
|
||||
// on cancel, will still add the contact
|
||||
await this.addContact({
|
||||
did: (registration.vc.credentialSubject.agent as any).identifier,
|
||||
did: (
|
||||
registration.vc.credentialSubject.agent as {
|
||||
identifier: string;
|
||||
}
|
||||
).identifier,
|
||||
name: "(person who invited you)",
|
||||
registered: true,
|
||||
});
|
||||
@@ -397,8 +410,7 @@ export default class ContactsView extends Vue {
|
||||
this.showOnboardingInfo();
|
||||
},
|
||||
);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (error: any) {
|
||||
} catch (error: unknown) {
|
||||
const fullError = "Error redeeming invite: " + errorStringForLog(error);
|
||||
this.$logAndConsole(fullError, true);
|
||||
let message = "Got an error sending the invite.";
|
||||
@@ -885,20 +897,21 @@ export default class ContactsView extends Vue {
|
||||
/**
|
||||
* Handle errors during contact addition
|
||||
*/
|
||||
private handleContactAddError(err: any): void {
|
||||
private handleContactAddError(err: unknown): void {
|
||||
const fullError =
|
||||
"Error when adding contact to storage: " + errorStringForLog(err);
|
||||
this.$logAndConsole(fullError, true);
|
||||
|
||||
let message = NOTIFY_CONTACT_IMPORT_ERROR.message;
|
||||
if (
|
||||
(err as any).message?.indexOf("Key already exists in the object store.") >
|
||||
-1
|
||||
) {
|
||||
message = NOTIFY_CONTACT_IMPORT_CONFLICT.message;
|
||||
}
|
||||
if ((err as any).name === "ConstraintError") {
|
||||
message += " " + NOTIFY_CONTACT_IMPORT_CONSTRAINT.message;
|
||||
|
||||
// Use type-safe error checking with our new type guards
|
||||
if (isDatabaseError(err)) {
|
||||
if (err.message.includes("Key already exists in the object store")) {
|
||||
message = NOTIFY_CONTACT_IMPORT_CONFLICT.message;
|
||||
}
|
||||
if (err.name === "ConstraintError") {
|
||||
message += " " + NOTIFY_CONTACT_IMPORT_CONSTRAINT.message;
|
||||
}
|
||||
}
|
||||
|
||||
this.notify.error(message, TIMEOUTS.LONG);
|
||||
@@ -1057,7 +1070,6 @@ export default class ContactsView extends Vue {
|
||||
}
|
||||
|
||||
let callback: (amount: number) => void;
|
||||
let customTitle = "";
|
||||
// choose whether to open dialog to user or from user
|
||||
if (giverDid == this.activeDid) {
|
||||
callback = (amount: number) => {
|
||||
@@ -1065,7 +1077,6 @@ export default class ContactsView extends Vue {
|
||||
newList[recipientDid] = (newList[recipientDid] || 0) + amount;
|
||||
this.givenByMeUnconfirmed = newList;
|
||||
};
|
||||
customTitle = "Given to " + (receiver?.name || "Someone Unnamed");
|
||||
} else {
|
||||
// must be (recipientDid == this.activeDid)
|
||||
callback = (amount: number) => {
|
||||
@@ -1073,13 +1084,14 @@ export default class ContactsView extends Vue {
|
||||
newList[giverDid] = (newList[giverDid] || 0) + amount;
|
||||
this.givenToMeUnconfirmed = newList;
|
||||
};
|
||||
customTitle = "Received from " + (giver?.name || "Someone Unnamed");
|
||||
}
|
||||
(this.$refs.customGivenDialog as GiftedDialog).open(
|
||||
giver,
|
||||
receiver,
|
||||
undefined as unknown as string,
|
||||
customTitle,
|
||||
undefined as unknown as string,
|
||||
undefined as unknown as string,
|
||||
undefined as unknown as string,
|
||||
undefined as unknown as string,
|
||||
callback,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user