Skip to content
This repository has been archived by the owner on Jan 11, 2021. It is now read-only.

Commit

Permalink
Merge pull request #136 from alexstyl/hot_fix
Browse files Browse the repository at this point in the history
Hotfix - Version 77(10.3)
  • Loading branch information
alexstyl authored Aug 7, 2017
2 parents 36a4672 + 1eb82bb commit 40329b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class FBImportClient extends WebViewClient {
private static final String HTTP = "http://";
private static final String MOBILE_HOME = "m.facebook.com/home.php";
private static final String DESKTOP_HOME = "www.facebook.com/home.php";
private static final String DESKTOP_USER_AGENT = "Mozilla/5.0 (X11; U; Linux i686; en US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0";
private static final String URL_WITH_BIRTHDAY_SOURCE = "https://www.facebook.com/events/calendar";

private final WebView webView;
private FacebookLogInCallback listener;
Expand All @@ -33,19 +35,18 @@ private boolean isHomePage(String url) {

private void internalOnUserLoggedIn() {
switchToDesktopBrowsing();
webView.loadUrl("http://www.facebook.com/events/birthdays");
webView.loadUrl(URL_WITH_BIRTHDAY_SOURCE);
listener.onUserCredentialsSubmitted();
}

private void switchToDesktopBrowsing() {
WebSettings settings = webView.getSettings();
String newUA = "Mozilla/5.0 (X11; U; Linux i686; en US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0";
settings.setUserAgentString(newUA);
settings.setUserAgentString(DESKTOP_USER_AGENT);
}

@Override
public void onPageFinished(WebView view, String url) {
if (url.contains("facebook.com/events/birthdays")) {
if (url.contains(URL_WITH_BIRTHDAY_SOURCE)) {
webView.loadUrl("javascript:window.HTMLOUT.processHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
}
}
Expand Down
4 changes: 2 additions & 2 deletions versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ext {
kotlin_version = '1.1.1'
androidCompileSdkVersion = 25
androidBuildToolsVersion = '25.0.2'
androidVersionCode = 76
androidVersionName = '10.2'
androidVersionCode = 77
androidVersionName = '10.3'
}

0 comments on commit 40329b4

Please sign in to comment.