Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use user agent of DownloaderImpl also in ReCaptchaActivity #5215

Merged
merged 1 commit into from
Dec 18, 2020
Merged
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
15 changes: 6 additions & 9 deletions app/src/main/java/org/schabi/newpipe/ReCaptchaActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ protected void onCreate(final Bundle savedInstanceState) {
// enable Javascript
final WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setUserAgentString(DownloaderImpl.USER_AGENT);

webView.setWebViewClient(new WebViewClient() {
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
Expand Down Expand Up @@ -120,8 +121,7 @@ public void onPageFinished(final WebView view, final String url) {
webView.clearHistory();
final android.webkit.CookieManager cookieManager = CookieManager.getInstance();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
cookieManager.removeAllCookies(aBoolean -> {
});
cookieManager.removeAllCookies(value -> { });
} else {
cookieManager.removeAllCookie();
}
Expand Down Expand Up @@ -150,14 +150,11 @@ public void onBackPressed() {

@Override
public boolean onOptionsItemSelected(final MenuItem item) {
final int id = item.getItemId();
switch (id) {
case R.id.menu_item_done:
saveCookiesAndFinish();
return true;
default:
return false;
if (item.getItemId() == R.id.menu_item_done) {
saveCookiesAndFinish();
return true;
}
return false;
}

private void saveCookiesAndFinish() {
Expand Down