summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorFup Duck <fupduck@sacknagel.com>2018-01-13 17:03:14 +0100
committerFup Duck <fupduck@sacknagel.com>2018-01-13 17:03:14 +0100
commit153e35707ed2854d89c61fdb9f82a6e9ec0db9cc (patch)
treee34a41e4ac95f7ad3ef8ffdb21da29c34310c03b /app/src/main/java
parent8909b3e9ea63c8dc78abf89de69b44d3d172f763 (diff)
more static constant import and import cleanup
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Dashboard.java42
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/OnBootReceiver.java6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/ProviderAPI.java4
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java12
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/VpnFragment.java3
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java18
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java8
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java8
8 files changed, 61 insertions, 40 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
index 3ed9de0c..07c6fdfb 100644
--- a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
+++ b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
@@ -47,10 +47,18 @@ import se.leap.bitmaskclient.userstatus.SessionDialog;
import se.leap.bitmaskclient.userstatus.User;
import se.leap.bitmaskclient.userstatus.UserStatusFragment;
+import static se.leap.bitmaskclient.Constants.APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE;
+import static se.leap.bitmaskclient.Constants.APP_ACTION_QUIT;
import static se.leap.bitmaskclient.Constants.EIP_IS_ALWAYS_ON;
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_ALLOW_ANONYMOUS;
+import static se.leap.bitmaskclient.Constants.PROVIDER_CONFIGURED;
+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_KEY;
import static se.leap.bitmaskclient.Constants.REQUEST_CODE_SWITCH_PROVIDER;
+import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES;
/**
* The main user facing Activity of Bitmask Android, consisting of status, controls,
@@ -93,7 +101,7 @@ public class Dashboard extends ButterKnifeActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
dashboardReceiver = new DashboardReceiver(this);
- preferences = getSharedPreferences(Constants.SHARED_PREFERENCES, MODE_PRIVATE);
+ preferences = getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE);
fragment_manager = new FragmentManagerEnhanced(getSupportFragmentManager());
providerAPI_result_receiver = new ProviderAPIResultReceiver(new Handler(), dashboardReceiver);
@@ -136,7 +144,7 @@ public class Dashboard extends ButterKnifeActivity {
private boolean providerInSharedPreferences() {
return preferences != null &&
- preferences.getBoolean(Constants.PROVIDER_CONFIGURED, false);
+ preferences.getBoolean(PROVIDER_CONFIGURED, false);
}
@@ -166,7 +174,7 @@ public class Dashboard extends ButterKnifeActivity {
switch (versionCode) {
case 91: // 0.6.0 without Bug #5999
case 101: // 0.8.0
- if (!preferences.getString(Constants.PROVIDER_KEY, "").isEmpty())
+ if (!preferences.getString(PROVIDER_KEY, "").isEmpty())
eip_fragment.updateEipService();
break;
}
@@ -188,7 +196,7 @@ public class Dashboard extends ButterKnifeActivity {
} else if (intent.hasExtra(EIP_RESTART_ON_BOOT)) {
Log.d(TAG, "Dashboard: EIP_RESTART_ON_BOOT");
prepareEIP(null);
- } else if (intent.hasExtra(Constants.APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE)) {
+ } else if (intent.hasExtra(APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE)) {
Log.d(TAG, "Dashboard: Constants.APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE");
handleConfigureAlwaysOn(getIntent());
}
@@ -207,7 +215,7 @@ public class Dashboard extends ButterKnifeActivity {
sessionDialog(Bundle.EMPTY);
}
- } else if (resultCode == RESULT_CANCELED && data != null && data.hasExtra(Constants.APP_ACTION_QUIT)) {
+ } else if (resultCode == RESULT_CANCELED && data != null && data.hasExtra(APP_ACTION_QUIT)) {
finish();
} else
configErrorDialog();
@@ -222,9 +230,9 @@ public class Dashboard extends ButterKnifeActivity {
}
private void handleConfigureAlwaysOn(Intent intent) {
- intent.removeExtra(Constants.APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE);
+ intent.removeExtra(APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE);
Log.d(TAG, "start Configuration wizard!");
- startActivityForResult(new Intent(this, ConfigurationWizard.class), Constants.REQUEST_CODE_CONFIGURE_LEAP);
+ startActivityForResult(new Intent(this, ConfigurationWizard.class), REQUEST_CODE_CONFIGURE_LEAP);
}
private void prepareEIP(Bundle savedInstanceState) {
@@ -244,14 +252,14 @@ public class Dashboard extends ButterKnifeActivity {
}
private void configureLeapProvider() {
- if (getIntent().hasExtra(Constants.APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE)) {
- getIntent().removeExtra(Constants.APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE);
+ if (getIntent().hasExtra(APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE)) {
+ getIntent().removeExtra(APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE);
}
- startActivityForResult(new Intent(this, ConfigurationWizard.class), Constants.REQUEST_CODE_CONFIGURE_LEAP);
+ startActivityForResult(new Intent(this, ConfigurationWizard.class), REQUEST_CODE_CONFIGURE_LEAP);
}
@SuppressLint("CommitPrefEdits")
private void providerToPreferences(Provider provider) {
- preferences.edit().putBoolean(Constants.PROVIDER_CONFIGURED, true).
+ preferences.edit().putBoolean(PROVIDER_CONFIGURED, true).
putString(Provider.MAIN_URL, provider.getMainUrl().toString()).
putString(Provider.KEY, provider.getDefinition().toString()).apply();
}
@@ -265,13 +273,13 @@ public class Dashboard extends ButterKnifeActivity {
.setPositiveButton(getResources().getString(R.string.setup_error_configure_button), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- startActivityForResult(new Intent(getApplicationContext(), ConfigurationWizard.class), Constants.REQUEST_CODE_CONFIGURE_LEAP);
+ startActivityForResult(new Intent(getApplicationContext(), ConfigurationWizard.class), REQUEST_CODE_CONFIGURE_LEAP);
}
})
.setNegativeButton(getResources().getString(R.string.setup_error_close_button), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- preferences.edit().remove(Provider.KEY).remove(Constants.PROVIDER_CONFIGURED).apply();
+ preferences.edit().remove(Provider.KEY).remove(PROVIDER_CONFIGURED).apply();
finish();
}
})
@@ -385,7 +393,7 @@ public class Dashboard extends ButterKnifeActivity {
// TODO MOVE TO VPNManager(?)
public static void downloadVpnCertificate() {
boolean is_authenticated = User.loggedIn();
- boolean allowed_anon = preferences.getBoolean(Constants.PROVIDER_ALLOW_ANONYMOUS, false);
+ boolean allowed_anon = preferences.getBoolean(PROVIDER_ALLOW_ANONYMOUS, false);
if (allowed_anon || is_authenticated)
ProviderAPICommand.execute(Bundle.EMPTY, ProviderAPI.DOWNLOAD_CERTIFICATE, providerAPI_result_receiver);
else
@@ -419,7 +427,7 @@ public class Dashboard extends ButterKnifeActivity {
if (entry.getKey().startsWith(Provider.KEY + ".") ||
entry.getKey().startsWith(Provider.CA_CERT + ".") ||
entry.getKey().startsWith(Provider.CA_CERT_FINGERPRINT + "." )||
- entry.getKey().equals(Constants.PREFERENCES_APP_VERSION)
+ entry.getKey().equals(PREFERENCES_APP_VERSION)
) {
continue;
}
@@ -433,7 +441,7 @@ public class Dashboard extends ButterKnifeActivity {
preferenceEditor.apply();
switching_provider = false;
- startActivityForResult(new Intent(this, ConfigurationWizard.class), Constants.REQUEST_CODE_SWITCH_PROVIDER);
+ startActivityForResult(new Intent(this, ConfigurationWizard.class), REQUEST_CODE_SWITCH_PROVIDER);
}
public static class DashboardReceiver implements ProviderAPIResultReceiver.Receiver{
@@ -478,7 +486,7 @@ public class Dashboard extends ButterKnifeActivity {
@Override
public void startActivityForResult(Intent intent, int requestCode) {
- intent.putExtra(Constants.REQUEST_CODE_KEY, requestCode);
+ intent.putExtra(REQUEST_CODE_KEY, requestCode);
super.startActivityForResult(intent, requestCode);
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/OnBootReceiver.java b/app/src/main/java/se/leap/bitmaskclient/OnBootReceiver.java
index aa661723..2a8aa42f 100644
--- a/app/src/main/java/se/leap/bitmaskclient/OnBootReceiver.java
+++ b/app/src/main/java/se/leap/bitmaskclient/OnBootReceiver.java
@@ -7,9 +7,11 @@ import android.content.SharedPreferences;
import android.util.Log;
import static android.content.Intent.ACTION_BOOT_COMPLETED;
+import static se.leap.bitmaskclient.Constants.APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE;
import static se.leap.bitmaskclient.Constants.EIP_IS_ALWAYS_ON;
import static se.leap.bitmaskclient.Constants.EIP_RESTART_ON_BOOT;
import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE;
+import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES;
public class OnBootReceiver extends BroadcastReceiver {
@@ -22,7 +24,7 @@ public class OnBootReceiver extends BroadcastReceiver {
if (intent == null || !ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
return;
}
- preferences = context.getSharedPreferences(Constants.SHARED_PREFERENCES, Context.MODE_PRIVATE);
+ preferences = context.getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE);
boolean providerConfigured = !preferences.getString(PROVIDER_VPN_CERTIFICATE, "").isEmpty();
boolean startOnBoot = preferences.getBoolean(EIP_RESTART_ON_BOOT, false);
boolean isAlwaysOnConfigured = preferences.getBoolean(EIP_IS_ALWAYS_ON, false);
@@ -41,7 +43,7 @@ public class OnBootReceiver extends BroadcastReceiver {
} else {
if (isAlwaysOnConfigured) {
Intent dashboardIntent = new Intent(context, Dashboard.class);
- dashboardIntent.putExtra(Constants.APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE, true);
+ dashboardIntent.putExtra(APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE, true);
dashboardIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(dashboardIntent);
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/main/java/se/leap/bitmaskclient/ProviderAPI.java
index 5a6aabc0..3dc93539 100644
--- a/app/src/main/java/se/leap/bitmaskclient/ProviderAPI.java
+++ b/app/src/main/java/se/leap/bitmaskclient/ProviderAPI.java
@@ -21,7 +21,7 @@ import android.app.IntentService;
import android.content.Intent;
import android.content.SharedPreferences;
-import de.blinkt.openvpn.core.Preferences;
+import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES;
/**
* Implements HTTP api methods (encapsulated in {{@link ProviderApiManager}})
@@ -117,7 +117,7 @@ public class ProviderAPI extends IntentService implements ProviderApiManagerBase
private ProviderApiManager initApiManager() {
- SharedPreferences preferences = getSharedPreferences(Constants.SHARED_PREFERENCES, MODE_PRIVATE);
+ SharedPreferences preferences = getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE);
OkHttpClientGenerator clientGenerator = new OkHttpClientGenerator(preferences, getResources());
return new ProviderApiManager(preferences, getResources(), clientGenerator, this);
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java b/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java
index 9f5fdc2d..f7bc0925 100644
--- a/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java
+++ b/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java
@@ -54,6 +54,10 @@ import se.leap.bitmaskclient.userstatus.User;
import se.leap.bitmaskclient.userstatus.UserStatus;
import static se.leap.bitmaskclient.ConfigHelper.getFingerprintFromCertificate;
+import static se.leap.bitmaskclient.Constants.PROVIDER_ALLOWED_REGISTERED;
+import static se.leap.bitmaskclient.Constants.PROVIDER_ALLOW_ANONYMOUS;
+import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY;
+import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE;
import static se.leap.bitmaskclient.DownloadFailedDialog.DOWNLOAD_ERRORS.ERROR_CERTIFICATE_PINNING;
import static se.leap.bitmaskclient.DownloadFailedDialog.DOWNLOAD_ERRORS.ERROR_CORRUPTED_PROVIDER_JSON;
import static se.leap.bitmaskclient.DownloadFailedDialog.DOWNLOAD_ERRORS.ERROR_INVALID_CERTIFICATE;
@@ -674,8 +678,8 @@ public abstract class ProviderApiManagerBase {
//valid certificate: skip download, save loaded provider CA cert and provider definition directly
try {
preferences.edit().putString(Provider.KEY, providerDefinition.toString()).
- putBoolean(Constants.PROVIDER_ALLOW_ANONYMOUS, providerDefinition.getJSONObject(Provider.SERVICE).getBoolean(Constants.PROVIDER_ALLOW_ANONYMOUS)).
- putBoolean(Constants.PROVIDER_ALLOWED_REGISTERED, providerDefinition.getJSONObject(Provider.SERVICE).getBoolean(Constants.PROVIDER_ALLOWED_REGISTERED)).
+ putBoolean(PROVIDER_ALLOW_ANONYMOUS, providerDefinition.getJSONObject(Provider.SERVICE).getBoolean(PROVIDER_ALLOW_ANONYMOUS)).
+ putBoolean(PROVIDER_ALLOWED_REGISTERED, providerDefinition.getJSONObject(Provider.SERVICE).getBoolean(PROVIDER_ALLOWED_REGISTERED)).
putString(Provider.CA_CERT, providerCaCert).commit();
CA_CERT_DOWNLOADED = true;
PROVIDER_JSON_DOWNLOADED = true;
@@ -912,11 +916,11 @@ public abstract class ProviderApiManagerBase {
RSAPrivateKey key = ConfigHelper.parseRsaKeyFromString(keyString);
keyString = Base64.encodeToString(key.getEncoded(), Base64.DEFAULT);
- preferences.edit().putString(Constants.PROVIDER_PRIVATE_KEY, "-----BEGIN RSA PRIVATE KEY-----\n" + keyString + "-----END RSA PRIVATE KEY-----").commit();
+ preferences.edit().putString(PROVIDER_PRIVATE_KEY, "-----BEGIN RSA PRIVATE KEY-----\n" + keyString + "-----END RSA PRIVATE KEY-----").commit();
X509Certificate certificate = ConfigHelper.parseX509CertificateFromString(certificateString);
certificateString = Base64.encodeToString(certificate.getEncoded(), Base64.DEFAULT);
- preferences.edit().putString(Constants.PROVIDER_VPN_CERTIFICATE, "-----BEGIN CERTIFICATE-----\n" + certificateString + "-----END CERTIFICATE-----").commit();
+ preferences.edit().putString(PROVIDER_VPN_CERTIFICATE, "-----BEGIN CERTIFICATE-----\n" + certificateString + "-----END CERTIFICATE-----").commit();
return true;
} catch (CertificateException e) {
// TODO Auto-generated catch block
diff --git a/app/src/main/java/se/leap/bitmaskclient/VpnFragment.java b/app/src/main/java/se/leap/bitmaskclient/VpnFragment.java
index 0af23917..8ea891cc 100644
--- a/app/src/main/java/se/leap/bitmaskclient/VpnFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/VpnFragment.java
@@ -64,6 +64,7 @@ import static se.leap.bitmaskclient.Constants.EIP_RESTART_ON_BOOT;
import static se.leap.bitmaskclient.Constants.PROVIDER_ALLOWED_REGISTERED;
import static se.leap.bitmaskclient.Constants.PROVIDER_ALLOW_ANONYMOUS;
import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE;
+import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES;
public class VpnFragment extends Fragment implements Observer {
@@ -114,7 +115,7 @@ public class VpnFragment extends Fragment implements Observer {
eipStatus = EipStatus.getInstance();
eipStatus.addObserver(this);
eipReceiver = new EIPReceiver(new Handler());
- preferences = getActivity().getSharedPreferences(Constants.SHARED_PREFERENCES, Context.MODE_PRIVATE);
+ preferences = getActivity().getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE);
}
@Override
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 e7217ad1..566134dd 100644
--- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java
@@ -3,16 +3,16 @@ package se.leap.bitmaskclient.drawer;
import android.content.Context;
import android.content.Intent;
-import android.support.v4.app.FragmentManager;
-import android.support.v7.app.ActionBarDrawerToggle;
-import android.support.v4.app.Fragment;
-import android.support.v4.view.GravityCompat;
-import android.support.v4.widget.DrawerLayout;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceManager;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+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.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
@@ -28,7 +28,6 @@ import android.widget.ListView;
import android.widget.Toast;
import se.leap.bitmaskclient.ConfigurationWizard;
-import se.leap.bitmaskclient.Constants;
import se.leap.bitmaskclient.Provider;
import se.leap.bitmaskclient.R;
import se.leap.bitmaskclient.VpnFragment;
@@ -37,6 +36,9 @@ import se.leap.bitmaskclient.fragments.LogFragment;
import se.leap.bitmaskclient.userstatus.User;
import se.leap.bitmaskclient.userstatus.UserStatusFragment;
+import static se.leap.bitmaskclient.Constants.REQUEST_CODE_SWITCH_PROVIDER;
+import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES;
+
/**
* Fragment used for managing interactions for and presentation of a navigation drawer.
* See the <a href="https://developer.android.com/design/patterns/navigation-drawer.html#Interaction">
@@ -86,7 +88,7 @@ public class NavigationDrawerFragment extends Fragment {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);
- preferences = getActivity().getSharedPreferences(Constants.SHARED_PREFERENCES, Context.MODE_PRIVATE);
+ preferences = getActivity().getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE);
if (savedInstanceState != null) {
mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
@@ -317,7 +319,7 @@ public class NavigationDrawerFragment extends Fragment {
// TODO STOP VPN
// if (provider.hasEIP()) eip_fragment.stopEipIfPossible();
preferences.edit().clear().apply();
- startActivityForResult(new Intent(getActivity(), ConfigurationWizard.class), Constants.REQUEST_CODE_SWITCH_PROVIDER);
+ startActivityForResult(new Intent(getActivity(), ConfigurationWizard.class), REQUEST_CODE_SWITCH_PROVIDER);
break;
case 2:
mTitle = getString(R.string.log_fragment_title);
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
index 43c16d00..0b330ed9 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
@@ -36,9 +36,11 @@ import java.util.List;
import de.blinkt.openvpn.VpnProfile;
import de.blinkt.openvpn.core.Connection;
import de.blinkt.openvpn.core.ProfileManager;
-import se.leap.bitmaskclient.Constants;
import se.leap.bitmaskclient.Provider;
+import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY;
+import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE;
+
/**
* @author parmegv
*/
@@ -124,8 +126,8 @@ public class GatewaysManager {
JSONObject result = new JSONObject();
try {
result.put(Provider.CA_CERT, preferences.getString(Provider.CA_CERT, ""));
- result.put(Constants.PROVIDER_PRIVATE_KEY, preferences.getString(Constants.PROVIDER_PRIVATE_KEY, ""));
- result.put(Constants.PROVIDER_VPN_CERTIFICATE, preferences.getString(Constants.PROVIDER_VPN_CERTIFICATE, ""));
+ result.put(PROVIDER_PRIVATE_KEY, preferences.getString(PROVIDER_PRIVATE_KEY, ""));
+ result.put(PROVIDER_VPN_CERTIFICATE, preferences.getString(PROVIDER_VPN_CERTIFICATE, ""));
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java
index e9c16dda..6f0ccf18 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java
@@ -22,9 +22,11 @@ import org.json.JSONObject;
import java.util.Iterator;
-import se.leap.bitmaskclient.Constants;
import se.leap.bitmaskclient.Provider;
+import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY;
+import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE;
+
public class VpnConfigGenerator {
private JSONObject general_configuration;
@@ -121,14 +123,14 @@ public class VpnConfigGenerator {
String key =
"<key>"
+ newLine
- + secrets.getString(Constants.PROVIDER_PRIVATE_KEY)
+ + secrets.getString(PROVIDER_PRIVATE_KEY)
+ newLine
+ "</key>";
String openvpnCert =
"<cert>"
+ newLine
- + secrets.getString(Constants.PROVIDER_VPN_CERTIFICATE)
+ + secrets.getString(PROVIDER_VPN_CERTIFICATE)
+ newLine
+ "</cert>";