-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: upgrade ua-parser-js to track correct device models #3406
base: dev
Are you sure you want to change the base?
Conversation
# Conflicts: # packages/hms-video-store/src/sdk/index.ts # packages/hms-video-store/src/utils/support.ts
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${event.metadata.token}`, | ||
user_agent_v2: event.metadata.userAgent, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this optional?
@@ -15,7 +15,7 @@ export interface HMSSessionFeedback { | |||
|
|||
export interface HMSSessionInfo { | |||
peer: HMSSessionPeerInfo; | |||
agent: string; | |||
agent?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
most likely should not be optional
export const isIOS = parsedUserAgent.getOS()?.name?.toLowerCase() === 'ios'; | ||
export const isMacOS = parsedUserAgent.getOS()?.name?.toLowerCase() === 'mac os'; | ||
export const isMacOS = parsedUserAgent.getOS()?.name?.toLowerCase() === 'macos'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this a typo earlier or the new version made this change?
} | ||
|
||
function getDeviceType(device?: string, type?: string) { | ||
return device && device.length > 0 ? `${device}_${type}` : type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
length check probably not needed
* @returns {Promise<UAParser.IOS>} OS name and version | ||
*/ | ||
async function getOSFromUserAgent(): Promise<UAParser.IOS> { | ||
const os = await parsedUserAgent.getOS().withClientHints(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might fail in older devices/browsers no? should we add a try catch and do feature check there as well?
Description
ua-parser-js
to track correct device modelsSample user agents -
Pre-launch Checklist
Merging: