Skip to content

Commit

Permalink
chore: add detection for Mac device (#7530)
Browse files Browse the repository at this point in the history
Co-authored-by: ilhan007 <[email protected]>
  • Loading branch information
Okiana and ilhan007 authored Sep 1, 2023
1 parent 4eefd89 commit 8da719c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/base/src/Device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ const internals = {
}
return navigator.platform.indexOf("Win") !== -1;
},
get macOS() {
if (isSSR) {
return false;
}
return !!navigator.userAgent.match(/Macintosh|Mac OS X/i);
},
get iOS() {
if (isSSR) {
return false;
Expand Down Expand Up @@ -184,6 +190,10 @@ const isIOS = (): boolean => {
return internals.iOS;
};

const isMac = (): boolean => {
return internals.macOS;
};

const isAndroid = (): boolean => {
return internals.android || internals.androidPhone;
};
Expand All @@ -200,4 +210,5 @@ export {
isCombi,
isIOS,
isAndroid,
isMac,
};

0 comments on commit 8da719c

Please sign in to comment.