diff options
author | Parménides GV <parmegv@sdf.org> | 2015-03-10 11:44:00 +0100 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2015-03-10 11:44:00 +0100 |
commit | 8a53bf0c88498059751693695775788874714fc8 (patch) | |
tree | aa4454d666009e3445044f87cd5a7d8854008369 /app/src | |
parent | 777cdf0e0844f8450fac6bc9146c013f30e820d2 (diff) |
Point to the log if an error occurrs while connecting
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/EipFragment.java | 6 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java | 12 |
2 files changed, 14 insertions, 4 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index 588b137b..3023442a 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -262,7 +262,11 @@ public class EipFragment extends Fragment implements Observer { private void setDisconnectedUI(){ hideProgressBar(); adjustSwitch(); - status_message.setText(dashboard.getString(R.string.eip_state_not_connected)); + String last_log_message = eip_status.getLastLogMessage(dashboard.getApplicationContext()); + if(last_log_message.contains("error") || last_log_message.contains("ERROR")) + status_message.setText("An error occurred." + "\n" + "Please take a look at the log, from the menu"); + else + status_message.setText(dashboard.getString(R.string.eip_state_not_connected)); } private void adjustSwitch() { diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java b/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java index c6735130..14158696 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java @@ -16,11 +16,12 @@ */ package se.leap.bitmaskclient.eip; -import android.util.Log; +import android.util.*; +import android.content.*; -import java.util.Observable; +import java.util.*; -import de.blinkt.openvpn.core.VpnStatus; +import de.blinkt.openvpn.core.*; public class EipStatus extends Observable implements VpnStatus.StateListener { public static String TAG = EipStatus.class.getSimpleName(); @@ -135,6 +136,11 @@ public class EipStatus extends Observable implements VpnStatus.StateListener { EipStatus.level = level; } + public String getLastLogMessage(Context context) { + VpnStatus.LogItem[] log = VpnStatus.getlogbuffer(); + return log[log.length-1].getString(context); + } + @Override public String toString() { return "State: " + state + " Level: " + level.toString(); |