From d6db9433d9f9e0e2f1dc21cd3de7d88d1e473861 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Mon, 19 Feb 2018 13:05:49 +0100 Subject: fix invalid vpn user message --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fa8fcd6c..2ea4670a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -106,5 +106,5 @@ Stored provider certificate is expired. You can either update Bitmask (recommended) or update the provider certificate using a commercial CA certificate. Downloading the VPN certificate failed. Try again or choose another provider. VPN certificate is invalid. Try to download a new one. - The VPN certificate is invalid. Please log in to do download a new one. + The VPN certificate is invalid. Please log in to download a new one. -- cgit v1.2.3 From 1943d9d2dd8fd605e218f81f3403867c6ce75dd5 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Tue, 20 Feb 2018 14:09:53 +0100 Subject: #8860 fix potential nullpointer exception on openvpnservice --- app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java index 6c312c87..f701b7aa 100644 --- a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java +++ b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java @@ -913,7 +913,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac // CONNECTED // Does not work :( notificationManager.buildOpenVpnNotification( - mProfile.mName, + mProfile != null ? mProfile.mName : "", VpnStatus.getLastCleanLogMessage(this), VpnStatus.getLastCleanLogMessage(this), level, @@ -944,7 +944,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac humanReadableByteCount(out, false, getResources()), humanReadableByteCount(diffOut / OpenVPNManagement.mBytecountInterval, true, getResources())); notificationManager.buildOpenVpnNotification( - mProfile.mName, + mProfile != null ? mProfile.mName : "", netstat, null, LEVEL_CONNECTED, @@ -987,7 +987,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac public void requestInputFromUser(int resid, String needed) { VpnStatus.updateStateString("NEED", "need " + needed, resid, LEVEL_WAITING_FOR_USER_INPUT); notificationManager.buildOpenVpnNotification( - mProfile.mName, + mProfile != null ? mProfile.mName : "", getString(resid), getString(resid), LEVEL_WAITING_FOR_USER_INPUT, -- cgit v1.2.3 From 2bb5c64efda2cefcb2f9768f32be2b2936edadef Mon Sep 17 00:00:00 2001 From: cyBerta Date: Tue, 20 Feb 2018 14:11:47 +0100 Subject: #8853 improve backend callback check for error responses --- app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java b/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java index a52df460..a84432e9 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java @@ -74,7 +74,7 @@ public class ConfigHelper { public static boolean checkErroneousDownload(String downloadedString) { try { - if (downloadedString == null || downloadedString.isEmpty() || new JSONObject(downloadedString).has(ProviderAPI.ERRORS)) { + if (downloadedString == null || downloadedString.isEmpty() || new JSONObject(downloadedString).has(ProviderAPI.ERRORS) || new JSONObject(downloadedString).has(ProviderAPI.BACKEND_ERROR_KEY)) { return true; } else { return false; -- cgit v1.2.3 From 8256666a9981ac347e4a6e769e1981007c408b3a Mon Sep 17 00:00:00 2001 From: cyBerta Date: Tue, 20 Feb 2018 14:25:56 +0100 Subject: #8853 fix failing vpn cert download callback for insecure flavor and use new provider method to build the api url --- .../insecure/java/se/leap/bitmaskclient/ProviderApiManager.java | 7 ++----- .../production/java/se/leap/bitmaskclient/ProviderApiManager.java | 8 ++++---- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'app') diff --git a/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java b/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java index 42bd576a..24803564 100644 --- a/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java +++ b/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java @@ -206,9 +206,7 @@ public class ProviderApiManager extends ProviderApiManagerBase { protected Bundle updateVpnCertificate(Provider provider) { Bundle result = new Bundle(); try { - JSONObject providerJson = provider.getDefinition(); - String providerMainUrl = providerJson.getString(Provider.API_URL); - URL newCertStringUrl = new URL(providerMainUrl + "/" + providerJson.getString(Provider.API_VERSION) + "/" + PROVIDER_VPN_CERTIFICATE); + URL newCertStringUrl = new URL(provider.getApiUrlWithVersion() + "/" + PROVIDER_VPN_CERTIFICATE); String certString = downloadWithProviderCA(provider.getCaCert(), newCertStringUrl.toString(), lastDangerOn); if (ConfigHelper.checkErroneousDownload(certString)) { @@ -223,8 +221,7 @@ public class ProviderApiManager extends ProviderApiManagerBase { } } result = loadCertificate(provider, certString); - } catch (IOException | JSONException e) { - // TODO try to get Provider Json + } catch (IOException e) { setErrorResult(result, downloading_vpn_certificate_failed, null); e.printStackTrace(); } diff --git a/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java b/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java index e5ee6c49..de50c170 100644 --- a/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java +++ b/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java @@ -34,6 +34,7 @@ import se.leap.bitmaskclient.eip.EIP; import static android.text.TextUtils.isEmpty; import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY; +import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE; import static se.leap.bitmaskclient.ProviderAPI.ERRORS; import static se.leap.bitmaskclient.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.ERROR_CERTIFICATE_PINNING; @@ -84,6 +85,7 @@ public class ProviderApiManager extends ProviderApiManagerBase { //provider details invalid if (currentDownload.containsKey(ERRORS)) { + currentDownload.putParcelable(PROVIDER_KEY, provider); return currentDownload; } @@ -177,9 +179,7 @@ public class ProviderApiManager extends ProviderApiManagerBase { protected Bundle updateVpnCertificate(Provider provider) { Bundle result = new Bundle(); try { - JSONObject providerJson = provider.getDefinition(); - String providerMainUrl = providerJson.getString(Provider.API_URL); - URL newCertStringUrl = new URL(providerMainUrl + "/" + providerJson.getString(Provider.API_VERSION) + "/" + PROVIDER_VPN_CERTIFICATE); + URL newCertStringUrl = new URL(provider.getApiUrlWithVersion() + "/" + PROVIDER_VPN_CERTIFICATE); String certString = downloadWithProviderCA(provider.getCaCert(), newCertStringUrl.toString()); if (ConfigHelper.checkErroneousDownload(certString)) { @@ -194,7 +194,7 @@ public class ProviderApiManager extends ProviderApiManagerBase { } } return loadCertificate(provider, certString); - } catch (IOException | JSONException e) { + } catch (IOException e) { // TODO try to get Provider Json setErrorResult(result, downloading_vpn_certificate_failed, null); e.printStackTrace(); -- cgit v1.2.3 From 0e762668e0be37d653d5c65c387eb16be8910f50 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Tue, 20 Feb 2018 14:29:28 +0100 Subject: #8853 fix signup for providers that allow only user authed vpn --- .../java/se/leap/bitmaskclient/EipFragment.java | 2 +- .../java/se/leap/bitmaskclient/MainActivity.java | 12 ++----- .../java/se/leap/bitmaskclient/ProviderAPI.java | 1 + .../leap/bitmaskclient/ProviderApiManagerBase.java | 41 +++++++++++----------- .../ProviderCredentialsBaseActivity.java | 18 ++++++---- 5 files changed, 38 insertions(+), 36 deletions(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index fb57aea8..8d1fa03a 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -60,7 +60,7 @@ import static se.leap.bitmaskclient.Constants.REQUEST_CODE_LOG_IN; import static se.leap.bitmaskclient.Constants.REQUEST_CODE_SWITCH_PROVIDER; import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; import static se.leap.bitmaskclient.ProviderAPI.DOWNLOAD_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.ProviderCredentialsBaseActivity.USER_MESSAGE; +import static se.leap.bitmaskclient.ProviderAPI.USER_MESSAGE; import static se.leap.bitmaskclient.R.string.vpn_certificate_user_message; public class EipFragment extends Fragment implements Observer { diff --git a/app/src/main/java/se/leap/bitmaskclient/MainActivity.java b/app/src/main/java/se/leap/bitmaskclient/MainActivity.java index 6e778309..b4be55a4 100644 --- a/app/src/main/java/se/leap/bitmaskclient/MainActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/MainActivity.java @@ -20,7 +20,6 @@ import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; -import org.jetbrains.annotations.NotNull; import org.json.JSONException; import org.json.JSONObject; @@ -58,7 +57,7 @@ import static se.leap.bitmaskclient.ProviderAPI.CORRECTLY_DOWNLOADED_VPN_CERTIFI import static se.leap.bitmaskclient.ProviderAPI.ERRORS; import static se.leap.bitmaskclient.ProviderAPI.INCORRECTLY_DOWNLOADED_EIP_SERVICE; import static se.leap.bitmaskclient.ProviderAPI.INCORRECTLY_DOWNLOADED_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.ProviderCredentialsBaseActivity.USER_MESSAGE; +import static se.leap.bitmaskclient.ProviderAPI.USER_MESSAGE; import static se.leap.bitmaskclient.R.string.downloading_vpn_certificate_failed; import static se.leap.bitmaskclient.R.string.vpn_certificate_user_message; @@ -67,12 +66,7 @@ public class MainActivity extends AppCompatActivity implements Observer { public final static String TAG = MainActivity.class.getSimpleName(); - private static final String KEY_ACTIVITY_STATE = "key state of activity"; - private static final String DEFAULT_UI_STATE = "default state"; - private static final String SHOW_DIALOG_STATE = "show dialog"; - private static final String REASON_TO_FAIL = "reason to fail"; - - private static Provider provider = new Provider(); + private Provider provider = new Provider(); private SharedPreferences preferences; private EipStatus eipStatus; private NavigationDrawerFragment navigationDrawerFragment; @@ -198,7 +192,7 @@ public class MainActivity extends AppCompatActivity implements Observer { break; } } - + //TODO: Why do we want this --v? legacy and redundant? Fragment fragment = new EipFragment(); Bundle arguments = new Bundle(); arguments.putParcelable(PROVIDER_KEY, provider); diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/main/java/se/leap/bitmaskclient/ProviderAPI.java index f5efde05..f1f474d7 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderAPI.java @@ -51,6 +51,7 @@ public class ProviderAPI extends IntentService implements ProviderApiManagerBase ERRORID = "errorId", BACKEND_ERROR_KEY = "error", BACKEND_ERROR_MESSAGE = "message", + USER_MESSAGE = "userMessage", DOWNLOAD_SERVICE_JSON = "ProviderAPI.DOWNLOAD_SERVICE_JSON", PROVIDER_SET_UP = "ProviderAPI.PROVIDER_SET_UP"; diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java b/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java index b93abaeb..2cde431e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java @@ -46,6 +46,7 @@ import java.security.cert.X509Certificate; import java.security.interfaces.RSAPrivateKey; import java.util.ArrayList; import java.util.List; +import java.util.NoSuchElementException; import javax.net.ssl.SSLHandshakeException; @@ -63,19 +64,16 @@ import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY; import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE; import static se.leap.bitmaskclient.ProviderAPI.BACKEND_ERROR_KEY; import static se.leap.bitmaskclient.ProviderAPI.BACKEND_ERROR_MESSAGE; -import static se.leap.bitmaskclient.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.ERROR_CERTIFICATE_PINNING; -import static se.leap.bitmaskclient.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.ERROR_CORRUPTED_PROVIDER_JSON; -import static se.leap.bitmaskclient.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.ERROR_INVALID_CERTIFICATE; -import static se.leap.bitmaskclient.ProviderAPI.CORRECTLY_DOWNLOADED_VPN_CERTIFICATE; import static se.leap.bitmaskclient.ProviderAPI.CORRECTLY_DOWNLOADED_EIP_SERVICE; -import static se.leap.bitmaskclient.ProviderAPI.DOWNLOAD_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.ProviderAPI.CORRECTLY_DOWNLOADED_VPN_CERTIFICATE; import static se.leap.bitmaskclient.ProviderAPI.DOWNLOAD_SERVICE_JSON; +import static se.leap.bitmaskclient.ProviderAPI.DOWNLOAD_VPN_CERTIFICATE; import static se.leap.bitmaskclient.ProviderAPI.ERRORID; import static se.leap.bitmaskclient.ProviderAPI.ERRORS; import static se.leap.bitmaskclient.ProviderAPI.FAILED_LOGIN; import static se.leap.bitmaskclient.ProviderAPI.FAILED_SIGNUP; -import static se.leap.bitmaskclient.ProviderAPI.INCORRECTLY_DOWNLOADED_VPN_CERTIFICATE; import static se.leap.bitmaskclient.ProviderAPI.INCORRECTLY_DOWNLOADED_EIP_SERVICE; +import static se.leap.bitmaskclient.ProviderAPI.INCORRECTLY_DOWNLOADED_VPN_CERTIFICATE; import static se.leap.bitmaskclient.ProviderAPI.LOGOUT_FAILED; import static se.leap.bitmaskclient.ProviderAPI.LOG_IN; import static se.leap.bitmaskclient.ProviderAPI.LOG_OUT; @@ -90,15 +88,18 @@ import static se.leap.bitmaskclient.ProviderAPI.SUCCESSFUL_LOGIN; import static se.leap.bitmaskclient.ProviderAPI.SUCCESSFUL_LOGOUT; import static se.leap.bitmaskclient.ProviderAPI.SUCCESSFUL_SIGNUP; import static se.leap.bitmaskclient.ProviderAPI.UPDATE_PROVIDER_DETAILS; +import static se.leap.bitmaskclient.ProviderAPI.USER_MESSAGE; +import static se.leap.bitmaskclient.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.ERROR_CERTIFICATE_PINNING; +import static se.leap.bitmaskclient.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.ERROR_CORRUPTED_PROVIDER_JSON; +import static se.leap.bitmaskclient.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.ERROR_INVALID_CERTIFICATE; import static se.leap.bitmaskclient.R.string.certificate_error; -import static se.leap.bitmaskclient.R.string.switch_provider_menu_option; -import static se.leap.bitmaskclient.R.string.vpn_certificate_is_invalid; import static se.leap.bitmaskclient.R.string.error_io_exception_user_message; import static se.leap.bitmaskclient.R.string.error_json_exception_user_message; import static se.leap.bitmaskclient.R.string.error_no_such_algorithm_exception_user_message; import static se.leap.bitmaskclient.R.string.malformed_url; import static se.leap.bitmaskclient.R.string.server_unreachable_message; import static se.leap.bitmaskclient.R.string.service_is_down_error; +import static se.leap.bitmaskclient.R.string.vpn_certificate_is_invalid; 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; @@ -290,7 +291,7 @@ public abstract class ProviderApiManagerBase { JSONObject stepResult = null; OkHttpClient okHttpClient = clientGenerator.initSelfSignedCAHttpClient(provider.getCaCert(), stepResult); if (okHttpClient == null) { - return authFailedNotification(stepResult, username); + return backendErrorNotification(stepResult, username); } LeapSRPSession client = new LeapSRPSession(username, password); @@ -302,7 +303,7 @@ public abstract class ProviderApiManagerBase { Bundle result = new Bundle(); if (api_result.has(ERRORS) || api_result.has(BACKEND_ERROR_KEY)) - result = authFailedNotification(api_result, username); + result = backendErrorNotification(api_result, username); else { result.putString(CREDENTIALS_USERNAME, username); result.putString(CREDENTIALS_PASSWORD, password); @@ -349,7 +350,7 @@ public abstract class ProviderApiManagerBase { OkHttpClient okHttpClient = clientGenerator.initSelfSignedCAHttpClient(provider.getCaCert(), stepResult); if (okHttpClient == null) { - return authFailedNotification(stepResult, username); + return backendErrorNotification(stepResult, username); } LeapSRPSession client = new LeapSRPSession(username, password); @@ -367,15 +368,15 @@ public abstract class ProviderApiManagerBase { if (client.verify(M2)) { result.putBoolean(BROADCAST_RESULT_KEY, true); } else { - authFailedNotification(step_result, username); + backendErrorNotification(step_result, username); } } else { result.putBoolean(BROADCAST_RESULT_KEY, false); result.putString(CREDENTIALS_USERNAME, username); - result.putString(resources.getString(R.string.user_message), resources.getString(R.string.error_srp_math_error_user_message)); + result.putString(USER_MESSAGE, resources.getString(R.string.error_srp_math_error_user_message)); } } catch (JSONException e) { - result = authFailedNotification(step_result, username); + result = backendErrorNotification(step_result, username); e.printStackTrace(); } @@ -391,7 +392,7 @@ public abstract class ProviderApiManagerBase { return true; } - private Bundle authFailedNotification(JSONObject result, String username) { + private Bundle backendErrorNotification(JSONObject result, String username) { Bundle userNotificationBundle = new Bundle(); if (result.has(ERRORS)) { Object baseErrorMessage = result.opt(ERRORS); @@ -400,14 +401,14 @@ public abstract class ProviderApiManagerBase { JSONObject errorMessage = result.getJSONObject(ERRORS); String errorType = errorMessage.keys().next().toString(); String message = errorMessage.get(errorType).toString(); - userNotificationBundle.putString(resources.getString(R.string.user_message), message); - } catch (JSONException e) { + userNotificationBundle.putString(USER_MESSAGE, message); + } catch (JSONException | NoSuchElementException | NullPointerException e) { e.printStackTrace(); } } else if (baseErrorMessage instanceof String) { try { String errorMessage = result.getString(ERRORS); - userNotificationBundle.putString(resources.getString(R.string.user_message), errorMessage); + userNotificationBundle.putString(USER_MESSAGE, errorMessage); } catch (JSONException e) { e.printStackTrace(); } @@ -418,7 +419,7 @@ public abstract class ProviderApiManagerBase { if (result.has(BACKEND_ERROR_MESSAGE)) { backendErrorMessage = resources.getString(R.string.error) + result.getString(BACKEND_ERROR_MESSAGE); } - userNotificationBundle.putString(resources.getString(R.string.user_message), backendErrorMessage); + userNotificationBundle.putString(USER_MESSAGE, backendErrorMessage); } catch (JSONException e) { e.printStackTrace(); } @@ -431,7 +432,7 @@ public abstract class ProviderApiManagerBase { return userNotificationBundle; } - void sendToReceiverOrBroadcast(ResultReceiver receiver, int resultCode, Bundle resultData, Provider provider) { + private void sendToReceiverOrBroadcast(ResultReceiver receiver, int resultCode, Bundle resultData, Provider provider) { if (resultData == null || resultData == Bundle.EMPTY) { resultData = new Bundle(); } diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java index d41be512..e6877756 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java @@ -30,6 +30,7 @@ import org.json.JSONException; import butterknife.InjectView; import butterknife.OnClick; import se.leap.bitmaskclient.Constants.CREDENTIAL_ERRORS; +import se.leap.bitmaskclient.eip.EipCommand; import se.leap.bitmaskclient.userstatus.User; import static android.view.View.GONE; @@ -41,9 +42,12 @@ import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY; import static se.leap.bitmaskclient.Constants.CREDENTIALS_PASSWORD; import static se.leap.bitmaskclient.Constants.CREDENTIALS_USERNAME; import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; +import static se.leap.bitmaskclient.ProviderAPI.BACKEND_ERROR_KEY; import static se.leap.bitmaskclient.ProviderAPI.DOWNLOAD_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.ProviderAPI.ERRORS; import static se.leap.bitmaskclient.ProviderAPI.LOG_IN; import static se.leap.bitmaskclient.ProviderAPI.SIGN_UP; +import static se.leap.bitmaskclient.ProviderAPI.USER_MESSAGE; /** * Base Activity for activities concerning a provider interaction @@ -59,7 +63,6 @@ public abstract class ProviderCredentialsBaseActivity extends ConfigWizardBaseAc final private static String SHOWING_FORM = "SHOWING_FORM"; final private static String PERFORMING_ACTION = "PERFORMING_ACTION"; - final public static String USER_MESSAGE = "USER_MESSAGE"; final private static String USERNAME_ERROR = "USERNAME_ERROR"; final private static String PASSWORD_ERROR = "PASSWORD_ERROR"; final private static String PASSWORD_VERIFICATION_ERROR = "PASSWORD_VERIFICATION_ERROR"; @@ -344,8 +347,8 @@ public abstract class ProviderCredentialsBaseActivity extends ConfigWizardBaseAc if (arguments.containsKey(CREDENTIAL_ERRORS.USERNAME_MISSING.toString())) { usernameError.setError(getString(R.string.username_ask)); } - if (arguments.containsKey(getString(R.string.user_message))) { - String userMessageString = arguments.getString(getString(R.string.user_message)); + if (arguments.containsKey(USER_MESSAGE)) { + String userMessageString = arguments.getString(USER_MESSAGE); try { userMessageString = new JSONArray(userMessageString).getString(0); } catch (JSONException e) { @@ -395,6 +398,10 @@ public abstract class ProviderCredentialsBaseActivity extends ConfigWizardBaseAc switch (resultCode) { case ProviderAPI.SUCCESSFUL_SIGNUP: + String password = resultData.getString(CREDENTIALS_PASSWORD); + String username = resultData.getString(CREDENTIALS_USERNAME); + login(username, password); + break; case ProviderAPI.SUCCESSFUL_LOGIN: downloadVpnCertificate(handledProvider); break; @@ -403,12 +410,11 @@ public abstract class ProviderCredentialsBaseActivity extends ConfigWizardBaseAc handleReceivedErrors((Bundle) intent.getParcelableExtra(BROADCAST_RESULT_KEY)); break; + case ProviderAPI.INCORRECTLY_DOWNLOADED_VPN_CERTIFICATE: + // error handling takes place in MainActivity case ProviderAPI.CORRECTLY_DOWNLOADED_VPN_CERTIFICATE: successfullyFinished(handledProvider); break; - case ProviderAPI.INCORRECTLY_DOWNLOADED_VPN_CERTIFICATE: - // TODO activity.setResult(RESULT_CANCELED); - break; } } } -- cgit v1.2.3 From c6c9ca844a50d9469e632a3356389f08e7f6f455 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Tue, 20 Feb 2018 15:17:06 +0100 Subject: #8853 show 'It doesn\'t seem to be a Bitmask provider' if entered URL is crap --- app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java | 2 +- app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java b/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java index 24803564..798b6433 100644 --- a/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java +++ b/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java @@ -140,7 +140,7 @@ public class ProviderApiManager extends ProviderApiManagerBase { else providerDotJsonString = downloadFromApiUrlWithProviderCA("/provider.json", caCert, providerDefinition, dangerOn); - if (!isValidJson(providerDotJsonString)) { + if (ConfigHelper.checkErroneousDownload(providerDotJsonString) || !isValidJson(providerDotJsonString)) { result.putString(ERRORS, resources.getString(malformed_url)); result.putBoolean(BROADCAST_RESULT_KEY, false); return result; diff --git a/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java b/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java index de50c170..885d69db 100644 --- a/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java +++ b/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java @@ -123,7 +123,7 @@ public class ProviderApiManager extends ProviderApiManagerBase { providerDotJsonString = downloadFromApiUrlWithProviderCA("/provider.json", caCert, providerDefinition); } - if (!isValidJson(providerDotJsonString)) { + if (ConfigHelper.checkErroneousDownload(providerDotJsonString) || !isValidJson(providerDotJsonString)) { setErrorResult(result, malformed_url, null); return result; } -- cgit v1.2.3 From 339251605b689d6afd4708d851d42d91fd1d3fa5 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Tue, 20 Feb 2018 16:01:31 +0100 Subject: #8853 fix provider setup with codigosur.org --- .../main/java/se/leap/bitmaskclient/Provider.java | 32 +++++----------------- 1 file changed, 7 insertions(+), 25 deletions(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/Provider.java b/app/src/main/java/se/leap/bitmaskclient/Provider.java index 7104143c..98662783 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Provider.java +++ b/app/src/main/java/se/leap/bitmaskclient/Provider.java @@ -90,9 +90,8 @@ public final class Provider implements Parcelable { } if (definition != null) { try { - this.definition = new JSONObject(definition); - parseDefinition(this.definition); - } catch (JSONException | NullPointerException e) { + define(new JSONObject(definition)); + } catch (JSONException e) { e.printStackTrace(); } } @@ -133,26 +132,8 @@ public final class Provider implements Parcelable { } public boolean define(JSONObject providerJson) { - /* - * fix against "api_uri": "https://calyx.net.malicious.url.net:4430", - * This method aims to prevent attacks where the provider.json file got manipulated by a third party. - * The main url should not change. - */ - - try { - String providerApiUrl = providerJson.getString(Provider.API_URL); - String providerDomain = providerJson.getString(Provider.DOMAIN); - if (getMainUrlString().contains(providerDomain) && providerApiUrl.contains(providerDomain + ":")) { - definition = providerJson; - parseDefinition(definition); - return true; - } else { - return false; - } - } catch (JSONException e) { - e.printStackTrace(); - return false; - } + definition = providerJson; + return parseDefinition(definition); } public JSONObject getDefinition() { @@ -345,7 +326,7 @@ public final class Provider implements Parcelable { } } - private void parseDefinition(JSONObject definition) { + private boolean parseDefinition(JSONObject definition) { try { String pin = definition.getString(CA_CERT_FINGERPRINT); this.certificatePin = pin.split(":")[1].trim(); @@ -354,8 +335,9 @@ public final class Provider implements Parcelable { this.allowAnonymous = definition.getJSONObject(Provider.SERVICE).getBoolean(PROVIDER_ALLOW_ANONYMOUS); this.allowRegistered = definition.getJSONObject(Provider.SERVICE).getBoolean(PROVIDER_ALLOWED_REGISTERED); this.apiVersion = getDefinition().getString(Provider.API_VERSION); + return true; } catch (JSONException | ArrayIndexOutOfBoundsException | MalformedURLException e) { - e.printStackTrace(); + return false; } } -- cgit v1.2.3 From e4f4521f9d50aad80a7c689eb949e75d1b521bac Mon Sep 17 00:00:00 2001 From: cyBerta Date: Wed, 21 Feb 2018 11:12:21 +0100 Subject: #8858 add custom providers to the providers list on successful setup --- app/assets/urls/calyx.net.url | 2 +- app/assets/urls/demo.bitmask.net.url | 2 +- app/assets/urls/riseup.net.url | 2 +- .../main/java/se/leap/bitmaskclient/Provider.java | 3 -- .../bitmaskclient/ProviderListBaseActivity.java | 3 +- .../se/leap/bitmaskclient/ProviderManager.java | 50 +++++++++++++++++++--- .../leap/bitmaskclient/ProviderListActivity.java | 3 +- .../java/se/leap/bitmaskclient/ProviderTest.java | 30 +++++++++++++ 8 files changed, 81 insertions(+), 14 deletions(-) (limited to 'app') diff --git a/app/assets/urls/calyx.net.url b/app/assets/urls/calyx.net.url index 8de04fe9..807e9e18 100644 --- a/app/assets/urls/calyx.net.url +++ b/app/assets/urls/calyx.net.url @@ -1,3 +1,3 @@ { - "main_url" : "https://calyx.net/" + "main_url" : "https://calyx.net" } diff --git a/app/assets/urls/demo.bitmask.net.url b/app/assets/urls/demo.bitmask.net.url index 1a412055..0c4de648 100644 --- a/app/assets/urls/demo.bitmask.net.url +++ b/app/assets/urls/demo.bitmask.net.url @@ -1,3 +1,3 @@ { - "main_url" : "https://demo.bitmask.net/" + "main_url" : "https://demo.bitmask.net" } diff --git a/app/assets/urls/riseup.net.url b/app/assets/urls/riseup.net.url index 4548b433..42cdb979 100644 --- a/app/assets/urls/riseup.net.url +++ b/app/assets/urls/riseup.net.url @@ -1,3 +1,3 @@ { - "main_url" : "https://riseup.net/" + "main_url" : "https://riseup.net" } diff --git a/app/src/main/java/se/leap/bitmaskclient/Provider.java b/app/src/main/java/se/leap/bitmaskclient/Provider.java index 7104143c..f4e2c477 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Provider.java +++ b/app/src/main/java/se/leap/bitmaskclient/Provider.java @@ -297,8 +297,6 @@ public final class Provider implements Parcelable { try { json.put(Provider.MAIN_URL, mainUrl); //TODO: add other fields here? - //this is used to save custom providers as json. I guess this doesn't work correctly - //TODO 2: verify that } catch (JSONException e) { e.printStackTrace(); } @@ -446,5 +444,4 @@ public final class Provider implements Parcelable { allowRegistered = false; allowAnonymous = false; } - } diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java index e961b0a2..3bf51a8c 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java @@ -207,7 +207,8 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity void handleProviderSetUp(Provider handledProvider) { this.provider = handledProvider; - + adapter.add(provider); + adapter.saveProviders(); if (provider.allowsAnonymous()) { mConfigState.putExtra(SERVICES_RETRIEVED, true); downloadVpnCertificate(); diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderManager.java b/app/src/main/java/se/leap/bitmaskclient/ProviderManager.java index ed41be67..b625c336 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderManager.java @@ -31,6 +31,8 @@ public class ProviderManager implements AdapteeCollection { private File externalFilesDir; private Set defaultProviders; private Set customProviders; + private Set defaultProviderURLs; + private Set customProviderURLs; private static ProviderManager instance; @@ -52,11 +54,20 @@ public class ProviderManager implements AdapteeCollection { private void addDefaultProviders(AssetManager assets_manager) { try { defaultProviders = providersFromAssets(URLS, assets_manager.list(URLS)); + defaultProviderURLs = getProviderUrlSetFromProviderSet(defaultProviders); } catch (IOException e) { e.printStackTrace(); } } + private Set getProviderUrlSetFromProviderSet(Set providers) { + HashSet providerUrls = new HashSet<>(); + for (Provider provider : providers) { + providerUrls.add(provider.getMainUrl().getUrl()); + } + return providerUrls; + } + private Set providersFromAssets(String directory, String[] relativeFilePaths) { Set providers = new HashSet<>(); @@ -89,6 +100,7 @@ public class ProviderManager implements AdapteeCollection { customProviders = externalFilesDir != null && externalFilesDir.isDirectory() ? providersFromFiles(externalFilesDir.list()) : new HashSet(); + customProviderURLs = getProviderUrlSetFromProviderSet(customProviders); } private Set providersFromFiles(String[] files) { @@ -132,6 +144,8 @@ public class ProviderManager implements AdapteeCollection { allProviders.addAll(defaultProviders); if(customProviders != null) allProviders.addAll(customProviders); + //add an option to add a custom provider + //TODO: refactor me? allProviders.add(new Provider()); return allProviders; } @@ -153,30 +167,56 @@ public class ProviderManager implements AdapteeCollection { @Override public boolean add(Provider element) { - return !defaultProviders.contains(element) || customProviders.add(element); + return element != null && + !defaultProviderURLs.contains(element.getMainUrl().getUrl()) && + customProviders.add(element) && + customProviderURLs.add(element.getMainUrl().getUrl()); } @Override public boolean remove(Object element) { - return customProviders.remove(element); + return element instanceof Provider && + customProviders.remove(element) && + customProviderURLs.remove(((Provider) element).getMainUrl().getUrl()); } @Override public boolean addAll(Collection elements) { - return customProviders.addAll(elements); + Iterator iterator = elements.iterator(); + boolean addedAll = true; + while (iterator.hasNext()) { + Provider p = (Provider) iterator.next(); + addedAll = customProviders.add(p) && + customProviderURLs.add(p.getMainUrl().getUrl()) && + addedAll; + } + return addedAll; } @Override public boolean removeAll(Collection elements) { - if(!elements.getClass().equals(Provider.class)) + Iterator iterator = elements.iterator(); + boolean removedAll = true; + try { + while (iterator.hasNext()) { + Provider p = (Provider) iterator.next(); + removedAll = ((defaultProviders.remove(p) && defaultProviderURLs.remove(p.getMainUrl().getUrl())) || + (customProviders.remove(p) && customProviderURLs.remove(p.getMainUrl().getUrl()))) && + removedAll; + } + } catch (ClassCastException e) { return false; - return defaultProviders.removeAll(elements) || customProviders.removeAll(elements); + } + + return removedAll; } @Override public void clear() { defaultProviders.clear(); customProviders.clear(); + customProviderURLs.clear(); + defaultProviderURLs.clear(); } void saveCustomProvidersToFile() { diff --git a/app/src/production/java/se/leap/bitmaskclient/ProviderListActivity.java b/app/src/production/java/se/leap/bitmaskclient/ProviderListActivity.java index b6e67331..cf1d1aa6 100644 --- a/app/src/production/java/se/leap/bitmaskclient/ProviderListActivity.java +++ b/app/src/production/java/se/leap/bitmaskclient/ProviderListActivity.java @@ -39,11 +39,10 @@ public class ProviderListActivity extends ProviderListBaseActivity { setUpProvider(); } + @Override public void showAndSelectProvider(String provider_main_url) { try { provider = new Provider(new URL((provider_main_url))); - adapter.add(provider); - adapter.saveProviders(); autoSelectProvider(provider); } catch (MalformedURLException e) { e.printStackTrace(); diff --git a/app/src/test/java/se/leap/bitmaskclient/ProviderTest.java b/app/src/test/java/se/leap/bitmaskclient/ProviderTest.java index 794c3087..495d5b3f 100644 --- a/app/src/test/java/se/leap/bitmaskclient/ProviderTest.java +++ b/app/src/test/java/se/leap/bitmaskclient/ProviderTest.java @@ -1,9 +1,15 @@ package se.leap.bitmaskclient; +import org.json.JSONException; import org.junit.Test; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + import se.leap.bitmaskclient.testutils.TestSetupHelper; +import static junit.framework.Assert.assertFalse; import static org.junit.Assert.assertTrue; /** @@ -18,4 +24,28 @@ public class ProviderTest { assertTrue("Providers should be same:", p1.equals(p2)); } + @Test + public void testEquals_sameFields_returnsFalse() throws Exception { + Provider p1 = TestSetupHelper.getConfiguredProvider(); + Provider p2 = TestSetupHelper.getConfiguredProvider(); + p2.setMainUrl("http://somethingsdiffer.org"); + assertFalse("Providers should be same:", p1.equals(p2)); + } + + // see ProviderManagerTest testing add(...) + @Test + public void testEqualsThroughSetContains_differentFields_returnsFalse() throws Exception { + Provider p1 = TestSetupHelper.getConfiguredProvider(); + Provider p2 = TestSetupHelper.getConfiguredProvider(); + p2.setMainUrl("http://somethingsdiffer.org"); + Provider p3 = new Provider("https://anotherprovider.net"); + + Set defaultProviders = new HashSet<>(); + defaultProviders.add(p1); + defaultProviders.add(p2); + + assertTrue(defaultProviders.contains(p1)); + assertTrue(defaultProviders.contains(p2)); + assertFalse(defaultProviders.contains(p3)); + } } -- cgit v1.2.3 From 8e23cc34861f1b9fe5e04cdcf24563ffedf568b0 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Wed, 21 Feb 2018 15:00:40 +0100 Subject: #8858 write tests for ProviderManager and some related refactorings --- .../java/se/leap/bitmaskclient/ConfigHelper.java | 40 ++++++--------------- .../se/leap/bitmaskclient/ProviderManager.java | 3 +- .../leap/bitmaskclient/testutils/MockHelper.java | 15 +++++++- .../test/resources/externalDir/leapcolombia.json | 3 ++ .../test/resources/preconfigured/calyx.net.json | 37 +++++++++++++++++++ app/src/test/resources/preconfigured/calyx.net.pem | 31 ++++++++++++++++ .../resources/preconfigured/demo.bitmask.net.json | 42 ++++++++++++++++++++++ .../resources/preconfigured/demo.bitmask.net.pem | 32 +++++++++++++++++ .../test/resources/preconfigured/riseup.net.json | 37 +++++++++++++++++++ .../test/resources/preconfigured/riseup.net.pem | 32 +++++++++++++++++ .../resources/preconfigured/urls/calyx.net.url | 3 ++ .../preconfigured/urls/demo.bitmask.net.url | 3 ++ .../resources/preconfigured/urls/riseup.net.url | 3 ++ 13 files changed, 250 insertions(+), 31 deletions(-) create mode 100644 app/src/test/resources/externalDir/leapcolombia.json create mode 100644 app/src/test/resources/preconfigured/calyx.net.json create mode 100644 app/src/test/resources/preconfigured/calyx.net.pem create mode 100644 app/src/test/resources/preconfigured/demo.bitmask.net.json create mode 100644 app/src/test/resources/preconfigured/demo.bitmask.net.pem create mode 100644 app/src/test/resources/preconfigured/riseup.net.json create mode 100644 app/src/test/resources/preconfigured/riseup.net.pem create mode 100644 app/src/test/resources/preconfigured/urls/calyx.net.url create mode 100644 app/src/test/resources/preconfigured/urls/demo.bitmask.net.url create mode 100644 app/src/test/resources/preconfigured/urls/riseup.net.url (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java b/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java index a52df460..083f4da3 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java @@ -27,6 +27,8 @@ import org.spongycastle.util.encoders.Base64; import java.io.BufferedReader; import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -47,9 +49,11 @@ import java.security.interfaces.RSAPrivateKey; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Set; import static android.R.attr.name; import static se.leap.bitmaskclient.Constants.PREFERENCES_APP_VERSION; @@ -125,36 +129,14 @@ public class ConfigHelper { return (X509Certificate) certificate; } + public static String loadInputStreamAsString(java.io.InputStream is) { + java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A"); + return s.hasNext() ? s.next() : ""; + } - public static String loadInputStreamAsString(InputStream inputStream) { - BufferedReader in = null; - try { - StringBuilder buf = new StringBuilder(); - in = new BufferedReader(new InputStreamReader(inputStream)); - - String str; - boolean isFirst = true; - while ( (str = in.readLine()) != null ) { - if (isFirst) - isFirst = false; - else - buf.append('\n'); - buf.append(str); - } - return buf.toString(); - } catch (IOException e) { - Log.e(TAG, "Error opening asset " + name); - } finally { - if (in != null) { - try { - in.close(); - } catch (IOException e) { - Log.e(TAG, "Error closing asset " + name); - } - } - } - - return null; + //allows us to mock FileInputStream + public static InputStream getInputStreamFrom(String filePath) throws FileNotFoundException { + return new FileInputStream(filePath); } protected static RSAPrivateKey parseRsaKeyFromString(String rsaKeyString) { diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderManager.java b/app/src/main/java/se/leap/bitmaskclient/ProviderManager.java index b625c336..97ba3b98 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderManager.java @@ -107,7 +107,7 @@ public class ProviderManager implements AdapteeCollection { Set providers = new HashSet<>(); try { for (String file : files) { - String mainUrl = extractMainUrlFromInputStream(new FileInputStream(externalFilesDir.getAbsolutePath() + "/" + file)); + String mainUrl = extractMainUrlFromInputStream(ConfigHelper.getInputStreamFrom(externalFilesDir.getAbsolutePath() + "/" + file)); providers.add(new Provider(new URL(mainUrl))); } } catch (MalformedURLException | FileNotFoundException e) { @@ -219,6 +219,7 @@ public class ProviderManager implements AdapteeCollection { defaultProviderURLs.clear(); } + //FIXME: removed custom providers should be deleted here as well void saveCustomProvidersToFile() { try { for (Provider provider : customProviders) { diff --git a/app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java b/app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java index c2362c7b..d85b050f 100644 --- a/app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java +++ b/app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java @@ -14,6 +14,7 @@ import org.json.JSONObject; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.security.NoSuchAlgorithmException; @@ -29,7 +30,6 @@ import java.util.Set; import okhttp3.OkHttpClient; import se.leap.bitmaskclient.ConfigHelper; -import se.leap.bitmaskclient.Constants; import se.leap.bitmaskclient.OkHttpClientGenerator; import se.leap.bitmaskclient.Provider; import se.leap.bitmaskclient.R; @@ -343,6 +343,18 @@ public class MockHelper { return resultReceiver; } + public static void mockConfigHelperForFileInputStream() throws FileNotFoundException { + mockStatic(ConfigHelper.class); + when(ConfigHelper.loadInputStreamAsString(any(InputStream.class))).thenCallRealMethod(); + when(ConfigHelper.getInputStreamFrom(anyString())).thenAnswer(new Answer() { + @Override + public InputStream answer(InvocationOnMock invocation) throws Throwable { + String filename = (String) invocation.getArguments()[0]; + return getClass().getClassLoader().getResourceAsStream(filename); + } + }); + } + public static void mockConfigHelper(String mockedFingerprint, final Provider providerFromPrefs) throws CertificateEncodingException, NoSuchAlgorithmException { // FIXME use MockSharedPreferences instead of provider mockStatic(ConfigHelper.class); @@ -366,6 +378,7 @@ public class MockHelper { when(ConfigHelper.getFingerprintFromCertificate(any(X509Certificate.class), anyString())).thenReturn(mockedFingerprint); when(ConfigHelper.checkErroneousDownload(anyString())).thenCallRealMethod(); when(ConfigHelper.parseX509CertificateFromString(anyString())).thenCallRealMethod(); + when(ConfigHelper.loadInputStreamAsString(any(InputStream.class))).thenCallRealMethod(); } public static void mockFingerprintForCertificate(String mockedFingerprint) throws CertificateEncodingException, NoSuchAlgorithmException { mockStatic(ConfigHelper.class); diff --git a/app/src/test/resources/externalDir/leapcolombia.json b/app/src/test/resources/externalDir/leapcolombia.json new file mode 100644 index 00000000..6820988c --- /dev/null +++ b/app/src/test/resources/externalDir/leapcolombia.json @@ -0,0 +1,3 @@ +{ + "main_url" : "https://leapcolombia.org" +} \ No newline at end of file diff --git a/app/src/test/resources/preconfigured/calyx.net.json b/app/src/test/resources/preconfigured/calyx.net.json new file mode 100644 index 00000000..30ab43c5 --- /dev/null +++ b/app/src/test/resources/preconfigured/calyx.net.json @@ -0,0 +1,37 @@ +{ + "api_uri": "https://calyx.net:4430", + "api_version": "1", + "ca_cert_fingerprint": "SHA256: 43683c9ba3862c5384a8c1885072fcac40b5d2d4dd67331443f13a3077fa2e69", + "ca_cert_uri": "https://calyx.net/ca.crt", + "default_language": "en", + "description": { + "en": "Calyx Institute privacy focused ISP testbed" + }, + "domain": "calyx.net", + "enrollment_policy": "open", + "languages": [ + "en" + ], + "name": { + "en": "calyx" + }, + "service": { + "allow_anonymous": false, + "allow_free": true, + "allow_limited_bandwidth": false, + "allow_paid": false, + "allow_registration": true, + "allow_unlimited_bandwidth": true, + "bandwidth_limit": 102400, + "default_service_level": 1, + "levels": { + "1": { + "description": "Please donate.", + "name": "free" + } + } + }, + "services": [ + "openvpn" + ] +} \ No newline at end of file diff --git a/app/src/test/resources/preconfigured/calyx.net.pem b/app/src/test/resources/preconfigured/calyx.net.pem new file mode 100644 index 00000000..cedb2e38 --- /dev/null +++ b/app/src/test/resources/preconfigured/calyx.net.pem @@ -0,0 +1,31 @@ +-----BEGIN CERTIFICATE----- +MIIFYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQ0FADBEMQ4wDAYDVQQKDAVjYWx5 +eDEaMBgGA1UECwwRaHR0cHM6Ly9jYWx5eC5uZXQxFjAUBgNVBAMMDWNhbHl4IFJv +b3QgQ0EwHhcNMTMwNzAyMDAwMDAwWhcNMjMwNzAyMDAwMDAwWjBEMQ4wDAYDVQQK +DAVjYWx5eDEaMBgGA1UECwwRaHR0cHM6Ly9jYWx5eC5uZXQxFjAUBgNVBAMMDWNh +bHl4IFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDupdnx +Bgat537XOqrZOulE/RvjoXB1S07sy9/MMtksXFoQuWJZRCSTp1Jaqg3H/e9o1nct +LQO91+izfJe07TUyajFl7CfllYgMeyKTYcT85dFwNX4pcIHZr8UpmO0MpGBoR4W1 +8cPa3vxAG0CsyUmrASJVyhRouk4qazRosM5RwBxTdMzCK7L3SwqPQoxlY9YmRJlD +XYZlK5VMJd0dj9XxhMeFs5n43R0bsDENryrExSbuxoNfnUoQg3wffKk+Z0gW7YgW +ivPsbObqOgXUuBEU0xr9xMNBpU33ffLIsccrHq1EKp8zGfCOcww6v7+zEadUkVLo +6j/rRhYYgRw9lijZG1rMuV/mTGnUqbjHsdoz5mzkFFWeTSqo44lvhveUyCcwRNmi +2sjS77l0fCTzfreufffFoOEcRVMRfsnJdu/xPeARoXILEx8nQ421mSn6spOZlDQr +Tt0T0BAWt+VNc+m0IGSW3SwS7r5MUyQ/M5GrbQBGi5W2SzPriKZ79YTOwPVmXKLZ +vJoEuKRDkEPJLBAhcD5oSQljOm/Wp/hjmRH4HnI1y4XMshWlDsyRDB1Au5yrsfwN +noFVSskEcbXlZfNgml4lktLBqz+qwsw+voq6Ak7ROKbc0ii5s8+iNMbAtIK7GcFF +kuKKIyRmmGlDim/SDhlNdWo7Ah4Akde7zfWufwIDAQABo2AwXjAdBgNVHQ4EFgQU +AY8+K4ZupAQ+L9ttFJG3vaLBq5gwDgYDVR0PAQH/BAQDAgIEMAwGA1UdEwQFMAMB +Af8wHwYDVR0jBBgwFoAUAY8+K4ZupAQ+L9ttFJG3vaLBq5gwDQYJKoZIhvcNAQEN +BQADggIBAOpXi5o3g/2o2rPa53iG7Zgcy8RpePGgZk6xknGYWeLamEqSh+XWQZ2w +2kQP54bf8HfPj3ugJBWsVtYAs/ltJwzeBfYDrwEJd1N8tw2IRuGlQOWiTAVVLBj4 +Zs+dikSuMoA399f/7BlUIEpVLUiV/emTtbkjFnDeKEV9zql6ypR0BtR8Knf8ALvL +YfMsWLvTe4rXeypzxIaE2pn8ttcXLYAX0ml2MofTi5xcDhMn1vznKIvs82xhncQx +I1MJMWqPHNHgJUJpA+y1IFh5LPbpag9PKQ0yQ9sM+/dyGumF2jElsMw71flh/Txr +2dEv8+FNV1pPK26XJZBK24rNWFs30eAFfH9EQCwVla174I4PDoWqsIR7vtQMObDt +Bq34R3TjjJJIt2sCSlYLooWwiK7Q+d/SgYqA+MSDmmwhzm86ToK6cwbCsvuw1AxR +X6VIs4U8wOotgljzX/CSpKqlxcqZjhnAuelZ1+KiN8RHKPj7AzSLYOv/YwTjLTIq +EOxquoNR58uDa5pBG22a7xWbSaKosn/mEl8SrUr6klzzc8Vh09IMoxrw74uLdAg2 +1jnrhm7qg91Ttb0aXiqbV+Kg/qQzojdewnnoBFnv4jaQ3y8zDCfMhsBtWlWz4Knb +Zqga1WyRm3Gj1j6IV0oOincYMrw5YA7bgXpwop/Lo/mmliMA14ps +-----END CERTIFICATE----- \ No newline at end of file diff --git a/app/src/test/resources/preconfigured/demo.bitmask.net.json b/app/src/test/resources/preconfigured/demo.bitmask.net.json new file mode 100644 index 00000000..e7fe6099 --- /dev/null +++ b/app/src/test/resources/preconfigured/demo.bitmask.net.json @@ -0,0 +1,42 @@ +{ + "api_uri": "https://api.demo.bitmask.net:4430", + "api_version": "1", + "ca_cert_fingerprint": "SHA256: 0f17c033115f6b76ff67871872303ff65034efe7dd1b910062ca323eb4da5c7e", + "ca_cert_uri": "https://demo.bitmask.net/ca.crt", + "default_language": "en", + "description": { + "el": "demo.bitmask.net allows you to test the Bitmask application. User accounts may be periodically deleted.", + "en": "demo.bitmask.net allows you to test the Bitmask application. User accounts may be periodically deleted.", + "es": "demo.bitmask.net allows you to test the Bitmask application. User accounts may be periodically deleted." + }, + "domain": "demo.bitmask.net", + "enrollment_policy": "open", + "languages": [ + "de", + "en", + "es", + "pt" + ], + "name": { + "en": "Bitmask" + }, + "service": { + "allow_anonymous": true, + "allow_free": true, + "allow_limited_bandwidth": false, + "allow_paid": false, + "allow_registration": true, + "allow_unlimited_bandwidth": true, + "bandwidth_limit": 102400, + "default_service_level": 1, + "levels": { + "1": { + "description": "Please donate.", + "name": "free" + } + } + }, + "services": [ + "openvpn" + ] +} \ No newline at end of file diff --git a/app/src/test/resources/preconfigured/demo.bitmask.net.pem b/app/src/test/resources/preconfigured/demo.bitmask.net.pem new file mode 100644 index 00000000..9a422161 --- /dev/null +++ b/app/src/test/resources/preconfigured/demo.bitmask.net.pem @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIIFbzCCA1egAwIBAgIBATANBgkqhkiG9w0BAQ0FADBKMRgwFgYDVQQDDA9CaXRt +YXNrIFJvb3QgQ0ExEDAOBgNVBAoMB0JpdG1hc2sxHDAaBgNVBAsME2h0dHBzOi8v +Yml0bWFzay5uZXQwHhcNMTIxMTA2MDAwMDAwWhcNMjIxMTA2MDAwMDAwWjBKMRgw +FgYDVQQDDA9CaXRtYXNrIFJvb3QgQ0ExEDAOBgNVBAoMB0JpdG1hc2sxHDAaBgNV +BAsME2h0dHBzOi8vYml0bWFzay5uZXQwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw +ggIKAoICAQC1eV4YvayaU+maJbWrD4OHo3d7S1BtDlcvkIRS1Fw3iYDjsyDkZxai +dHp4EUasfNQ+EVtXUvtk6170EmLco6Elg8SJBQ27trE6nielPRPCfX3fQzETRfvB +7tNvGw4Jn2YKiYoMD79kkjgyZjkJ2r/bEHUSevmR09BRp86syHZerdNGpXYhcQ84 +CA1+V+603GFIHnrP+uQDdssW93rgDNYu+exT+Wj6STfnUkugyjmPRPjL7wh0tzy+ +znCeLl4xiV3g9sjPnc7r2EQKd5uaTe3j71sDPF92KRk0SSUndREz+B1+Dbe/RGk4 +MEqGFuOzrtsgEhPIX0hplhb0Tgz/rtug+yTT7oJjBa3u20AAOQ38/M99EfdeJvc4 +lPFF1XBBLh6X9UKF72an2NuANiX6XPySnJgZ7nZ09RiYZqVwu/qt3DfvLfhboq+0 +bQvLUPXrVDr70onv5UDjpmEA/cLmaIqqrduuTkFZOym65/PfAPvpGnt7crQj/Ibl +DEDYZQmP7AS+6zBjoOzNjUGE5r40zWAR1RSi7zliXTu+yfsjXUIhUAWmYR6J3KxB +lfsiHBQ+8dn9kC3YrUexWoOqBiqJOAJzZh5Y1tqgzfh+2nmHSB2dsQRs7rDRRlyy +YMbkpzL9ZsOUO2eTP1mmar6YjCN+rggYjRrX71K2SpBG6b1zZxOG+wIDAQABo2Aw +XjAdBgNVHQ4EFgQUuYGDLL2sswnYpHHvProt1JU+D48wDgYDVR0PAQH/BAQDAgIE +MAwGA1UdEwQFMAMBAf8wHwYDVR0jBBgwFoAUuYGDLL2sswnYpHHvProt1JU+D48w +DQYJKoZIhvcNAQENBQADggIBADeG67vaFcbITGpi51264kHPYPEWaXUa5XYbtmBl +cXYyB6hY5hv/YNuVGJ1gWsDmdeXEyj0j2icGQjYdHRfwhrbEri+h1EZOm1cSBDuY +k/P5+ctHyOXx8IE79DBsZ6IL61UKIaKhqZBfLGYcWu17DVV6+LT+AKtHhOrv3TSj +RnAcKnCbKqXLhUPXpK0eTjPYS2zQGQGIhIy9sQXVXJJJsGrPgMxna1Xw2JikBOCG +htD/JKwt6xBmNwktH0GI/LVtVgSp82Clbn9C4eZN9E5YbVYjLkIEDhpByeC71QhX +EIQ0ZR56bFuJA/CwValBqV/G9gscTPQqd+iETp8yrFpAVHOW+YzSFbxjTEkBte1J +aF0vmbqdMAWLk+LEFPQRptZh0B88igtx6tV5oVd+p5IVRM49poLhuPNJGPvMj99l +mlZ4+AeRUnbOOeAEuvpLJbel4rhwFzmUiGoeTVoPZyMevWcVFq6BMkS+jRR2w0jK +G6b0v5XDHlcFYPOgUrtsOBFJVwbutLvxdk6q37kIFnWCd8L3kmES5q4wjyFK47Co +Ja8zlx64jmMZPg/t3wWqkZgXZ14qnbyG5/lGsj5CwVtfDljrhN0oCWK1FZaUmW3d +69db12/g4f6phldhxiWuGC/W6fCW5kre7nmhshcltqAJJuU47iX+DarBFiIj816e +yV8e +-----END CERTIFICATE----- \ No newline at end of file diff --git a/app/src/test/resources/preconfigured/riseup.net.json b/app/src/test/resources/preconfigured/riseup.net.json new file mode 100644 index 00000000..9a5ec79e --- /dev/null +++ b/app/src/test/resources/preconfigured/riseup.net.json @@ -0,0 +1,37 @@ +{ + "api_uri": "https://api.black.riseup.net:443", + "api_version": "1", + "ca_cert_fingerprint": "SHA256: a5244308a1374709a9afce95e3ae47c1b44bc2398c0a70ccbf8b3a8a97f29494", + "ca_cert_uri": "https://black.riseup.net/ca.crt", + "default_language": "en", + "description": { + "en": "Riseup is a non-profit collective in Seattle that provides online communication tools for people and groups working toward liberatory social change." + }, + "domain": "riseup.net", + "enrollment_policy": "open", + "languages": [ + "en" + ], + "name": { + "en": "Riseup Networks" + }, + "service": { + "allow_anonymous": false, + "allow_free": true, + "allow_limited_bandwidth": false, + "allow_paid": false, + "allow_registration": true, + "allow_unlimited_bandwidth": true, + "bandwidth_limit": 102400, + "default_service_level": 1, + "levels": { + "1": { + "description": "Please donate.", + "name": "free" + } + } + }, + "services": [ + "openvpn" + ] +} \ No newline at end of file diff --git a/app/src/test/resources/preconfigured/riseup.net.pem b/app/src/test/resources/preconfigured/riseup.net.pem new file mode 100644 index 00000000..c890aff4 --- /dev/null +++ b/app/src/test/resources/preconfigured/riseup.net.pem @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIIFjTCCA3WgAwIBAgIBATANBgkqhkiG9w0BAQ0FADBZMRgwFgYDVQQKDA9SaXNl +dXAgTmV0d29ya3MxGzAZBgNVBAsMEmh0dHBzOi8vcmlzZXVwLm5ldDEgMB4GA1UE +AwwXUmlzZXVwIE5ldHdvcmtzIFJvb3QgQ0EwHhcNMTQwNDI4MDAwMDAwWhcNMjQw +NDI4MDAwMDAwWjBZMRgwFgYDVQQKDA9SaXNldXAgTmV0d29ya3MxGzAZBgNVBAsM +Emh0dHBzOi8vcmlzZXVwLm5ldDEgMB4GA1UEAwwXUmlzZXVwIE5ldHdvcmtzIFJv +b3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC76J4ciMJ8Sg0m +TP7DF2DT9zNe0Csk4myoMFC57rfJeqsAlJCv1XMzBmXrw8wq/9z7XHv6n/0sWU7a +7cF2hLR33ktjwODlx7vorU39/lXLndo492ZBhXQtG1INMShyv+nlmzO6GT7ESfNE +LliFitEzwIegpMqxCIHXFuobGSCWF4N0qLHkq/SYUMoOJ96O3hmPSl1kFDRMtWXY +iw1SEKjUvpyDJpVs3NGxeLCaA7bAWhDY5s5Yb2fA1o8ICAqhowurowJpW7n5ZuLK +5VNTlNy6nZpkjt1QycYvNycffyPOFm/Q/RKDlvnorJIrihPkyniV3YY5cGgP+Qkx +HUOT0uLA6LHtzfiyaOqkXwc4b0ZcQD5Vbf6Prd20Ppt6ei0zazkUPwxld3hgyw58 +m/4UIjG3PInWTNf293GngK2Bnz8Qx9e/6TueMSAn/3JBLem56E0WtmbLVjvko+LF +PM5xA+m0BmuSJtrD1MUCXMhqYTtiOvgLBlUm5zkNxALzG+cXB28k6XikXt6MRG7q +hzIPG38zwkooM55yy5i1YfcIi5NjMH6A+t4IJxxwb67MSb6UFOwg5kFokdONZcwj +shczHdG9gLKSBIvrKa03Nd3W2dF9hMbRu//STcQxOailDBQCnXXfAATj9pYzdY4k +ha8VCAREGAKTDAex9oXf1yRuktES4QIDAQABo2AwXjAdBgNVHQ4EFgQUC4tdmLVu +f9hwfK4AGliaet5KkcgwDgYDVR0PAQH/BAQDAgIEMAwGA1UdEwQFMAMBAf8wHwYD +VR0jBBgwFoAUC4tdmLVuf9hwfK4AGliaet5KkcgwDQYJKoZIhvcNAQENBQADggIB +AGzL+GRnYu99zFoy0bXJKOGCF5XUXP/3gIXPRDqQf5g7Cu/jYMID9dB3No4Zmf7v +qHjiSXiS8jx1j/6/Luk6PpFbT7QYm4QLs1f4BlfZOti2KE8r7KRDPIecUsUXW6P/ +3GJAVYH/+7OjA39za9AieM7+H5BELGccGrM5wfl7JeEz8in+V2ZWDzHQO4hMkiTQ +4ZckuaL201F68YpiItBNnJ9N5nHr1MRiGyApHmLXY/wvlrOpclh95qn+lG6/2jk7 +3AmihLOKYMlPwPakJg4PYczm3icFLgTpjV5sq2md9bRyAg3oPGfAuWHmKj2Ikqch +Td5CHKGxEEWbGUWEMP0s1A/JHWiCbDigc4Cfxhy56CWG4q0tYtnc2GMw8OAUO6Wf +Xu5pYKNkzKSEtT/MrNJt44tTZWbKV/Pi/N2Fx36my7TgTUj7g3xcE9eF4JV2H/sg +tsK3pwE0FEqGnT4qMFbixQmc8bGyuakr23wjMvfO7eZUxBuWYR2SkcP26sozF9PF +tGhbZHQVGZUTVPyvwahMUEhbPGVerOW0IYpxkm0x/eaWdTc4vPpf/rIlgbAjarnJ +UN9SaWRlWKSdP4haujnzCoJbM7dU9bjvlGZNyXEekgeT0W2qFeGGp+yyUWw8tNsp +0BuC1b7uW/bBn/xKm319wXVDvBgZgcktMolak39V7DVO +-----END CERTIFICATE----- \ No newline at end of file diff --git a/app/src/test/resources/preconfigured/urls/calyx.net.url b/app/src/test/resources/preconfigured/urls/calyx.net.url new file mode 100644 index 00000000..807e9e18 --- /dev/null +++ b/app/src/test/resources/preconfigured/urls/calyx.net.url @@ -0,0 +1,3 @@ +{ + "main_url" : "https://calyx.net" +} diff --git a/app/src/test/resources/preconfigured/urls/demo.bitmask.net.url b/app/src/test/resources/preconfigured/urls/demo.bitmask.net.url new file mode 100644 index 00000000..0c4de648 --- /dev/null +++ b/app/src/test/resources/preconfigured/urls/demo.bitmask.net.url @@ -0,0 +1,3 @@ +{ + "main_url" : "https://demo.bitmask.net" +} diff --git a/app/src/test/resources/preconfigured/urls/riseup.net.url b/app/src/test/resources/preconfigured/urls/riseup.net.url new file mode 100644 index 00000000..42cdb979 --- /dev/null +++ b/app/src/test/resources/preconfigured/urls/riseup.net.url @@ -0,0 +1,3 @@ +{ + "main_url" : "https://riseup.net" +} -- cgit v1.2.3 From ce71463e93a0ca51a9a893a1eb666f51171e8e9d Mon Sep 17 00:00:00 2001 From: cyBerta Date: Wed, 21 Feb 2018 17:50:06 +0100 Subject: #8861 fix splash screen handling --- app/src/main/java/se/leap/bitmaskclient/StartActivity.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java index 39717bd8..b7180f5f 100644 --- a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java @@ -184,12 +184,9 @@ public class StartActivity extends Activity { @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { - if (data == null) { - return; - } if (requestCode == REQUEST_CODE_CONFIGURE_LEAP) { - if (resultCode == RESULT_OK && data.hasExtra(Provider.KEY)) { + if (resultCode == RESULT_OK && data != null && data.hasExtra(Provider.KEY)) { Provider provider = data.getParcelableExtra(Provider.KEY); ConfigHelper.storeProviderInPreferences(preferences, provider); EipCommand.startVPN(this, false); -- cgit v1.2.3 From cf10c3dc481b154cd8f4d6996c9a80643b67c840 Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Thu, 22 Feb 2018 12:04:19 +0100 Subject: 8851 - remove options menu --- .../se/leap/bitmaskclient/ProviderListBaseActivity.java | 6 ------ app/src/main/res/menu/configuration_wizard_activity.xml | 15 --------------- 2 files changed, 21 deletions(-) delete mode 100644 app/src/main/res/menu/configuration_wizard_activity.xml (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java index 3bf51a8c..75fffaf7 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java @@ -369,12 +369,6 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity } } - @Override - public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.configuration_wizard_activity, menu); - return true; - } - public class ProviderAPIBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { diff --git a/app/src/main/res/menu/configuration_wizard_activity.xml b/app/src/main/res/menu/configuration_wizard_activity.xml deleted file mode 100644 index 21591547..00000000 --- a/app/src/main/res/menu/configuration_wizard_activity.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - \ No newline at end of file -- cgit v1.2.3 From 0f5a0510aa83872417467914ad52aa3d0d663f51 Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Thu, 22 Feb 2018 12:23:33 +0100 Subject: 8865 - allow disconnect without internet --- app/src/main/java/se/leap/bitmaskclient/EipFragment.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index 8d1fa03a..4d28315f 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -171,8 +171,8 @@ public class EipFragment extends Fragment implements Observer { super.onResume(); //FIXME: avoid race conditions while checking certificate an logging in at about the same time //eipCommand(Constants.EIP_ACTION_CHECK_CERT_VALIDITY); - handleNewState(); bindOpenVpnService(); + handleNewState(); } @Override @@ -407,8 +407,10 @@ public class EipFragment extends Fragment implements Observer { private boolean isOpenVpnRunningWithoutNetwork() { boolean isRunning = false; try { - isRunning = eipStatus.getLevel() == LEVEL_NONETWORK && - mService.isVpnRunning(); + if (mService != null) { + isRunning = eipStatus.getLevel() == LEVEL_NONETWORK && + mService.isVpnRunning(); + } } catch (Exception e) { //eat me e.printStackTrace(); -- cgit v1.2.3 From 0cf6368a993d23527802b3eba70ddeda4b5933c6 Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Thu, 22 Feb 2018 15:47:32 +0100 Subject: 8867 - add url to username --- .../leap/bitmaskclient/ProviderCredentialsBaseActivity.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java index e6877756..15cd9617 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java @@ -186,7 +186,11 @@ public abstract class ProviderCredentialsBaseActivity extends ConfigWizardBaseAc String username = usernameField.getText().toString(); String providerDomain = provider.getDomain(); if (username.endsWith(providerDomain)) { - return username.split("@" + providerDomain)[0]; + try { + return username.split("@" + providerDomain)[0]; + } catch (ArrayIndexOutOfBoundsException e) { + return ""; + } } return username; } @@ -240,9 +244,15 @@ public abstract class ProviderCredentialsBaseActivity extends ConfigWizardBaseAc @Override public void afterTextChanged(Editable s) { if (getUsername().equalsIgnoreCase("")) { + s.clear(); usernameError.setError(getString(R.string.username_ask)); } else { usernameError.setError(null); + String suffix = "@" + provider.getDomain(); + if (!usernameField.getText().toString().endsWith(suffix)) { + s.append(suffix); + usernameField.setSelection(usernameField.getText().toString().indexOf('@')); + } } } }); -- cgit v1.2.3 From 6a683c605aa5bb5ce72f8ea46a4b6bcae0f9e98a Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Thu, 22 Feb 2018 17:00:40 +0100 Subject: 8868 - fix lollipop ui issues --- .../leap/bitmaskclient/ConfigWizardBaseActivity.java | 20 +++++++++++++++++++- .../main/java/se/leap/bitmaskclient/EipFragment.java | 5 +++-- .../java/se/leap/bitmaskclient/StartActivity.java | 4 +--- .../main/res/layout-xlarge/eip_service_fragment.xml | 9 ++++++--- app/src/main/res/layout/eip_service_fragment.xml | 9 ++++++--- 5 files changed, 35 insertions(+), 12 deletions(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java index ea328216..f0e2de85 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java @@ -1,16 +1,19 @@ package se.leap.bitmaskclient; import android.content.SharedPreferences; +import android.graphics.PorterDuff; +import android.os.Build; import android.os.Bundle; -import android.os.PersistableBundle; import android.support.annotation.DrawableRes; import android.support.annotation.Nullable; import android.support.annotation.StringRes; +import android.support.v4.content.ContextCompat; import android.support.v7.widget.AppCompatImageView; import android.support.v7.widget.AppCompatTextView; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; +import android.widget.ProgressBar; import butterknife.InjectView; @@ -38,6 +41,9 @@ public abstract class ConfigWizardBaseActivity extends ButterKnifeActivity { @InjectView(R.id.loading_screen) protected LinearLayout loadingScreen; + @InjectView(R.id.progressbar) + protected ProgressBar progressBar; + @InjectView(R.id.progressbar_description) protected AppCompatTextView progressbarText; @@ -59,6 +65,7 @@ public abstract class ConfigWizardBaseActivity extends ButterKnifeActivity { super.setContentView(view); if (provider != null) setProviderHeaderText(provider.getName()); + setProgressbarColorForPreLollipop(); } @Override @@ -66,6 +73,7 @@ public abstract class ConfigWizardBaseActivity extends ButterKnifeActivity { super.setContentView(layoutResID); if (provider != null) setProviderHeaderText(provider.getName()); + setProgressbarColorForPreLollipop(); } @Override @@ -73,8 +81,18 @@ public abstract class ConfigWizardBaseActivity extends ButterKnifeActivity { super.setContentView(view, params); if (provider != null) setProviderHeaderText(provider.getName()); + setProgressbarColorForPreLollipop(); } + private void setProgressbarColorForPreLollipop() { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { + progressBar.getIndeterminateDrawable().setColorFilter( + ContextCompat.getColor(this, R.color.colorPrimary), + PorterDuff.Mode.SRC_IN); + } + } + + @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index 8d1fa03a..08622453 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -31,6 +31,7 @@ import android.support.annotation.NonNull; import android.support.v4.app.Fragment; import android.support.v7.app.AlertDialog; import android.support.v7.widget.AppCompatImageView; +import android.support.v7.widget.AppCompatTextView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; @@ -84,10 +85,10 @@ public class EipFragment extends Fragment implements Observer { Button mainButton; @InjectView(R.id.routed_text) - TextView routedText; + AppCompatTextView routedText; @InjectView(R.id.vpn_route) - TextView vpnRoute; + AppCompatTextView vpnRoute; private EipStatus eipStatus; diff --git a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java index b7180f5f..6bbdeb4f 100644 --- a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java @@ -13,12 +13,10 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import de.blinkt.openvpn.core.VpnStatus; -import se.leap.bitmaskclient.eip.EIP; import se.leap.bitmaskclient.eip.EipCommand; import se.leap.bitmaskclient.userstatus.User; import static se.leap.bitmaskclient.Constants.APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_START; import static se.leap.bitmaskclient.Constants.EIP_RESTART_ON_BOOT; import static se.leap.bitmaskclient.Constants.PREFERENCES_APP_VERSION; import static se.leap.bitmaskclient.Constants.PROVIDER_EIP_DEFINITION; @@ -32,7 +30,7 @@ import static se.leap.bitmaskclient.MainActivity.ACTION_SHOW_VPN_FRAGMENT; * and acts and calls another activity accordingly. * */ -public class StartActivity extends Activity { +public class StartActivity extends Activity{ public static final String TAG = StartActivity.class.getSimpleName(); @Retention(RetentionPolicy.SOURCE) diff --git a/app/src/main/res/layout-xlarge/eip_service_fragment.xml b/app/src/main/res/layout-xlarge/eip_service_fragment.xml index b7af5797..c09bda2d 100644 --- a/app/src/main/res/layout-xlarge/eip_service_fragment.xml +++ b/app/src/main/res/layout-xlarge/eip_service_fragment.xml @@ -54,7 +54,7 @@ app:srcCompat="@drawable/ic_colorsquare" /> - @@ -97,7 +98,7 @@ style="@style/BitmaskButtonBlack" /> - - diff --git a/app/src/main/res/layout/eip_service_fragment.xml b/app/src/main/res/layout/eip_service_fragment.xml index 814ec310..30b94de9 100644 --- a/app/src/main/res/layout/eip_service_fragment.xml +++ b/app/src/main/res/layout/eip_service_fragment.xml @@ -52,7 +52,7 @@ app:srcCompat="@drawable/ic_colorsquare" /> - @@ -97,7 +98,7 @@ style="@style/BitmaskButtonBlack" /> - - -- cgit v1.2.3 From 06eb4014837704e04d6ea8e9d7a69475a58c3c65 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 23 Feb 2018 02:22:25 +0100 Subject: #8754 enable pause openvpn on device inactivity feature --- .../java/se/leap/bitmaskclient/ConfigHelper.java | 38 ++-- .../main/java/se/leap/bitmaskclient/Constants.java | 5 + .../main/java/se/leap/bitmaskclient/Dashboard.java | 0 .../leap/bitmaskclient/DrawerSettingsAdapter.java | 219 +++++++++++++++++++++ .../java/se/leap/bitmaskclient/EipFragment.java | 2 +- .../java/se/leap/bitmaskclient/MainActivity.java | 17 +- .../drawer/NavigationDrawerFragment.java | 149 ++++++++++++-- app/src/main/res/layout/switch_list_item.xml | 15 ++ app/src/main/res/values/strings.xml | 3 + 9 files changed, 417 insertions(+), 31 deletions(-) delete mode 100644 app/src/main/java/se/leap/bitmaskclient/Dashboard.java create mode 100644 app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java create mode 100644 app/src/main/res/layout/switch_list_item.xml (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java b/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java index a52df460..50d23106 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java @@ -16,7 +16,9 @@ */ package se.leap.bitmaskclient; +import android.content.Context; import android.content.SharedPreferences; +import android.preference.PreferenceManager; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.util.Log; @@ -52,6 +54,7 @@ import java.util.Locale; import java.util.Map; import static android.R.attr.name; +import static se.leap.bitmaskclient.Constants.DEFAULT_SHARED_PREFS_BATTERY_SAVER; import static se.leap.bitmaskclient.Constants.PREFERENCES_APP_VERSION; import static se.leap.bitmaskclient.Constants.PROVIDER_CONFIGURED; import static se.leap.bitmaskclient.Constants.PROVIDER_EIP_DEFINITION; @@ -383,6 +386,7 @@ public class ConfigHelper { clearDataOfLastProvider(preferences, false); } + @Deprecated public static void clearDataOfLastProvider(SharedPreferences preferences, boolean commit) { Map allEntries = preferences.getAll(); List lastProvidersKeys = new ArrayList<>(); @@ -410,18 +414,30 @@ public class ConfigHelper { } public static void deleteProviderDetailsFromPreferences(@NonNull SharedPreferences preferences, String providerDomain) { - preferences.edit(). - remove(Provider.KEY + "." + providerDomain). - remove(Provider.CA_CERT + "." + providerDomain). - remove(Provider.CA_CERT_FINGERPRINT + "." + providerDomain). - remove(Provider.MAIN_URL + "." + providerDomain). - remove(Provider.KEY + "." + providerDomain). - remove(Provider.CA_CERT + "." + providerDomain). - remove(PROVIDER_EIP_DEFINITION + "." + providerDomain). - remove(PROVIDER_PRIVATE_KEY + "." + providerDomain). - remove(PROVIDER_VPN_CERTIFICATE + "." + providerDomain). - apply(); + preferences.edit(). + remove(Provider.KEY + "." + providerDomain). + remove(Provider.CA_CERT + "." + providerDomain). + remove(Provider.CA_CERT_FINGERPRINT + "." + providerDomain). + remove(Provider.MAIN_URL + "." + providerDomain). + remove(Provider.KEY + "." + providerDomain). + remove(Provider.CA_CERT + "." + providerDomain). + remove(PROVIDER_EIP_DEFINITION + "." + providerDomain). + remove(PROVIDER_PRIVATE_KEY + "." + providerDomain). + remove(PROVIDER_VPN_CERTIFICATE + "." + providerDomain). + apply(); } + public static void saveBattery(Context context, boolean isEnabled) { + if (context == null) { + return; + } + SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); + preferences.edit().putBoolean(DEFAULT_SHARED_PREFS_BATTERY_SAVER, isEnabled).apply(); + } + + public static boolean getSaveBattery(@NonNull Context context) { + SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); + return preferences.getBoolean(DEFAULT_SHARED_PREFS_BATTERY_SAVER, false); + } } diff --git a/app/src/main/java/se/leap/bitmaskclient/Constants.java b/app/src/main/java/se/leap/bitmaskclient/Constants.java index 2b7a8113..58145015 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Constants.java +++ b/app/src/main/java/se/leap/bitmaskclient/Constants.java @@ -81,4 +81,9 @@ public interface Constants { String BROADCAST_RESULT_CODE = "BROADCAST.RESULT_CODE"; String BROADCAST_RESULT_KEY = "BROADCAST.RESULT_KEY"; + + ////////////////////////////////////////////// + // ICS-OPENVPN CONSTANTS + ///////////////////////////////////////////// + String DEFAULT_SHARED_PREFS_BATTERY_SAVER = "screenoff"; } diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java deleted file mode 100644 index e69de29b..00000000 diff --git a/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java b/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java new file mode 100644 index 00000000..867f3d48 --- /dev/null +++ b/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java @@ -0,0 +1,219 @@ +/** + * Copyright (c) 2018 LEAP Encryption Access Project and contributers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package se.leap.bitmaskclient; + +import android.support.annotation.NonNull; +import android.support.v7.widget.SwitchCompat; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.CompoundButton; +import android.widget.TextView; + +import java.util.ArrayList; + +/** + * Created by cyberta on 21.02.18. + */ + +public class DrawerSettingsAdapter extends BaseAdapter { + + //item types + public static final int NONE = -1; + public static final int SWITCH_PROVIDER = 0; + public static final int LOG = 1; + public static final int ABOUT = 2; + public static final int BATTERY_SAVER = 3; + + //view types + public final static int VIEW_SIMPLE_TEXT = 0; + public final static int VIEW_SWITCH = 1; + + public static class DrawerSettingsItem { + private String description = ""; + private int viewType = VIEW_SIMPLE_TEXT; + private boolean isChecked = false; + private int itemType = NONE; + private CompoundButton.OnCheckedChangeListener callback; + + private DrawerSettingsItem(String description, int viewType, boolean isChecked, int itemType, CompoundButton.OnCheckedChangeListener callback) { + this.description = description; + this.viewType = viewType; + this.isChecked = isChecked; + this.itemType = itemType; + this.callback = callback; + } + + public static DrawerSettingsItem getSimpleTextInstance(String description, int itemType) { + return new DrawerSettingsItem(description, VIEW_SIMPLE_TEXT, false, itemType, null); + } + + public static DrawerSettingsItem getSwitchInstance(String description, boolean isChecked, int itemType, CompoundButton.OnCheckedChangeListener callback) { + return new DrawerSettingsItem(description, VIEW_SWITCH, isChecked, itemType, callback); + } + + public int getItemType() { + return itemType; + } + + public void setChecked(boolean checked) { + isChecked = checked; + } + + public boolean isChecked() { + return isChecked; + } + } + + private ArrayList mData = new ArrayList<>(); + private LayoutInflater mInflater; + + public DrawerSettingsAdapter(LayoutInflater layoutInflater) { + mInflater = layoutInflater; + } + + public void addItem(final DrawerSettingsItem item) { + mData.add(item); + notifyDataSetChanged(); + } + + @Override + public int getItemViewType(int position) { + DrawerSettingsItem item = mData.get(position); + return item.viewType; + } + + @Override + public int getViewTypeCount() { + boolean hasSwitchItem = false; + for (DrawerSettingsItem item : mData) { + if (item.viewType == VIEW_SWITCH) { + hasSwitchItem = true; + break; + } + } + return hasSwitchItem ? 2 : 1; + } + + @Override + public int getCount() { + return mData.size(); + } + + @Override + public DrawerSettingsItem getItem(int position) { + return mData.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + DrawerSettingsItem drawerSettingsItem = mData.get(position); + ViewHolder holder = null; + int type = getItemViewType(position); + if (convertView == null) { + holder = new ViewHolder(); + switch(type) { + case VIEW_SIMPLE_TEXT: + convertView = initTextViewBinding(holder); + holder.textView.setText(drawerSettingsItem.description); + break; + case VIEW_SWITCH: + convertView = initSwitchBinding(holder); + bindSwitch(drawerSettingsItem, holder); + break; + } + convertView.setTag(holder); + } else { + holder = (ViewHolder)convertView.getTag(); + switch (type) { + case VIEW_SIMPLE_TEXT: + if (holder.isSwitchViewHolder()) { + holder.resetSwitchView(); + convertView = initTextViewBinding(holder); + } + holder.textView.setText(drawerSettingsItem.description); + break; + case VIEW_SWITCH: + if (!holder.isSwitchViewHolder()) { + holder.resetTextView(); + convertView = initSwitchBinding(holder); + } + bindSwitch(drawerSettingsItem, holder); + break; + } + convertView.setTag(holder); + } + return convertView; + } + + private void bindSwitch(DrawerSettingsItem drawerSettingsItem, ViewHolder holder) { + holder.switchView.setChecked(drawerSettingsItem.isChecked); + holder.switchView.setText(drawerSettingsItem.description); + holder.switchView.setOnCheckedChangeListener(drawerSettingsItem.callback); + } + + @NonNull + private View initSwitchBinding(ViewHolder holder) { + View convertView = mInflater.inflate(R.layout.switch_list_item, null); + holder.switchView = convertView.findViewById(android.R.id.text1); + return convertView; + } + + @NonNull + private View initTextViewBinding(ViewHolder holder) { + View convertView = mInflater.inflate(R.layout.single_list_item, null); + holder.textView = convertView.findViewById(android.R.id.text1); + return convertView; + } + + public DrawerSettingsItem getDrawerItem(int elementType) { + for (DrawerSettingsItem item : mData) { + if (item.itemType == elementType) { + return item; + } + } + return null; + } + + static class ViewHolder { + TextView textView; + SwitchCompat switchView; + + boolean isSwitchViewHolder() { + return switchView != null; + } + + void resetSwitchView() { + switchView.setOnCheckedChangeListener(null); + switchView = null; + } + + void resetTextView() { + textView = null; + } + } +} + + + diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index fb57aea8..7b84657c 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2013 LEAP Encryption Access Project and contributers + * Copyright (c) 2018 LEAP Encryption Access Project and contributers * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/app/src/main/java/se/leap/bitmaskclient/MainActivity.java b/app/src/main/java/se/leap/bitmaskclient/MainActivity.java index 6e778309..952f2d1f 100644 --- a/app/src/main/java/se/leap/bitmaskclient/MainActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/MainActivity.java @@ -1,3 +1,19 @@ +/** + * Copyright (c) 2018 LEAP Encryption Access Project and contributers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package se.leap.bitmaskclient; @@ -20,7 +36,6 @@ import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; -import org.jetbrains.annotations.NotNull; import org.json.JSONException; import org.json.JSONObject; diff --git a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java index 772140b0..ebe5783a 100644 --- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java @@ -1,6 +1,24 @@ +/** + * Copyright (c) 2018 LEAP Encryption Access Project and contributers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package se.leap.bitmaskclient.drawer; +import android.app.Activity; +import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; @@ -11,6 +29,7 @@ import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarDrawerToggle; +import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; @@ -22,10 +41,13 @@ import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; +import android.widget.CompoundButton; import android.widget.ListView; import android.widget.Toast; import se.leap.bitmaskclient.ConfigHelper; +import se.leap.bitmaskclient.DrawerSettingsAdapter; +import se.leap.bitmaskclient.DrawerSettingsAdapter.DrawerSettingsItem; import se.leap.bitmaskclient.Provider; import se.leap.bitmaskclient.ProviderListActivity; import se.leap.bitmaskclient.EipFragment; @@ -35,9 +57,19 @@ import se.leap.bitmaskclient.fragments.LogFragment; import static android.content.Context.MODE_PRIVATE; import static se.leap.bitmaskclient.BitmaskApp.getRefWatcher; +import static se.leap.bitmaskclient.ConfigHelper.getSaveBattery; import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; import static se.leap.bitmaskclient.Constants.REQUEST_CODE_SWITCH_PROVIDER; import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; +import static se.leap.bitmaskclient.DrawerSettingsAdapter.ABOUT; +import static se.leap.bitmaskclient.DrawerSettingsAdapter.BATTERY_SAVER; +import static se.leap.bitmaskclient.DrawerSettingsAdapter.DrawerSettingsItem.getSimpleTextInstance; +import static se.leap.bitmaskclient.DrawerSettingsAdapter.DrawerSettingsItem.getSwitchInstance; +import static se.leap.bitmaskclient.DrawerSettingsAdapter.LOG; +import static se.leap.bitmaskclient.DrawerSettingsAdapter.SWITCH_PROVIDER; +import static se.leap.bitmaskclient.R.string.about_fragment_title; +import static se.leap.bitmaskclient.R.string.log_fragment_title; +import static se.leap.bitmaskclient.R.string.switch_provider_menu_option; /** * Fragment used for managing interactions for and presentation of a navigation drawer. @@ -63,6 +95,7 @@ public class NavigationDrawerFragment extends Fragment { private ListView mDrawerAccountsListView; private View mFragmentContainerView; private ArrayAdapter accountListAdapter; + private DrawerSettingsAdapter settingsListAdapter; private boolean mFromSavedInstanceState; private boolean mUserLearnedDrawer; @@ -71,17 +104,23 @@ public class NavigationDrawerFragment extends Fragment { private SharedPreferences preferences; + private final static String KEY_SHOW_ENABLE_EXPERIMENTAL_FEATURE = "KEY_SHOW_ENABLE_EXPERIMENTAL_FEATURE"; + private boolean showEnableExperimentalFeature = false; + AlertDialog alertDialog; + public NavigationDrawerFragment() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - // Read in the flag indicating whether or not the user has demonstrated awareness of the // drawer. See PREF_USER_LEARNED_DRAWER for details. preferences = getContext().getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE); mUserLearnedDrawer = preferences.getBoolean(PREF_USER_LEARNED_DRAWER, false); + if (savedInstanceState != null) { + mFromSavedInstanceState = true; + } } @Override @@ -95,7 +134,9 @@ public class NavigationDrawerFragment extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mDrawerView = inflater.inflate(R.layout.drawer_main, container, false); + restoreFromSavedInstance(savedInstanceState); return mDrawerView; + } public boolean isDrawerOpen() { @@ -119,16 +160,23 @@ public class NavigationDrawerFragment extends Fragment { selectItem(parent, position); } }); + settingsListAdapter = new DrawerSettingsAdapter(getLayoutInflater()); + if (getContext() != null) { + settingsListAdapter.addItem(getSwitchInstance(getString(R.string.save_battery), + getSaveBattery(getContext()), + BATTERY_SAVER, + new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean newStateIsChecked) { + onSwitchItemSelected(BATTERY_SAVER, newStateIsChecked); + } + })); + } + settingsListAdapter.addItem(getSimpleTextInstance(getString(switch_provider_menu_option), SWITCH_PROVIDER)); + settingsListAdapter.addItem(getSimpleTextInstance(getString(log_fragment_title), LOG)); + settingsListAdapter.addItem(getSimpleTextInstance(getString(about_fragment_title), ABOUT)); - mDrawerSettingsListView.setAdapter(new ArrayAdapter( - actionBar.getThemedContext(), - R.layout.single_list_item, - android.R.id.text1, - new String[]{ - getString(R.string.switch_provider_menu_option), - getString(R.string.log_fragment_title), - getString(R.string.about_fragment_title), - })); + mDrawerSettingsListView.setAdapter(settingsListAdapter); mDrawerAccountsListView = mDrawerView.findViewById(R.id.accountList); mDrawerAccountsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @@ -215,12 +263,55 @@ public class NavigationDrawerFragment extends Fragment { if (mDrawerLayout != null) { mDrawerLayout.closeDrawer(mFragmentContainerView); } - onNavigationDrawerItemSelected(list, position); + onTextItemSelected(list, position); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); + if (showEnableExperimentalFeature) { + outState.putBoolean(KEY_SHOW_ENABLE_EXPERIMENTAL_FEATURE, true); + alertDialog.dismiss(); + } + } + + private void restoreFromSavedInstance(Bundle savedInstanceState) { + if (savedInstanceState != null && savedInstanceState.containsKey(KEY_SHOW_ENABLE_EXPERIMENTAL_FEATURE)) { + showEnableExperimentalFeature = true; + showExperimentalFeatureAlert(); + } + } + + private void showExperimentalFeatureAlert() { + Activity activity = getActivity(); + if (activity == null) { + return; + } + + AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getActivity()); + showEnableExperimentalFeature = true; + alertDialog = alertBuilder.setTitle(activity.getString(R.string.experimental_feature_title)) + .setMessage(activity.getString(R.string.experimental_feature_message)) + .setPositiveButton((android.R.string.yes), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + DrawerSettingsItem item = settingsListAdapter.getDrawerItem(BATTERY_SAVER); + item.setChecked(true); + settingsListAdapter.notifyDataSetChanged(); + ConfigHelper.saveBattery(getContext(), item.isChecked()); + } + }) + .setNegativeButton(activity.getString(android.R.string.no), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + disableSwitch(BATTERY_SAVER); + } + }).setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + showEnableExperimentalFeature = false; + } + }).show(); } @Override @@ -272,7 +363,28 @@ public class NavigationDrawerFragment extends Fragment { return ((AppCompatActivity) getActivity()).getSupportActionBar(); } - public void onNavigationDrawerItemSelected(AdapterView parent, int position) { + private void onSwitchItemSelected(int elementType, boolean newStateIsChecked) { + switch (elementType) { + case BATTERY_SAVER: + if (newStateIsChecked) { + showExperimentalFeatureAlert(); + } else { + ConfigHelper.saveBattery(this.getContext(), false); + disableSwitch(BATTERY_SAVER); + } + break; + default: + break; + } + } + + private void disableSwitch(int elementType) { + DrawerSettingsItem item = settingsListAdapter.getDrawerItem(elementType); + item.setChecked(false); + settingsListAdapter.notifyDataSetChanged(); + } + + public void onTextItemSelected(AdapterView parent, int position) { // update the main content by replacing fragments FragmentManager fragmentManager = getFragmentManager(); Fragment fragment = null; @@ -286,16 +398,17 @@ public class NavigationDrawerFragment extends Fragment { fragment.setArguments(arguments); } else { Log.d("Drawer", String.format("Selected position %d", position)); - switch (position) { - case 0: + DrawerSettingsItem settingsItem = settingsListAdapter.getItem(position); + switch (settingsItem.getItemType()) { + case SWITCH_PROVIDER: getActivity().startActivityForResult(new Intent(getActivity(), ProviderListActivity.class), REQUEST_CODE_SWITCH_PROVIDER); break; - case 1: - mTitle = getString(R.string.log_fragment_title); + case LOG: + mTitle = getString(log_fragment_title); fragment = new LogFragment(); break; - case 2: - mTitle = getString(R.string.about_fragment_title); + case ABOUT: + mTitle = getString(about_fragment_title); fragment = new AboutFragment(); break; default: diff --git a/app/src/main/res/layout/switch_list_item.xml b/app/src/main/res/layout/switch_list_item.xml new file mode 100644 index 00000000..bdb9a74c --- /dev/null +++ b/app/src/main/res/layout/switch_list_item.xml @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2ea4670a..a69c2420 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -107,4 +107,7 @@ Downloading the VPN certificate failed. Try again or choose another provider. VPN certificate is invalid. Try to download a new one. The VPN certificate is invalid. Please log in to download a new one. + Save battery + Save Battery Warning + Background data connections will hibernate when your phone is inactive. This feature is still experimental. -- cgit v1.2.3 From ad086ab192b9094278b27f94120566a7ca21dccc Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 23 Feb 2018 02:34:55 +0100 Subject: #8754 fix dialog cancellation handling and change dialog title --- .../leap/bitmaskclient/drawer/NavigationDrawerFragment.java | 12 +++++++++--- app/src/main/res/values/strings.xml | 3 +-- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java index ebe5783a..25ef9161 100644 --- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java @@ -290,8 +290,8 @@ public class NavigationDrawerFragment extends Fragment { AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getActivity()); showEnableExperimentalFeature = true; - alertDialog = alertBuilder.setTitle(activity.getString(R.string.experimental_feature_title)) - .setMessage(activity.getString(R.string.experimental_feature_message)) + alertDialog = alertBuilder.setTitle(activity.getString(R.string.save_battery)) + .setMessage(activity.getString(R.string.save_battery_message)) .setPositiveButton((android.R.string.yes), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { @@ -311,7 +311,13 @@ public class NavigationDrawerFragment extends Fragment { public void onDismiss(DialogInterface dialog) { showEnableExperimentalFeature = false; } - }).show(); + }).setOnCancelListener(new DialogInterface.OnCancelListener() { + @Override + public void onCancel(DialogInterface dialog) { + disableSwitch(BATTERY_SAVER); + } + }) + .show(); } @Override diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a69c2420..a0ca00c9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -108,6 +108,5 @@ VPN certificate is invalid. Try to download a new one. The VPN certificate is invalid. Please log in to download a new one. Save battery - Save Battery Warning - Background data connections will hibernate when your phone is inactive. This feature is still experimental. + Background data connections will hibernate when your phone is inactive. This feature is still experimental. -- cgit v1.2.3 From e317fd9029948a06afd0842c69a714f3d9d0862d Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 23 Feb 2018 03:50:51 +0100 Subject: #8754 disable dialog flag on cancel --- .../main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java | 1 + 1 file changed, 1 insertion(+) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java index 25ef9161..3651cd05 100644 --- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java @@ -315,6 +315,7 @@ public class NavigationDrawerFragment extends Fragment { @Override public void onCancel(DialogInterface dialog) { disableSwitch(BATTERY_SAVER); + showEnableExperimentalFeature = false; } }) .show(); -- cgit v1.2.3 From 3f37c6891621d913d034409cad69cd9f8feb6675 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 23 Feb 2018 03:53:08 +0100 Subject: #8754 don't let both navigation drawer lists eat each other on small displays --- app/src/main/res/layout/drawer_main.xml | 48 ++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 15 deletions(-) (limited to 'app') diff --git a/app/src/main/res/layout/drawer_main.xml b/app/src/main/res/layout/drawer_main.xml index 26267bbb..54614f3f 100644 --- a/app/src/main/res/layout/drawer_main.xml +++ b/app/src/main/res/layout/drawer_main.xml @@ -1,13 +1,13 @@ + xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:background="@color/colorBackground" + tools:context="se.leap.bitmaskclient.drawer.NavigationDrawerFragment" + android:clickable="true" + android:focusable="true"> - + android:layout_height="wrap_content" + android:isScrollContainer="false" + /> - + + + android:layout_alignTop="@id/divider" + android:layout_alignParentBottom="true" + > + + + + -- cgit v1.2.3 From 0ab7afb26280510f6097fe403a280a5ede3f40f7 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sat, 24 Feb 2018 14:21:21 +0100 Subject: #8754 ignore initial onCheckedChanged callback during ui setup --- .../java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java index 3651cd05..111c02f5 100644 --- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java @@ -277,7 +277,6 @@ public class NavigationDrawerFragment extends Fragment { private void restoreFromSavedInstance(Bundle savedInstanceState) { if (savedInstanceState != null && savedInstanceState.containsKey(KEY_SHOW_ENABLE_EXPERIMENTAL_FEATURE)) { - showEnableExperimentalFeature = true; showExperimentalFeatureAlert(); } } @@ -373,6 +372,10 @@ public class NavigationDrawerFragment extends Fragment { private void onSwitchItemSelected(int elementType, boolean newStateIsChecked) { switch (elementType) { case BATTERY_SAVER: + if (ConfigHelper.getSaveBattery(getContext()) == newStateIsChecked) { + //initial ui setup, ignore + return; + } if (newStateIsChecked) { showExperimentalFeatureAlert(); } else { -- cgit v1.2.3 From 2324de2a0bbcdd6befe4bbe1fea70731d538b664 Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Sun, 25 Feb 2018 10:24:49 +0100 Subject: 8865 - resolve discussions --- .../de/blinkt/openvpn/core/OpenVPNService.java | 6 +-- .../java/se/leap/bitmaskclient/EipFragment.java | 55 ++++++++++++---------- app/src/main/res/values/strings.xml | 1 + 3 files changed, 34 insertions(+), 28 deletions(-) (limited to 'app') diff --git a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java index f701b7aa..6c312c87 100644 --- a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java +++ b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java @@ -913,7 +913,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac // CONNECTED // Does not work :( notificationManager.buildOpenVpnNotification( - mProfile != null ? mProfile.mName : "", + mProfile.mName, VpnStatus.getLastCleanLogMessage(this), VpnStatus.getLastCleanLogMessage(this), level, @@ -944,7 +944,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac humanReadableByteCount(out, false, getResources()), humanReadableByteCount(diffOut / OpenVPNManagement.mBytecountInterval, true, getResources())); notificationManager.buildOpenVpnNotification( - mProfile != null ? mProfile.mName : "", + mProfile.mName, netstat, null, LEVEL_CONNECTED, @@ -987,7 +987,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac public void requestInputFromUser(int resid, String needed) { VpnStatus.updateStateString("NEED", "need " + needed, resid, LEVEL_WAITING_FOR_USER_INPUT); notificationManager.buildOpenVpnNotification( - mProfile != null ? mProfile.mName : "", + mProfile.mName, getString(resid), getString(resid), LEVEL_WAITING_FOR_USER_INPUT, diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index 4d28315f..35693c9b 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -48,7 +48,6 @@ import de.blinkt.openvpn.core.IOpenVPNServiceInternal; import de.blinkt.openvpn.core.OpenVPNService; import se.leap.bitmaskclient.eip.EipCommand; import se.leap.bitmaskclient.eip.EipStatus; -import se.leap.bitmaskclient.eip.VoidVpnService; import se.leap.bitmaskclient.views.VpnStateImage; import static android.view.View.GONE; @@ -67,7 +66,6 @@ public class EipFragment extends Fragment implements Observer { public final static String TAG = EipFragment.class.getSimpleName(); - public static final String START_EIP_ON_BOOT = "start on boot"; public static final String ASK_TO_CANCEL_VPN = "ask_to_cancel_vpn"; @@ -100,23 +98,7 @@ public class EipFragment extends Fragment implements Observer { AlertDialog alertDialog; private IOpenVPNServiceInternal mService; - private ServiceConnection openVpnConnection = new ServiceConnection() { - - - - @Override - public void onServiceConnected(ComponentName className, - IBinder service) { - - mService = IOpenVPNServiceInternal.Stub.asInterface(service); - } - - @Override - public void onServiceDisconnected(ComponentName arg0) { - mService = null; - } - - }; + private ServiceConnection openVpnConnection; @Override public void onAttach(Context context) { @@ -141,6 +123,7 @@ public class EipFragment extends Fragment implements Observer { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + openVpnConnection = new EipFragmentServiceConnection(); eipStatus = EipStatus.getInstance(); Activity activity = getActivity(); if (activity != null) { @@ -230,7 +213,7 @@ public class EipFragment extends Fragment implements Observer { } void handleIcon() { - if (eipStatus.isConnected() || eipStatus.isConnecting()) + if (isOpenVpnRunningWithoutNetwork() || eipStatus.isConnected() || eipStatus.isConnecting()) handleSwitchOff(); else handleSwitchOn(); @@ -386,10 +369,20 @@ public class EipFragment extends Fragment implements Observer { routedText.setVisibility(GONE); vpnRoute.setVisibility(GONE); colorBackgroundALittle(); - } else if (eipStatus.isConnected() || isOpenVpnRunningWithoutNetwork()) { + } else if (eipStatus.isConnected() ) { mainButton.setText(activity.getString(R.string.vpn_button_turn_off)); vpnStateImage.setStateIcon(R.drawable.vpn_connected); vpnStateImage.stopProgress(true); + routedText.setText(R.string.vpn_securely_routed); + routedText.setVisibility(VISIBLE); + vpnRoute.setVisibility(VISIBLE); + vpnRoute.setText(ConfigHelper.getProviderName(preferences)); + colorBackground(); + } else if(isOpenVpnRunningWithoutNetwork()){ + mainButton.setText(activity.getString(R.string.vpn_button_turn_off)); + vpnStateImage.setStateIcon(R.drawable.vpn_disconnected); + vpnStateImage.stopProgress(true); + routedText.setText(R.string.vpn_securely_routed_no_internet); routedText.setVisibility(VISIBLE); vpnRoute.setVisibility(VISIBLE); vpnRoute.setText(ConfigHelper.getProviderName(preferences)); @@ -407,10 +400,8 @@ public class EipFragment extends Fragment implements Observer { private boolean isOpenVpnRunningWithoutNetwork() { boolean isRunning = false; try { - if (mService != null) { - isRunning = eipStatus.getLevel() == LEVEL_NONETWORK && - mService.isVpnRunning(); - } + isRunning = eipStatus.getLevel() == LEVEL_NONETWORK && + mService.isVpnRunning(); } catch (Exception e) { //eat me e.printStackTrace(); @@ -467,4 +458,18 @@ public class EipFragment extends Fragment implements Observer { activity.startActivityForResult(intent, REQUEST_CODE_LOG_IN); } } + + private class EipFragmentServiceConnection implements ServiceConnection { + @Override + public void onServiceConnected(ComponentName className, + IBinder service) { + mService = IOpenVPNServiceInternal.Stub.asInterface(service); + handleNewState(); + } + + @Override + public void onServiceDisconnected(ComponentName arg0) { + mService = null; + } + } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2ea4670a..2c191afa 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -85,6 +85,7 @@ Turn off Stop blocking Your traffic is securely routed through: + No internet connection. Your traffic will be securely routed through: Bitmask Log Bitmask Log -- cgit v1.2.3 From e02f1648353dad012c3c556f996a667640da11ce Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 25 Feb 2018 11:39:54 +0100 Subject: #8754 don't cancel dialog onSavedInstanceState --- .../drawer/NavigationDrawerFragment.java | 69 +++++++++++----------- 1 file changed, 35 insertions(+), 34 deletions(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java index 111c02f5..6e39e9ed 100644 --- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java @@ -48,9 +48,9 @@ import android.widget.Toast; import se.leap.bitmaskclient.ConfigHelper; import se.leap.bitmaskclient.DrawerSettingsAdapter; import se.leap.bitmaskclient.DrawerSettingsAdapter.DrawerSettingsItem; +import se.leap.bitmaskclient.EipFragment; import se.leap.bitmaskclient.Provider; import se.leap.bitmaskclient.ProviderListActivity; -import se.leap.bitmaskclient.EipFragment; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.fragments.AboutFragment; import se.leap.bitmaskclient.fragments.LogFragment; @@ -136,7 +136,6 @@ public class NavigationDrawerFragment extends Fragment { mDrawerView = inflater.inflate(R.layout.drawer_main, container, false); restoreFromSavedInstance(savedInstanceState); return mDrawerView; - } public boolean isDrawerOpen() { @@ -271,7 +270,6 @@ public class NavigationDrawerFragment extends Fragment { super.onSaveInstanceState(outState); if (showEnableExperimentalFeature) { outState.putBoolean(KEY_SHOW_ENABLE_EXPERIMENTAL_FEATURE, true); - alertDialog.dismiss(); } } @@ -287,37 +285,40 @@ public class NavigationDrawerFragment extends Fragment { return; } - AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getActivity()); - showEnableExperimentalFeature = true; - alertDialog = alertBuilder.setTitle(activity.getString(R.string.save_battery)) - .setMessage(activity.getString(R.string.save_battery_message)) - .setPositiveButton((android.R.string.yes), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - DrawerSettingsItem item = settingsListAdapter.getDrawerItem(BATTERY_SAVER); - item.setChecked(true); - settingsListAdapter.notifyDataSetChanged(); - ConfigHelper.saveBattery(getContext(), item.isChecked()); - } - }) - .setNegativeButton(activity.getString(android.R.string.no), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - disableSwitch(BATTERY_SAVER); - } - }).setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialog) { - showEnableExperimentalFeature = false; - } - }).setOnCancelListener(new DialogInterface.OnCancelListener() { - @Override - public void onCancel(DialogInterface dialog) { - disableSwitch(BATTERY_SAVER); - showEnableExperimentalFeature = false; - } - }) - .show(); + try { + AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getActivity()); + showEnableExperimentalFeature = true; + alertDialog = alertBuilder.setTitle(activity.getString(R.string.save_battery)) + .setMessage(activity.getString(R.string.save_battery_message)) + .setPositiveButton((android.R.string.yes), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + DrawerSettingsItem item = settingsListAdapter.getDrawerItem(BATTERY_SAVER); + item.setChecked(true); + settingsListAdapter.notifyDataSetChanged(); + ConfigHelper.saveBattery(getContext(), item.isChecked()); + } + }) + .setNegativeButton(activity.getString(android.R.string.no), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + disableSwitch(BATTERY_SAVER); + } + }).setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + showEnableExperimentalFeature = false; + } + }).setOnCancelListener(new DialogInterface.OnCancelListener() { + @Override + public void onCancel(DialogInterface dialog) { + disableSwitch(BATTERY_SAVER); + } + }).show(); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } @Override -- cgit v1.2.3 From 205c65cf94a9cc96e9b4d15e3ff60a3209cfbb60 Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Sun, 25 Feb 2018 15:13:32 +0100 Subject: 8865 - fix ics_openvpn --- app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java index 6c312c87..f701b7aa 100644 --- a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java +++ b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java @@ -913,7 +913,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac // CONNECTED // Does not work :( notificationManager.buildOpenVpnNotification( - mProfile.mName, + mProfile != null ? mProfile.mName : "", VpnStatus.getLastCleanLogMessage(this), VpnStatus.getLastCleanLogMessage(this), level, @@ -944,7 +944,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac humanReadableByteCount(out, false, getResources()), humanReadableByteCount(diffOut / OpenVPNManagement.mBytecountInterval, true, getResources())); notificationManager.buildOpenVpnNotification( - mProfile.mName, + mProfile != null ? mProfile.mName : "", netstat, null, LEVEL_CONNECTED, @@ -987,7 +987,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac public void requestInputFromUser(int resid, String needed) { VpnStatus.updateStateString("NEED", "need " + needed, resid, LEVEL_WAITING_FOR_USER_INPUT); notificationManager.buildOpenVpnNotification( - mProfile.mName, + mProfile != null ? mProfile.mName : "", getString(resid), getString(resid), LEVEL_WAITING_FOR_USER_INPUT, -- cgit v1.2.3 From 0bf176d8e925c71be7853c67f7c8b57d58df0ce3 Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Sun, 25 Feb 2018 15:47:49 +0100 Subject: 8865 - set correct route as in 8824 --- app/src/main/java/se/leap/bitmaskclient/EipFragment.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index 35693c9b..f80d15e7 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -44,8 +44,10 @@ import java.util.Observer; import butterknife.ButterKnife; import butterknife.InjectView; import butterknife.OnClick; +import de.blinkt.openvpn.VpnProfile; import de.blinkt.openvpn.core.IOpenVPNServiceInternal; import de.blinkt.openvpn.core.OpenVPNService; +import de.blinkt.openvpn.core.ProfileManager; import se.leap.bitmaskclient.eip.EipCommand; import se.leap.bitmaskclient.eip.EipStatus; import se.leap.bitmaskclient.views.VpnStateImage; @@ -376,7 +378,7 @@ public class EipFragment extends Fragment implements Observer { routedText.setText(R.string.vpn_securely_routed); routedText.setVisibility(VISIBLE); vpnRoute.setVisibility(VISIBLE); - vpnRoute.setText(ConfigHelper.getProviderName(preferences)); + setVpnRouteText(); colorBackground(); } else if(isOpenVpnRunningWithoutNetwork()){ mainButton.setText(activity.getString(R.string.vpn_button_turn_off)); @@ -385,7 +387,7 @@ public class EipFragment extends Fragment implements Observer { routedText.setText(R.string.vpn_securely_routed_no_internet); routedText.setVisibility(VISIBLE); vpnRoute.setVisibility(VISIBLE); - vpnRoute.setText(ConfigHelper.getProviderName(preferences)); + setVpnRouteText(); colorBackground(); } else { mainButton.setText(activity.getString(R.string.vpn_button_turn_on)); @@ -459,6 +461,15 @@ public class EipFragment extends Fragment implements Observer { } } + private void setVpnRouteText() { + String vpnRouteString = provider.getName(); + VpnProfile vpnProfile = ProfileManager.getLastConnectedVpn(); + if (vpnProfile != null && vpnProfile.mName != null) { + vpnRouteString += " (" + vpnProfile.mName + ")"; + } + vpnRoute.setText(vpnRouteString); + } + private class EipFragmentServiceConnection implements ServiceConnection { @Override public void onServiceConnected(ComponentName className, -- cgit v1.2.3 From 304efac028b1a2e2b145e5b2cba474c4b84fd3cf Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Sun, 25 Feb 2018 16:10:05 +0100 Subject: 8865 - color background only a little if not internet connection --- app/src/main/java/se/leap/bitmaskclient/EipFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index 7c61ddae..c4f4dbc9 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -389,7 +389,7 @@ public class EipFragment extends Fragment implements Observer { routedText.setVisibility(VISIBLE); vpnRoute.setVisibility(VISIBLE); setVpnRouteText(); - colorBackground(); + colorBackgroundALittle(); } else { mainButton.setText(activity.getString(R.string.vpn_button_turn_on)); vpnStateImage.setStateIcon(R.drawable.vpn_disconnected); -- cgit v1.2.3 From 44322f28b28676a8938f4c1066a75ba47397aa7d Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Mon, 26 Feb 2018 20:31:48 +0100 Subject: 8865 - allow disconnecting without internet * moved logic from MainActivity to EIP --- .../java/se/leap/bitmaskclient/EipFragment.java | 3 +- .../java/se/leap/bitmaskclient/MainActivity.java | 74 +-------------- .../main/java/se/leap/bitmaskclient/eip/EIP.java | 103 +++++++++++++++++++-- .../res/layout-xlarge/eip_service_fragment.xml | 17 +--- app/src/main/res/layout/eip_service_fragment.xml | 27 +----- 5 files changed, 107 insertions(+), 117 deletions(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index c4f4dbc9..956cd67e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -37,7 +37,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; -import android.widget.TextView; import java.util.Observable; import java.util.Observer; @@ -252,7 +251,7 @@ public class EipFragment extends Fragment implements Observer { } private void handleSwitchOff() { - if (eipStatus.isConnecting()) { + if (isOpenVpnRunningWithoutNetwork() || eipStatus.isConnecting()) { askPendingStartCancellation(); } else if (eipStatus.isConnected()) { askToStopEIP(); diff --git a/app/src/main/java/se/leap/bitmaskclient/MainActivity.java b/app/src/main/java/se/leap/bitmaskclient/MainActivity.java index b4be55a4..ee754b32 100644 --- a/app/src/main/java/se/leap/bitmaskclient/MainActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/MainActivity.java @@ -2,15 +2,11 @@ package se.leap.bitmaskclient; import android.content.BroadcastReceiver; -import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.content.ServiceConnection; import android.content.SharedPreferences; import android.os.Bundle; -import android.os.IBinder; -import android.os.RemoteException; import android.support.v4.app.DialogFragment; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; @@ -26,14 +22,9 @@ import org.json.JSONObject; import java.util.Observable; import java.util.Observer; -import de.blinkt.openvpn.core.IOpenVPNServiceInternal; -import de.blinkt.openvpn.core.OpenVPNService; -import de.blinkt.openvpn.core.ProfileManager; -import de.blinkt.openvpn.core.VpnStatus; import se.leap.bitmaskclient.drawer.NavigationDrawerFragment; import se.leap.bitmaskclient.eip.EipCommand; import se.leap.bitmaskclient.eip.EipStatus; -import se.leap.bitmaskclient.eip.VoidVpnService; import se.leap.bitmaskclient.fragments.LogFragment; import static android.content.Intent.CATEGORY_DEFAULT; @@ -43,9 +34,7 @@ import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_CODE; import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY; import static se.leap.bitmaskclient.Constants.EIP_ACTION_START; import static se.leap.bitmaskclient.Constants.EIP_ACTION_STOP; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_STOP_BLOCKING_VPN; import static se.leap.bitmaskclient.Constants.EIP_REQUEST; -import static se.leap.bitmaskclient.Constants.EIP_RESTART_ON_BOOT; import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; import static se.leap.bitmaskclient.Constants.REQUEST_CODE_CONFIGURE_LEAP; import static se.leap.bitmaskclient.Constants.REQUEST_CODE_LOG_IN; @@ -62,31 +51,15 @@ import static se.leap.bitmaskclient.R.string.downloading_vpn_certificate_failed; import static se.leap.bitmaskclient.R.string.vpn_certificate_user_message; -public class MainActivity extends AppCompatActivity implements Observer { +public class MainActivity extends AppCompatActivity { public final static String TAG = MainActivity.class.getSimpleName(); private Provider provider = new Provider(); private SharedPreferences preferences; - private EipStatus eipStatus; private NavigationDrawerFragment navigationDrawerFragment; private MainActivityBroadcastReceiver mainActivityBroadcastReceiver; - private IOpenVPNServiceInternal mService; - private ServiceConnection openVpnConnection = new ServiceConnection() { - @Override - public void onServiceConnected(ComponentName className, - IBinder service) { - mService = IOpenVPNServiceInternal.Stub.asInterface(service); - } - - @Override - public void onServiceDisconnected(ComponentName arg0) { - mService = null; - } - - }; - public final static String ACTION_SHOW_VPN_FRAGMENT = "action_show_vpn_fragment"; public final static String ACTION_SHOW_LOG_FRAGMENT = "action_show_log_fragment"; @@ -114,14 +87,12 @@ public class MainActivity extends AppCompatActivity implements Observer { R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); - eipStatus = EipStatus.getInstance(); handleIntentAction(getIntent()); } @Override protected void onResume() { super.onResume(); - bindOpenVpnService(); } @Override @@ -205,7 +176,6 @@ public class MainActivity extends AppCompatActivity implements Observer { @Override protected void onPause() { super.onPause(); - unbindService(openVpnConnection); } @Override @@ -215,14 +185,6 @@ public class MainActivity extends AppCompatActivity implements Observer { super.onDestroy(); } - - @Override - public void update(Observable observable, Object data) { - if (observable instanceof EipStatus) { - eipStatus = (EipStatus) observable; - } - } - private void setUpBroadcastReceiver() { IntentFilter updateIntentFilter = new IntentFilter(BROADCAST_EIP_EVENT); updateIntentFilter.addAction(BROADCAST_PROVIDER_API_EVENT); @@ -283,7 +245,6 @@ public class MainActivity extends AppCompatActivity implements Observer { case EIP_ACTION_STOP: switch (resultCode) { case RESULT_OK: - stop(); break; case RESULT_CANCELED: break; @@ -343,39 +304,6 @@ public class MainActivity extends AppCompatActivity implements Observer { } - - private void stop() { - preferences.edit().putBoolean(EIP_RESTART_ON_BOOT, false).apply(); - if (eipStatus.isBlockingVpnEstablished()) { - stopBlockingVpn(); - } - disconnect(); - } - - private void stopBlockingVpn() { - Log.d(TAG, "stop VoidVpn!"); - Intent stopVoidVpnIntent = new Intent(this, VoidVpnService.class); - stopVoidVpnIntent.setAction(EIP_ACTION_STOP_BLOCKING_VPN); - startService(stopVoidVpnIntent); - } - - private void disconnect() { - ProfileManager.setConntectedVpnProfileDisconnected(this); - if (mService != null) { - try { - mService.stopVPN(false); - } catch (RemoteException e) { - VpnStatus.logException(e); - } - } - } - - private void bindOpenVpnService() { - Intent intent = new Intent(this, OpenVPNService.class); - intent.setAction(OpenVPNService.START_SERVICE); - bindService(intent, openVpnConnection, Context.BIND_AUTO_CREATE); - } - private void askUserToLogIn(String userMessage) { Intent intent = new Intent(this, LoginActivity.class); intent.putExtra(PROVIDER_KEY, provider); diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java index 5cf180d3..0c83c261 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java @@ -17,9 +17,13 @@ package se.leap.bitmaskclient.eip; import android.app.IntentService; +import android.content.ComponentName; import android.content.Intent; +import android.content.ServiceConnection; import android.content.SharedPreferences; import android.os.Bundle; +import android.os.IBinder; +import android.os.RemoteException; import android.os.ResultReceiver; import android.support.v4.content.LocalBroadcastManager; import android.util.Log; @@ -28,13 +32,20 @@ import org.json.JSONException; import org.json.JSONObject; import java.lang.ref.WeakReference; +import java.util.Observable; +import java.util.Observer; import de.blinkt.openvpn.LaunchVPN; +import de.blinkt.openvpn.core.IOpenVPNServiceInternal; +import de.blinkt.openvpn.core.OpenVPNService; +import de.blinkt.openvpn.core.ProfileManager; +import de.blinkt.openvpn.core.VpnStatus; import se.leap.bitmaskclient.OnBootReceiver; import static android.app.Activity.RESULT_CANCELED; import static android.app.Activity.RESULT_OK; import static android.content.Intent.CATEGORY_DEFAULT; +import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_NONETWORK; import static se.leap.bitmaskclient.Constants.BROADCAST_EIP_EVENT; import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_CODE; import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY; @@ -43,6 +54,7 @@ import static se.leap.bitmaskclient.Constants.EIP_ACTION_IS_RUNNING; import static se.leap.bitmaskclient.Constants.EIP_ACTION_START; import static se.leap.bitmaskclient.Constants.EIP_ACTION_START_ALWAYS_ON_VPN; import static se.leap.bitmaskclient.Constants.EIP_ACTION_STOP; +import static se.leap.bitmaskclient.Constants.EIP_ACTION_STOP_BLOCKING_VPN; import static se.leap.bitmaskclient.Constants.EIP_EARLY_ROUTES; import static se.leap.bitmaskclient.Constants.EIP_RECEIVER; import static se.leap.bitmaskclient.Constants.EIP_REQUEST; @@ -63,7 +75,7 @@ import static se.leap.bitmaskclient.R.string.vpn_certificate_is_invalid; * @author Sean Leonard * @author Parménides GV */ -public final class EIP extends IntentService { +public final class EIP extends IntentService implements Observer{ public final static String TAG = EIP.class.getSimpleName(), SERVICE_API_PATH = "config/eip-service.json", @@ -73,6 +85,27 @@ public final class EIP extends IntentService { private WeakReference mReceiverRef = new WeakReference<>(null); private SharedPreferences preferences; + private EipStatus eipStatus; + private IOpenVPNServiceInternal mService; + private boolean stopEipIfConnectionIsEstablished = false; + + private ServiceConnection openVpnConnection = new ServiceConnection() { + @Override + public void onServiceConnected(ComponentName className, + IBinder service) { + mService = IOpenVPNServiceInternal.Stub.asInterface(service); + if (stopEipIfConnectionIsEstablished) { + stopEipIfConnectionIsEstablished = false; + stopEIP(); + } + } + + @Override + public void onServiceDisconnected(ComponentName arg0) { + mService = null; + } + }; + public EIP() { super(TAG); } @@ -80,9 +113,30 @@ public final class EIP extends IntentService { @Override public void onCreate() { super.onCreate(); + eipStatus = EipStatus.getInstance(); + eipStatus.addObserver(this); + Intent intent = new Intent(this, OpenVPNService.class); + intent.setAction(OpenVPNService.START_SERVICE); + bindOpenVpnService(); preferences = getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE); } + @Override + public void onDestroy() { + super.onDestroy(); + unbindService(openVpnConnection); + eipStatus.deleteObserver(this); + eipStatus = null; + mService = null; + } + + @Override + public void update(Observable observable, Object data) { + if (observable instanceof EipStatus) { + eipStatus = (EipStatus) observable; + } + } + @Override protected void onHandleIntent(Intent intent) { String action = intent.getAction(); @@ -183,22 +237,41 @@ public final class EIP extends IntentService { } private void stopEIP() { - // TODO stop eip from here if possible... - EipStatus eipStatus = EipStatus.getInstance(); + if (mService == null) { + stopEipIfConnectionIsEstablished = true; + return; + } + int resultCode = RESULT_CANCELED; - if (eipStatus.isConnected() || eipStatus.isConnecting()) + if (isOpenVpnRunningWithoutNetwork() || eipStatus.isConnected() || eipStatus.isConnecting()) { + preferences.edit().putBoolean(EIP_RESTART_ON_BOOT, false).apply(); + if (eipStatus.isBlockingVpnEstablished()) { + stopBlockingVpn(); + } + ProfileManager.setConntectedVpnProfileDisconnected(this); + try { + mService.stopVPN(false); + } catch (RemoteException e) { + VpnStatus.logException(e); + } resultCode = RESULT_OK; - + } tellToReceiverOrBroadcast(EIP_ACTION_STOP, resultCode); } + private void stopBlockingVpn() { + Log.d(TAG, "stop VoidVpn!"); + Intent stopVoidVpnIntent = new Intent(this, VoidVpnService.class); + stopVoidVpnIntent.setAction(EIP_ACTION_STOP_BLOCKING_VPN); + startService(stopVoidVpnIntent); + } + /** * Checks the last stored status notified by ics-openvpn * Sends Activity.RESULT_CANCELED to the ResultReceiver that made the * request if it's not connected, Activity.RESULT_OK otherwise. */ private void isRunning() { - EipStatus eipStatus = EipStatus.getInstance(); int resultCode = (eipStatus.isConnected()) ? RESULT_OK : RESULT_CANCELED; @@ -278,4 +351,22 @@ public final class EIP extends IntentService { e.printStackTrace(); } } + + private boolean isOpenVpnRunningWithoutNetwork() { + boolean isRunning = false; + try { + isRunning = eipStatus.getLevel() == LEVEL_NONETWORK && + mService.isVpnRunning(); + } catch (Exception e) { + //eat me + e.printStackTrace(); + } + return isRunning; + } + + private void bindOpenVpnService() { + Intent intent = new Intent(this, OpenVPNService.class); + intent.setAction(OpenVPNService.START_SERVICE); + bindService(intent, openVpnConnection, BIND_AUTO_CREATE); + } } diff --git a/app/src/main/res/layout-xlarge/eip_service_fragment.xml b/app/src/main/res/layout-xlarge/eip_service_fragment.xml index c09bda2d..2fe046b8 100644 --- a/app/src/main/res/layout-xlarge/eip_service_fragment.xml +++ b/app/src/main/res/layout-xlarge/eip_service_fragment.xml @@ -58,11 +58,7 @@ android:id="@+id/eipLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="@dimen/stdpadding" - android:layout_marginStart="@dimen/stdpadding" - android:layout_marginTop="@dimen/stdpadding" - android:layout_marginLeft="@dimen/stdpadding" - android:layout_marginRight="@dimen/stdpadding" + android:padding="@dimen/stdpadding" android:text="@string/eip_service_label" android:textAppearance="?android:attr/textAppearanceMedium" android:gravity="center" @@ -102,11 +98,7 @@ android:id="@+id/routed_text" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="@dimen/stdpadding" - android:layout_marginStart="@dimen/stdpadding" - android:layout_marginTop="@dimen/stdpadding" - android:layout_marginLeft="@dimen/stdpadding" - android:layout_marginRight="@dimen/stdpadding" + android:padding="@dimen/stdpadding" android:text="@string/vpn_securely_routed" android:gravity="center" android:visibility="visible" @@ -118,10 +110,7 @@ android:id="@+id/vpn_route" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="@dimen/stdpadding" - android:layout_marginStart="@dimen/stdpadding" - android:layout_marginLeft="@dimen/stdpadding" - android:layout_marginRight="@dimen/stdpadding" + android:padding="@dimen/stdpadding" android:gravity="center" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/eip_service_fragment.xml b/app/src/main/res/layout/eip_service_fragment.xml index 30b94de9..347f09d2 100644 --- a/app/src/main/res/layout/eip_service_fragment.xml +++ b/app/src/main/res/layout/eip_service_fragment.xml @@ -56,11 +56,7 @@ android:id="@+id/eipLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="@dimen/stdpadding" - android:layout_marginStart="@dimen/stdpadding" - android:layout_marginTop="@dimen/stdpadding" - android:layout_marginLeft="@dimen/stdpadding" - android:layout_marginRight="@dimen/stdpadding" + android:padding="@dimen/stdpadding" android:text="@string/eip_service_label" android:textAppearance="?android:attr/textAppearanceMedium" android:gravity="center" @@ -85,28 +81,18 @@ android:id="@+id/vpn_main_button" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/stdpadding" - android:layout_marginEnd="@dimen/stdpadding" - android:layout_marginStart="@dimen/stdpadding" - android:layout_marginTop="@dimen/stdpadding" - android:layout_marginLeft="@dimen/stdpadding" - android:layout_marginRight="@dimen/stdpadding" + android:padding="@dimen/stdpadding" app:layout_constraintBottom_toBottomOf="@+id/background" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" android:text="@string/vpn.button.turn.on" - style="@style/BitmaskButtonBlack" - /> + style="@style/BitmaskButtonBlack" /> Date: Tue, 27 Feb 2018 13:23:43 +0100 Subject: 8871 - rename sign up/log in --- app/src/main/res/values/strings.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2ea4670a..f4a5e6a8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -39,12 +39,11 @@ Try again: I/O error Try again: Bad response from the server Encryption algorithm not found. Please upgrade Android! - Sign Up/Log In Log In - Log in to profile + Log In Log Out Sign Up - Create profile + Sign Up Set up provider Configuration Error Configure -- cgit v1.2.3 From c532d4726e72071a14959846a2ebde3c693c2d72 Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Tue, 27 Feb 2018 13:34:32 +0100 Subject: 8872 - new launcher icon --- app/src/main/AndroidManifest.xml | 4 +- app/src/main/ic_launcher-web.png | Bin 0 -> 39579 bytes app/src/main/res/drawable-hdpi/icon.png | Bin 7965 -> 0 bytes app/src/main/res/drawable-ldpi/icon.png | Bin 3118 -> 0 bytes app/src/main/res/drawable-mdpi/icon.png | Bin 4518 -> 0 bytes app/src/main/res/drawable-xhdpi/icon.png | Bin 11135 -> 0 bytes .../main/res/drawable/ic_launcher_background.xml | 74 +++++++++++++++++++++ app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml | 5 ++ .../res/mipmap-anydpi-v26/ic_launcher_round.xml | 5 ++ app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 4054 bytes .../res/mipmap-hdpi/ic_launcher_foreground.png | Bin 0 -> 5812 bytes app/src/main/res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 6301 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2738 bytes .../res/mipmap-mdpi/ic_launcher_foreground.png | Bin 0 -> 3796 bytes app/src/main/res/mipmap-mdpi/ic_launcher_round.png | Bin 0 -> 3812 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 5607 bytes .../res/mipmap-xhdpi/ic_launcher_foreground.png | Bin 0 -> 8292 bytes .../main/res/mipmap-xhdpi/ic_launcher_round.png | Bin 0 -> 8783 bytes app/src/main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 8486 bytes .../res/mipmap-xxhdpi/ic_launcher_foreground.png | Bin 0 -> 13528 bytes .../main/res/mipmap-xxhdpi/ic_launcher_round.png | Bin 0 -> 13542 bytes app/src/main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 11566 bytes .../res/mipmap-xxxhdpi/ic_launcher_foreground.png | Bin 0 -> 20381 bytes .../main/res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 19074 bytes 24 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 app/src/main/ic_launcher-web.png delete mode 100644 app/src/main/res/drawable-hdpi/icon.png delete mode 100644 app/src/main/res/drawable-ldpi/icon.png delete mode 100644 app/src/main/res/drawable-mdpi/icon.png delete mode 100644 app/src/main/res/drawable-xhdpi/icon.png create mode 100644 app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png (limited to 'app') diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b11bd89f..740dee08 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -32,9 +32,9 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..c4a603d4 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..c4a603d4 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 00000000..2d33905e Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png new file mode 100644 index 00000000..4b5ebe2f Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 00000000..226eb6cd Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 00000000..93c5dda3 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png new file mode 100644 index 00000000..8adc11b3 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 00000000..8b289993 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 00000000..f1ffdafa Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png new file mode 100644 index 00000000..bdaf6943 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 00000000..bf47a793 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..8c507b7b Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 00000000..7197b58a Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 00000000..68139e11 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000..c0eafbc4 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 00000000..cc095966 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 00000000..89d2ec18 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ -- cgit v1.2.3 From e5c09ca83bafd5cc8d473793b18c82f649ba02f7 Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Tue, 27 Feb 2018 17:57:32 +0100 Subject: Revert "8865 - allow disconnecting without internet" This reverts commit 44322f28b28676a8938f4c1066a75ba47397aa7d. --- .../java/se/leap/bitmaskclient/EipFragment.java | 3 +- .../java/se/leap/bitmaskclient/MainActivity.java | 74 ++++++++++++++- .../main/java/se/leap/bitmaskclient/eip/EIP.java | 103 ++------------------- .../res/layout-xlarge/eip_service_fragment.xml | 17 +++- app/src/main/res/layout/eip_service_fragment.xml | 27 +++++- 5 files changed, 117 insertions(+), 107 deletions(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index 956cd67e..c4f4dbc9 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -37,6 +37,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; +import android.widget.TextView; import java.util.Observable; import java.util.Observer; @@ -251,7 +252,7 @@ public class EipFragment extends Fragment implements Observer { } private void handleSwitchOff() { - if (isOpenVpnRunningWithoutNetwork() || eipStatus.isConnecting()) { + if (eipStatus.isConnecting()) { askPendingStartCancellation(); } else if (eipStatus.isConnected()) { askToStopEIP(); diff --git a/app/src/main/java/se/leap/bitmaskclient/MainActivity.java b/app/src/main/java/se/leap/bitmaskclient/MainActivity.java index ee754b32..b4be55a4 100644 --- a/app/src/main/java/se/leap/bitmaskclient/MainActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/MainActivity.java @@ -2,11 +2,15 @@ package se.leap.bitmaskclient; import android.content.BroadcastReceiver; +import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.content.ServiceConnection; import android.content.SharedPreferences; import android.os.Bundle; +import android.os.IBinder; +import android.os.RemoteException; import android.support.v4.app.DialogFragment; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; @@ -22,9 +26,14 @@ import org.json.JSONObject; import java.util.Observable; import java.util.Observer; +import de.blinkt.openvpn.core.IOpenVPNServiceInternal; +import de.blinkt.openvpn.core.OpenVPNService; +import de.blinkt.openvpn.core.ProfileManager; +import de.blinkt.openvpn.core.VpnStatus; import se.leap.bitmaskclient.drawer.NavigationDrawerFragment; import se.leap.bitmaskclient.eip.EipCommand; import se.leap.bitmaskclient.eip.EipStatus; +import se.leap.bitmaskclient.eip.VoidVpnService; import se.leap.bitmaskclient.fragments.LogFragment; import static android.content.Intent.CATEGORY_DEFAULT; @@ -34,7 +43,9 @@ import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_CODE; import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY; import static se.leap.bitmaskclient.Constants.EIP_ACTION_START; import static se.leap.bitmaskclient.Constants.EIP_ACTION_STOP; +import static se.leap.bitmaskclient.Constants.EIP_ACTION_STOP_BLOCKING_VPN; import static se.leap.bitmaskclient.Constants.EIP_REQUEST; +import static se.leap.bitmaskclient.Constants.EIP_RESTART_ON_BOOT; import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; import static se.leap.bitmaskclient.Constants.REQUEST_CODE_CONFIGURE_LEAP; import static se.leap.bitmaskclient.Constants.REQUEST_CODE_LOG_IN; @@ -51,15 +62,31 @@ import static se.leap.bitmaskclient.R.string.downloading_vpn_certificate_failed; import static se.leap.bitmaskclient.R.string.vpn_certificate_user_message; -public class MainActivity extends AppCompatActivity { +public class MainActivity extends AppCompatActivity implements Observer { public final static String TAG = MainActivity.class.getSimpleName(); private Provider provider = new Provider(); private SharedPreferences preferences; + private EipStatus eipStatus; private NavigationDrawerFragment navigationDrawerFragment; private MainActivityBroadcastReceiver mainActivityBroadcastReceiver; + private IOpenVPNServiceInternal mService; + private ServiceConnection openVpnConnection = new ServiceConnection() { + @Override + public void onServiceConnected(ComponentName className, + IBinder service) { + mService = IOpenVPNServiceInternal.Stub.asInterface(service); + } + + @Override + public void onServiceDisconnected(ComponentName arg0) { + mService = null; + } + + }; + public final static String ACTION_SHOW_VPN_FRAGMENT = "action_show_vpn_fragment"; public final static String ACTION_SHOW_LOG_FRAGMENT = "action_show_log_fragment"; @@ -87,12 +114,14 @@ public class MainActivity extends AppCompatActivity { R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); + eipStatus = EipStatus.getInstance(); handleIntentAction(getIntent()); } @Override protected void onResume() { super.onResume(); + bindOpenVpnService(); } @Override @@ -176,6 +205,7 @@ public class MainActivity extends AppCompatActivity { @Override protected void onPause() { super.onPause(); + unbindService(openVpnConnection); } @Override @@ -185,6 +215,14 @@ public class MainActivity extends AppCompatActivity { super.onDestroy(); } + + @Override + public void update(Observable observable, Object data) { + if (observable instanceof EipStatus) { + eipStatus = (EipStatus) observable; + } + } + private void setUpBroadcastReceiver() { IntentFilter updateIntentFilter = new IntentFilter(BROADCAST_EIP_EVENT); updateIntentFilter.addAction(BROADCAST_PROVIDER_API_EVENT); @@ -245,6 +283,7 @@ public class MainActivity extends AppCompatActivity { case EIP_ACTION_STOP: switch (resultCode) { case RESULT_OK: + stop(); break; case RESULT_CANCELED: break; @@ -304,6 +343,39 @@ public class MainActivity extends AppCompatActivity { } + + private void stop() { + preferences.edit().putBoolean(EIP_RESTART_ON_BOOT, false).apply(); + if (eipStatus.isBlockingVpnEstablished()) { + stopBlockingVpn(); + } + disconnect(); + } + + private void stopBlockingVpn() { + Log.d(TAG, "stop VoidVpn!"); + Intent stopVoidVpnIntent = new Intent(this, VoidVpnService.class); + stopVoidVpnIntent.setAction(EIP_ACTION_STOP_BLOCKING_VPN); + startService(stopVoidVpnIntent); + } + + private void disconnect() { + ProfileManager.setConntectedVpnProfileDisconnected(this); + if (mService != null) { + try { + mService.stopVPN(false); + } catch (RemoteException e) { + VpnStatus.logException(e); + } + } + } + + private void bindOpenVpnService() { + Intent intent = new Intent(this, OpenVPNService.class); + intent.setAction(OpenVPNService.START_SERVICE); + bindService(intent, openVpnConnection, Context.BIND_AUTO_CREATE); + } + private void askUserToLogIn(String userMessage) { Intent intent = new Intent(this, LoginActivity.class); intent.putExtra(PROVIDER_KEY, provider); diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java index 0c83c261..5cf180d3 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java @@ -17,13 +17,9 @@ package se.leap.bitmaskclient.eip; import android.app.IntentService; -import android.content.ComponentName; import android.content.Intent; -import android.content.ServiceConnection; import android.content.SharedPreferences; import android.os.Bundle; -import android.os.IBinder; -import android.os.RemoteException; import android.os.ResultReceiver; import android.support.v4.content.LocalBroadcastManager; import android.util.Log; @@ -32,20 +28,13 @@ import org.json.JSONException; import org.json.JSONObject; import java.lang.ref.WeakReference; -import java.util.Observable; -import java.util.Observer; import de.blinkt.openvpn.LaunchVPN; -import de.blinkt.openvpn.core.IOpenVPNServiceInternal; -import de.blinkt.openvpn.core.OpenVPNService; -import de.blinkt.openvpn.core.ProfileManager; -import de.blinkt.openvpn.core.VpnStatus; import se.leap.bitmaskclient.OnBootReceiver; import static android.app.Activity.RESULT_CANCELED; import static android.app.Activity.RESULT_OK; import static android.content.Intent.CATEGORY_DEFAULT; -import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_NONETWORK; import static se.leap.bitmaskclient.Constants.BROADCAST_EIP_EVENT; import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_CODE; import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY; @@ -54,7 +43,6 @@ import static se.leap.bitmaskclient.Constants.EIP_ACTION_IS_RUNNING; import static se.leap.bitmaskclient.Constants.EIP_ACTION_START; import static se.leap.bitmaskclient.Constants.EIP_ACTION_START_ALWAYS_ON_VPN; import static se.leap.bitmaskclient.Constants.EIP_ACTION_STOP; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_STOP_BLOCKING_VPN; import static se.leap.bitmaskclient.Constants.EIP_EARLY_ROUTES; import static se.leap.bitmaskclient.Constants.EIP_RECEIVER; import static se.leap.bitmaskclient.Constants.EIP_REQUEST; @@ -75,7 +63,7 @@ import static se.leap.bitmaskclient.R.string.vpn_certificate_is_invalid; * @author Sean Leonard * @author Parménides GV */ -public final class EIP extends IntentService implements Observer{ +public final class EIP extends IntentService { public final static String TAG = EIP.class.getSimpleName(), SERVICE_API_PATH = "config/eip-service.json", @@ -85,27 +73,6 @@ public final class EIP extends IntentService implements Observer{ private WeakReference mReceiverRef = new WeakReference<>(null); private SharedPreferences preferences; - private EipStatus eipStatus; - private IOpenVPNServiceInternal mService; - private boolean stopEipIfConnectionIsEstablished = false; - - private ServiceConnection openVpnConnection = new ServiceConnection() { - @Override - public void onServiceConnected(ComponentName className, - IBinder service) { - mService = IOpenVPNServiceInternal.Stub.asInterface(service); - if (stopEipIfConnectionIsEstablished) { - stopEipIfConnectionIsEstablished = false; - stopEIP(); - } - } - - @Override - public void onServiceDisconnected(ComponentName arg0) { - mService = null; - } - }; - public EIP() { super(TAG); } @@ -113,30 +80,9 @@ public final class EIP extends IntentService implements Observer{ @Override public void onCreate() { super.onCreate(); - eipStatus = EipStatus.getInstance(); - eipStatus.addObserver(this); - Intent intent = new Intent(this, OpenVPNService.class); - intent.setAction(OpenVPNService.START_SERVICE); - bindOpenVpnService(); preferences = getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE); } - @Override - public void onDestroy() { - super.onDestroy(); - unbindService(openVpnConnection); - eipStatus.deleteObserver(this); - eipStatus = null; - mService = null; - } - - @Override - public void update(Observable observable, Object data) { - if (observable instanceof EipStatus) { - eipStatus = (EipStatus) observable; - } - } - @Override protected void onHandleIntent(Intent intent) { String action = intent.getAction(); @@ -237,33 +183,13 @@ public final class EIP extends IntentService implements Observer{ } private void stopEIP() { - if (mService == null) { - stopEipIfConnectionIsEstablished = true; - return; - } - + // TODO stop eip from here if possible... + EipStatus eipStatus = EipStatus.getInstance(); int resultCode = RESULT_CANCELED; - if (isOpenVpnRunningWithoutNetwork() || eipStatus.isConnected() || eipStatus.isConnecting()) { - preferences.edit().putBoolean(EIP_RESTART_ON_BOOT, false).apply(); - if (eipStatus.isBlockingVpnEstablished()) { - stopBlockingVpn(); - } - ProfileManager.setConntectedVpnProfileDisconnected(this); - try { - mService.stopVPN(false); - } catch (RemoteException e) { - VpnStatus.logException(e); - } + if (eipStatus.isConnected() || eipStatus.isConnecting()) resultCode = RESULT_OK; - } - tellToReceiverOrBroadcast(EIP_ACTION_STOP, resultCode); - } - private void stopBlockingVpn() { - Log.d(TAG, "stop VoidVpn!"); - Intent stopVoidVpnIntent = new Intent(this, VoidVpnService.class); - stopVoidVpnIntent.setAction(EIP_ACTION_STOP_BLOCKING_VPN); - startService(stopVoidVpnIntent); + tellToReceiverOrBroadcast(EIP_ACTION_STOP, resultCode); } /** @@ -272,6 +198,7 @@ public final class EIP extends IntentService implements Observer{ * request if it's not connected, Activity.RESULT_OK otherwise. */ private void isRunning() { + EipStatus eipStatus = EipStatus.getInstance(); int resultCode = (eipStatus.isConnected()) ? RESULT_OK : RESULT_CANCELED; @@ -351,22 +278,4 @@ public final class EIP extends IntentService implements Observer{ e.printStackTrace(); } } - - private boolean isOpenVpnRunningWithoutNetwork() { - boolean isRunning = false; - try { - isRunning = eipStatus.getLevel() == LEVEL_NONETWORK && - mService.isVpnRunning(); - } catch (Exception e) { - //eat me - e.printStackTrace(); - } - return isRunning; - } - - private void bindOpenVpnService() { - Intent intent = new Intent(this, OpenVPNService.class); - intent.setAction(OpenVPNService.START_SERVICE); - bindService(intent, openVpnConnection, BIND_AUTO_CREATE); - } } diff --git a/app/src/main/res/layout-xlarge/eip_service_fragment.xml b/app/src/main/res/layout-xlarge/eip_service_fragment.xml index 2fe046b8..c09bda2d 100644 --- a/app/src/main/res/layout-xlarge/eip_service_fragment.xml +++ b/app/src/main/res/layout-xlarge/eip_service_fragment.xml @@ -58,7 +58,11 @@ android:id="@+id/eipLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="@dimen/stdpadding" + android:layout_marginEnd="@dimen/stdpadding" + android:layout_marginStart="@dimen/stdpadding" + android:layout_marginTop="@dimen/stdpadding" + android:layout_marginLeft="@dimen/stdpadding" + android:layout_marginRight="@dimen/stdpadding" android:text="@string/eip_service_label" android:textAppearance="?android:attr/textAppearanceMedium" android:gravity="center" @@ -98,7 +102,11 @@ android:id="@+id/routed_text" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="@dimen/stdpadding" + android:layout_marginEnd="@dimen/stdpadding" + android:layout_marginStart="@dimen/stdpadding" + android:layout_marginTop="@dimen/stdpadding" + android:layout_marginLeft="@dimen/stdpadding" + android:layout_marginRight="@dimen/stdpadding" android:text="@string/vpn_securely_routed" android:gravity="center" android:visibility="visible" @@ -110,7 +118,10 @@ android:id="@+id/vpn_route" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="@dimen/stdpadding" + android:layout_marginEnd="@dimen/stdpadding" + android:layout_marginStart="@dimen/stdpadding" + android:layout_marginLeft="@dimen/stdpadding" + android:layout_marginRight="@dimen/stdpadding" android:gravity="center" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/eip_service_fragment.xml b/app/src/main/res/layout/eip_service_fragment.xml index 347f09d2..30b94de9 100644 --- a/app/src/main/res/layout/eip_service_fragment.xml +++ b/app/src/main/res/layout/eip_service_fragment.xml @@ -56,7 +56,11 @@ android:id="@+id/eipLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="@dimen/stdpadding" + android:layout_marginEnd="@dimen/stdpadding" + android:layout_marginStart="@dimen/stdpadding" + android:layout_marginTop="@dimen/stdpadding" + android:layout_marginLeft="@dimen/stdpadding" + android:layout_marginRight="@dimen/stdpadding" android:text="@string/eip_service_label" android:textAppearance="?android:attr/textAppearanceMedium" android:gravity="center" @@ -81,18 +85,28 @@ android:id="@+id/vpn_main_button" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="@dimen/stdpadding" + android:layout_marginBottom="@dimen/stdpadding" + android:layout_marginEnd="@dimen/stdpadding" + android:layout_marginStart="@dimen/stdpadding" + android:layout_marginTop="@dimen/stdpadding" + android:layout_marginLeft="@dimen/stdpadding" + android:layout_marginRight="@dimen/stdpadding" app:layout_constraintBottom_toBottomOf="@+id/background" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" android:text="@string/vpn.button.turn.on" - style="@style/BitmaskButtonBlack" /> + style="@style/BitmaskButtonBlack" + /> Date: Tue, 27 Feb 2018 18:12:21 +0100 Subject: 8865 - allow disconnect without connection * revert last commit * dirty fix to disconnect - see #8876 * add padding in EipFragment --- .../main/java/se/leap/bitmaskclient/EipFragment.java | 17 +++++++++++++++++ app/src/main/java/se/leap/bitmaskclient/eip/EIP.java | 1 + app/src/main/res/layout-xlarge/eip_service_fragment.xml | 17 +++-------------- app/src/main/res/layout/eip_service_fragment.xml | 17 +++-------------- 4 files changed, 24 insertions(+), 28 deletions(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index c4f4dbc9..1a6ad8d2 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -29,6 +29,7 @@ import android.os.Bundle; import android.os.IBinder; import android.support.annotation.NonNull; import android.support.v4.app.Fragment; +import android.support.v4.content.LocalBroadcastManager; import android.support.v7.app.AlertDialog; import android.support.v7.widget.AppCompatImageView; import android.support.v7.widget.AppCompatTextView; @@ -56,6 +57,11 @@ import se.leap.bitmaskclient.views.VpnStateImage; import static android.view.View.GONE; import static android.view.View.VISIBLE; import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_NONETWORK; +import static se.leap.bitmaskclient.Constants.BROADCAST_EIP_EVENT; +import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_CODE; +import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY; +import static se.leap.bitmaskclient.Constants.EIP_ACTION_STOP; +import static se.leap.bitmaskclient.Constants.EIP_REQUEST; import static se.leap.bitmaskclient.Constants.EIP_RESTART_ON_BOOT; import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; import static se.leap.bitmaskclient.Constants.REQUEST_CODE_LOG_IN; @@ -256,6 +262,17 @@ public class EipFragment extends Fragment implements Observer { askPendingStartCancellation(); } else if (eipStatus.isConnected()) { askToStopEIP(); + } else if (isOpenVpnRunningWithoutNetwork()) { + // TODO move to EIP + // TODO see stopEIP function + Bundle resultData = new Bundle(); + resultData.putString(EIP_REQUEST, EIP_ACTION_STOP); + Intent intentUpdate = new Intent(BROADCAST_EIP_EVENT); + intentUpdate.addCategory(Intent.CATEGORY_DEFAULT); + intentUpdate.putExtra(BROADCAST_RESULT_CODE, Activity.RESULT_OK); + intentUpdate.putExtra(BROADCAST_RESULT_KEY, resultData); + Log.d(TAG, "sending broadcast"); + LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(intentUpdate); } } diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java index 5cf180d3..665e0ebd 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java @@ -184,6 +184,7 @@ public final class EIP extends IntentService { private void stopEIP() { // TODO stop eip from here if possible... + // TODO then refactor EipFragment.handleSwitchOff EipStatus eipStatus = EipStatus.getInstance(); int resultCode = RESULT_CANCELED; if (eipStatus.isConnected() || eipStatus.isConnecting()) diff --git a/app/src/main/res/layout-xlarge/eip_service_fragment.xml b/app/src/main/res/layout-xlarge/eip_service_fragment.xml index c09bda2d..2fe046b8 100644 --- a/app/src/main/res/layout-xlarge/eip_service_fragment.xml +++ b/app/src/main/res/layout-xlarge/eip_service_fragment.xml @@ -58,11 +58,7 @@ android:id="@+id/eipLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="@dimen/stdpadding" - android:layout_marginStart="@dimen/stdpadding" - android:layout_marginTop="@dimen/stdpadding" - android:layout_marginLeft="@dimen/stdpadding" - android:layout_marginRight="@dimen/stdpadding" + android:padding="@dimen/stdpadding" android:text="@string/eip_service_label" android:textAppearance="?android:attr/textAppearanceMedium" android:gravity="center" @@ -102,11 +98,7 @@ android:id="@+id/routed_text" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="@dimen/stdpadding" - android:layout_marginStart="@dimen/stdpadding" - android:layout_marginTop="@dimen/stdpadding" - android:layout_marginLeft="@dimen/stdpadding" - android:layout_marginRight="@dimen/stdpadding" + android:padding="@dimen/stdpadding" android:text="@string/vpn_securely_routed" android:gravity="center" android:visibility="visible" @@ -118,10 +110,7 @@ android:id="@+id/vpn_route" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="@dimen/stdpadding" - android:layout_marginStart="@dimen/stdpadding" - android:layout_marginLeft="@dimen/stdpadding" - android:layout_marginRight="@dimen/stdpadding" + android:padding="@dimen/stdpadding" android:gravity="center" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/eip_service_fragment.xml b/app/src/main/res/layout/eip_service_fragment.xml index 30b94de9..9842198b 100644 --- a/app/src/main/res/layout/eip_service_fragment.xml +++ b/app/src/main/res/layout/eip_service_fragment.xml @@ -56,11 +56,7 @@ android:id="@+id/eipLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="@dimen/stdpadding" - android:layout_marginStart="@dimen/stdpadding" - android:layout_marginTop="@dimen/stdpadding" - android:layout_marginLeft="@dimen/stdpadding" - android:layout_marginRight="@dimen/stdpadding" + android:padding="@dimen/stdpadding" android:text="@string/eip_service_label" android:textAppearance="?android:attr/textAppearanceMedium" android:gravity="center" @@ -102,11 +98,7 @@ android:id="@+id/routed_text" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="@dimen/stdpadding" - android:layout_marginStart="@dimen/stdpadding" - android:layout_marginTop="@dimen/stdpadding" - android:layout_marginLeft="@dimen/stdpadding" - android:layout_marginRight="@dimen/stdpadding" + android:padding="@dimen/stdpadding" android:text="@string/vpn_securely_routed" android:gravity="center" android:visibility="visible" @@ -118,10 +110,7 @@ android:id="@+id/vpn_route" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="@dimen/stdpadding" - android:layout_marginStart="@dimen/stdpadding" - android:layout_marginLeft="@dimen/stdpadding" - android:layout_marginRight="@dimen/stdpadding" + android:padding="@dimen/stdpadding" android:gravity="center" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" -- cgit v1.2.3 From aa9e7531a3d2d2aa08b0dad6c1f64200e64a5234 Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Tue, 27 Feb 2018 18:47:25 +0100 Subject: 8863 - update provider json --- app/assets/calyx.net.json | 2 +- app/assets/riseup.net.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/assets/calyx.net.json b/app/assets/calyx.net.json index 30ab43c5..69e1c2a6 100644 --- a/app/assets/calyx.net.json +++ b/app/assets/calyx.net.json @@ -1,5 +1,5 @@ { - "api_uri": "https://calyx.net:4430", + "api_uri": "https://api.calyx.net:4430", "api_version": "1", "ca_cert_fingerprint": "SHA256: 43683c9ba3862c5384a8c1885072fcac40b5d2d4dd67331443f13a3077fa2e69", "ca_cert_uri": "https://calyx.net/ca.crt", diff --git a/app/assets/riseup.net.json b/app/assets/riseup.net.json index 9a5ec79e..82290ecd 100644 --- a/app/assets/riseup.net.json +++ b/app/assets/riseup.net.json @@ -16,7 +16,7 @@ "en": "Riseup Networks" }, "service": { - "allow_anonymous": false, + "allow_anonymous": true, "allow_free": true, "allow_limited_bandwidth": false, "allow_paid": false, -- cgit v1.2.3 From 51944da747bc883eeef09bb5ffc9b395416ec253 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Tue, 27 Feb 2018 18:48:26 +0100 Subject: #8875 update licenses --- app/src/main/res/layout-xlarge/about.xml | 52 ++++++++++++++++++++++++++++++ app/src/main/res/layout/about.xml | 46 ++++++++++++++++++++++++++ app/src/main/res/values/untranslatable.xml | 20 ++++++------ 3 files changed, 108 insertions(+), 10 deletions(-) (limited to 'app') diff --git a/app/src/main/res/layout-xlarge/about.xml b/app/src/main/res/layout-xlarge/about.xml index ea2251cf..c7896917 100644 --- a/app/src/main/res/layout-xlarge/about.xml +++ b/app/src/main/res/layout-xlarge/about.xml @@ -152,6 +152,58 @@ android:layout_height="wrap_content" android:textSize="18sp" android:text="@string/copyright_okhttp" /> + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/about.xml b/app/src/main/res/layout/about.xml index abc12566..aba51141 100644 --- a/app/src/main/res/layout/about.xml +++ b/app/src/main/res/layout/about.xml @@ -150,6 +150,52 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/copyright_okhttp" /> + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/untranslatable.xml b/app/src/main/res/values/untranslatable.xml index 59605609..2e91366a 100644 --- a/app/src/main/res/values/untranslatable.xml +++ b/app/src/main/res/values/untranslatable.xml @@ -1,8 +1,7 @@ Bitmask - %s - - Copyright 2012-2017\nLEAP Encryption Access Project <info@leap.se> + Copyright 2012-2018\nLEAP Encryption Access Project <info@leap.se> Copyright © 2002–2010 OpenVPN Technologies, Inc. <sales@openvpn.net>\n "OpenVPN" is a trademark of OpenVPN Technologies, Inc. Copyright © 1996 – 2011 Markus Franz Xaver Johannes Oberhumer @@ -15,20 +14,21 @@ OpenVPN LZO OpenSSL + Mbed TLS + Unless specifically indicated otherwise in a file, files are licensed under the Apache 2.0 license, as can be found in: apache-2.0.txt. \n + https://github.com/schwabe/polarssl/blob/icsopenvpn_270/apache-2.0.txt + + Asio + Boost Software License - Version 1.0 - August 17th, 2003 + OpenVPN 3 + GNU AFFERO GENERAL PUBLIC LICENSE\n + Version 3, 19 November 2007 Unknown state - Copyright 2012–2017 Arne Schwabe <arne@rfc2549.org> - openvpn.uni-paderborn.de 1194 File Dialog based on work by Alexander Ponomarev - - - File Dialog - - - Allows another app to control OpenVPN Bouncy Castle Crypto APIs Copyright © 2000–2012 The Legion Of The Bouncy Castle (http://www.bouncycastle.org) -- cgit v1.2.3 From 9787e857bca4dca056d9e55cc9c8eaa1756eb990 Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Tue, 27 Feb 2018 19:04:18 +0100 Subject: 8865 - disconnect without internet * move function to dialog --- .../java/se/leap/bitmaskclient/EipFragment.java | 28 ++++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index 1a6ad8d2..cb98aaac 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -258,21 +258,10 @@ public class EipFragment extends Fragment implements Observer { } private void handleSwitchOff() { - if (eipStatus.isConnecting()) { + if (isOpenVpnRunningWithoutNetwork() || eipStatus.isConnecting()) { askPendingStartCancellation(); } else if (eipStatus.isConnected()) { askToStopEIP(); - } else if (isOpenVpnRunningWithoutNetwork()) { - // TODO move to EIP - // TODO see stopEIP function - Bundle resultData = new Bundle(); - resultData.putString(EIP_REQUEST, EIP_ACTION_STOP); - Intent intentUpdate = new Intent(BROADCAST_EIP_EVENT); - intentUpdate.addCategory(Intent.CATEGORY_DEFAULT); - intentUpdate.putExtra(BROADCAST_RESULT_CODE, Activity.RESULT_OK); - intentUpdate.putExtra(BROADCAST_RESULT_KEY, resultData); - Log.d(TAG, "sending broadcast"); - LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(intentUpdate); } } @@ -293,7 +282,20 @@ public class EipFragment extends Fragment implements Observer { protected void stopEipIfPossible() { Context context = getContext(); if (context != null) { - EipCommand.stopVPN(getContext()); + if (isOpenVpnRunningWithoutNetwork()) { + // TODO move to EIP + // TODO see stopEIP function + Bundle resultData = new Bundle(); + resultData.putString(EIP_REQUEST, EIP_ACTION_STOP); + Intent intentUpdate = new Intent(BROADCAST_EIP_EVENT); + intentUpdate.addCategory(Intent.CATEGORY_DEFAULT); + intentUpdate.putExtra(BROADCAST_RESULT_CODE, Activity.RESULT_OK); + intentUpdate.putExtra(BROADCAST_RESULT_KEY, resultData); + Log.d(TAG, "sending broadcast"); + LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(intentUpdate); + } else { + EipCommand.stopVPN(getContext()); + } } else { Log.e(TAG, "context is null when trying to stop EIP"); } -- cgit v1.2.3 From ebfd6b38aaf5a375aaa4d27d696e22dd432e642a Mon Sep 17 00:00:00 2001 From: cyBerta Date: Tue, 27 Feb 2018 19:36:02 +0100 Subject: #8873 add new translations --- app/src/main/res/values-ar/strings_ar.xml | 12 ++++ app/src/main/res/values-de/strings.xml | 13 +++- app/src/main/res/values-es/strings.xml | 7 ++ app/src/main/res/values-fa-rIR/strings.xml | 92 +++++++++++++++++++++--- app/src/main/res/values-fr/strings.xml | 16 +++++ app/src/main/res/values-gl/strings.xml | 110 +++++++++++++++++++++++++++++ app/src/main/res/values-nl/strings.xml | 73 +++++++++++++++++++ app/src/main/res/values-no/strings.xml | 5 ++ app/src/main/res/values-uk/strings.xml | 1 + app/src/main/res/values/strings.xml | 5 +- 10 files changed, 319 insertions(+), 15 deletions(-) create mode 100644 app/src/main/res/values-ar/strings_ar.xml create mode 100644 app/src/main/res/values-gl/strings.xml (limited to 'app') diff --git a/app/src/main/res/values-ar/strings_ar.xml b/app/src/main/res/values-ar/strings_ar.xml new file mode 100644 index 00000000..d432873f --- /dev/null +++ b/app/src/main/res/values-ar/strings_ar.xml @@ -0,0 +1,12 @@ + + + حاول مجددا + حفظ + اسم النطاق + إسم المستخدم + كلمة المرور + تسجيل الدخول + تسجيل الخروج + تكوين + الخروج + diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index f42ddb03..38e98e4a 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -23,7 +23,7 @@ Gültige URL Ungültige URL Provider Details - Anonym benutzen. + Anonym benutzen Benutzer*innenname Bitte geben Sie Ihr Benutzer*innenname ein Bitte Passwort eingeben @@ -41,10 +41,10 @@ Verschlüsselungsalgorithmus nicht gefunden. Bitte aktualisiere deine Android-Version! Registrieren / Anmelden Anmelden - Profil anmelden. + Anmelden Abmelden Registrieren - Profil erstellen. + Profil erstellen Provider einrichten. Konfigurationsfehler Konfigurieren @@ -99,7 +99,14 @@ Internetverkehr wird blockiert Providerdetails werden aktualisiert Zertifikat aktualisieren + Die Aktualisierung der Providerkonfiguration ist fehlgeschlagen. + Die Aktualisierung der Providerkonfiguration ist fehlgeschlagen. Bitte einloggen, um es erneut zu versuchen. Die gespeicherten Providerdetails sind fehlerhaft. Du kannst entweder Bitmask aktualisieren (Empfehlung) oder die Providerdetails mithilfe eines kommerziellen CA Zertifikates aktualisieren. Das gespeicherte Providerzertifikat ist ungültig. Du kannst entweder Bitmask aktualisieren (Empfehlung) oder das Providerzertifikat mithilfe eines kommerziellen CA Zertifikates aktualisieren. Das gespeicherte Providerzertifikat ist abgelaufen. Du kannst entweder Bitmask aktualisieren (Empfehlung) oder das Providerzertifikat mithilfe eines kommerziellen CA Zertifikates aktualisieren. + Das Herunterladen des VPN Zertifikates ist fehlgeschlagen. Versuche es erneut oder wähle einen anderen Provider aus. + Das VPN Zertifikat ist ungültig. Versuche ein neues herunterzuladen. + Das VPN Zertifikat ist ungültig. Bitte melde dich an, um ein neues herunterzuladen. + Batteriesparmodus + Hintergrunddaten werden nicht übertragen während das Telefon inaktiv ist. Diese Funktion ist noch experimentell. diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 710b1b8d..abb263bc 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -99,7 +99,14 @@ Bloqueando el tráfico Actualizar detalles del proveedor Actualizar certificado + No se pudo actualizar la configuración del proveedor. + No se pudo actualizar la configuración del proveedor. Por favor, incie sesión e inténtelo de nuevo. Los detalles del proveedor almacenados están corrompidos. Puede actualizar Bitmask (recomendado), o bien actualizar los detalles del proveedor usando un certificado de una autoridad de certificación/CA comercial. El certificado del proveedor almacenado no es válido. Puede actualizar Bitmask (recomendado), o bien actualizar el certificado de proveedor usando una autoridad de certificación/CA comercial. El certificado del proveedor almacenado ha caducado. Puede actualizar Bitmask (recomendado) o actualizar el certificado de proveedor usando una autoridad de certificación/CA comercial. + No se pudo descargar el certificado de la VPN. Inténtelo de nuevo o escoja otro proveedor. + El certificado de la VPN no es válido. Trate de descargar uno nuevo. + El certificado de la VPN no es válido. Por favor, inicie sesión para descargar uno nuevo. + Ahorrar batería + Las conexiones de datos en segundo plano hibernarán cuando su teléfono esté inactivo. Esta característica todavía es experimental. diff --git a/app/src/main/res/values-fa-rIR/strings.xml b/app/src/main/res/values-fa-rIR/strings.xml index 551bdd16..99819cfb 100644 --- a/app/src/main/res/values-fa-rIR/strings.xml +++ b/app/src/main/res/values-fa-rIR/strings.xml @@ -1,38 +1,110 @@ تلاش دوباره + دسترسی به منبع کد در https://0xacab.org/leap/bitmask_android + نظرات، پیشنهادات و گزارش اشکالات در https://0xacab.org/leap/bitmask_android/issues + از همکاری شما برای ترجمه استقبال می‌کنیم. پروژه Transifex ما در اینجا ببینید: https://www.transifex.com/projects/p/bitmask-android/ تعویض ارائه دهنده اطلاعات - نمایش اطلاعات تماس + نمایش جزئیات ارتباط مسیرها: %s + مسیرهای IPv6: %s نام کاربری نباید خالی باشد. + گرفتن تصدیق \'%s\' از کی‌استور ارائه‌دهنده: - ارائه‌دهنده‌ای تنظیم نشده - وضعیت نامشخص. + ارائه‌دهنده‌ای تنظیم نشده است + وضعیت نامشخص + دسترسی کدگزاری شده به اینترنت با وی‌پی‌ان + انتخاب سرویس ارائه‌دهنده + اضافه کردن ارائه‌دهنده جدید ارائه‌دهنده‌ی سروریس جدید وارد کنید ذخیره نام دامنه - استفاده از ناشناسی + URL معتبر است + URL صحیح نیست + اطلاعات ارائه‌دهنده + استفاده به صورت ناشناس نام کاربری لطفا شناسه‌ی خود را وارد کنید - کلمه عبور + لطفا رمز عبور خود را وارد کنید + رمز عبور + رمزهای عبور یکسان است + رمزهای عبور یکسان نیست پیغام کاربر - شناسه یا رمز نادرست - تلاش دوباره: خطای HTTP کاربر - تلاش دوباره: خطای I/O - تلاش دوباره: پاسخ نامناسب از سرور + درباره‌ + دوباره تلاش کنید: اشکال در سرور + نام کاربری یا رمز نادرست + باید حداقل ۸ حرف باشد. + دوباره تلاش کنید: خطای HTTP کاربر + دوباره تلاش کنید: خطای I/O + دوباره تلاش کنید: پاسخ نامناسب از سرور + الگوریتم کدگذاری‌شده یافت نشد. لطفا آندروید را به‌روز رسانی کنید! + ثبت نام/ ورود ورود - برون رفت + ورود به صفحه شخصی + خروج + ثبت‌نام + درست‌کردن صفحه شخصی + تنظیم ارائه‌دهنده خطای تنظیمات تنظیم خروج + خطای تنظیم بیتمسک با ارائه‌دهنده انتخابی شما. n\n\ تنظیم را دوباره انجام دهید یا از برنامه خارج شوید و تنظیم ارائه‌دهنده را با بازکردن مجدد انجام دهید. + سرور قابل دسترس نیست، لطفا دوباره تلاش کنید. + اخطار امنیتی، برنامه app را به‌روز رسانی کنید یا ارائه‌دهنده دیگری انتخاب کنید. به نظر نمی‌رسد که یک ارائه‌دهنده‌ی بیتمسک باشد. این یک ارائه‌دهنده‌ی قابل اعتماد بیتمسک نیست. + سرور وی‌پی‌ان در دسترس نیست. در حال تنظیم کردن ارائه‌دهنده گواهی ناشناسی شما دریافت نشد + دریافت گواهی وی‌پی‌ان + به‌روز رسانی گواهی وی‌پی‌ان + کاربران Riseup نیاز به ساختن حساب کاربری جداگانه‌ای برای استفاده از وی‌پی‌ان دارند + احراز هویت احراز هویت ناموفق بود. + ثبت‌ ناموفق آماده‌سازی اتصال انصراف از اتصال؟ تلاشی برای برقراری ارتباط در جریان است. آیا می‌خواهید آن را قطع کنید؟ + خاموش کردن اتصال با وی‌پی‌ان؟ وقتی وی‌پی‌ان خاموش است، اطلاعات شما ممکن است توسط ارائه‌دهنده اینترنت و یا شبکه محلی قابل دسترس باشد. + کار نمی‌کند! اتصال ناامن! اتصال امن. + به نظر می‌رسد مشکلی با ارائه‌دهنده وجود دارد. + لطفا از ارائه‌دهنده دیگری استفاده کنید و یا با ارائه‌دهنده تماس بگیرید. + ناشناس + وارد شده است. + خارج شده است + خارج نشده‌است. بعدا دوباره امتحان کنید، ممکن است مشکلی در شبکه یا با ارائه‌دهنده باشد. اگر قابل حل نیست، اطلاعات بیتمسک را از روی تنظیمات اندروید پاک کنید. + وارد نشده است. + در حال ورود. + وارد شدن + ثبت‌نام کردن + در حال خروج. + ثبت شده است. + روشن کردن + خاموش کردن + توقف مسدود کردن + ترافیک شما به صورت امن از اینجا گذشته است: + لاگ بیتمسک + بیتمسک + لاگ + وی‌پی‌ان + بازکردن نوار ابزار + بستن نوار ابزار + فعالیت نمونه + تنظیمات + بیتمسک تمام ترافیک خروجی اینترنت را مسدود می‌کند. + ناموفق در راه‌اندازی وی‌پی‌ان مسدودکننده + مسدودکردن تمام ترافیک خروجی اینترنت متوقف شد. + مسدود کردن ترافیک + به‌روز رسانی اطلاعات ارائه‌دهنده + به‌روز رسانی گواهی + ناموفق در به‌روز رسانی تنظیمات ارا‌ئه‌دهنده + ناموفق در به‌روز رسانی تنظیمات ارا‌ئه‌دهنده. برای تلاش مجدد، لطفا دوباره وارد شوید. + گواهی ارائه‌دهنده ذخیره‌شده خراب است. یا بیتمسک را به‌روز رسانی کنید (گزینه پیشنهادی)، و یا اطلاعات ارائه‌دهنده را با استفاده از گواهی تجاری CA به‌روز رسانی کنید. + گواهی ارائه‌دهنده ذخیره‌شده نامعتبر است. یا بیتمسک را به‌روز رسانی کنید (گزینه پیشنهادی)، و یا گواهی ارائه‌دهنده را با استفاده از گواهی تجاری CA به‌روز رسانی کنید. + گواهی ارائه‌دهنده ذخیره‌شده تاریخ‌گذشته است. یا بیتمسک را به‌روز رسانی کنید (گزینه پیشنهادی)، و یا گواهی ارائه‌دهنده را با استفاده از گواهی تجاری CA به‌روز رسانی کنید. + ناموفق در دریافت گواهی وی‌پی‌ان. لطفا دوباره تلاش کنید و یا ارائه‌دهنده دیگری را انتخاب کنید. + گواهی وی‌پی‌ان نامعتبر است. تلاش کنید که گواهی جدیدی دریافت کنید. + گواهی وی‌پی‌ان نامعتبر است. لطفا برای دریافت گواهی جدید وارد شوید. diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index e1133837..3a668286 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -16,15 +16,20 @@ État inconnu. Accès à Internet par RPV chiffré Choisir un fournisseur de services + Ajouter un nouveau fournisseur Ajouter un nouveau fournisseur de services Enregistrer Nom de domaine Cette URL est valide URL malformée + Renseignements sur le fournisseur Utiliser anonymement nom d’utilisateur Veuillez saisir votre nom d’utilisateur + Veuillez saisir votre mot de passe mot de passe + Les mots de passe correspondent + Les mots de passe ne correspondent pas Message utilisateur À propos Ressayer : erreur mathématique du serveur. @@ -82,6 +87,10 @@ Votre trafic est acheminé en toute sécurité par : Journal Bitmask Bitmask + Journal + RPV + Ouvrir le tiroir de navigation + Fermer le tiroir de navigation Exemple d’action Paramètres Bitmask bloque tout le trafic Internet sortant. @@ -90,7 +99,14 @@ Blocage du trafic Mettre les renseignements de fournisseur à jour Mettre le certificat à jour + Échec de mise à jour de la configuration du fournisseur. + Échec de mise à jour de la configuration du fournisseur. Veuillez vous connecter pour ressayer. Les renseignements de fournisseur enregistrés sont corrompus. Vous pouvez soit mettre Bitmask à jour (recommandé), soit mettre les renseignements de fournisseur à jour en utilisant un certificat CA commercial. Le certificat de fournisseur enregistré est invalide. Vous pouvez soit mettre Bitmask à jour (recommandé), soit mettre le certificat de fournisseur à jour en utilisant un certificat CA commercial. Le certificat de fournisseur enregistré est expiré. Vous pouvez soit mettre Bitmask à jour (recommandé), soit mettre le certificat de fournisseur à jour en utilisant un certificat CA commercial. + Échec de téléchargement du certificat du RPV. Ressayez ou choisissez un autre fournisseur. + Le certificat du RPV est invalide. Essayez d’en télécharger un nouveau. + Le certificat du RPV est invalide. Veuillez vous connecter pour en télécharger un nouveau. + Économiser la batterie + Les communications de données d’arrière-plan seront mises en veille quand votre téléphone sera inactif. Cette fonction est encore expérimentale. diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml new file mode 100644 index 00000000..35c77f4f --- /dev/null +++ b/app/src/main/res/values-gl/strings.xml @@ -0,0 +1,110 @@ + + + Intentar de novo + Código fonte dispoñible en https://0xacab.org/leap/bitmask_android + Seguimento de incidencias en https://0xacab.org/leap/bitmask_android/issues + Agradécese a tradución. Aquí está o noso proxecto en Transifex https://www.transifex.com/projects/p/bitmask-android/ + Cambiar provedor + info + Mostrar detalles da conexión + Rutas: %s + Rutas IPv6: %s + A caixa nome de usuaria non pode estar baldeira. + Obteña o certificado \'%s\' do almacén de chaves + Provedor: + Non hai provedor configurado + Estado descoñecido. + Acceso a internet con VPN cifrado + Escolla un provedor de acceso + Engadir novo provedor + Engadir novo provedor de servizo + Gardar + Nome de dominio + O URL é válido + URL mal formado + Detalles do provedor + Utilizar de xeito anónimo + nome de usuaria + Por favor introduza o seu nome de usuaria + Por favor introduza o seu contrasinal + contrasinal + Os contrasinais concordan + Os contrasinais non concordan + Mensaxe de usuaria + Sobre + Inténtar de novo: Fallo no servidor. + Nome de usuaria ou contrasinal incorrectos. + Cando menos debe ter 8 caracteres. + Intentar de novo: Fallo no cliente HTTP + Intentar de novo: fallo I/O + Intentar de novo: resposta incorrecta desde o servidor + Non se atopou algoritmo de cifrado. Por favor actualice Android! + Conexión/Rexistro + Conectar + Conectar perfil + Desconectar + Rexistro + Crear perfil + Establecer provedor + Fallo na configuración + Configurar + Saír + Algo fallou ao configurar Bitmask co provedor escollido.\n\nPode escoller reconfigurar ou saír e configurar un provedor no seguinte inicio. + Non se puido conectar ao servidor, por favor inténteo de novo. + Fallo de seguridade, anove o aplicativo ou escolla outro provedor + Non semella ser un provedor Bitmask. + Este non é un provedor de confianza de Bitmask + O servizo está caído. + Configurando provedor + Non se descargou o seu certificado de anonimato + Descargando certificado VPN + Anovando certificado VPN + As usuarias de Riseup precisarán crear unha conta separada para utilizar o servizo VPN + Autenticada. + Fallo na autenticación. + Fallo no rexistro + Iniciando conexión + Cancelar a conexión? + Hai un intento de conexión en proceso. Desexa cancelalo? + Apagar a conexión VPN? Si está desconectada a VPN podería suministrar información personal ao seu provedor de acceso a internet ou rede local. + Non está a conectada! Conexión insegura! + Conexión segura. + Semella que hai un problema co provedor. + Por favor, inténteo con un novo provedor ou contacte co seu. + Anónimo + está conectada. + desconectada. + non se desconectou. Inténteo máis tarde, podería haber un problema na rede ou co provedor. Si persiste o problema, borre os datos de Bitmask nos axustes de Android. + non se ten conectado. + está a conectar. + Conectando + Rexistrando + está a desconectar. + está sendo rexistrada. + Acender + Apagar + Deixar de bloquear + O seu tráfico está securizado a través de: + Rexistro Bitmask + Bitmask + Rexistro + VPN + Abrir cadro de navegación + Pechar cadro de navegación + Acción de exemplo + Axustes + Bitmask bloquea todo o tráfico saínte a internet. + Fallo ao establecer bloqueo VPN. + Deixou de bloquear todo o tráfico saínte. + Bloqueando tráfico + Actualizar detalles do provedor + Anovar certificado + Fallo ao anovar a configuración do provedor. + Fallo ao anovar a configuración do provedor. Por favor conéctese para intentalo de novo. + Os datos do provedor gardados son defectuosos. Pode actualizar Bitmask (recomendado) ou ben actualizar os detalles do provedor utilizando un certificado CA de confianza. + O certificado de provedor gardado non é válido. Pode actualizar Bitmask (recomendado) ou actualizar o certificado do provedor utilizando un certificado CA comercial. + O certificado do provedor gardado caducou. Pode actualizar Bitmask (recomendado) ou pode actualizar o certificado do provedor utilizando un certificado CA comercial. + Fallou a descarga do certificado do VPN. Inténteo de novo ou escolla outro provedor. + O certificado do VPN non é válido. Intente descargar un novo. + O certificado VPN non é válido. Por favor conéctese para descargar un novo. + diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 0d8b85a6..b17ac66d 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -3,39 +3,112 @@ Opnieuw proberen Broncode is beschikbaar op https://0xacab.org/leap/bitmask_android Issue tracker https://0xacab.org/leap/bitmask_android/issues + Vertalingen zijn welkom en worden gewaardeerd. Kijk voor meer info op onze Transifex pagina: https://www.transifex.com/projects/p/bitmask-android/ Provider wisselen info Details van de verbinding weergeven Routes: %s + IPv6 routes: %s De gebruikersnaam moet niet leeg zijn. + Kreeg certificaat \'%s\' van de keystore Provider: Geen provider ingesteld Status onbekend + VPN Versleutelde Internet Toegang + Service provider selecteren + Nieuwe provider toevoegen Nieuwe serviceprovider toevoegen Opslaan Domeinnaam + De URL is correct + Incorrecte URL + Provider details Anoniem gebruiken gebruikersnaam Geef je gebruikersnaam in + Voer je wachtwoord in wachtwoord + Wachtwoorden komen overeen + Wachtwoorden komen niet overeen Bericht + Over + Probeer opnieuw: serverrekenfout. Gebruikersnaam of wachtwoord verkeerd. + Wachtwoord moet minstens 8 tekens bevatten. Probeer opnieuw: Client HTTP fout Probeer opnieuw: I/O fout Probeer opnieuw: incorrect antwoord van de server + Coderingsalgoritme niet gevonden. Gelieve Android te upgraden! + Inschrijven/Inloggen Aanmelden + Login voor profiel Afmelden + Registreer + Creeer profiel + Setup provider Configuratiefout Configureren Aflsluiten + Er is een probleem opgetreden om Bitmask te configureren met jou provider. + +Je kan kiezen om te herconfigureren of af te sluiten en bij de volgende start een provider in te stellen. + Server is onbereikbaar, probeer later opnieuw. + Beveiligingsprobleem, upgrade de app of kies een andere provider. Dit lijkt geen Bitmask provider te zijn. Dit is geen vertrouwde Bitmask provider. + Service is onbereikbaar. Provider wordt ingesteld Je anonieme certificaat is niet gedownload + Downloading VPN certificaat + Updaten VPN certificaat + Riseup gebruikers moeten een apart account aanmaken om de VPN service te gebruiken + Geauthenticeerd. Authenticatie mislukt. + Registratie mislukt. Verbinding wordt geïnitialiseerd Verbinding annuleren? We proberen een verbinding tot stand te brengen. Wil je dit annuleren? + VPN verbinding uitzetten? Wanneer de VPN uitstaat, kan je persoonlijke data lekken naar je internet provider of je lokale netwerk. + Uitgeschakeld! Onbeveiligde verbinding! Verbinding beveiligd. + Het lijkt er op dat er een probleem is met de provider. + Gelieve een andere provider te proberen of contacteer je huidige. + Anoniem + is ingelogd. + is uitgelogd. + niet uitgelogd. Probeer het later, er kan een probleem zijn met het netwerk of de provider. Als het probleem zich blijft voordoen, verwijder dan de Bitmask data uit de Android settings. + heeft zich niet ingelogd. + wordt aangemeld. + Aanmelden + Sign up + wordt uitgelogd. + wordt geregistreerd. + Aanzetten + Uitschakelen + Stop blokkeren + Je verkeer wordt veilig geroute door: + Bitmask Log + Bitmask + Log + VPN + Open navigatiemenu + Sluit navigatiemenu + Voorbeeld + Instellingen + Bitmaks blokkert alle uitgaande internetverkeer. + Niet gelukt om een blokkerende VPN op te zetten. + Gestopt met blokkkeren van alle uitgaande internetverkeer. + Blokkeert verkeer + Update provider details Update certificaat + Updaten providerconfiguratie mislukt + Updaten providerconfiguratie mislukt. Login of probeer opnieuw. + Opgeslagen providerdetails zijn corrupt. Je kan Bitmask updaten (aanbevolen) of de provider details updaten met een commercieel CA-certificaat. + Opgeslagen providercertificaat is ongeldig. Je kan Bitmask updaten (aanbevolen) of het provider certificaat updaten met een commercieel CA-certificaat. + Opgeslagen providercertificaat is verlopen. Je kan Bitmask updaten (aanbevolen) of het provider certificaat updaten met een commercieel CA-certificaat. + Downloaden van het VPN certificaat mislukt. Probeer opnieuw of kies een andere provider. + VPN certificaat is ongeldig. Probeer een nieuw te downloaden. + Het VPN certificaat in ongeldig. Gelieve opnieuw in te loggen om een nieuw te downloaden. + Batterij besparen + Achtergrond dataverbindingen worden in slaapstand gezet wanneer uw telefoon inactief is. Deze functionaliteit is nog experimenteel. diff --git a/app/src/main/res/values-no/strings.xml b/app/src/main/res/values-no/strings.xml index 42a03df0..1e825b9d 100644 --- a/app/src/main/res/values-no/strings.xml +++ b/app/src/main/res/values-no/strings.xml @@ -99,7 +99,12 @@ Blokkerer trafikk Oppdater tilbyderdetaljer Oppdater sertifikat + Oppdatering av tilbyderoppsett mislyktes + Oppdatering av tilbyderoppsett mislyktes. Logg inn og prøv igjen. De lagrede tilbyderdetaljene er skadet. Du kan enten oppdatere Bitmask (anbefalt) eller oppdatere tilbyderdetaljene til å bruke et kommersielt CA-sertifikat. Lagret tilbydersertifikat er ugyldig. Du kan enten oppdatere Bitmask (anbefalt) eller oppdatere tilbydersertifikatet til å bruke et kommersielt CA-sertifikat. Det lagrede tilbydersertifikatet er utløpt. Du kan enten oppdatere Bitmask (anbefalt) eller oppdatere tilbydersertifikatet til å bruke et kommersielt CA-sertifikat. + Nedlasting av VPN-sertifikat mislyktes. Prøv igjen eller velg en annen tilbyder. + VPN-sertifikatet er ugyldig. Prøv å laste ned et nytt et. + VPN-sertifikatet er ugyldig. Logg inn for å laste ned et nytt et. diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index b810af61..70efcd9d 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -9,6 +9,7 @@ Назва домена ім\'я користувача пароль + Про Вхід у систему Налаштування Вихід diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 122800ce..a0ca00c9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -39,11 +39,12 @@ Try again: I/O error Try again: Bad response from the server Encryption algorithm not found. Please upgrade Android! + Sign Up/Log In Log In - Log In + Log in to profile Log Out Sign Up - Sign Up + Create profile Set up provider Configuration Error Configure -- cgit v1.2.3 From b047acd0b627c97d4a7a518b4979af8926a4a684 Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Tue, 27 Feb 2018 19:54:25 +0100 Subject: 8865 - smaller vertical padding --- app/src/main/res/layout-xlarge/eip_service_fragment.xml | 15 ++++++++++++--- app/src/main/res/layout/eip_service_fragment.xml | 17 ++++++++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/src/main/res/layout-xlarge/eip_service_fragment.xml b/app/src/main/res/layout-xlarge/eip_service_fragment.xml index 2fe046b8..2326ffe8 100644 --- a/app/src/main/res/layout-xlarge/eip_service_fragment.xml +++ b/app/src/main/res/layout-xlarge/eip_service_fragment.xml @@ -58,7 +58,10 @@ android:id="@+id/eipLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="@dimen/stdpadding" + android:paddingLeft="@dimen/stdpadding" + android:paddingRight="@dimen/stdpadding" + android:paddingStart="@dimen/stdpadding" + android:paddingEnd="@dimen/stdpadding" android:text="@string/eip_service_label" android:textAppearance="?android:attr/textAppearanceMedium" android:gravity="center" @@ -98,7 +101,10 @@ android:id="@+id/routed_text" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="@dimen/stdpadding" + android:paddingLeft="@dimen/stdpadding" + android:paddingRight="@dimen/stdpadding" + android:paddingStart="@dimen/stdpadding" + android:paddingEnd="@dimen/stdpadding" android:text="@string/vpn_securely_routed" android:gravity="center" android:visibility="visible" @@ -110,7 +116,10 @@ android:id="@+id/vpn_route" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="@dimen/stdpadding" + android:paddingLeft="@dimen/stdpadding" + android:paddingRight="@dimen/stdpadding" + android:paddingStart="@dimen/stdpadding" + android:paddingEnd="@dimen/stdpadding" android:gravity="center" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/eip_service_fragment.xml b/app/src/main/res/layout/eip_service_fragment.xml index 9842198b..e220bf16 100644 --- a/app/src/main/res/layout/eip_service_fragment.xml +++ b/app/src/main/res/layout/eip_service_fragment.xml @@ -56,7 +56,11 @@ android:id="@+id/eipLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="@dimen/stdpadding" + android:paddingLeft="@dimen/stdpadding" + android:paddingRight="@dimen/stdpadding" + android:paddingStart="@dimen/stdpadding" + android:paddingEnd="@dimen/stdpadding" + android:paddingTop="@dimen/stdpadding" android:text="@string/eip_service_label" android:textAppearance="?android:attr/textAppearanceMedium" android:gravity="center" @@ -98,7 +102,11 @@ android:id="@+id/routed_text" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="@dimen/stdpadding" + android:paddingLeft="@dimen/stdpadding" + android:paddingRight="@dimen/stdpadding" + android:paddingStart="@dimen/stdpadding" + android:paddingEnd="@dimen/stdpadding" + android:paddingTop="@dimen/stdpadding" android:text="@string/vpn_securely_routed" android:gravity="center" android:visibility="visible" @@ -110,7 +118,10 @@ android:id="@+id/vpn_route" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="@dimen/stdpadding" + android:paddingLeft="@dimen/stdpadding" + android:paddingRight="@dimen/stdpadding" + android:paddingStart="@dimen/stdpadding" + android:paddingEnd="@dimen/stdpadding" android:gravity="center" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" -- cgit v1.2.3 From 96bc3f8d14cab11e43fbe6b11dfb6dbf46e5919b Mon Sep 17 00:00:00 2001 From: cyBerta Date: Tue, 27 Feb 2018 20:21:45 +0100 Subject: set version name to 0.9.8 --- app/src/main/AndroidManifest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 740dee08..6f6feebb 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -16,8 +16,8 @@ --> + android:versionCode="134" + android:versionName="0.9.8" >