diff options
author | Denis Anisimov <denis@vaadin.com> | 2014-09-07 16:33:30 +0300 |
---|---|---|
committer | Denis Anisimov <denis@vaadin.com> | 2014-10-09 14:35:48 +0300 |
commit | 709f35aca0f445444c8052015e34113e567a3166 (patch) | |
tree | 3492e967f97681e27ae3e75b43e5f946c37dbebe /shared | |
parent | 29b57f24f735fc529df3487820bc8f2cb513385a (diff) | |
download | vaadin-framework-709f35aca0f445444c8052015e34113e567a3166.tar.gz vaadin-framework-709f35aca0f445444c8052015e34113e567a3166.zip |
isIPad() and isIPhone() methods are added to WebBrowser (#14424,#14423).
Change-Id: I7b3556d5f9c1dd84beec638d7fbff1c5382070a4
Diffstat (limited to 'shared')
-rw-r--r-- | shared/src/com/vaadin/shared/VBrowserDetails.java | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/shared/src/com/vaadin/shared/VBrowserDetails.java b/shared/src/com/vaadin/shared/VBrowserDetails.java index 5fbf9bbb39..a85d031c49 100644 --- a/shared/src/com/vaadin/shared/VBrowserDetails.java +++ b/shared/src/com/vaadin/shared/VBrowserDetails.java @@ -43,6 +43,8 @@ public class VBrowserDetails implements Serializable { private boolean isIE = false; private boolean isWindowsPhone; + private boolean isIPad; + private boolean isIPhone; private OperatingSystem os = OperatingSystem.UNKNOWN; @@ -176,8 +178,9 @@ public class VBrowserDetails implements Serializable { } else if (userAgent.contains("macintosh") || userAgent.contains("mac osx") || userAgent.contains("mac os x")) { - if (userAgent.contains("ipad") || userAgent.contains("ipod") - || userAgent.contains("iphone")) { + isIPad = userAgent.contains("ipad"); + isIPhone = userAgent.contains("iphone"); + if (isIPad || userAgent.contains("ipod") || isIPhone) { os = OperatingSystem.IOS; parseIOSVersion(userAgent); } else { @@ -474,6 +477,24 @@ public class VBrowserDetails implements Serializable { } /** + * Tests if the browser is run on iPhone. + * + * @return + */ + public boolean isIPhone() { + return isIPhone; + } + + /** + * Tests if the browser is run on iPad. + * + * @return + */ + public boolean isIPad() { + return isIPad; + } + + /** * Returns the major version of the operating system. Currently only * supported for mobile devices (iOS/Android) * |