Skip to content

Commit 857be4d

Browse files
committed
fix: resolve lint warnings for AddJavascriptInterface, SetJavaScriptEnabled, WrongConstant
- D3SView.java: Add @SuppressLint for SetJavaScriptEnabled and AddJavascriptInterface. JavaScript and the JS bridge are required for 3DS payment flow; only trusted ACS pages are loaded. - D3SRegexUtils.java: Replace static imports with qualified Pattern.compile(), Pattern.DOTALL, Pattern.CASE_INSENSITIVE so lint can verify the flag constants. Fixes #8
1 parent 32384f6 commit 857be4d

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

3DSView/src/main/java/eu/livotov/labs/android/d3s/D3SRegexUtils.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
import java.util.regex.Matcher;
77
import java.util.regex.Pattern;
88

9-
import static java.util.regex.Pattern.CASE_INSENSITIVE;
10-
import static java.util.regex.Pattern.DOTALL;
11-
import static java.util.regex.Pattern.compile;
129

1310
/**
1411
* Utilities to find 3DS values in ACS webpages.
@@ -18,12 +15,12 @@ final class D3SRegexUtils {
1815
/**
1916
* Pattern to find the value of an attribute named value from an html tag with an attribute named name and a value of MD.
2017
*/
21-
private static final Pattern mdFinder = compile("<input(?=[^<>]+?value=\"([^\"]+?)\")[^<>]+?name=\"MD\"[^<>]+?>", DOTALL | CASE_INSENSITIVE);
18+
private static final Pattern mdFinder = Pattern.compile("<input(?=[^<>]+?value=\"([^\"]+?)\")[^<>]+?name=\"MD\"[^<>]+?>", Pattern.DOTALL | Pattern.CASE_INSENSITIVE);
2219

2320
/**
2421
* Pattern to find the value of an attribute named value from an html tag with an attribute named name and a value of PaRes.
2522
*/
26-
private static final Pattern paresFinder = compile("<input(?=[^<>]+?value=\"([^\"]+?)\")[^<>]+?name=\"PaRes\"[^<>]+?>", DOTALL | CASE_INSENSITIVE);
23+
private static final Pattern paresFinder = Pattern.compile("<input(?=[^<>]+?value=\"([^\"]+?)\")[^<>]+?name=\"PaRes\"[^<>]+?>", Pattern.DOTALL | Pattern.CASE_INSENSITIVE);
2724

2825
/**
2926
* Pattern to find the value of an attribute named value from an html tag with an attribute named name and a value of CRes.

3DSView/src/main/java/eu/livotov/labs/android/d3s/D3SView.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package eu.livotov.labs.android.d3s;
22

3+
import android.annotation.SuppressLint;
34
import android.content.Context;
45
import android.text.TextUtils;
56
import android.util.AttributeSet;
@@ -72,6 +73,7 @@ public D3SView(final Context context) {
7273
initUI();
7374
}
7475

76+
@SuppressLint({"SetJavaScriptEnabled", "AddJavascriptInterface"})
7577
private void initUI() {
7678
getSettings().setJavaScriptEnabled(true);
7779
getSettings().setBuiltInZoomControls(true);

0 commit comments

Comments
 (0)