// assertBrowserMinorVersion(bd, 1);
assertEngineVersion(bd, 536f);
assertIOS(bd, 6, 1);
+ assertIPhone(bd);
}
public void testIPhoneIOS5() {
assertBrowserMinorVersion(bd, 1);
assertEngineVersion(bd, 534f);
assertIOS(bd, 5, 1);
+ assertIPhone(bd);
}
public void testIPhoneIOS4() {
assertBrowserMinorVersion(bd, 0);
assertEngineVersion(bd, 532f);
assertIOS(bd, 4, 0);
+ assertIPhone(bd);
}
public void testIPadIOS4() {
assertBrowserMinorVersion(bd, 0);
assertEngineVersion(bd, 533f);
assertIOS(bd, 4, 3);
+ assertIPad(bd);
}
public void testAndroid21() {
assertOSMinorVersion(browserDetails, minorVersion);
}
+ private void assertIPhone(VBrowserDetails browserDetails) {
+ assertTrue(browserDetails.isIPhone());
+ assertFalse(browserDetails.isIPad());
+ }
+
+ private void assertIPad(VBrowserDetails browserDetails) {
+ assertFalse(browserDetails.isIPhone());
+ assertTrue(browserDetails.isIPad());
+ }
+
private void assertWindows(VBrowserDetails browserDetails) {
assertWindows(browserDetails, false);
}
return browserDetails.isIOS();
}
+ /**
+ * Tests if the browser is run on IPhone.
+ *
+ * @return true if run on IPhone false if the user is not using IPhone or if
+ * no information on the browser is present
+ */
+ public boolean isIPhone() {
+ return browserDetails.isIPhone();
+ }
+
+ /**
+ * Tests if the browser is run on IPad.
+ *
+ * @return true if run on IPad false if the user is not using IPad or if no
+ * information on the browser is present
+ */
+ public boolean isIPad() {
+ return browserDetails.isIPad();
+ }
+
/**
* Returns the browser-reported TimeZone offset in milliseconds from GMT.
* This includes possible daylight saving adjustments, to figure out which
private boolean isIE = false;
private boolean isWindowsPhone;
+ private boolean isIPad;
+ private boolean isIPhone;
private OperatingSystem os = OperatingSystem.UNKNOWN;
} 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 {
return os == OperatingSystem.IOS;
}
+ /**
+ * 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)