diff options
author | Andrew Henry <andrew.k.henry@nasa.gov> | 2018-05-26 08:18:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-26 08:18:18 +0300 |
commit | 0520b03b974caf3626427973e5d75beb1fc34063 (patch) | |
tree | b599117724fdf7a62c90bd6c082b000fefa32e17 | |
parent | 08bed6c23a2e9da3ca3c12125b05f3a08061b1b6 (diff) |
recognize difference between android tablet and phones (#2048)notification-service-1709
-rw-r--r-- | platform/commonUI/mobile/src/AgentService.js | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/platform/commonUI/mobile/src/AgentService.js b/platform/commonUI/mobile/src/AgentService.js index 123a1bf6a..f0da7a8c8 100644 --- a/platform/commonUI/mobile/src/AgentService.js +++ b/platform/commonUI/mobile/src/AgentService.js @@ -60,9 +60,33 @@ define( * @returns {boolean} true on a phone */ AgentService.prototype.isPhone = function () { - // iOS is test-to device for mobile, so only - // make this distinction for iPhones - return this.mobileName === 'iPhone'; + if (this.isMobile()) { + if (this.isAndroidTablet()) { + 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 */ AgentService.prototype.isTablet = function () { - return this.isMobile() && !this.isPhone(); + return (this.isMobile() && !this.isPhone() && this.mobileName !== 'Android') || (this.isMobile() && this.isAndroidTablet()); }; /** |