forked from jsnbuchanan/crowd-funder-for-time-pwa
Complete Enhanced Triple Migration Pattern for contact components
- Migrate ContactBulkActions, ContactInputForm, ContactListHeader, ContactListItem, LargeIdenticonModal, and ContactsView to PlatformServiceMixin - Add comprehensive deep linking support to CapacitorPlatformService and WebPlatformService - Enhance PlatformService with new database operations and deep link handling - Update service worker and documentation for migration progress - Fix TypeScript type errors in util.ts and deepLinks.ts - Streamline circular dependency analysis and migration tracking docs
This commit is contained in:
@@ -23,11 +23,13 @@
|
||||
|
||||
<!-- New Contact -->
|
||||
<ContactInputForm
|
||||
:is-registered="isRegistered"
|
||||
v-model="contactInput"
|
||||
:is-registered="isRegistered"
|
||||
@submit="onClickNewContact"
|
||||
@show-onboard-meeting="showOnboardMeetingDialog"
|
||||
@registration-required="notify.warning('You must get registered before you can create invites.')"
|
||||
@registration-required="
|
||||
notify.warning('You must get registered before you can create invites.')
|
||||
"
|
||||
@navigate-onboard-meeting="$router.push({ name: 'onboard-meeting-list' })"
|
||||
@qr-scan="handleQRCodeClick"
|
||||
/>
|
||||
@@ -403,8 +405,6 @@ export default class ContactsView extends Vue {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Legacy danger() and warning() methods removed - now using this.notify.error() and this.notify.warning()
|
||||
|
||||
private showOnboardingInfo() {
|
||||
@@ -435,12 +435,12 @@ export default class ContactsView extends Vue {
|
||||
|
||||
get copyButtonClass() {
|
||||
return this.contactsSelected.length > 0
|
||||
? 'text-md bg-gradient-to-b from-blue-400 to-blue-700 ' +
|
||||
'shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white ' +
|
||||
'ml-3 px-3 py-1.5 rounded-md cursor-pointer'
|
||||
: 'text-md bg-gradient-to-b from-slate-400 to-slate-700 ' +
|
||||
'shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-slate-300 ' +
|
||||
'ml-3 px-3 py-1.5 rounded-md cursor-not-allowed';
|
||||
? "text-md bg-gradient-to-b from-blue-400 to-blue-700 " +
|
||||
"shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white " +
|
||||
"ml-3 px-3 py-1.5 rounded-md cursor-pointer"
|
||||
: "text-md bg-gradient-to-b from-slate-400 to-slate-700 " +
|
||||
"shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-slate-300 " +
|
||||
"ml-3 px-3 py-1.5 rounded-md cursor-not-allowed";
|
||||
}
|
||||
|
||||
get copyButtonDisabled() {
|
||||
@@ -473,14 +473,15 @@ export default class ContactsView extends Vue {
|
||||
|
||||
toggleContactSelection(contactDid: string): void {
|
||||
if (this.contactsSelected.includes(contactDid)) {
|
||||
this.contactsSelected.splice(this.contactsSelected.indexOf(contactDid), 1);
|
||||
this.contactsSelected.splice(
|
||||
this.contactsSelected.indexOf(contactDid),
|
||||
1,
|
||||
);
|
||||
} else {
|
||||
this.contactsSelected.push(contactDid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async loadGives() {
|
||||
if (!this.activeDid) {
|
||||
return;
|
||||
@@ -636,7 +637,8 @@ export default class ContactsView extends Vue {
|
||||
await Promise.all(lineAdded);
|
||||
this.notify.success(NOTIFY_CONTACTS_ADDED_CSV.message);
|
||||
} catch (e) {
|
||||
const fullError = "Error adding contacts from CSV: " + errorStringForLog(e);
|
||||
const fullError =
|
||||
"Error adding contacts from CSV: " + errorStringForLog(e);
|
||||
logConsoleAndDb(fullError, true);
|
||||
this.notify.error(NOTIFY_CONTACTS_ADD_ERROR.message);
|
||||
}
|
||||
@@ -665,7 +667,7 @@ export default class ContactsView extends Vue {
|
||||
private parseDidContactString(contactInput: string): Contact {
|
||||
let did = contactInput;
|
||||
let name, publicKeyInput, nextPublicKeyHashInput;
|
||||
|
||||
|
||||
const commaPos1 = contactInput.indexOf(",");
|
||||
if (commaPos1 > -1) {
|
||||
did = contactInput.substring(0, commaPos1).trim();
|
||||
@@ -676,7 +678,9 @@ export default class ContactsView extends Vue {
|
||||
publicKeyInput = contactInput.substring(commaPos2 + 1).trim();
|
||||
const commaPos3 = contactInput.indexOf(",", commaPos2 + 1);
|
||||
if (commaPos3 > -1) {
|
||||
publicKeyInput = contactInput.substring(commaPos2 + 1, commaPos3).trim();
|
||||
publicKeyInput = contactInput
|
||||
.substring(commaPos2 + 1, commaPos3)
|
||||
.trim();
|
||||
nextPublicKeyHashInput = contactInput.substring(commaPos3 + 1).trim();
|
||||
}
|
||||
}
|
||||
@@ -721,7 +725,8 @@ export default class ContactsView extends Vue {
|
||||
});
|
||||
return true;
|
||||
} catch (e) {
|
||||
const fullError = "Error adding contacts from array: " + errorStringForLog(e);
|
||||
const fullError =
|
||||
"Error adding contacts from array: " + errorStringForLog(e);
|
||||
logConsoleAndDb(fullError, true);
|
||||
this.notify.error(NOTIFY_CONTACT_INPUT_PARSE_ERROR.message);
|
||||
}
|
||||
@@ -816,7 +821,11 @@ export default class ContactsView extends Vue {
|
||||
* Handle registration prompt for new contacts
|
||||
*/
|
||||
private async handleRegistrationPrompt(newContact: Contact): Promise<void> {
|
||||
if (!this.isRegistered || this.hideRegisterPromptOnNewContact || newContact.registered) {
|
||||
if (
|
||||
!this.isRegistered ||
|
||||
this.hideRegisterPromptOnNewContact ||
|
||||
newContact.registered
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -846,7 +855,9 @@ export default class ContactsView extends Vue {
|
||||
/**
|
||||
* Handle user response to registration prompt
|
||||
*/
|
||||
private async handleRegistrationPromptResponse(stopAsking?: boolean): Promise<void> {
|
||||
private async handleRegistrationPromptResponse(
|
||||
stopAsking?: boolean,
|
||||
): Promise<void> {
|
||||
if (stopAsking) {
|
||||
await this.$saveSettings({
|
||||
hideRegisterPromptOnNewContact: stopAsking,
|
||||
@@ -859,17 +870,21 @@ export default class ContactsView extends Vue {
|
||||
* Handle errors during contact addition
|
||||
*/
|
||||
private handleContactAddError(err: any): void {
|
||||
const fullError = "Error when adding contact to storage: " + errorStringForLog(err);
|
||||
const fullError =
|
||||
"Error when adding contact to storage: " + errorStringForLog(err);
|
||||
logConsoleAndDb(fullError, true);
|
||||
|
||||
|
||||
let message = NOTIFY_CONTACT_IMPORT_ERROR.message;
|
||||
if ((err as any).message?.indexOf("Key already exists in the object store.") > -1) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
this.notify.error(message, TIMEOUTS.LONG);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user