[ALOY-117] Identify is a device is "handheld" or "tablet" on all supported platforms
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Low |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2012-09-12T17:10:35.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2012 Sprint 19, Release 3.0.0 |
Components | Runtime |
Labels | n/a |
Reporter | Tony Lukasavage |
Assignee | Unknown |
Created | 2012-07-19T15:38:19.000+0000 |
Updated | 2018-03-07T22:26:03.000+0000 |
Description
Here's a general idea of how it will be performed on each platform. The code below is not what will be used. It has been expanded for clarity and will be more concise and performant in practice, and obviously platform-safe.
iOS (done)
var isIosTablet = Ti.Platform.osname === 'ipad';
Android (done)
var isAndroidTablet = Ti.Platform.osname === 'android' &&
(Ti.Platform.displayCaps.physicalSizeCategory === 'large' ||
Ti.Platform.displayCaps.physicalSizeCategory === 'xlarge');
This code relies on the linked issue. I put a PR in place to expose this Android API. Until this API is processed, I will put together an Android module that we can use in Alloy in the meantime.
*UPDATE:* Android module found here: https://github.com/tonylukasavage/physicalSizeCategory
Mobileweb (not done)
// we may have to resort to just using the Ti.Platform.displayCaps.platformHeight(Width)
// until an API can be exposed from Mobileweb to allow better size detection.
var isMobilewebTablet = !(Math.max(
Ti.Platform.displayCaps.platformHeight,
Ti.Platform.displayCaps.platformWidth
) < 700);
Setting a due date. We need to keep following up to make sure Mobile Web implements the feature.
I have been following up. Follow the progress in the linked TIMOB ticket: TIMOB-10492
Bryan has given some advice in the linked ticket. I will implement it and close the ticket.