summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2014-07-04 10:33:27 +0200
committerParménides GV <parmegv@sdf.org>2014-07-10 08:59:36 +0200
commit8ebea084e117365c4b7a9c10e56aaaceabcd43b2 (patch)
treefef73925997e59f75cc7db566dc2d5cdd8a0de15 /app/src
parent0a5c95eb01344aeccc3e3ed848166b6c02bedff9 (diff)
Change the name of the gateway to its location.
This way, the notification shows the city of the gateway rather than the hostname :)
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/EIP.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/EIP.java b/app/src/main/java/se/leap/bitmaskclient/EIP.java
index 75c6ada8..01b7d827 100644
--- a/app/src/main/java/se/leap/bitmaskclient/EIP.java
+++ b/app/src/main/java/se/leap/bitmaskclient/EIP.java
@@ -369,7 +369,7 @@ public final class EIP extends IntentService {
for (int i = 0; i < gateways.length(); i++) {
JSONObject gw = gateways.getJSONObject(i);
if ( gw.getString("location").equalsIgnoreCase(closestLocation) || closestLocation.isEmpty()){
- chosenHost = gw.getString("host");
+ chosenHost = eipDefinition.getJSONObject("locations").getJSONObject(gw.getString("location")).getString("name");
break;
}
}
@@ -480,7 +480,6 @@ public final class EIP extends IntentService {
private void loadVpnProfile() {
ProfileManager vpl = ProfileManager.getInstance(context);
-
try {
if ( mName == null )
mVpnProfile = vpl.getProfiles().iterator().next();
@@ -510,8 +509,10 @@ public final class EIP extends IntentService {
Collection<VpnProfile> profiles = vpl.getProfiles();
for (Iterator<VpnProfile> it = profiles.iterator(); it.hasNext(); ){
VpnProfile p = it.next();
+
try {
- if ( p.mName.equalsIgnoreCase( gateway.getString("host") ) ){
+ String name = eipDefinition.getJSONObject("locations").getJSONObject(mGateway.getString("location")).getString("name");
+ if ( p.mName.equalsIgnoreCase( name ) ) {
it.remove();
vpl.removeProfile(context, p);
}
@@ -548,7 +549,9 @@ public final class EIP extends IntentService {
newname = getString(R.string.converted_profile_i,i);
}
+ newname = eipDefinition.getJSONObject("locations").getJSONObject(mGateway.getString("location")).getString("name");
mVpnProfile.mName=newname;
+ mName = newname;
} catch (JSONException e) {
// TODO Auto-generated catch block
Log.v(TAG,"Couldn't read gateway name for profile creation!");