diff options
author | Parménides GV <parmegv@sdf.org> | 2013-10-10 21:12:32 +0200 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2013-12-09 18:54:33 +0100 |
commit | b001f59fcbc30112ce04891fbca4c1365b457813 (patch) | |
tree | f617cce816dc27bb7e02baecddf2895d36bda3ec /src/se/leap/bitmaskclient/ProviderListContent.java | |
parent | 8fe314897cb59067c10cee376afbe01d623a9661 (diff) |
Simplified the methods to add a new provider.
Adding a new provider is the same that selecting a new one, using the same methods and following the same workflow.
Diffstat (limited to 'src/se/leap/bitmaskclient/ProviderListContent.java')
-rw-r--r-- | src/se/leap/bitmaskclient/ProviderListContent.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/se/leap/bitmaskclient/ProviderListContent.java b/src/se/leap/bitmaskclient/ProviderListContent.java index a6da5620..3695066c 100644 --- a/src/se/leap/bitmaskclient/ProviderListContent.java +++ b/src/se/leap/bitmaskclient/ProviderListContent.java @@ -28,6 +28,8 @@ import java.net.MalformedURLException; import org.json.JSONException;
import org.json.JSONObject;
+import android.app.Activity;
+
/**
* Models the provider list shown in the ConfigurationWizard.
*
@@ -60,7 +62,7 @@ public class ProviderListContent { final public static String CUSTOM = "custom";
final public static String DANGER_ON = "danger_on";
private boolean custom = false;
- private String provider_json_url;
+ private String provider_main_url;
private String name;
private boolean danger_on = false; @@ -77,7 +79,7 @@ public class ProviderListContent { urls_file_input_stream.read(urls_file_bytes);
String urls_file_content = new String(urls_file_bytes);
JSONObject file_contents = new JSONObject(urls_file_content); - provider_json_url = file_contents.getString(Provider.DOT_JSON_URL);
+ provider_main_url = file_contents.getString(Provider.MAIN_URL);
this.name = name; this.custom = custom;
this.danger_on = danger_on;
@@ -92,14 +94,14 @@ public class ProviderListContent { /**
* @param name of the provider
- * @param provider_json_url used to download provider.json file of the provider
+ * @param provider_main_url used to download provider.json file of the provider
* @param provider_json already downloaded
* @param custom if it's a new provider entered by the user or not
* @param danger_on if the user trusts completely the new provider
*/ - public ProviderItem(String name, String provider_json_url, boolean custom, boolean danger_on) {
+ public ProviderItem(String name, String provider_main_url, boolean custom, boolean danger_on) {
this.name = name;
- this.provider_json_url = provider_json_url;
+ this.provider_main_url = provider_main_url;
this.custom = custom;
this.danger_on = danger_on; }
@@ -108,13 +110,13 @@ public class ProviderListContent { public boolean custom() { return custom; }
- public String providerJsonUrl() { return provider_json_url; }
+ public String providerMainUrl() { return provider_main_url; }
public String domain() {
try {
- return new URL(provider_json_url).getHost();
+ return new URL(provider_main_url).getHost();
} catch (MalformedURLException e) {
- return provider_json_url.replaceFirst("http[s]?://", "").replaceFirst("/.*", "");
+ return provider_main_url.replaceFirst("http[s]?://", "").replaceFirst("/.*", "");
}
}
|