Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions ASP_NET/Sub-Classed Page Technique/MDetectPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,8 @@ public bool DetectIphone()
{
if (useragent.IndexOf(deviceIphone)!= -1)
{
//The iPad and iPod touch say they're an iPhone! So let's disambiguate.
if (DetectIpad() || DetectIpod())
//The iPad, iPod Touch and Windows Phone 8 say they're an iPhone! So let's disambiguate.
if (DetectIpad() || DetectIpod() || DetectWindowsPhone8())
{
return false;
}
Expand Down Expand Up @@ -608,8 +608,10 @@ public bool DetectIos()
// Also detects Google TV.
public bool DetectAndroid()
{
if ((useragent.IndexOf(deviceAndroid) != -1) ||
DetectGoogleTV())
if (((useragent.IndexOf(deviceAndroid) != -1)
&& !DetectWindowsPhone10()
&& !DetectWindowsPhone8())
|| DetectGoogleTV())
return true;

return false;
Expand Down
10 changes: 6 additions & 4 deletions ASP_NET/UserControl Technique/MDetectControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,8 @@ public bool DetectIphone()
{
if (useragent.IndexOf(deviceIphone)!= -1)
{
//The iPad and iPod touch say they're an iPhone! So let's disambiguate.
if (DetectIpad() || DetectIpod())
//The iPad, iPod Touch and Windows Phone 8 say they're an iPhone! So let's disambiguate.
if (DetectIpad() || DetectIpod() || DetectWindowsPhone8())
{
return false;
}
Expand Down Expand Up @@ -615,8 +615,10 @@ public bool DetectIos()
// Also detects Google TV.
public bool DetectAndroid()
{
if ((useragent.IndexOf(deviceAndroid) != -1) ||
DetectGoogleTV())
if (((useragent.IndexOf(deviceAndroid) != -1)
&& !DetectWindowsPhone10()
&& !DetectWindowsPhone8())
|| DetectGoogleTV())
return true;

return false;
Expand Down
9 changes: 6 additions & 3 deletions Cpp/mdetect.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,10 @@ class uagent_info

if (useragent.find( MobileESP::deviceIphone) != std::string::npos)
{
//The iPad and iPod Touch say they're an iPhone. So let's disambiguate.
//The iPad, iPod Touch and Windows Phone 8 say they're an iPhone. So let's disambiguate.
if (DetectIpad() == true ||
DetectIpod() == true)
DetectIpod() == true ||
DetectWindowsPhone8() == true)
return false;
//Yay! It's an iPhone!
else
Expand Down Expand Up @@ -360,7 +361,9 @@ class uagent_info
isAndroid == true)
return isAndroid;

if ((useragent.find( MobileESP::deviceAndroid) != std::string::npos)
if (((useragent.find( MobileESP::deviceAndroid) != std::string::npos)
&& (DetectWindowsPhone10() == false)
&& (DetectWindowsPhone10() == false))
|| (DetectGoogleTV() == true))
return true;

Expand Down
42 changes: 42 additions & 0 deletions Java/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.handinteractive.mobile</groupId>
<artifactId>MobileESP</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,11 @@ public void initDeviceScan() {
* @return detection of an iPhone
*/
public boolean detectIphone() {
// The iPad and iPod touch say they're an iPhone! So let's disambiguate.
if (userAgent.indexOf(deviceIphone) != -1 &&
// The iPad, iPod Touch and Windows Phone 8 say they're an iPhone! So let's disambiguate.
if (userAgent.indexOf(deviceIphone) != -1 &&
!detectIpad() &&
!detectIpod()) {
!detectIpod() &&
!detectWindowsPhone8()) {
return true;
}
return false;
Expand Down Expand Up @@ -344,7 +345,8 @@ && detectWebkit()) {
*/
public boolean detectIphoneOrIpod() {
//We repeat the searches here because some iPods may report themselves as an iPhone, which would be okay.
if (userAgent.indexOf(deviceIphone) != -1
if ((userAgent.indexOf(deviceIphone) != -1
&& !detectWindowsPhone8())
|| userAgent.indexOf(deviceIpod) != -1) {
return true;
}
Expand All @@ -369,8 +371,10 @@ public boolean detectIos() {
* @return detection of an Android device
*/
public boolean detectAndroid() {
if ((userAgent.indexOf(deviceAndroid) != -1) ||
detectGoogleTV())
if ((userAgent.indexOf(deviceAndroid) != -1
&& !detectWindowsPhone10()
&& !detectWindowsPhone8())
|| detectGoogleTV())
return true;

return false;
Expand Down Expand Up @@ -414,7 +418,7 @@ public boolean detectAndroidTablet() {
return false;

//Otherwise, if it's Android and does NOT have 'mobile' in it, Google says it's a tablet.
if ((userAgent.indexOf(mobile) > -1))
if ((userAgent.indexOf(mobile) > -1))
return false;
else
return true;
Expand Down Expand Up @@ -546,10 +550,9 @@ public boolean detectWindowsMobile() {
// and some older ones report as 'PIE' for Pocket IE.
// We also look for instances of HTC and Windows for many of their WinMo devices.
if (userAgent.indexOf(deviceWinMob) != -1
|| userAgent.indexOf(deviceWinMob) != -1
|| userAgent.indexOf(deviceIeMob) != -1
|| userAgent.indexOf(enginePie) != -1
|| (userAgent.indexOf(manuHtc) != -1 && userAgent.indexOf(deviceWindows) != -1)
|| (userAgent.indexOf(manuHtc) != -1 && userAgent.indexOf(deviceWindows) != -1)
|| (detectWapWml() && userAgent.indexOf(deviceWindows) != -1)) {
return true;
}
Expand All @@ -568,8 +571,8 @@ public boolean detectWindowsMobile() {
* @return detection of Blackberry
*/
public boolean detectBlackBerry() {
if (userAgent.indexOf(deviceBB) != -1 ||
httpAccept.indexOf(vndRIM) != -1)
if (userAgent.indexOf(deviceBB) != -1 ||
httpAccept.indexOf(vndRIM) != -1)
return true;

if (detectBlackBerry10Phone())
Expand All @@ -584,7 +587,7 @@ public boolean detectBlackBerry() {
* @return detection of a Blackberry 10 device
*/
public boolean detectBlackBerry10Phone() {
if (userAgent.indexOf(deviceBB10) != -1 &&
if (userAgent.indexOf(deviceBB10) != -1 &&
userAgent.indexOf(mobile) != -1) {
return true;
}
Expand Down Expand Up @@ -714,7 +717,7 @@ public boolean detectPalmWebOS() {
* @return detection of an HP WebOS tablet
*/
public boolean detectWebOSTablet() {
if (userAgent.indexOf(deviceWebOShp) != -1 &&
if (userAgent.indexOf(deviceWebOShp) != -1 &&
userAgent.indexOf(deviceTablet) != -1) {
return true;
}
Expand All @@ -726,7 +729,7 @@ public boolean detectWebOSTablet() {
* @return detection of a WebOS smart TV
*/
public boolean detectWebOSTV() {
if (userAgent.indexOf(deviceWebOStv) != -1 &&
if (userAgent.indexOf(deviceWebOStv) != -1 &&
userAgent.indexOf(smartTV2) != -1) {
return true;
}
Expand Down
Loading