Skip to content

Commit 20d1976

Browse files
committed
Revert "feat: set custom user agent"
This reverts commit 1974550.
1 parent 1974550 commit 20d1976

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

app/src/main/java/com/webview/myapplication/MainActivity.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent intent)
138138
if (null == mUploadMessage && null == mFilePathCallback) return;
139139
Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData();
140140
if (mFilePathCallback != null) {
141-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
142-
mFilePathCallback.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent));
143-
} else {
144-
mFilePathCallback.onReceiveValue(result != null ? new Uri[]{result} : null);
145-
}
141+
mFilePathCallback.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent));
146142
mFilePathCallback = null;
147143
} else if (mUploadMessage != null) {
148144
mUploadMessage.onReceiveValue(result);
@@ -162,9 +158,9 @@ protected void onCreate(Bundle savedInstanceState) {
162158
super.onCreate(savedInstanceState);
163159
AdBlockerUtil adBlockerUtil = AdBlockerUtil.getInstance();
164160
adBlockerUtil.initialize(this);
165-
if (VIEW_MODE.equals("PORTRAIT")) {
161+
if (VIEW_MODE == "PORTRAIT") {
166162
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
167-
} else if (VIEW_MODE.equals("LANDSCAPE")) {
163+
} else if (VIEW_MODE == "LANDSCAPE") {
168164
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
169165
} else {
170166
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
@@ -184,7 +180,6 @@ protected void onCreate(Bundle savedInstanceState) {
184180
webSettings.setDefaultTextEncodingName("utf-8");
185181
webSettings.setPluginState(PluginState.ON);
186182
webSettings.setAllowFileAccess(false);
187-
webSettings.setUserAgentString("Mozilla/5.0 (Linux; Android 12; Pixel 6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Mobile Safari/537.36");
188183
if (BLOCK_MEDIA) {
189184
webSettings.setLoadsImagesAutomatically(false);
190185
}
@@ -213,9 +208,9 @@ public void onHideCustomView() {
213208
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
214209
mCustomViewCallback.onCustomViewHidden();
215210
mCustomViewCallback = null;
216-
if (VIEW_MODE.equals("PORTRAIT")) {
211+
if (VIEW_MODE == "PORTRAIT") {
217212
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
218-
} else if (VIEW_MODE.equals("LANDSCAPE")) {
213+
} else if (VIEW_MODE == "LANDSCAPE") {
219214
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
220215
} else {
221216
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
@@ -356,9 +351,7 @@ public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError e
356351
@Override
357352
public void onBackPressed() {
358353
if (mCustomView != null) {
359-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
360-
mWebView.getWebChromeClient().onHideCustomView();
361-
}
354+
mWebView.getWebChromeClient().onHideCustomView();
362355
} else if (mWebView.canGoBack()) {
363356
mWebView.goBack();
364357
} else {

0 commit comments

Comments
 (0)