From 46b3c201f8a9ca0e19af861c7bfcb125f2f1d738 Mon Sep 17 00:00:00 2001
From: Kevin Lee <kevin@infinite-lee.com>
Date: Thu, 10 May 2018 18:26:50 -0700
Subject: [PATCH] explicitly prevent iPhones from using cardboard for now

---
 src/utils/vr-caps-detect.js | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/utils/vr-caps-detect.js b/src/utils/vr-caps-detect.js
index 1a296ebe8..eaacf1fa8 100644
--- a/src/utils/vr-caps-detect.js
+++ b/src/utils/vr-caps-detect.js
@@ -43,6 +43,7 @@ export async function getAvailableVREntryTypes() {
   const isSamsungBrowser = browser.name === "chrome" && navigator.userAgent.match(/SamsungBrowser/);
   const isOculusBrowser = navigator.userAgent.match(/Oculus/);
   const isDaydreamCapableBrowser = !!(isWebVRCapableBrowser && browser.name === "chrome" && !isSamsungBrowser);
+  const isIPhone = navigator.userAgent.match(/iPhone/);
 
   let generic = VR_DEVICE_AVAILABILITY.no;
   let cardboard = VR_DEVICE_AVAILABILITY.no;
@@ -70,9 +71,10 @@ export async function getAvailableVREntryTypes() {
       ? VR_DEVICE_AVAILABILITY.yes
       : VR_DEVICE_AVAILABILITY.no;
 
-    cardboard = displays.find(d => d.capabilities.canPresent && d.displayName.match(/\W*cardboard\W*/i))
-      ? VR_DEVICE_AVAILABILITY.yes
-      : VR_DEVICE_AVAILABILITY.no;
+    cardboard =
+      displays.find(d => d.capabilities.canPresent && d.displayName.match(/\W*cardboard\W*/i)) && !isIPhone
+        ? VR_DEVICE_AVAILABILITY.yes
+        : VR_DEVICE_AVAILABILITY.no;
 
     // For daydream detection, in a WebVR browser we can increase confidence in daydream compatibility.
     const hasDaydreamWebVRDevice = displays.find(d => d.displayName.match(/\W*daydream\W*/i));
-- 
GitLab