Commit 0affe452 authored by Thomas's avatar Thomas

Merge branch 'show-connect-error' into 'develop'

Show different error if failed to connect to instance domain

See merge request !336
parents 5e20d2e4 a9fc7858
Pipeline #150050 passed with stage
in 3 minutes and 14 seconds
......@@ -337,6 +337,8 @@ public class LoginActivity extends BaseActivity {
instance_chosen.setText(instance);
}
}
}else if(instanceNodeInfo != null && instanceNodeInfo.isConnectionError()){
Toasty.error(LoginActivity.this,getString(R.string.connect_error), Toast.LENGTH_LONG).show();
}else{
Toasty.error(LoginActivity.this,getString(R.string.client_error), Toast.LENGTH_LONG).show();
}
......
......@@ -650,6 +650,7 @@ public class API {
setDefaultError(e);
}
} catch (IOException e) {
instanceNodeInfo.setConnectionError(true);
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
......@@ -663,6 +664,7 @@ public class API {
instanceNodeInfo.setVersion(jsonObject.getString("version"));
instanceNodeInfo.setOpenRegistrations(true);
} catch (IOException e1) {
instanceNodeInfo.setConnectionError(true);
e1.printStackTrace();
} catch (NoSuchAlgorithmException e1) {
e1.printStackTrace();
......
......@@ -19,6 +19,7 @@ public class InstanceNodeInfo {
private String name;
private String version;
private boolean openRegistrations;
private boolean connectionError;
public String getName() {
return name;
......@@ -43,4 +44,10 @@ public class InstanceNodeInfo {
public void setOpenRegistrations(boolean openRegistrations) {
this.openRegistrations = openRegistrations;
}
public boolean isConnectionError() { return connectionError; }
public void setConnectionError(boolean connectionError) {
this.connectionError = connectionError;
}
}
......@@ -268,6 +268,7 @@
<string name="pinned_toots">Pinned</string>
<!-- TOAST -->
<string name="client_error">Unable to get client id!</string>
<string name="connect_error">Unable to connect to instance domain!</string>
<string name="no_internet">No Internet connection!</string>
<string name="toast_block">The account was blocked!</string>
<string name="toast_unblock">The account is no longer blocked!</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment