|
@ -654,17 +654,25 @@ function compareAccounts(dexieAccounts: Account[], sqliteDids: string[]) { |
|
|
* ``` |
|
|
* ``` |
|
|
*/ |
|
|
*/ |
|
|
function contactsEqual(contact1: Contact, contact2: Contact): boolean { |
|
|
function contactsEqual(contact1: Contact, contact2: Contact): boolean { |
|
|
|
|
|
const ifEmpty = (arg: any, def: any) => !!arg ? arg : def; |
|
|
|
|
|
const contact1Methods = |
|
|
|
|
|
contact1.contactMethods && Array.isArray(contact1.contactMethods) && contact1.contactMethods.length > 0 |
|
|
|
|
|
? JSON.stringify(contact1.contactMethods) |
|
|
|
|
|
: "[]"; |
|
|
|
|
|
const contact2Methods = |
|
|
|
|
|
contact2.contactMethods && Array.isArray(contact2.contactMethods) && contact2.contactMethods.length > 0 |
|
|
|
|
|
? JSON.stringify(contact2.contactMethods) |
|
|
|
|
|
: "[]"; |
|
|
return ( |
|
|
return ( |
|
|
contact1.did == contact2.did && |
|
|
ifEmpty(contact1.did, "") == ifEmpty(contact2.did, "") && |
|
|
contact1.name == contact2.name && |
|
|
ifEmpty(contact1.name, "") == ifEmpty(contact2.name, "") && |
|
|
contact1.notes == contact2.notes && |
|
|
ifEmpty(contact1.notes, "") == ifEmpty(contact2.notes, "") && |
|
|
contact1.profileImageUrl == contact2.profileImageUrl && |
|
|
ifEmpty(contact1.profileImageUrl, "") == ifEmpty(contact2.profileImageUrl, "") && |
|
|
contact1.publicKeyBase64 == contact2.publicKeyBase64 && |
|
|
ifEmpty(contact1.publicKeyBase64, "") == ifEmpty(contact2.publicKeyBase64, "") && |
|
|
contact1.nextPubKeyHashB64 == contact2.nextPubKeyHashB64 && |
|
|
ifEmpty(contact1.nextPubKeyHashB64, "") == ifEmpty(contact2.nextPubKeyHashB64, "") && |
|
|
contact1.seesMe == contact2.seesMe && |
|
|
!!contact1.seesMe == !!contact2.seesMe && |
|
|
contact1.registered == contact2.registered && |
|
|
!!contact1.registered == !!contact2.registered && |
|
|
JSON.stringify(contact1.contactMethods) == |
|
|
contact1Methods == contact2Methods |
|
|
JSON.stringify(contact2.contactMethods) |
|
|
|
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|