diff options
author | Denis Anisimov <denis@vaadin.com> | 2014-09-07 16:33:30 +0300 |
---|---|---|
committer | Markus Koivisto <markus@vaadin.com> | 2014-10-14 18:03:06 +0300 |
commit | cf0682ab3b5346138659c572b074f09455a15638 (patch) | |
tree | ed89d70b7bc160398b852565e4b8d864194c6945 /shared/src/com | |
parent | dd6ef048372e441718ecf357066a374f6570ea2f (diff) | |
download | vaadin-framework-cf0682ab3b5346138659c572b074f09455a15638.tar.gz vaadin-framework-cf0682ab3b5346138659c572b074f09455a15638.zip |
isIPad() and isIPhone() methods are added to WebBrowser (#14424,#14423).
Change-Id: I7b3556d5f9c1dd84beec638d7fbff1c5382070a4
Diffstat (limited to 'shared/src/com')
-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) * |