Add back SSL error detection that was removed, fixed static analysis warnings.
This commit is contained in:
parent
72ee377a35
commit
1c96b62eb6
@ -210,7 +210,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
private static final FrameLayout.LayoutParams COVER_SCREEN_PARAMS = new FrameLayout.LayoutParams(
|
||||
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
|
||||
|
||||
public abstract boolean isIncognito();
|
||||
protected abstract boolean isIncognito();
|
||||
|
||||
// abstract void initializeTabs();
|
||||
|
||||
|
@ -7,7 +7,6 @@ import android.webkit.CookieManager;
|
||||
import android.webkit.CookieSyncManager;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class IncognitoActivity extends BrowserActivity {
|
||||
|
@ -7,7 +7,6 @@ import android.webkit.CookieManager;
|
||||
import android.webkit.CookieSyncManager;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class MainActivity extends BrowserActivity {
|
||||
|
@ -38,7 +38,6 @@ public class TabsManager {
|
||||
final String mem = mPreferenceManager.getMemoryUrl();
|
||||
mPreferenceManager.setMemoryUrl("");
|
||||
String[] array = Utils.getArray(mem);
|
||||
int count = 0;
|
||||
for (String urlString : array) {
|
||||
if (!urlString.isEmpty()) {
|
||||
newTab(activity, urlString, darkTheme, incognito);
|
||||
|
@ -5,7 +5,6 @@ import android.os.Bundle;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.app.BrowserApp;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.utils.ThemeUtils;
|
||||
|
||||
public abstract class ThemableSettingsActivity extends AppCompatPreferenceActivity {
|
||||
|
@ -3,13 +3,11 @@
|
||||
*/
|
||||
package acr.browser.lightning.controller;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.Message;
|
||||
import android.view.View;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebChromeClient.CustomViewCallback;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import acr.browser.lightning.view.LightningView;
|
||||
|
||||
|
@ -16,7 +16,6 @@ import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.app.BrowserApp;
|
||||
|
||||
@Singleton
|
||||
public class HistoryDatabase extends SQLiteOpenHelper {
|
||||
@ -73,7 +72,7 @@ public class HistoryDatabase extends SQLiteOpenHelper {
|
||||
mDatabase = this.getWritableDatabase();
|
||||
}
|
||||
|
||||
public boolean isClosed() {
|
||||
private boolean isClosed() {
|
||||
return mDatabase == null || !mDatabase.isOpen();
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.View;
|
||||
|
@ -20,7 +20,6 @@ import java.net.URL;
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.app.BrowserApp;
|
||||
import acr.browser.lightning.bus.BrowserEvents;
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
|
||||
/**
|
||||
* This class is used to pull down the http headers of a given URL so that we
|
||||
|
@ -5,7 +5,6 @@ package acr.browser.lightning.fragment;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
@ -52,7 +51,7 @@ public class BookmarkSettingsFragment extends PreferenceFragment implements Pref
|
||||
|
||||
private class ImportBookmarksTask extends AsyncTask<Void, Void, Integer> {
|
||||
|
||||
private WeakReference<Activity> mActivityReference;
|
||||
private final WeakReference<Activity> mActivityReference;
|
||||
|
||||
public ImportBookmarksTask(Activity activity) {
|
||||
mActivityReference = new WeakReference<>(activity);
|
||||
|
@ -36,7 +36,6 @@ import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.activity.BrowserActivity;
|
||||
import acr.browser.lightning.activity.ReadingActivity;
|
||||
import acr.browser.lightning.activity.TabsManager;
|
||||
import acr.browser.lightning.app.BrowserApp;
|
||||
@ -95,8 +94,6 @@ public class BookmarksFragment extends Fragment implements View.OnClickListener,
|
||||
// Colors
|
||||
private int mIconColor, mScrollIndex;
|
||||
|
||||
private boolean mIsIncognito;
|
||||
|
||||
// Init asynchronously the bookmark manager
|
||||
private final Runnable mInitBookmarkManager = new Runnable() {
|
||||
@Override
|
||||
@ -114,8 +111,8 @@ public class BookmarksFragment extends Fragment implements View.OnClickListener,
|
||||
BrowserApp.getAppComponent().inject(this);
|
||||
final Bundle arguments = getArguments();
|
||||
final Context context = getContext();
|
||||
mIsIncognito = arguments.getBoolean(INCOGNITO_MODE, false);
|
||||
boolean darkTheme = mPreferenceManager.getUseTheme() != 0 || mIsIncognito;
|
||||
boolean isIncognito = arguments.getBoolean(INCOGNITO_MODE, false);
|
||||
boolean darkTheme = mPreferenceManager.getUseTheme() != 0 || isIncognito;
|
||||
mWebpageBitmap = ThemeUtils.getThemedBitmap(context, R.drawable.ic_webpage, darkTheme);
|
||||
mFolderBitmap = ThemeUtils.getThemedBitmap(context, R.drawable.ic_folder, darkTheme);
|
||||
mIconColor = darkTheme ? ThemeUtils.getIconDarkThemeColor(context) :
|
||||
|
@ -22,7 +22,6 @@ import android.widget.LinearLayout;
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.download.DownloadHandler;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.utils.ProxyUtils;
|
||||
import acr.browser.lightning.utils.ThemeUtils;
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
|
@ -21,6 +21,7 @@ import android.support.annotation.IdRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v7.graphics.Palette;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
@ -249,6 +250,9 @@ public class TabsFragment extends Fragment implements View.OnClickListener, View
|
||||
ViewCompat.jumpDrawablesToCurrentState(holder.exitButton);
|
||||
|
||||
LightningView web = tabsManager.getTabAtPosition(position);
|
||||
if (web == null) {
|
||||
return;
|
||||
}
|
||||
holder.txtTitle.setText(web.getTitle());
|
||||
|
||||
final Bitmap favicon = web.getFavicon();
|
||||
@ -326,14 +330,7 @@ public class TabsFragment extends Fragment implements View.OnClickListener, View
|
||||
return;
|
||||
}
|
||||
|
||||
final int defaultColor;
|
||||
final Resources resources = getResources();
|
||||
final ColorDrawable mBackground = new ColorDrawable();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
defaultColor = resources.getColor(R.color.primary_color, null);
|
||||
} else {
|
||||
defaultColor = resources.getColor(R.color.primary_color);
|
||||
}
|
||||
final int defaultColor = ContextCompat.getColor(getContext(), R.color.primary_color);
|
||||
if (mCurrentUiColor == Color.BLACK) {
|
||||
mCurrentUiColor = defaultColor;
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import android.content.SharedPreferences;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import acr.browser.lightning.app.BrowserApp;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.download.DownloadHandler;
|
||||
|
||||
|
@ -491,8 +491,7 @@ public class ArticleTextExtractor {
|
||||
Element el = elems.get(0);
|
||||
if (el.hasAttr("content")) {
|
||||
dateStr = el.attr("content");
|
||||
Date parsedDate = parseDate(dateStr);
|
||||
return parsedDate;
|
||||
return parseDate(dateStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,8 @@ import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.Inflater;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
|
||||
/**
|
||||
* Class to fetch articles. This class is thread safe.
|
||||
*
|
||||
@ -49,28 +51,34 @@ public class HtmlFetcher {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
BufferedReader reader = new BufferedReader(new FileReader("urls.txt"));
|
||||
String line;
|
||||
Set<String> existing = new LinkedHashSet<>();
|
||||
while ((line = reader.readLine()) != null) {
|
||||
int index1 = line.indexOf('\"');
|
||||
int index2 = line.indexOf('\"', index1 + 1);
|
||||
String url = line.substring(index1 + 1, index2);
|
||||
String domainStr = SHelper.extractDomain(url, true);
|
||||
String counterStr = "";
|
||||
// TODO more similarities
|
||||
if (existing.contains(domainStr))
|
||||
counterStr = "2";
|
||||
else
|
||||
existing.add(domainStr);
|
||||
BufferedReader reader = null;
|
||||
BufferedWriter writer = null;
|
||||
try {
|
||||
|
||||
String html = new HtmlFetcher().fetchAsString(url, 2000);
|
||||
String outFile = domainStr + counterStr + ".html";
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(outFile));
|
||||
writer.write(html);
|
||||
writer.close();
|
||||
reader = new BufferedReader(new FileReader("urls.txt"));
|
||||
String line;
|
||||
Set<String> existing = new LinkedHashSet<>();
|
||||
while ((line = reader.readLine()) != null) {
|
||||
int index1 = line.indexOf('\"');
|
||||
int index2 = line.indexOf('\"', index1 + 1);
|
||||
String url = line.substring(index1 + 1, index2);
|
||||
String domainStr = SHelper.extractDomain(url, true);
|
||||
String counterStr = "";
|
||||
// TODO more similarities
|
||||
if (existing.contains(domainStr))
|
||||
counterStr = "2";
|
||||
else
|
||||
existing.add(domainStr);
|
||||
|
||||
String html = new HtmlFetcher().fetchAsString(url, 2000);
|
||||
String outFile = domainStr + counterStr + ".html";
|
||||
writer = new BufferedWriter(new FileWriter(outFile));
|
||||
writer.write(html);
|
||||
}
|
||||
} finally {
|
||||
Utils.close(reader);
|
||||
Utils.close(writer);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
private String referrer = "http://jetsli.de/crawler";
|
||||
|
@ -15,7 +15,6 @@ import java.util.Set;
|
||||
|
||||
import acr.browser.lightning.app.BrowserApp;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
|
||||
public class AdBlock {
|
||||
|
||||
|
@ -2,7 +2,6 @@ package acr.browser.lightning.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager;
|
||||
|
@ -11,7 +11,6 @@ import android.webkit.WebView;
|
||||
import android.webkit.WebViewDatabase;
|
||||
|
||||
import acr.browser.lightning.app.BrowserApp;
|
||||
import acr.browser.lightning.database.HistoryDatabase;
|
||||
|
||||
/**
|
||||
* Copyright 8/4/2015 Anthony Restaino
|
||||
|
@ -231,8 +231,8 @@ class LightningChromeClient extends WebChromeClient {
|
||||
super.onShowCustomView(view, callback);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
@Deprecated
|
||||
public void onShowCustomView(View view, int requestedOrientation,
|
||||
CustomViewCallback callback) {
|
||||
// While these lines might look like they work, in practice,
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
package acr.browser.lightning.view;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
@ -36,13 +35,9 @@ import com.squareup.otto.Bus;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.activity.BrowserActivity;
|
||||
import acr.browser.lightning.app.BrowserApp;
|
||||
@ -53,7 +48,6 @@ import acr.browser.lightning.constant.StartPage;
|
||||
import acr.browser.lightning.dialog.LightningDialogBuilder;
|
||||
import acr.browser.lightning.download.LightningDownloadListener;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.utils.PermissionsManager;
|
||||
import acr.browser.lightning.utils.ProxyUtils;
|
||||
import acr.browser.lightning.utils.ThemeUtils;
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
@ -80,18 +74,16 @@ public class LightningView {
|
||||
0, 0, -1.0f, 0, 255, // blue
|
||||
0, 0, 0, 1.0f, 0 // alpha
|
||||
};
|
||||
private final PermissionsManager mPermissionsManager;
|
||||
private static final String[] PERMISSIONS = new String[]{Manifest.permission.ACCESS_FINE_LOCATION};
|
||||
private final WebViewHandler webViewHandler = new WebViewHandler();
|
||||
private final WebViewHandler mWebViewHandler = new WebViewHandler();
|
||||
|
||||
@Inject
|
||||
Bus eventBus;
|
||||
Bus mEventBus;
|
||||
|
||||
@Inject
|
||||
PreferenceManager mPreferences;
|
||||
|
||||
@Inject
|
||||
LightningDialogBuilder bookmarksDialogBuilder;
|
||||
LightningDialogBuilder mBookmarksDialogBuilder;
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public LightningView(BrowserActivity activity, String url, boolean darkTheme, boolean isIncognito) {
|
||||
@ -100,7 +92,6 @@ public class LightningView {
|
||||
mWebView = new WebView(activity);
|
||||
mIsIncognitoTab = isIncognito;
|
||||
mTitle = new LightningViewTitle(activity, darkTheme);
|
||||
mPermissionsManager = PermissionsManager.getInstance();
|
||||
|
||||
mMaxFling = ViewConfiguration.get(activity).getScaledMaximumFlingVelocity();
|
||||
|
||||
@ -410,7 +401,7 @@ public class LightningView {
|
||||
|
||||
public void setForegroundTab(boolean isForeground) {
|
||||
isForegroundTab = isForeground;
|
||||
eventBus.post(new BrowserEvents.TabsChanged());
|
||||
mEventBus.post(new BrowserEvents.TabsChanged());
|
||||
}
|
||||
|
||||
public boolean isForegroundTab() {
|
||||
@ -568,7 +559,7 @@ public class LightningView {
|
||||
}
|
||||
}
|
||||
|
||||
public String getUserAgent() {
|
||||
private String getUserAgent() {
|
||||
if (mWebView != null) {
|
||||
return mWebView.getSettings().getUserAgentString();
|
||||
} else {
|
||||
@ -620,36 +611,36 @@ public class LightningView {
|
||||
if (currentUrl != null && currentUrl.startsWith(Constants.FILE)) {
|
||||
if (currentUrl.endsWith(HistoryPage.FILENAME)) {
|
||||
if (url != null) {
|
||||
bookmarksDialogBuilder.showLongPressedHistoryLinkDialog(mActivity, url);
|
||||
mBookmarksDialogBuilder.showLongPressedHistoryLinkDialog(mActivity, url);
|
||||
} else if (result != null && result.getExtra() != null) {
|
||||
final String newUrl = result.getExtra();
|
||||
bookmarksDialogBuilder.showLongPressedHistoryLinkDialog(mActivity, newUrl);
|
||||
mBookmarksDialogBuilder.showLongPressedHistoryLinkDialog(mActivity, newUrl);
|
||||
}
|
||||
} else if (currentUrl.endsWith(Constants.BOOKMARKS_FILENAME)) {
|
||||
if (url != null) {
|
||||
bookmarksDialogBuilder.showLongPressedDialogForBookmarkUrl(mActivity, url);
|
||||
mBookmarksDialogBuilder.showLongPressedDialogForBookmarkUrl(mActivity, url);
|
||||
} else if (result != null && result.getExtra() != null) {
|
||||
final String newUrl = result.getExtra();
|
||||
bookmarksDialogBuilder.showLongPressedDialogForBookmarkUrl(mActivity, newUrl);
|
||||
mBookmarksDialogBuilder.showLongPressedDialogForBookmarkUrl(mActivity, newUrl);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (url != null) {
|
||||
if (result != null) {
|
||||
if (result.getType() == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE || result.getType() == WebView.HitTestResult.IMAGE_TYPE) {
|
||||
bookmarksDialogBuilder.showLongPressImageDialog(mActivity, url, getUserAgent());
|
||||
mBookmarksDialogBuilder.showLongPressImageDialog(mActivity, url, getUserAgent());
|
||||
} else {
|
||||
bookmarksDialogBuilder.showLongPressLinkDialog(mActivity, url);
|
||||
mBookmarksDialogBuilder.showLongPressLinkDialog(mActivity, url);
|
||||
}
|
||||
} else {
|
||||
bookmarksDialogBuilder.showLongPressLinkDialog(mActivity, url);
|
||||
mBookmarksDialogBuilder.showLongPressLinkDialog(mActivity, url);
|
||||
}
|
||||
} else if (result != null && result.getExtra() != null) {
|
||||
final String newUrl = result.getExtra();
|
||||
if (result.getType() == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE || result.getType() == WebView.HitTestResult.IMAGE_TYPE) {
|
||||
bookmarksDialogBuilder.showLongPressImageDialog(mActivity, newUrl, getUserAgent());
|
||||
mBookmarksDialogBuilder.showLongPressImageDialog(mActivity, newUrl, getUserAgent());
|
||||
} else {
|
||||
bookmarksDialogBuilder.showLongPressLinkDialog(mActivity, newUrl);
|
||||
mBookmarksDialogBuilder.showLongPressLinkDialog(mActivity, newUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -754,9 +745,9 @@ public class LightningView {
|
||||
@Override
|
||||
public void onLongPress(MotionEvent e) {
|
||||
if (mCanTriggerLongPress) {
|
||||
Message msg = webViewHandler.obtainMessage();
|
||||
Message msg = mWebViewHandler.obtainMessage();
|
||||
if (msg != null) {
|
||||
msg.setTarget(webViewHandler);
|
||||
msg.setTarget(mWebViewHandler);
|
||||
mWebView.requestFocusNodeHref(msg);
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class LightningViewTitle {
|
||||
return mFavicon;
|
||||
}
|
||||
|
||||
public Bitmap getDefaultIcon() {
|
||||
public static Bitmap getDefaultIcon() {
|
||||
return DEFAULT_ICON;
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ import com.squareup.otto.Bus;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.activity.BrowserActivity;
|
||||
@ -42,7 +44,7 @@ import acr.browser.lightning.utils.Utils;
|
||||
* @author Stefano Pacifici based on Anthony C. Restaino's code
|
||||
* @date 2015/09/22
|
||||
*/
|
||||
public class LightningWebClient extends WebViewClient {
|
||||
class LightningWebClient extends WebViewClient {
|
||||
|
||||
private final BrowserActivity mActivity;
|
||||
private final LightningView mLightningView;
|
||||
@ -70,6 +72,7 @@ public class LightningWebClient extends WebViewClient {
|
||||
return super.shouldInterceptRequest(view, request);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
|
||||
if (mAdBlock.isAd(url)) {
|
||||
@ -180,11 +183,45 @@ public class LightningWebClient extends WebViewClient {
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Integer> getAllSslErrorMessageCodes(SslError error) {
|
||||
List<Integer> errorCodeMessageCodes = new ArrayList<>();
|
||||
|
||||
if (error.hasError(SslError.SSL_DATE_INVALID)) {
|
||||
errorCodeMessageCodes.add(R.string.message_certificate_date_invalid);
|
||||
}
|
||||
if (error.hasError(SslError.SSL_EXPIRED)) {
|
||||
errorCodeMessageCodes.add(R.string.message_certificate_expired);
|
||||
}
|
||||
if (error.hasError(SslError.SSL_IDMISMATCH)) {
|
||||
errorCodeMessageCodes.add(R.string.message_certificate_domain_mismatch);
|
||||
}
|
||||
if (error.hasError(SslError.SSL_NOTYETVALID)) {
|
||||
errorCodeMessageCodes.add(R.string.message_certificate_not_yet_valid);
|
||||
}
|
||||
if (error.hasError(SslError.SSL_UNTRUSTED)) {
|
||||
errorCodeMessageCodes.add(R.string.message_certificate_untrusted);
|
||||
}
|
||||
if (error.hasError(SslError.SSL_INVALID)) {
|
||||
errorCodeMessageCodes.add(R.string.message_certificate_invalid);
|
||||
}
|
||||
|
||||
return errorCodeMessageCodes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedSslError(WebView view, @NonNull final SslErrorHandler handler, SslError error) {
|
||||
List<Integer> errorCodeMessageCodes = getAllSslErrorMessageCodes(error);
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (Integer messageCode : errorCodeMessageCodes) {
|
||||
stringBuilder.append(" - ").append(mActivity.getString(messageCode)).append('\n');
|
||||
}
|
||||
String alertMessage =
|
||||
mActivity.getString(R.string.message_insecure_connection, stringBuilder.toString());
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
builder.setTitle(mActivity.getString(R.string.title_warning));
|
||||
builder.setMessage(mActivity.getString(R.string.message_untrusted_certificate))
|
||||
builder.setMessage(alertMessage)
|
||||
.setCancelable(true)
|
||||
.setPositiveButton(mActivity.getString(R.string.action_yes),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@ -200,13 +237,7 @@ public class LightningWebClient extends WebViewClient {
|
||||
handler.cancel();
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
if (error.getPrimaryError() == SslError.SSL_UNTRUSTED) {
|
||||
alert.show();
|
||||
} else {
|
||||
handler.proceed();
|
||||
}
|
||||
|
||||
builder.create().show();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -219,7 +250,6 @@ public class LightningWebClient extends WebViewClient {
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
resend.sendToTarget();
|
||||
}
|
||||
})
|
||||
@ -227,7 +257,6 @@ public class LightningWebClient extends WebViewClient {
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
dontResend.sendToTarget();
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user