Skip to content

Commit

Permalink
feat(isIOS): detect new iPad (#3582)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
  • Loading branch information
Doctor-wu and antfu committed Dec 4, 2023
1 parent 8cbfd9d commit 47d2d2e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/shared/utils/is.ts
Expand Up @@ -24,5 +24,10 @@ export const hasOwn = <T extends object, K extends keyof T>(val: T, key: K): key
export const isIOS = /* #__PURE__ */ getIsIOS()

function getIsIOS() {
return isClient && /* #__PURE__ */ window?.navigator?.userAgent && /* #__PURE__ */ /iP(ad|hone|od)/.test(/* #__PURE__ */ window.navigator.userAgent)
return isClient && window?.navigator?.userAgent && (
(/iP(ad|hone|od)/.test(window.navigator.userAgent))
// The new iPad Pro Gen3 does not identify itself as iPad, but as Macintosh.
// https://github.com/vueuse/vueuse/issues/3577
|| (window?.navigator?.maxTouchPoints > 2 && /iPad|Macintosh/.test(window?.navigator.userAgent))
)
}

0 comments on commit 47d2d2e

Please sign in to comment.