diff options
author | Fup Duck <fupduck@sacknagel.com> | 2017-11-23 11:34:52 +0100 |
---|---|---|
committer | Fup Duck <fupduck@sacknagel.com> | 2017-12-12 16:17:46 +0100 |
commit | 14ba6c81a5ec60732481e84eb02d62d6490c27f8 (patch) | |
tree | d5bf0881dd86ed1c2e42022a552b5e3b3ef8e323 /app/src/production/java | |
parent | f19e355b2e53af5d76880bb7450137c4c9a2e227 (diff) |
Add Splash StartActivity
* added Splash StartActivity to handle updates and initialization
* created global Constants
* move EIPConstants to Constants
* create update possibility
* use VectorDrawable as background for StartActivity
Diffstat (limited to 'app/src/production/java')
-rw-r--r-- | app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java | 9 | ||||
-rw-r--r-- | app/src/production/java/se/leap/bitmaskclient/ProviderDetailFragment.java | 10 |
2 files changed, 8 insertions, 11 deletions
diff --git a/app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java index 70a2c27c..fadb03c3 100644 --- a/app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java @@ -33,7 +33,6 @@ import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLHandshakeException; import okhttp3.OkHttpClient; -import se.leap.bitmaskclient.eip.Constants; import se.leap.bitmaskclient.eip.EIP; import static se.leap.bitmaskclient.R.string.error_io_exception_user_message; @@ -120,8 +119,8 @@ public class ProviderAPI extends ProviderApiBase { //TODO setProviderName(name); preferences.edit().putString(Provider.KEY, provider_json.toString()).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(); + preferences.edit().putBoolean(Constants.PROVIDER_ALLOW_ANONYMOUS, provider_json.getJSONObject(Provider.SERVICE).getBoolean(Constants.PROVIDER_ALLOW_ANONYMOUS)).commit(); + preferences.edit().putBoolean(Constants.PROVIDER_ALLOWED_REGISTERED, provider_json.getJSONObject(Provider.SERVICE).getBoolean(Constants.PROVIDER_ALLOWED_REGISTERED)).commit(); result.putBoolean(RESULT_KEY, true); } catch (JSONException e) { @@ -150,7 +149,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(Constants.KEY, eip_service_json.toString()).commit(); + preferences.edit().putString(Constants.PROVIDER_KEY, eip_service_json.toString()).commit(); result.putBoolean(RESULT_KEY, true); } catch (NullPointerException | JSONException e) { @@ -173,7 +172,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) + "/" + Constants.VPN_CERTIFICATE); + URL new_cert_string_url = new URL(provider_main_url + "/" + provider_json.getString(Provider.API_VERSION) + "/" + Constants.PROVIDER_VPN_CERTIFICATE); String cert_string = downloadWithProviderCA(new_cert_string_url.toString()); diff --git a/app/src/production/java/se/leap/bitmaskclient/ProviderDetailFragment.java b/app/src/production/java/se/leap/bitmaskclient/ProviderDetailFragment.java index da7f8763..c7224ede 100644 --- a/app/src/production/java/se/leap/bitmaskclient/ProviderDetailFragment.java +++ b/app/src/production/java/se/leap/bitmaskclient/ProviderDetailFragment.java @@ -2,8 +2,6 @@ package se.leap.bitmaskclient; import org.json.*; -import se.leap.bitmaskclient.eip.*; - import android.app.*; import android.content.*; import android.os.*; @@ -22,7 +20,7 @@ public class ProviderDetailFragment extends DialogFragment { LayoutInflater inflater = getActivity().getLayoutInflater(); View provider_detail_view = inflater.inflate(R.layout.provider_detail_fragment, null); - JSONObject provider_json = new JSONObject(getActivity().getSharedPreferences(Dashboard.SHARED_PREFERENCES, getActivity().MODE_PRIVATE).getString(Provider.KEY, "")); + JSONObject provider_json = new JSONObject(getActivity().getSharedPreferences(Constants.SHARED_PREFERENCES, getActivity().MODE_PRIVATE).getString(Provider.KEY, "")); final TextView domain = (TextView) provider_detail_view.findViewById(R.id.provider_detail_domain); domain.setText(provider_json.getString(Provider.DOMAIN)); @@ -59,7 +57,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(Constants.ALLOWED_ANON) && service_description.getBoolean(Constants.ALLOWED_ANON); + return service_description.has(Constants.PROVIDER_ALLOW_ANONYMOUS) && service_description.getBoolean(Constants.PROVIDER_ALLOW_ANONYMOUS); } catch (JSONException e) { return false; } @@ -77,8 +75,8 @@ public class ProviderDetailFragment extends DialogFragment { @Override public void onCancel(DialogInterface dialog) { super.onCancel(dialog); - SharedPreferences.Editor editor = getActivity().getSharedPreferences(Dashboard.SHARED_PREFERENCES, Activity.MODE_PRIVATE).edit(); - editor.remove(Provider.KEY).remove(Constants.ALLOWED_ANON).remove(Constants.KEY).commit(); + SharedPreferences.Editor editor = getActivity().getSharedPreferences(Constants.SHARED_PREFERENCES, Activity.MODE_PRIVATE).edit(); + editor.remove(Provider.KEY).remove(Constants.PROVIDER_ALLOW_ANONYMOUS).remove(Constants.PROVIDER_KEY).commit(); interface_with_configuration_wizard.cancelAndShowAllProviders(); } |