diff options
author | Fup Duck <fupduck@sacknagel.com> | 2017-12-06 01:58:21 +0100 |
---|---|---|
committer | Fup Duck <fupduck@sacknagel.com> | 2017-12-06 01:58:21 +0100 |
commit | da7293252f197e9b54c1abd8127b4abe45b95110 (patch) | |
tree | cf8185239d8c1394f89e2b90ce8932a2a876ad6a /app/src/insecure/java | |
parent | 38796aeb892379b8c2b7e4e1d7af00c4c050e8dc (diff) |
move constants
* move EIPConstants to Constants
* unify EIPConstants where possible
* create Updater
Diffstat (limited to 'app/src/insecure/java')
-rw-r--r-- | app/src/insecure/java/se/leap/bitmaskclient/ProviderAPI.java | 9 | ||||
-rw-r--r-- | app/src/insecure/java/se/leap/bitmaskclient/ProviderDetailFragment.java | 4 |
2 files changed, 6 insertions, 7 deletions
diff --git a/app/src/insecure/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/insecure/java/se/leap/bitmaskclient/ProviderAPI.java index fd6d4b79..c6826a53 100644 --- a/app/src/insecure/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/insecure/java/se/leap/bitmaskclient/ProviderAPI.java @@ -45,7 +45,6 @@ import javax.net.ssl.X509TrustManager; import okhttp3.OkHttpClient; import se.leap.bitmaskclient.ProviderListContent.ProviderItem; -import se.leap.bitmaskclient.eip.EIPConstants; import se.leap.bitmaskclient.eip.EIP; import static se.leap.bitmaskclient.R.string.certificate_error; @@ -138,8 +137,8 @@ public class ProviderAPI extends ProviderApiBase { //TODO setProviderName(name); preferences.edit().putString(Provider.KEY, provider_json.toString()).commit(); - preferences.edit().putBoolean(EIPConstants.ALLOWED_ANON, provider_json.getJSONObject(Provider.SERVICE).getBoolean(EIPConstants.ALLOWED_ANON)).commit(); - preferences.edit().putBoolean(EIPConstants.ALLOWED_REGISTERED, provider_json.getJSONObject(Provider.SERVICE).getBoolean(EIPConstants.ALLOWED_REGISTERED)).commit(); + preferences.edit().putBoolean(Constants.ALLOWED_ANON, provider_json.getJSONObject(Provider.SERVICE).getBoolean(Constants.ALLOWED_ANON)).commit(); + preferences.edit().putBoolean(Constants.ALLOWED_REGISTERED, provider_json.getJSONObject(Provider.SERVICE).getBoolean(Constants.ALLOWED_REGISTERED)).commit(); result.putBoolean(RESULT_KEY, true); } catch (JSONException e) { @@ -168,7 +167,7 @@ public class ProviderAPI extends ProviderApiBase { JSONObject eip_service_json = new JSONObject(eip_service_json_string); eip_service_json.getInt(Provider.API_RETURN_SERIAL); - preferences.edit().putString(EIPConstants.KEY, eip_service_json.toString()).commit(); + preferences.edit().putString(Constants.KEY, eip_service_json.toString()).commit(); result.putBoolean(RESULT_KEY, true); } catch (NullPointerException | JSONException e) { @@ -191,7 +190,7 @@ public class ProviderAPI extends ProviderApiBase { JSONObject provider_json = new JSONObject(preferences.getString(Provider.KEY, "")); String provider_main_url = provider_json.getString(Provider.API_URL); - URL new_cert_string_url = new URL(provider_main_url + "/" + provider_json.getString(Provider.API_VERSION) + "/" + EIPConstants.VPN_CERTIFICATE); + URL new_cert_string_url = new URL(provider_main_url + "/" + provider_json.getString(Provider.API_VERSION) + "/" + Constants.VPN_CERTIFICATE); String cert_string = downloadWithProviderCA(new_cert_string_url.toString(), last_danger_on); diff --git a/app/src/insecure/java/se/leap/bitmaskclient/ProviderDetailFragment.java b/app/src/insecure/java/se/leap/bitmaskclient/ProviderDetailFragment.java index 9c401da4..f6ebfc4b 100644 --- a/app/src/insecure/java/se/leap/bitmaskclient/ProviderDetailFragment.java +++ b/app/src/insecure/java/se/leap/bitmaskclient/ProviderDetailFragment.java @@ -60,7 +60,7 @@ public class ProviderDetailFragment extends DialogFragment { private boolean anon_allowed(JSONObject provider_json) { try { JSONObject service_description = provider_json.getJSONObject(Provider.SERVICE); - return service_description.has(EIPConstants.ALLOWED_ANON) && service_description.getBoolean(EIPConstants.ALLOWED_ANON); + return service_description.has(Constants.ALLOWED_ANON) && service_description.getBoolean(Constants.ALLOWED_ANON); } catch (JSONException e) { return false; } @@ -79,7 +79,7 @@ public class ProviderDetailFragment extends DialogFragment { public void onCancel(DialogInterface dialog) { super.onCancel(dialog); SharedPreferences.Editor editor = getActivity().getSharedPreferences(Constants.SHARED_PREFERENCES, Activity.MODE_PRIVATE).edit(); - editor.remove(Provider.KEY).remove(ProviderItem.DANGER_ON).remove(EIPConstants.ALLOWED_ANON).remove(EIPConstants.KEY).commit(); + editor.remove(Provider.KEY).remove(ProviderItem.DANGER_ON).remove(Constants.ALLOWED_ANON).remove(Constants.KEY).commit(); interface_with_configuration_wizard.cancelAndShowAllProviders(); } |