summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/EipFragment.java7
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java11
2 files changed, 10 insertions, 8 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
index c92ae3cd..a13cab09 100644
--- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
@@ -103,7 +103,6 @@ public class EipFragment extends Fragment implements Observer {
@OnClick(R.id.vpn_Status_Image)
void handleIcon() {
- LogWindowWrapper.getInstance(dashboard.getApplicationContext()).clearReason();
if (eip_status.isConnected() || eip_status.isConnecting())
handleSwitchOff();
else
@@ -243,11 +242,9 @@ public class EipFragment extends Fragment implements Observer {
private void handleNewState(EipStatus eip_status) {
Context context = dashboard.getApplicationContext();
String error = eip_status.lastError(5, context);
- LogWindowWrapper log_window = LogWindowWrapper.getInstance(context);
- if (!error.isEmpty() && log_window != null && !log_window.reason().equalsIgnoreCase(error)) {
- log_window.showLog();
- log_window.showedBecauseOf(error);
+ if (!error.isEmpty()) {
+ dashboard.showLog();
VoidVpnService.stop();
}
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 356cf6b0..4bfef1cb 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java
@@ -31,7 +31,7 @@ public class EipStatus extends Observable implements VpnStatus.StateListener {
wants_to_disconnect = false,
is_connecting = false;
-
+ int last_error_line = 0;
private String state, log_message;
private int localized_res_id;
@@ -146,13 +146,18 @@ public class EipStatus extends Observable implements VpnStatus.StateListener {
String[] error_keywords = {"error", "ERROR", "fatal", "FATAL"};
VpnStatus.LogItem[] log = VpnStatus.getlogbuffer();
+ if(log.length < last_error_line)
+ last_error_line = 0;
String message = "";
for (int i = 1; i <= lines && log.length > i; i++) {
- VpnStatus.LogItem log_item = log[log.length - i];
+ int line = log.length - i;
+ VpnStatus.LogItem log_item = log[line];
message = log_item.getString(context);
for (int j = 0; j < error_keywords.length; j++)
- if (message.contains(error_keywords[j]))
+ if (message.contains(error_keywords[j]) && line > last_error_line) {
error = message;
+ last_error_line = line;
+ }
}
return error;