From 776ff709c3588b6705795062bcc4933fe02360e3 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 17 May 2024 10:18:20 +0200 Subject: [PATCH] fix: make platform detection more robust and future proof (#435) --- src/lib/utils/navigatorUtils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/utils/navigatorUtils.ts b/src/lib/utils/navigatorUtils.ts index 32f3c844..d5a69c6b 100644 --- a/src/lib/utils/navigatorUtils.ts +++ b/src/lib/utils/navigatorUtils.ts @@ -1,2 +1,4 @@ export const IS_MAC = - typeof navigator !== 'undefined' ? navigator.platform.toUpperCase().indexOf('MAC') >= 0 : false + navigator?.platform?.toUpperCase().includes('MAC') ?? + navigator?.userAgentData?.platform?.toUpperCase().includes('MAC') ?? + false