summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2019-09-15 18:01:06 +0200
committerArne Schwabe <arne@rfc2549.org>2019-09-15 18:01:06 +0200
commit638fed55948d9ebb2792d84f7039d3392629e37d (patch)
tree4fa6cf70ad916ae30866723142a68dec7fb8052e /main/src
parent08c208ed2d3389f476a55b36e01b62b8b067d3fa (diff)
Minor tweaks to info message support
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java24
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java4
-rw-r--r--main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java3
3 files changed, 24 insertions, 7 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
index cf602a52..a2126861 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
@@ -136,6 +136,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
private Handler guiHandler;
private Toast mlastToast;
private Runnable mOpenVPNThread;
+ private PendingIntent mSSOPendingIntent = null;
// From: http://stackoverflow.com/questions/3758606/how-to-convert-byte-size-into-human-readable-format-in-java
public static String humanReadableByteCount(long bytes, boolean speed, Resources res) {
@@ -268,8 +269,13 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
nbuilder.setOngoing(true);
nbuilder.setSmallIcon(icon);
- if (status == LEVEL_WAITING_FOR_USER_INPUT)
- nbuilder.setContentIntent(getUserInputIntent(msg));
+ if (status == LEVEL_WAITING_FOR_USER_INPUT) {
+ if (mSSOPendingIntent != null) {
+ nbuilder.setContentIntent(mSSOPendingIntent);
+ } else {
+ nbuilder.setContentIntent(getUserInputIntent(msg));
+ }
+ }
else
nbuilder.setContentIntent(getGraphPendingIntent());
@@ -1254,10 +1260,11 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
Intent intent;
+ int reason;
if (method.equals("OPEN_URL")) {
String url = info.split(":", 2)[1];
-
- nbuilder.setContentTitle(getString(R.string.openurl_requested));
+ reason = R.string.openurl_requested;
+ nbuilder.setContentTitle(getString(reason));
nbuilder.setContentText(url);
@@ -1269,7 +1276,8 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
} else if (method.equals("CR_TEXT")) {
String challenge = info.split(":", 2)[1];
- nbuilder.setContentTitle(getString(R.string.crtext_requested));
+ reason = R.string.crtext_requested;
+ nbuilder.setContentTitle(getString(reason));
nbuilder.setContentText(challenge);
intent = new Intent(this, CredentialsPopup.class);
@@ -1280,7 +1288,11 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
return;
}
- nbuilder.setContentIntent(PendingIntent.getActivity(this, 0, intent, 0));
+ // updateStateString trigger the notification of the VPN to be refreshed, save this intent
+ // to have that notification also this intent to be set
+ mSSOPendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
+ VpnStatus.updateStateString("USER_INPUT", "waiting for user input", reason, LEVEL_WAITING_FOR_USER_INPUT);
+ nbuilder.setContentIntent(mSSOPendingIntent);
// Try to set the priority available since API 16 (Jellybean)
diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java
index 83132505..c8609e41 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java
@@ -345,6 +345,10 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement {
{
mOpenVPNService.trigger_sso(info);
}
+ else
+ {
+ VpnStatus.logDebug("Info message from server:" + info);
+ }
}
private void processLogMessage(String argument) {
diff --git a/main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java b/main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java
index f453205a..c74281e7 100644
--- a/main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java
+++ b/main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java
@@ -283,9 +283,10 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable
String name = event.getName();
String info = event.getInfo();
if (name.equals("INFO")) {
- VpnStatus.logInfo(R.string.info_from_server, info);
if (info.startsWith("OPEN_URL:") || info.startsWith("CR_TEXT:")) {
mService.trigger_sso(info);
+ } else {
+ VpnStatus.logInfo(R.string.info_from_server, info);
}
} else {
VpnStatus.updateStateString(name, info);