Show different error if failed to connect to instance domain.
This commit is contained in:
parent
8543f24bc7
commit
a9fc78581c
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue