feat: 导出联系人标签和详细描述

扩展联系人读取与导出链路,新增 labels 和 detailDescription 字段的兼容提取,并同步更新通讯录缓存、详情展示与
  JSON/CSV/VCF 导出。
  Close #402
This commit is contained in:
姜北尘
2026-03-22 14:17:19 +08:00
parent 2e1c0e6c54
commit e12193aa40
5 changed files with 91 additions and 4 deletions

View File

@@ -663,6 +663,8 @@ export interface ContactsListCacheContact {
remark?: string
nickname?: string
alias?: string
labels?: string[]
detailDescription?: string
type: 'friend' | 'group' | 'official' | 'former_friend' | 'other'
}
@@ -1176,6 +1178,10 @@ export async function getContactsListCache(scopeKey: string): Promise<ContactsLi
remark: typeof item.remark === 'string' ? item.remark : undefined,
nickname: typeof item.nickname === 'string' ? item.nickname : undefined,
alias: typeof item.alias === 'string' ? item.alias : undefined,
labels: Array.isArray(item.labels)
? Array.from(new Set(item.labels.map((label) => String(label || '').trim()).filter(Boolean)))
: undefined,
detailDescription: typeof item.detailDescription === 'string' ? item.detailDescription : undefined,
type: (type === 'friend' || type === 'group' || type === 'official' || type === 'former_friend' || type === 'other')
? type
: 'other'
@@ -1210,6 +1216,10 @@ export async function setContactsListCache(scopeKey: string, contacts: ContactsL
remark: contact?.remark ? String(contact.remark) : undefined,
nickname: contact?.nickname ? String(contact.nickname) : undefined,
alias: contact?.alias ? String(contact.alias) : undefined,
labels: Array.isArray(contact?.labels)
? Array.from(new Set(contact.labels.map((label) => String(label || '').trim()).filter(Boolean)))
: undefined,
detailDescription: contact?.detailDescription ? String(contact.detailDescription) : undefined,
type
})
}