From 8a53bf0c88498059751693695775788874714fc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Tue, 10 Mar 2015 11:44:00 +0100 Subject: Point to the log if an error occurrs while connecting --- app/src/main/java/se/leap/bitmaskclient/EipFragment.java | 6 +++++- app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java | 12 +++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'app/src/main/java/se') 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(); -- cgit v1.2.3