mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 16:40:32 +00:00
Use user agent of DownloaderImpl also in ReCapthaActivity
Does not contain device info and should also fix some issues about recaptchas not showing up
This commit is contained in:
parent
96862cbcb3
commit
aacb1f46a8
@ -83,6 +83,7 @@ public class ReCaptchaActivity extends AppCompatActivity {
|
|||||||
// enable Javascript
|
// enable Javascript
|
||||||
final WebSettings webSettings = webView.getSettings();
|
final WebSettings webSettings = webView.getSettings();
|
||||||
webSettings.setJavaScriptEnabled(true);
|
webSettings.setJavaScriptEnabled(true);
|
||||||
|
webSettings.setUserAgentString(DownloaderImpl.USER_AGENT);
|
||||||
|
|
||||||
webView.setWebViewClient(new WebViewClient() {
|
webView.setWebViewClient(new WebViewClient() {
|
||||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||||
@ -120,8 +121,7 @@ public class ReCaptchaActivity extends AppCompatActivity {
|
|||||||
webView.clearHistory();
|
webView.clearHistory();
|
||||||
final android.webkit.CookieManager cookieManager = CookieManager.getInstance();
|
final android.webkit.CookieManager cookieManager = CookieManager.getInstance();
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
cookieManager.removeAllCookies(aBoolean -> {
|
cookieManager.removeAllCookies(value -> { });
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
cookieManager.removeAllCookie();
|
cookieManager.removeAllCookie();
|
||||||
}
|
}
|
||||||
@ -150,14 +150,11 @@ public class ReCaptchaActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||||
final int id = item.getItemId();
|
if (item.getItemId() == R.id.menu_item_done) {
|
||||||
switch (id) {
|
saveCookiesAndFinish();
|
||||||
case R.id.menu_item_done:
|
return true;
|
||||||
saveCookiesAndFinish();
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveCookiesAndFinish() {
|
private void saveCookiesAndFinish() {
|
||||||
|
Loading…
Reference in New Issue
Block a user