Add warning message when using http
This commit is contained in:
@@ -102,11 +102,16 @@ public class LoginActivity extends AppCompatActivity {
|
||||
@OnClick(R.id.checkurl)
|
||||
public void doCheckUrl() {
|
||||
String url = urlField.getText().toString();
|
||||
if (HttpUrl.parse(url) == null) {
|
||||
HttpUrl parsedUrl = HttpUrl.parse(url);
|
||||
if (parsedUrl == null) {
|
||||
Utils.showSnackBar(LoginActivity.this, "Invalid URL (include http:// or https://)");
|
||||
return;
|
||||
}
|
||||
|
||||
if ("http".equals(parsedUrl.scheme())) {
|
||||
showHttpWarning();
|
||||
}
|
||||
|
||||
checkUrlProgress.setVisibility(View.VISIBLE);
|
||||
checkUrlButton.setVisibility(View.GONE);
|
||||
|
||||
@@ -117,6 +122,15 @@ public class LoginActivity extends AppCompatActivity {
|
||||
.enqueue(callInUI(this, onValidUrl(fixedUrl), onInvalidUrl(fixedUrl)));
|
||||
}
|
||||
|
||||
public void showHttpWarning() {
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.warning)
|
||||
.setCancelable(true)
|
||||
.setMessage(R.string.http_warning)
|
||||
.setPositiveButton(R.string.i_understand, (a, b) -> {})
|
||||
.show();
|
||||
}
|
||||
|
||||
@OnClick(R.id.open_logs)
|
||||
public void openLogs() {
|
||||
startActivity(new Intent(this, LogsActivity.class));
|
||||
|
||||
Reference in New Issue
Block a user