Fix F-Droid regex + fix submit URL

This commit is contained in:
Thomas 2020-12-12 13:21:41 +01:00
parent e4b8dc9ad7
commit e64e04398a
1 changed files with 5 additions and 5 deletions

View File

@ -49,7 +49,7 @@ import java.util.regex.Pattern;
public class CheckAppActivity extends AppCompatActivity implements NetworkListener, TrackerListAdapter.OnTrackerClickListener { public class CheckAppActivity extends AppCompatActivity implements NetworkListener, TrackerListAdapter.OnTrackerClickListener {
private static final Pattern fdroidRegex = Pattern.compile("https?://f-droid\\.org/[\\w-]+/packages/([\\w.-]+)"); private static final Pattern fdroidRegex = Pattern.compile("https?://f-droid\\.org/([\\w-]+/)?packages/([\\w.-]+)");
private static final Pattern googleRegex = Pattern.compile("https?://play\\.google\\.com/store/apps/details\\?id=([\\w.-]+)"); private static final Pattern googleRegex = Pattern.compile("https?://play\\.google\\.com/store/apps/details\\?id=([\\w.-]+)");
private String app_id; private String app_id;
@ -72,14 +72,14 @@ public class CheckAppActivity extends AppCompatActivity implements NetworkListen
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Intent intent = getIntent(); Intent intent = getIntent();
String extraText = intent.getStringExtra(Intent.EXTRA_TEXT); String extraText = intent.getStringExtra(Intent.EXTRA_TEXT);
if (extraText != null) { if (extraText != null) {
Matcher matcher = fdroidRegex.matcher(extraText); Matcher matcher = fdroidRegex.matcher(extraText);
app_id = null; app_id = null;
while (matcher.find()) { while (matcher.find()) {
app_id = matcher.group(1); app_id = matcher.group(2);
} }
if (app_id == null) { if (app_id == null) {
matcher = googleRegex.matcher(extraText); matcher = googleRegex.matcher(extraText);
@ -114,9 +114,9 @@ public class CheckAppActivity extends AppCompatActivity implements NetworkListen
ClipData clip = ClipData.newPlainText(getString(R.string.app_name), app_id); ClipData clip = ClipData.newPlainText(getString(R.string.app_name), app_id);
clipboard.setPrimaryClip(clip); clipboard.setPrimaryClip(clip);
if (BuildConfig.FLAVOR.equals("exodus")) { if (BuildConfig.FLAVOR.equals("exodus")) {
uri = Uri.parse("https://reports.exodus-privacy.eu.org/"); uri = Uri.parse("https://reports.exodus-privacy.eu.org/analysis/submit/");
} else { } else {
uri = Uri.parse("https://exodus.phm.education.gouv.fr/reports/"); uri = Uri.parse("https://exodus.phm.education.gouv.fr/analysis/submit/");
} }
Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri); Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(browserIntent); startActivity(browserIntent);