Skip to content

Commit 61df1db

Browse files
committed
refactor(zalouser): use native typing API
1 parent 992b4cf commit 61df1db

1 file changed

Lines changed: 1 addition & 12 deletions

File tree

‎extensions/zalouser/src/zalo-js.ts‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,6 @@ const groupContextCache = new Map<string, { value: ZaloGroupContext; expiresAt:
9898

9999
type AccountInfoResponse = Awaited<ReturnType<API["fetchAccountInfo"]>>;
100100

101-
type ApiTypingCapability = {
102-
sendTypingEvent: (
103-
threadId: string,
104-
type?: (typeof ThreadType)[keyof typeof ThreadType],
105-
) => Promise<unknown>;
106-
};
107-
108101
type StoredZaloCredentials = {
109102
imei: string;
110103
cookie: Credentials["cookie"];
@@ -1388,11 +1381,7 @@ export async function sendZaloTypingEvent(
13881381
}
13891382
await withZaloApi(profile, async (api) => {
13901383
const type = options.isGroup ? ThreadType.Group : ThreadType.User;
1391-
if ("sendTypingEvent" in api && typeof api.sendTypingEvent === "function") {
1392-
await (api as API & ApiTypingCapability).sendTypingEvent(trimmedThreadId, type);
1393-
return;
1394-
}
1395-
throw new Error("Zalo typing indicator is not supported by current API session");
1384+
await api.sendTypingEvent(trimmedThreadId, type);
13961385
});
13971386
}
13981387

0 commit comments

Comments
 (0)