Never open external links in our WebView

This commit is contained in:
cketti 2020-02-06 13:51:37 +01:00
parent 79c06745fb
commit 67e2029d56

View file

@ -16,9 +16,11 @@ import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import androidx.annotation.Nullable;
import com.fsck.k9.mailstore.AttachmentResolver;
import com.fsck.k9.ui.R;
import com.fsck.k9.view.MessageWebView.OnPageFinishedListener;
import timber.log.Timber;
@ -56,15 +58,13 @@ public class K9WebViewClient extends WebViewClient {
Context context = webView.getContext();
Intent intent = createBrowserViewIntent(uri, context);
boolean overridingUrlLoading = false;
try {
context.startActivity(intent);
overridingUrlLoading = true;
} catch (ActivityNotFoundException ex) {
// If no application can handle the URL, assume that the WebView can handle it.
Toast.makeText(context, R.string.error_activity_not_found, Toast.LENGTH_LONG).show();
}
return overridingUrlLoading;
return true;
}
private Intent createBrowserViewIntent(Uri uri, Context context) {