From 2125d38a66cafb611ea3982dcbf474d68736f569 Mon Sep 17 00:00:00 2001 From: anonTree1417 Date: Tue, 31 Mar 2020 21:04:08 +0200 Subject: [PATCH] Adding information at error and resetting button. --- .../org/mian/gitnex/activities/LoginActivity.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java b/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java index 1890ee3f..337ac401 100644 --- a/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java @@ -31,6 +31,7 @@ import org.mian.gitnex.models.UserInfo; import org.mian.gitnex.models.UserTokens; import org.mian.gitnex.util.AppUtil; import org.mian.gitnex.util.TinyDB; +import java.net.NoRouteToHostException; import java.net.URI; import java.net.URISyntaxException; import java.nio.charset.StandardCharsets; @@ -465,7 +466,20 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener @Override public void onFailure(@NonNull Call callVersion, Throwable t) { + Log.e("onFailure-version", t.toString()); + + if(t instanceof NoRouteToHostException) { + Toasty.info(getApplicationContext(), "Could not connect to host. Please check your url or port " + + "for issues."); + } + else { + Toasty.info(getApplicationContext(), getResources().getString(R.string.commentError)); + } + + enableProcessButton(); + loginButton.setText(R.string.btnLogin); + } });