summaryrefslogtreecommitdiff
path: root/src/se/leap/bitmaskclient
diff options
context:
space:
mode:
Diffstat (limited to 'src/se/leap/bitmaskclient')
-rw-r--r--src/se/leap/bitmaskclient/AboutActivity.java12
-rw-r--r--src/se/leap/bitmaskclient/ConfigurationWizard.java4
-rw-r--r--src/se/leap/bitmaskclient/Dashboard.java2
-rw-r--r--src/se/leap/bitmaskclient/EIP.java11
-rw-r--r--src/se/leap/bitmaskclient/LeapSRPSession.java3
-rw-r--r--src/se/leap/bitmaskclient/ProviderAPI.java10
-rw-r--r--src/se/leap/bitmaskclient/ProviderListFragment.java7
7 files changed, 21 insertions, 28 deletions
diff --git a/src/se/leap/bitmaskclient/AboutActivity.java b/src/se/leap/bitmaskclient/AboutActivity.java
index a3320c81..6d025422 100644
--- a/src/se/leap/bitmaskclient/AboutActivity.java
+++ b/src/se/leap/bitmaskclient/AboutActivity.java
@@ -18,7 +18,7 @@ public class AboutActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
+ super.onCreate(savedInstanceState);
setContentView(R.layout.about);
TextView ver = (TextView) findViewById(R.id.version);
@@ -34,15 +34,7 @@ public class AboutActivity extends Activity {
ver.setText(getString(R.string.version_info,name,version));
-
- TextView translation = (TextView) findViewById(R.id.translation);
-
- // Don't print a text for myself
- if ( getString(R.string.translationby).contains("Arne Schwabe"))
- translation.setVisibility(TextView.INVISIBLE);
- else
- translation.setText(R.string.translationby);
- setResult(VIEWED);
+ setResult(VIEWED);
}
}
diff --git a/src/se/leap/bitmaskclient/ConfigurationWizard.java b/src/se/leap/bitmaskclient/ConfigurationWizard.java
index e5ad5b3d..1c5f6048 100644
--- a/src/se/leap/bitmaskclient/ConfigurationWizard.java
+++ b/src/se/leap/bitmaskclient/ConfigurationWizard.java
@@ -137,9 +137,9 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD
public void refreshProviderList(int top_padding) {
ProviderListFragment new_provider_list_fragment = new ProviderListFragment();
Bundle top_padding_bundle = new Bundle();
- top_padding_bundle.putInt(getResources().getString(R.string.top_padding), top_padding);
+ top_padding_bundle.putInt(ProviderListFragment.TOP_PADDING, top_padding);
new_provider_list_fragment.setArguments(top_padding_bundle);
-
+
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.configuration_wizard_layout, new_provider_list_fragment, ProviderListFragment.TAG)
diff --git a/src/se/leap/bitmaskclient/Dashboard.java b/src/se/leap/bitmaskclient/Dashboard.java
index b4d06f23..65fd2d5b 100644
--- a/src/se/leap/bitmaskclient/Dashboard.java
+++ b/src/se/leap/bitmaskclient/Dashboard.java
@@ -110,7 +110,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
updateEIP.setAction(EIP.ACTION_UPDATE_EIP_SERVICE);
startService(updateEIP);
buildDashboard();
-
+ invalidateOptionsMenu();
if(data != null && data.hasExtra(LogInDialog.VERB)) {
View view = ((ViewGroup)findViewById(android.R.id.content)).getChildAt(0);
logInDialog(view, Bundle.EMPTY);
diff --git a/src/se/leap/bitmaskclient/EIP.java b/src/se/leap/bitmaskclient/EIP.java
index 169178d1..e773e3b9 100644
--- a/src/se/leap/bitmaskclient/EIP.java
+++ b/src/se/leap/bitmaskclient/EIP.java
@@ -280,9 +280,9 @@ public final class EIP extends IntentService {
if(parsedEipSerial == 0) {
// Delete all vpn profiles
ProfileManager vpl = ProfileManager.getInstance(context);
- Collection<VpnProfile> profiles = vpl.getProfiles();
- for (VpnProfile profile : profiles){
- vpl.removeProfile(context, profile);
+ VpnProfile[] profiles = (VpnProfile[]) vpl.getProfiles().toArray(new VpnProfile[vpl.getProfiles().size()]);
+ for (int current_profile = 0; current_profile < profiles.length; current_profile++){
+ vpl.removeProfile(context, profiles[current_profile]);
}
}
if (eipDefinition.optInt("serial") > parsedEipSerial)
@@ -332,14 +332,15 @@ public final class EIP extends IntentService {
}
}
- String closestLocation = offsets.firstEntry().getValue().iterator().next();
+
+ String closestLocation = offsets.isEmpty() ? "" : offsets.firstEntry().getValue().iterator().next();
JSONArray gateways = null;
String chosenHost = null;
try {
gateways = eipDefinition.getJSONArray("gateways");
for (int i = 0; i < gateways.length(); i++) {
JSONObject gw = gateways.getJSONObject(i);
- if ( gw.getString("location").equalsIgnoreCase(closestLocation) ){
+ if ( gw.getString("location").equalsIgnoreCase(closestLocation) || closestLocation.isEmpty()){
chosenHost = gw.getString("host");
break;
}
diff --git a/src/se/leap/bitmaskclient/LeapSRPSession.java b/src/se/leap/bitmaskclient/LeapSRPSession.java
index 0849f777..a317d95e 100644
--- a/src/se/leap/bitmaskclient/LeapSRPSession.java
+++ b/src/se/leap/bitmaskclient/LeapSRPSession.java
@@ -41,7 +41,8 @@ public class LeapSRPSession {
final public static String M1 = "M1";
final public static String M2 = "M2";
final public static String TOKEN = "token";
-
+ final public static String AUTHORIZATION_HEADER= "Authorization";
+
private SRPParameters params;
private String username;
private String password;
diff --git a/src/se/leap/bitmaskclient/ProviderAPI.java b/src/se/leap/bitmaskclient/ProviderAPI.java
index 5344e471..7aafa2e3 100644
--- a/src/se/leap/bitmaskclient/ProviderAPI.java
+++ b/src/se/leap/bitmaskclient/ProviderAPI.java
@@ -601,12 +601,12 @@ public class ProviderAPI extends IntentService {
URLConnection url_connection = provider_url.openConnection();
url_connection.setConnectTimeout(seconds_of_timeout*1000);
if(!LeapSRPSession.getToken().isEmpty())
- url_connection.addRequestProperty(LeapSRPSession.TOKEN, LeapSRPSession.getToken());
+ url_connection.addRequestProperty(LeapSRPSession.AUTHORIZATION_HEADER, "Token token = " + LeapSRPSession.getToken());
json_file_content = new Scanner(url_connection.getInputStream()).useDelimiter("\\A").next();
} catch (MalformedURLException e) {
json_file_content = formatErrorMessage(R.string.malformed_url);
} catch(SocketTimeoutException e) {
- json_file_content = formatErrorMessage(R.string.server_is_down_message);
+ json_file_content = formatErrorMessage(R.string.server_unreachable_message);
} catch (IOException e) {
if(provider_url != null) {
json_file_content = downloadWithProviderCA(string_url, danger_on);
@@ -638,13 +638,13 @@ public class ProviderAPI extends IntentService {
(HttpsURLConnection)url.openConnection();
urlConnection.setSSLSocketFactory(getProviderSSLSocketFactory());
if(!LeapSRPSession.getToken().isEmpty())
- urlConnection.addRequestProperty(LeapSRPSession.TOKEN, LeapSRPSession.getToken());
+ urlConnection.addRequestProperty(LeapSRPSession.AUTHORIZATION_HEADER, "Token token=" + LeapSRPSession.getToken());
json_file_content = new Scanner(urlConnection.getInputStream()).useDelimiter("\\A").next();
} catch (CertificateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnknownHostException e) {
- json_file_content = formatErrorMessage(R.string.server_is_down_message);
+ json_file_content = formatErrorMessage(R.string.server_unreachable_message);
} catch (IOException e) {
// The downloaded certificate doesn't validate our https connection.
if(danger_on) {
@@ -727,7 +727,7 @@ public class ProviderAPI extends IntentService {
System.out.println("String ignoring certificate = " + string);
} catch (FileNotFoundException e) {
e.printStackTrace();
- string = formatErrorMessage(R.string.server_is_down_message);
+ string = formatErrorMessage(R.string.server_unreachable_message);
} catch (IOException e) {
// The downloaded certificate doesn't validate our https connection.
e.printStackTrace();
diff --git a/src/se/leap/bitmaskclient/ProviderListFragment.java b/src/se/leap/bitmaskclient/ProviderListFragment.java
index 45047982..f35cf739 100644
--- a/src/se/leap/bitmaskclient/ProviderListFragment.java
+++ b/src/se/leap/bitmaskclient/ProviderListFragment.java
@@ -39,7 +39,7 @@ public class ProviderListFragment extends ListFragment {
public static String TAG = "provider_list_fragment";
public static String SHOW_ALL_PROVIDERS = "show_all_providers";
-
+ public static String TOP_PADDING = "top padding from providerlistfragment";
private ProviderListAdapter<ProviderItem> content_adapter;
/**
@@ -120,9 +120,8 @@ public class ProviderListFragment extends ListFragment {
&& savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
}
- String top_padding_key = getResources().getString(R.string.top_padding);
- if(getArguments() != null && getArguments().containsKey(top_padding_key)) {
- int topPadding = getArguments().getInt(top_padding_key);
+ if(getArguments() != null && getArguments().containsKey(TOP_PADDING)) {
+ int topPadding = getArguments().getInt(TOP_PADDING);
View current_view = getView();
getView().setPadding(current_view.getPaddingLeft(), topPadding, current_view.getPaddingRight(), current_view.getPaddingBottom());
}