@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Improve reliability of detecting small devices when loading Differential changesets

Summary: Ref T10229. Fixes T9969. We make a decision about 1up vs 2up pretty early, and sometimes the viewport size reads as larger than the device, so we incorrectly select 2up when the proper setting would be 1up.

Test Plan:
I can reproduce this by, e.g., reloading a lot on an iPhone 4s in iOS Simulator running iOS 9.2. Sometimes it picks 2-up. I added logging to show that the viewport dimension read was the issue.

After this change, it always selects 1-up (`window.screen.availWidth` is defined and sensible on the device).

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9969, T10229

Differential Revision: https://secure.phabricator.com/D15135

+13
+13
webroot/rsrc/js/core/behavior-device.js
··· 26 26 var v = JX.Vector.getViewport(); 27 27 var self = JX.Device; 28 28 29 + // Even when we emit a '<meta name="viewport" ... />' tag which tells 30 + // devices to fit the conent to the screen width, we'll sometimes measure 31 + // a viewport dimension which is larger than the available screen width, 32 + // particularly if we check too early. 33 + 34 + // If the device provides a screen width and the screen width is smaller 35 + // than the viewport width, use the screen width. 36 + 37 + var screen_width = (window.screen && window.screen.availWidth); 38 + if (screen_width) { 39 + v.x = Math.min(v.x, screen_width); 40 + } 41 + 29 42 var device = 'desktop'; 30 43 if (v.x <= self._tabletBreakpoint) { 31 44 device = 'tablet';