Skip to content

Commit 0e520a5

Browse files
authored
Merge pull request #470 from kdvalin/flying-control-fixes
Flying Control Fixes
2 parents cad7960 + 6ba4a4b commit 0e520a5

1 file changed

Lines changed: 6 additions & 19 deletions

File tree

src/utils/browserType.js

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,12 @@
1-
import { UAParser } from "ua-parser-js";
2-
3-
const MOBILE_TYPES = [
4-
"mobile",
5-
"tablet",
6-
"wearable"
7-
];
1+
import AFRAME from "aframe";
82

93
export const browserType = () => {
10-
let parser = new UAParser();
11-
const device = parser.getDevice();
4+
const device = AFRAME.utils.device;
125

13-
if("xr" in navigator) {
14-
return "vr";
15-
}
16-
else if("getVRDisplays" in navigator && navigator.getVRDisplays().length > 0) {
17-
return "vr";
18-
}
19-
else if(MOBILE_TYPES.indexOf(device.type) === -1) {
20-
return "desktop";
21-
}
22-
else {
6+
if(device.isMobile()) {
237
return "mobile";
8+
}else if(device.getVRDisplay() && device.getVRDisplay().length >= 0) {
9+
return "vr";
2410
}
11+
return "desktop";
2512
};

0 commit comments

Comments
 (0)