Przeglądaj źródła

[FIXED] now it should detects all macintosh

EricGit 1 rok temu
rodzic
commit
f1ca03e378
1 zmienionych plików z 5 dodań i 5 usunięć
  1. 5 5
      app/utils.ts

+ 5 - 5
app/utils.ts

@@ -175,13 +175,13 @@ export function getCSSVar(varName: string) {
 }
 
 /**
- * Detects if the Operation system is MacOS
+ * Detects Macintosh
  */
 export function isMacOS(): boolean {
   if (typeof window !== "undefined") {
-    let userAgent = window?.navigator?.userAgent;
-    if (userAgent.indexOf("Mac") != -1) return true;
+    let userAgent = window.navigator.userAgent.toLocaleLowerCase();
+    const macintosh = /iphone|ipad|ipod|macintosh/.test(userAgent)
+    return !!macintosh
   }
-
-  return false;
+  return false
 }