diff --git a/projects/ng-event-plugins/src/utils/is-apple.ts b/projects/ng-event-plugins/src/utils/is-apple.ts deleted file mode 100644 index 6f72c9e..0000000 --- a/projects/ng-event-plugins/src/utils/is-apple.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @description: - * All Chrome / Chromium-based browsers will return MacIntel on macOS, - * no matter what the hardware architecture is. See the source code here: - * https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/frame/navigator_id.cc;l=64;drc=703d3c472cf27470dad21a3f2c8972aca3732cd6 - * But maybe in future years, it will be changed to MacM1 - * - * Documentation: - * https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform - */ -export function isApple(navigator: Navigator): boolean { - return navigator.platform.startsWith('Mac') || navigator.platform === 'iPhone'; -} diff --git a/projects/ng-event-plugins/src/utils/is-ios.ts b/projects/ng-event-plugins/src/utils/is-ios.ts index f8d8730..6d5a229 100644 --- a/projects/ng-event-plugins/src/utils/is-ios.ts +++ b/projects/ng-event-plugins/src/utils/is-ios.ts @@ -1,10 +1,3 @@ -import {isApple} from './is-apple'; - -const IOS_REG_EXP = /ipad|iphone|ipod/; - -export function isIos(navigator: Navigator): boolean { - return ( - IOS_REG_EXP.test(navigator.userAgent.toLowerCase()) || - (isApple(navigator) && navigator.maxTouchPoints > 1) - ); -} +export const isIos = ({userAgent, maxTouchPoints}: Navigator): boolean => + /ipad|iphone|ipod|mac/i.test(userAgent) || + (/^((?!chrome|android).)*safari/i.test(userAgent) && maxTouchPoints > 1);