update custom repo impl

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/299/head
androidacy-user 1 year ago
parent 99c3cd2ede
commit 5ea6840cee

@ -114,12 +114,6 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
BackgroundUpdateChecker.onMainActivityCreate(this);
super.onCreate(savedInstanceState);
// log all shared preferences that are present
// first, get every shared preference
Map<String, ?> allPrefs = MainApplication.getPreferences("mmm").getAll();
// then, log them
for (Map.Entry<String, ?> entry : allPrefs.entrySet()) {
Timber.d("Shared preference: %s = %s", entry.getKey(), entry.getValue());
}
if (!isOfficial) {
Timber.w("You may be running an untrusted build.");
// Show a toast to warn the user

@ -35,7 +35,7 @@ import java.nio.charset.StandardCharsets;
import timber.log.Timber;
@SuppressWarnings("SameReturnValue")
@SuppressWarnings({"unused", "SameReturnValue"})
@Keep
public class AndroidacyWebAPI {
public static final int COMPAT_UNSUPPORTED = 0;

@ -1169,7 +1169,22 @@ public class SettingsActivity extends FoxActivity implements LanguageActivity {
input.setValidator(new AutoCompleteTextView.Validator() {
@Override
public boolean isValid(CharSequence charSequence) {
return customRepoManager.canAddRepo(charSequence.toString());
// show error if string is empty, does not start with https://, or contains spaces
if (charSequence.toString().isEmpty()) {
input.setError(getString(R.string.empty_field));
return false;
} else if (!charSequence.toString().matches("^https://.*")) {
input.setError(getString(R.string.invalid_repo_url));
return false;
} else if (charSequence.toString().contains(" ")) {
input.setError(getString(R.string.invalid_repo_url));
return false;
} else if (!customRepoManager.canAddRepo(charSequence.toString())) {
input.setError(getString(R.string.repo_already_added));
return false;
} else {
return true;
}
}
@Override

@ -394,4 +394,6 @@
<string name="setup_crash_reporting_pii_summary"> This may include device identifiers and IP addresses. No data will be used for any other purpose besides analyzing crashes and improving performance.</string>
<string name="error_creating_cookie_database">Error accessing WebView. Functionality may be impacted.</string>
<string name="setup_scroll_down">To enable the finish button, please scroll down and view all the options.</string>
<string name="empty_field">URL is required</string>
<string name="repo_already_added">Repo already exists.</string>
</resources>

Loading…
Cancel
Save