-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update tablet detection #4724
Update tablet detection #4724
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on the issue.
But unfortunately Hubs crashes with Uncaught ReferenceError: AFRAME is not defined
error.
I confirmed it on the dev branch and hubs.local:8080
with npm run dev
.
Curious to know if we really need to override A-Frame isMobile()
. Is it called in A-Frame internal code we use?
It seems that is-mobile is also being used in the homepage. I've fixed it. All the methods exposed in We use Would also make sense to override the AFRAME implementation for other methods that we have updated in |
I think it would be good if we can replace A-Frame function in our code with our code like from If internal A-Frame code we still use calls We don't really want to apply any changes in Three.js code for maintenance we we override some Three.js methods in our code. But we rarely (or will never) upgrade A-Frame so I don't think updating our A-Frame code is a big deal. |
@takahirox not sure if I follow but I'm going to land this and we can refactor if we feel that's what we want. |
I suggested either one
from if (AFRAME.utils.device.isMobile()) {
...
} to import isMobile from './src/utils/is-mobile.js';
if (isMobile()) {
...
}
Because I'm not sure if overriding A-Frame function is a good design. |
This won't update the internal AFRAME calls so we would end up with two different implementations of isMobile (and the rest of the AFRAME utild functions that we duplicate) https://github.com/search?q=repo%3Aaframevr%2Faframe+extension%3Ajs+path%3A%2Fsrc+isMobile&type=Code
I would say that to make sure that the AFRAME utils methods implementations are consistent between AFRAME and Hubs we should go for your you second suggestion and update our AFRAME fork and always use those utility methods instead of duplicating and pointing to our implementation. |
Fixes #3261
Our internal and AFrame's tablet detection seems to be outdated. I've updated it and now we are detecting tablet mobile browsers.
@takahirox I don't have iOS devices so I've only tried in Android tablets.