Update getDevice (#569)

Co-authored-by: Bob <115008575+bobpetrov@users.noreply.github.com>
This commit is contained in:
Bob
2024-01-19 13:01:32 -03:00
committed by GitHub
parent 18990f874f
commit 985fd3b94d

View File

@@ -738,7 +738,7 @@ export const extractMessageContent = (content: WAMessageContent | undefined | nu
/**
* Returns the device predicted by message ID
*/
export const getDevice = (id: string) => /^3A/.test(id) ? 'ios' : /^3E/.test(id) ? 'web' : /^.{21}/.test(id) ? 'android' : /^.{18}/.test(id) ? 'desktop' : 'unknown'
export const getDevice = (id: string) => /^3A.{18}$/.test(id) ? 'ios' : /^3E.{20}$/.test(id) ? 'web' : /^(.{21}|.{32})$/.test(id) ? 'android' : /^.{18}$/.test(id) ? 'desktop' : 'unknown'
/** Upserts a receipt in the message */
export const updateMessageWithReceipt = (msg: Pick<WAMessage, 'userReceipt'>, receipt: MessageUserReceipt) => {