mirror of
https://github.com/nasa/openmct.git
synced 2025-02-21 09:52:04 +00:00
recognize difference between android tablet and phones (#2048)
This commit is contained in:
parent
08bed6c23a
commit
0520b03b97
@ -60,9 +60,33 @@ define(
|
|||||||
* @returns {boolean} true on a phone
|
* @returns {boolean} true on a phone
|
||||||
*/
|
*/
|
||||||
AgentService.prototype.isPhone = function () {
|
AgentService.prototype.isPhone = function () {
|
||||||
// iOS is test-to device for mobile, so only
|
if (this.isMobile()) {
|
||||||
// make this distinction for iPhones
|
if (this.isAndroidTablet()) {
|
||||||
return this.mobileName === 'iPhone';
|
return false;
|
||||||
|
} else if (this.mobileName === 'iPad') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the user is on a tablet sized android device
|
||||||
|
* @returns {boolean} true on an android tablet
|
||||||
|
*/
|
||||||
|
AgentService.prototype.isAndroidTablet = function () {
|
||||||
|
if (this.mobileName === 'Android') {
|
||||||
|
if (this.isPortrait() && window.innerWidth >= 768) {
|
||||||
|
return true;
|
||||||
|
} else if (this.isLandscape() && window.innerHeight >= 768) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,7 +94,7 @@ define(
|
|||||||
* @returns {boolean} true on a tablet
|
* @returns {boolean} true on a tablet
|
||||||
*/
|
*/
|
||||||
AgentService.prototype.isTablet = function () {
|
AgentService.prototype.isTablet = function () {
|
||||||
return this.isMobile() && !this.isPhone();
|
return (this.isMobile() && !this.isPhone() && this.mobileName !== 'Android') || (this.isMobile() && this.isAndroidTablet());
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user