-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #705 from xscreach/feature/popup-cleaup
popup cleanup
- Loading branch information
Showing
2 changed files
with
70 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
mobile/app/src/main/java/org/exarhteam/iitc_mobile/LoginUrlChecker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.exarhteam.iitc_mobile; | ||
|
||
import android.net.Uri; | ||
|
||
public class LoginUrlChecker { | ||
|
||
private LoginUrlChecker() { | ||
//hiding default constructor - only static methods | ||
} | ||
|
||
public static boolean isLoginUrl(Uri uri) { | ||
String uriHost = uri.getHost(); | ||
String uriPath = uri.getPath(); | ||
|
||
return isFacebookAuth(uriHost, uriPath) | ||
|| isGoogleAuth(uriHost) | ||
|| isAppleAuth(uriHost) | ||
|| isNianticAuth(uriHost); | ||
} | ||
|
||
private static boolean isFacebookAuth(String uriHost, String uriPath) { | ||
return uriHost.endsWith("facebook.com") | ||
&& (uriPath.contains("oauth") || uriPath.startsWith("/login") || uriPath.equals("/checkpoint/") | ||
|| uriPath.equals("/cookie/consent_prompt/")); | ||
} | ||
|
||
private static boolean isGoogleAuth(String uriHost) { | ||
return uriHost.startsWith("accounts.google.") || | ||
uriHost.startsWith("appengine.google.") || | ||
uriHost.startsWith("accounts.youtube.") || | ||
uriHost.startsWith("myaccount.google.") || | ||
uriHost.startsWith("gds.google."); | ||
} | ||
|
||
private static boolean isAppleAuth(String uriHost) { | ||
return uriHost.equals("appleid.apple.com"); | ||
} | ||
|
||
private static boolean isNianticAuth(String uriHost) { | ||
return uriHost.startsWith("signin.nianticlabs."); | ||
} | ||
} |