]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
android: Show countdown and retry button in notification
authorTobias Brunner <tobias@strongswan.org>
Mon, 18 Jun 2018 14:57:03 +0000 (16:57 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 3 Jul 2018 09:31:39 +0000 (11:31 +0200)
src/frontends/android/app/src/main/java/org/strongswan/android/logic/CharonVpnService.java
src/frontends/android/app/src/main/res/values-de/strings.xml
src/frontends/android/app/src/main/res/values-pl/strings.xml
src/frontends/android/app/src/main/res/values-ru/strings.xml
src/frontends/android/app/src/main/res/values-ua/strings.xml
src/frontends/android/app/src/main/res/values-zh-rCN/strings.xml
src/frontends/android/app/src/main/res/values-zh-rTW/strings.xml
src/frontends/android/app/src/main/res/values/strings.xml

index b0c12985ed5f145311043ffdcd59cdbdb93c46b4..7910f7d5217b5f5e14cb7aa2e84e8e822a373f0f 100644 (file)
@@ -417,10 +417,30 @@ public class CharonVpnService extends VpnService implements Runnable, VpnStateSe
                        s = mService.getErrorText();
                        builder.setSmallIcon(R.drawable.ic_notification_warning);
                        builder.setColor(ContextCompat.getColor(this, R.color.error_text));
-                       builder.setContentText(getString(R.string.tap_for_details));
+
+                       if (!publicVersion && profile != null)
+                       {
+                               int retry = mService.getRetryIn();
+                               if (retry > 0)
+                               {
+                                       builder.setContentText(getResources().getQuantityString(R.plurals.retry_in, retry, retry));
+                                       builder.setProgress(mService.getRetryTimeout(), retry, false);
+                               }
+
+                               Intent intent = new Intent(getApplicationContext(), VpnProfileControlActivity.class);
+                               intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                               intent.setAction(VpnProfileControlActivity.START_PROFILE);
+                               intent.putExtra(VpnProfileControlActivity.EXTRA_VPN_PROFILE_ID, profile.getUUID().toString());
+                               PendingIntent pending = PendingIntent.getActivity(getApplicationContext(), 0, intent,
+                                                                                                                                 PendingIntent.FLAG_UPDATE_CURRENT);
+                               builder.addAction(R.drawable.ic_notification_connecting, getString(R.string.retry), pending);
+                               add_action = true;
+                       }
                }
                else
                {
+                       builder.setProgress(0, 0, false);
+
                        switch (state)
                        {
                                case CONNECTING:
index 4dc812ca2d3916a57b2e11b5fcc63008ce789cb5..cc107e60ceec4fd9d27790080cbe4a6d9c1d7851 100644 (file)
@@ -31,7 +31,6 @@
     <string name="strongswan_shortcut">strongSwan-Verknüpfung</string>
     <string name="permanent_notification_name">VPN Verbindungsstatus</string>
     <string name="permanent_notification_description">Zeigt Informationen zum Verbindungsstatus der VPN Verbindung und dient als permanente Notification dazu, den VPN Dienst im Hintergrund am Laufen zu halten.</string>
-    <string name="tap_for_details">Antippen für Details.</string>
 
     <!-- Settings -->
     <string name="pref_title">Einstellungen</string>
index d4cf10ef4248937186a114f774e9a8a4b4f64fe7..b2ee09288f2379d6191522abbf560a3f25a2c638 100644 (file)
@@ -31,7 +31,6 @@
     <string name="strongswan_shortcut">Skrót strongSwan</string>
     <string name="permanent_notification_name">VPN connection state</string>
     <string name="permanent_notification_description">Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background.</string>
-    <string name="tap_for_details">Tap for details.</string>
 
     <!-- Settings -->
     <string name="pref_title">Settings</string>
index be34c2d98d5ef38fd73e5f496da113a8d2dd419b..5373fdd1fe1ef6146f734136c73b750442a6eebd 100644 (file)
@@ -28,7 +28,6 @@
     <string name="strongswan_shortcut">Ссылка на strongSwan</string>
     <string name="permanent_notification_name">VPN connection state</string>
     <string name="permanent_notification_description">Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background.</string>
-    <string name="tap_for_details">Tap for details.</string>
 
     <!-- Settings -->
     <string name="pref_title">Settings</string>
index faad4a758d54f018a5554ecb49065debf2f6612c..a9dfbadd4537bdcc4c054a3ce2c3b5286618a0df 100644 (file)
@@ -29,7 +29,6 @@
     <string name="strongswan_shortcut">strongSwan посилання</string>
     <string name="permanent_notification_name">VPN connection state</string>
     <string name="permanent_notification_description">Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background.</string>
-    <string name="tap_for_details">Tap for details.</string>
 
     <!-- Settings -->
     <string name="pref_title">Settings</string>
index 5b350facc1e46c89572b0edbe0350d561cb7f60f..501d4bb801e7a949831371fc156eb642766ac898 100644 (file)
@@ -28,7 +28,6 @@
     <string name="strongswan_shortcut">strongSwan快捷方式</string>
     <string name="permanent_notification_name">VPN connection state</string>
     <string name="permanent_notification_description">Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background.</string>
-    <string name="tap_for_details">Tap for details.</string>
 
     <!-- Settings -->
     <string name="pref_title">Settings</string>
index 4d5afc71bb6c1888bf281901441a721cd7e64281..f94efda9d381f2fa0474cc0db8b7c0dde964e236 100644 (file)
@@ -28,7 +28,6 @@
     <string name="strongswan_shortcut">strongSwan快速選單</string>
     <string name="permanent_notification_name">VPN connection state</string>
     <string name="permanent_notification_description">Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background.</string>
-    <string name="tap_for_details">Tap for details.</string>
 
     <!-- Settings -->
     <string name="pref_title">Settings</string>
index c4b697bcc47696f234ef4f71894da614ff7477f5..79d6e76b90f7abf7bc936eaa74776651e3783ab7 100644 (file)
@@ -31,7 +31,6 @@
     <string name="strongswan_shortcut">strongSwan shortcut</string>
     <string name="permanent_notification_name">VPN connection state</string>
     <string name="permanent_notification_description">Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background.</string>
-    <string name="tap_for_details">Tap for details.</string>
 
     <!-- Settings -->
     <string name="pref_title">Settings</string>