From: Henri Sara Date: Thu, 4 Jul 2013 07:53:44 +0000 (+0300) Subject: Enable native scrolling in home screen apps on iOS 6+ (#12149) X-Git-Tag: 7.1.1~16 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d7a64fd5b514f18a65bbc6f3f3816c9219f7ab80;p=vaadin-framework.git Enable native scrolling in home screen apps on iOS 6+ (#12149) This also fixes another iOS 6 detection issue for home screen apps. Change-Id: Icbbb15d3f0d6668f11b2a796ae2c096d8c4dec0b --- diff --git a/client/src/com/vaadin/client/ApplicationConfiguration.java b/client/src/com/vaadin/client/ApplicationConfiguration.java index 86ab9455ed..ecd957194d 100644 --- a/client/src/com/vaadin/client/ApplicationConfiguration.java +++ b/client/src/com/vaadin/client/ApplicationConfiguration.java @@ -559,8 +559,7 @@ public class ApplicationConfiguration implements EntryPoint { BrowserInfo browserInfo = BrowserInfo.get(); // Enable iOS6 cast fix (see #10460) - if (browserInfo.isIOS() && browserInfo.isWebkit() - && browserInfo.getBrowserMajorVersion() == 6) { + if (browserInfo.isIOS6() && browserInfo.isWebkit()) { enableIOS6castFix(); } diff --git a/client/src/com/vaadin/client/BrowserInfo.java b/client/src/com/vaadin/client/BrowserInfo.java index b3490c3ca4..c733f38481 100644 --- a/client/src/com/vaadin/client/BrowserInfo.java +++ b/client/src/com/vaadin/client/BrowserInfo.java @@ -352,6 +352,16 @@ public class BrowserInfo { return browserDetails.isIOS(); } + /** + * Checks if the browser is run on iOS 6. + * + * @since 7.1.1 + * @return true if the browser is run on iOS 6, false otherwise + */ + public boolean isIOS6() { + return isIOS() && getOperatingSystemMajorVersion() == 6; + } + /** * Checks if the browser is run on Android * @@ -378,7 +388,7 @@ public class BrowserInfo { } // iOS 6 Safari supports native scrolling; iOS 5 suffers from #8792 // TODO Should test other iOS browsers - if (isIOS() && isSafari() && getBrowserMajorVersion() >= 6) { + if (isIOS6() && isWebkit()) { return false; } return true; diff --git a/client/tests/src/com/vaadin/client/TestVBrowserDetailsUserAgentParser.java b/client/tests/src/com/vaadin/client/TestVBrowserDetailsUserAgentParser.java index 4ce03d885d..7d5911f5a0 100644 --- a/client/tests/src/com/vaadin/client/TestVBrowserDetailsUserAgentParser.java +++ b/client/tests/src/com/vaadin/client/TestVBrowserDetailsUserAgentParser.java @@ -43,6 +43,9 @@ public class TestVBrowserDetailsUserAgentParser extends TestCase { private static final String IPHONE_IOS_4_0 = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7"; private static final String IPAD_IOS_4_3_1 = "Mozilla/5.0 (iPad; U; CPU OS 4_3_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8G4 Safari/6533.18.5"; + // application on the home screen, without Safari in user agent + private static final String IPHONE_IOS_6_1_HOMESCREEN_SIMULATOR = "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B141"; + private static final String ANDROID_HTC_2_1 = "Mozilla/5.0 (Linux; U; Android 2.1-update1; en-us; ADR6300 Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17"; private static final String ANDROID_GOOGLE_NEXUS_2_2 = "Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"; private static final String ANDROID_MOTOROLA_3_0 = "Mozilla/5.0 (Linux; U; Android 3.0; en-us; Xoom Build/HRI39) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13"; @@ -68,6 +71,18 @@ public class TestVBrowserDetailsUserAgentParser extends TestCase { assertMacOSX(bd); } + public void testIPhoneIOS6Homescreen() { + VBrowserDetails bd = new VBrowserDetails( + IPHONE_IOS_6_1_HOMESCREEN_SIMULATOR); + assertWebKit(bd); + // not identified as Safari, no browser version available + // assertSafari(bd); + // assertBrowserMajorVersion(bd, 6); + // assertBrowserMinorVersion(bd, 1); + assertEngineVersion(bd, 536f); + assertIOS(bd, 6, 1); + } + public void testIPhoneIOS5() { VBrowserDetails bd = new VBrowserDetails(IPHONE_IOS_5_1); assertWebKit(bd);