Merge pull request #451 from andresayac/master

proposal: detect desktop and fix device identification using message
This commit is contained in:
Rajeh Taher
2024-01-01 01:27:34 +02:00
committed by GitHub

View File

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