summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java4
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/OkHttpClientGenerator.java6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java10
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java8
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java8
-rw-r--r--app/src/main/res/values/strings.xml23
6 files changed, 33 insertions, 26 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java b/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java
index d52ebac1..fa28a875 100644
--- a/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java
+++ b/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java
@@ -20,6 +20,8 @@ import java.util.concurrent.CopyOnWriteArrayList;
import se.leap.bitmaskclient.R;
+import static se.leap.bitmaskclient.utils.ConfigHelper.getProviderFormattedString;
+
public class VpnStatus {
@@ -103,6 +105,8 @@ public class VpnStatus {
if (mLastStateresid == R.string.state_waitconnectretry) {
return c.getString(R.string.state_waitconnectretry, mLaststatemsg);
+ } else if (mLastStateresid == R.string.void_vpn_establish) {
+ return getProviderFormattedString(c.getResources(), R.string.void_vpn_establish);
}
String prefix = c.getString(mLastStateresid);
diff --git a/app/src/main/java/se/leap/bitmaskclient/OkHttpClientGenerator.java b/app/src/main/java/se/leap/bitmaskclient/OkHttpClientGenerator.java
index 7d1054f1..69270140 100644
--- a/app/src/main/java/se/leap/bitmaskclient/OkHttpClientGenerator.java
+++ b/app/src/main/java/se/leap/bitmaskclient/OkHttpClientGenerator.java
@@ -52,7 +52,7 @@ import static se.leap.bitmaskclient.R.string.error_io_exception_user_message;
import static se.leap.bitmaskclient.R.string.error_no_such_algorithm_exception_user_message;
import static se.leap.bitmaskclient.R.string.keyChainAccessError;
import static se.leap.bitmaskclient.R.string.server_unreachable_message;
-import static se.leap.bitmaskclient.R.string.warning_corrupted_provider_cert;
+import static se.leap.bitmaskclient.utils.ConfigHelper.getProviderFormattedString;
/**
* Created by cyberta on 08.01.18.
@@ -92,7 +92,7 @@ public class OkHttpClientGenerator {
} catch (IllegalArgumentException e) {
e.printStackTrace();
// TODO ca cert is invalid - show better error ?!
- addErrorMessageToJson(initError, resources.getString(certificate_error));
+ addErrorMessageToJson(initError, getProviderFormattedString(resources, certificate_error));
} catch (IllegalStateException | KeyManagementException | KeyStoreException e) {
e.printStackTrace();
addErrorMessageToJson(initError, String.format(resources.getString(keyChainAccessError), e.getLocalizedMessage()));
@@ -102,7 +102,7 @@ public class OkHttpClientGenerator {
} catch (CertificateException e) {
e.printStackTrace();
// TODO ca cert is invalid - show better error ?!
- addErrorMessageToJson(initError, resources.getString(certificate_error));
+ addErrorMessageToJson(initError, getProviderFormattedString(resources, certificate_error));
} catch (UnknownHostException e) {
e.printStackTrace();
addErrorMessageToJson(initError, resources.getString(server_unreachable_message));
diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java b/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java
index 15c7457e..37adbe93 100644
--- a/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java
+++ b/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java
@@ -107,6 +107,7 @@ import static se.leap.bitmaskclient.R.string.warning_corrupted_provider_cert;
import static se.leap.bitmaskclient.R.string.warning_corrupted_provider_details;
import static se.leap.bitmaskclient.R.string.warning_expired_provider_cert;
import static se.leap.bitmaskclient.utils.ConfigHelper.getFingerprintFromCertificate;
+import static se.leap.bitmaskclient.utils.ConfigHelper.getProviderFormattedString;
import static se.leap.bitmaskclient.utils.ConfigHelper.parseRsaKeyFromString;
import static se.leap.bitmaskclient.utils.PreferenceHelper.deleteProviderDetailsFromPreferences;
import static se.leap.bitmaskclient.utils.PreferenceHelper.getFromPersistedProvider;
@@ -237,8 +238,8 @@ public abstract class ProviderApiManagerBase {
deleteProviderDetailsFromPreferences(preferences, provider.getDomain());
}
- String formatErrorMessage(final int toastStringId) {
- return formatErrorMessage(resources.getString(toastStringId));
+ String formatErrorMessage(final int errorStringId) {
+ return formatErrorMessage(getProviderFormattedString(resources, errorStringId));
}
private String formatErrorMessage(String errorMessage) {
@@ -751,10 +752,11 @@ public abstract class ProviderApiManagerBase {
Bundle setErrorResult(Bundle result, int errorMessageId, String errorId) {
JSONObject errorJson = new JSONObject();
+ String errorMessage = getProviderFormattedString(resources, errorMessageId);
if (errorId != null) {
- addErrorMessageToJson(errorJson, resources.getString(errorMessageId), errorId);
+ addErrorMessageToJson(errorJson, errorMessage, errorId);
} else {
- addErrorMessageToJson(errorJson, resources.getString(errorMessageId));
+ addErrorMessageToJson(errorJson, errorMessage);
}
result.putString(ERRORS, errorJson.toString());
result.putBoolean(BROADCAST_RESULT_KEY, false);
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java
index a896197c..f6e3df7c 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java
@@ -40,6 +40,7 @@ import static se.leap.bitmaskclient.Constants.EIP_ACTION_START_BLOCKING_VPN;
import static se.leap.bitmaskclient.Constants.EIP_ACTION_STOP_BLOCKING_VPN;
import static se.leap.bitmaskclient.Constants.EIP_IS_ALWAYS_ON;
import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES;
+import static se.leap.bitmaskclient.utils.ConfigHelper.getProviderFormattedString;
public class VoidVpnService extends VpnService implements Observer, VpnNotificationManager.VpnServiceCallback {
@@ -147,7 +148,7 @@ public class VoidVpnService extends VpnService implements Observer, VpnNotificat
private void establishBlockingVpn() {
try {
- VpnStatus.logInfo(getString(R.string.void_vpn_establish));
+ VpnStatus.logInfo(getProviderFormattedString(getResources(), R.string.void_vpn_establish));
VpnStatus.updateStateString(STATE_ESTABLISH, "",
R.string.void_vpn_establish, ConnectionStatus.LEVEL_BLOCKING);
Builder builder = prepareBlockingVpnProfile();
@@ -180,9 +181,10 @@ public class VoidVpnService extends VpnService implements Observer, VpnNotificat
}
if (eipStatus.isBlockingVpnEstablished()) {
+ String blockingMessage = getProviderFormattedString(getResources(), eipStatus.getLocalizedResId());
notificationManager.buildVoidVpnNotification(
- getString(eipStatus.getLocalizedResId()),
- getString(eipStatus.getLocalizedResId()),
+ blockingMessage,
+ blockingMessage,
eipStatus.getLevel());
} else {
notificationManager.stopNotifications(NOTIFICATION_CHANNEL_NEWSTATUS_ID);
diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java b/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java
index d1ac0eb3..da74c7c4 100644
--- a/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java
+++ b/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java
@@ -17,8 +17,10 @@
package se.leap.bitmaskclient.utils;
import android.content.Context;
+import android.content.res.Resources;
import android.os.Looper;
import android.support.annotation.NonNull;
+import android.support.annotation.StringRes;
import org.json.JSONException;
import org.json.JSONObject;
@@ -43,6 +45,7 @@ import java.util.Calendar;
import se.leap.bitmaskclient.BuildConfig;
import se.leap.bitmaskclient.ProviderAPI;
+import se.leap.bitmaskclient.R;
import static se.leap.bitmaskclient.Constants.DEFAULT_BITMASK;
@@ -182,4 +185,9 @@ public class ConfigHelper {
public static int getCurrentTimezone() {
return Calendar.getInstance().get(Calendar.ZONE_OFFSET) / 3600000;
}
+
+ public static String getProviderFormattedString(Resources resources, @StringRes int resourceId) {
+ String appName = resources.getString(R.string.app_name);
+ return resources.getString(resourceId, appName);
+ }
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ba4ef949..551b7cb1 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -49,11 +49,11 @@
<string name="setup_error_title">Configuration Error</string>
<string name="setup_error_configure_button">Configure</string>
<string name="setup_error_close_button">Exit</string>
- <string name="setup_error_text">There was an error configuring Bitmask with your chosen provider.\n\nYou may choose to reconfigure, or exit and configure a provider upon next launch.</string>
+ <string name="setup_error_text">There was an error configuring %s with your chosen provider.\n\nYou may choose to reconfigure, or exit and configure a provider upon next launch.</string>
<string name="server_unreachable_message">The server is unreachable, please try again.</string>
<string name="error.security.pinnedcertificate">Security error, upgrade the app or choose another provider.</string>
- <string name="malformed_url">It doesn\'t seem to be a Bitmask provider.</string>
- <string name="certificate_error">This is not a trusted Bitmask provider.</string>
+ <string name="malformed_url">It doesn\'t seem to be a %s provider.</string>
+ <string name="certificate_error">This is not a trusted %s provider.</string>
<string name="service_is_down_error">The service is down.</string>
<string name="configuring_provider">Configuring provider</string>
<string name="incorrectly_downloaded_certificate_message">Your anonymous certificate was not downloaded</string>
@@ -72,29 +72,20 @@
<string name="provider_problem">It seems there is a problem with the provider.</string>
<string name="try_another_provider">Please try another provider, or contact yours.</string>
<string name="default_username">Anonymous</string>
- <string name="logged_in_user_status">is logged in.</string>
- <string name="logged_out_user_status">logged out.</string>
- <string name="didnt_log_out_user_status">didn\'t log out. Try later, it may be a problem in the network or with the provider. Should it persist, wipe the Bitmask data from the Android settings.</string>
- <string name="not_logged_in_user_status">have not logged in.</string>
- <string name="logging_in_user_status">is logging in.</string>
<string name="logging_in">Logging in</string>
<string name="signing_up">Signing up</string>
- <string name="logging_out_user_status">is logging out.</string>
- <string name="signingup_message">is being registered.</string>
<string name="vpn.button.turn.on">Turn on</string>
<string name="vpn.button.turn.off">Turn off</string>
<string name="vpn_button_turn_off_blocking">Stop blocking</string>
<string name="vpn_securely_routed">Your traffic is securely routed through:</string>
<string name="vpn_securely_routed_no_internet">No internet connection detected, when it comes back we\'ll route your traffic securely through:</string>
- <string name="bitmask_log">Bitmask Log</string>
- <string name="title_activity_main">Bitmask</string>
<string name="log_fragment_title">Log</string>
<string name="vpn_fragment_title">VPN</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="action_example">Example action</string>
<string name="action_settings">Settings</string>
- <string name="void_vpn_establish">Bitmask blocks all outgoing internet traffic.</string>
+ <string name="void_vpn_establish">%s blocks all outgoing internet traffic.</string>
<string name="void_vpn_error_establish">Failed to establish blocking VPN.</string>
<string name="void_vpn_stopped">Stopped blocking all outgoing internet traffic.</string>
<string name="void_vpn_title">Blocking traffic</string>
@@ -102,9 +93,9 @@
<string name="update_certificate">Update certificate</string>
<string name="warning_eip_json_corrupted">Updating provider configuration failed.</string>
<string name="eip_json_corrupted_user_message">Updating provider configuration failed. Please log in to try again.</string>
- <string name="warning_corrupted_provider_details">Stored provider details are corrupted. You can either update Bitmask (recommended) or update the provider details using a commercial CA certificate.</string>
- <string name="warning_corrupted_provider_cert">Stored provider certificate is invalid. You can either update Bitmask (recommended) or update the provider certificate using a commercial CA certificate.</string>
- <string name="warning_expired_provider_cert">Stored provider certificate is expired. You can either update Bitmask (recommended) or update the provider certificate using a commercial CA certificate.</string>
+ <string name="warning_corrupted_provider_details">Stored provider details are corrupted. You can either update %s (recommended) or update the provider details using a commercial CA certificate.</string>
+ <string name="warning_corrupted_provider_cert">Stored provider certificate is invalid. You can either update %s (recommended) or update the provider certificate using a commercial CA certificate.</string>
+ <string name="warning_expired_provider_cert">Stored provider certificate is expired. You can either update %s (recommended) or update the provider certificate using a commercial CA certificate.</string>
<string name="downloading_vpn_certificate_failed">Downloading the VPN certificate failed. Try again or choose another provider.</string>
<string name="vpn_certificate_is_invalid">VPN certificate is invalid. Try to download a new one.</string>
<string name="vpn_certificate_user_message">The VPN certificate is invalid. Please log in to download a new one.</string>