Open johnd0e opened 5 years ago
As for 7941ed7e2b21fec28ec083e7bf8999c74e43e492, I think that better fix L.Browser.touch
itself (#189).
Ok, let me summarize:
L.Browser.touch
means that client is touch-aware. But it does not necessary mean that it has touchscreen/touchpad (but it may be attached in runtime). In most cases we actually do not need to know that, more info.isTouchDevice
should be deprecated in favor of L.Browser.touch
(#463)
Alternatively, we could use something like this:
function isTouchDevice() {
return 'maxTouchPoints' in navigator && navigator.maxTouchPoints > 0;
}
L.Browser.mobile
is now used in these cases
typeof android !== 'undefined'
.isSmartphone
should be used to detect if we are in 'mobile' intel view, or userAgent contains android/iphone substrings.
The point of this detection: choose between desktop and mobile iitc view (with left/right side panes, etc.)
TODO: I've not checked yet if it is used consistently.
We need this function because:
isSmarphone
usage is also far from great
Currently we use a bunch of different methods in order to detect similar things:
L.
Browser
.mobile
(used inportal-level-numbers.user.js
and in several parts of the core). There is alsoL.Browser.touch
(seen inleaflet.draw-src.js
until 7941ed7e2b21fec28ec083e7bf8999c74e43e492)isTouchDevice
(used inplayer-tracker.user.js
only) https://github.com/IITC-CE/ingress-intel-total-conversion/blob/d77562b91a5b1e0bf170b4257eb33316a0b9daa3/code/utils_misc.js#L220-L223isSmartphone
(used most) https://github.com/IITC-CE/ingress-intel-total-conversion/blob/d77562b91a5b1e0bf170b4257eb33316a0b9daa3/code/smartphone.js#L1-L16We should define clearly when we need each of the mentioned functions.