Skip to content

Commit

Permalink
chore: test react-device-detect package
Browse files Browse the repository at this point in the history
  • Loading branch information
hasan-deriv committed Apr 15, 2024
1 parent d1b9940 commit 397a006
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"moment": "^2.29.2",
"object.fromentries": "^2.0.0",
"react": "^17.0.2",
"react-loadable": "^5.5.0"
"react-loadable": "^5.5.0",
"react-device-detect": "2.2.3"
}
}
4 changes: 4 additions & 0 deletions packages/shared/src/utils/os/os_detect.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { mobileVendor } from 'react-device-detect';

declare global {
interface Window {
opera?: string;
Expand Down Expand Up @@ -80,6 +82,8 @@ export const OSDetect = () => {
};

export const mobileOSDetect = () => {
// eslint-disable-next-line no-console
console.log('==>', mobileVendor);
const userAgent = navigator.userAgent || navigator.vendor || window.opera || '';
// huawei devices regex from: https://gist.github.com/megaacheyounes/e1c7eec5c790e577db602381b8c50bfa
const huaweiDevicesRegex =
Expand Down

0 comments on commit 397a006

Please sign in to comment.