提交 aa38bb99 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

allow Contact.remark(null) to delete remark

上级 a4cbcbc9
......@@ -21,7 +21,7 @@ type ContactObj = {
id: string
name: string
province: string
remark: string
remark: string|null
sex: string
signature: string
star: boolean
......@@ -222,8 +222,12 @@ export class Contact implements Sayable {
* set the remark for contact
*/
public remark(newRemark: string): Promise<boolean>
/**
* delete the remark for a contact
*/
public remark(empty: null): Promise<boolean>
public remark(newRemark?: string): Promise<boolean> | string {
public remark(newRemark?: string|null): Promise<boolean> | string {
log.silly('Contact', 'remark(%s)', newRemark || '')
if (newRemark === undefined) {
......
......@@ -134,7 +134,7 @@ export class Bridge {
}
}
public async contactRemark(contactId: string, remark: string): Promise<boolean> {
public async contactRemark(contactId: string, remark: string|null): Promise<boolean> {
try {
return await this.proxyWechaty('contactRemarkAsync', contactId, remark)
} catch (e) {
......
......@@ -368,7 +368,7 @@ export class PuppetWeb extends Puppet {
}
}
public async contactRemark(contact: Contact, remark: string): Promise<boolean> {
public async contactRemark(contact: Contact, remark: string|null): Promise<boolean> {
try {
const ret = await this.bridge.contactRemark(contact.id, remark)
if (!ret) {
......
......@@ -67,5 +67,5 @@ export abstract class Puppet extends EventEmitter implements Sayable {
* Contact
*/
public abstract contactFind(filterFunc: string): Promise<Contact[]>
public abstract contactRemark(contact: Contact, remark: string): Promise<boolean>
public abstract contactRemark(contact: Contact, remark: string|null): Promise<boolean>
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册