summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Dashboard.java35
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/EIP.java5
2 files changed, 26 insertions, 14 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
index fe546a21..761afc0a 100644
--- a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
+++ b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
@@ -104,10 +104,18 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
try {
int versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
int lastDetectedVersion = preferences.getInt(APP_VERSION, 0);
- if(lastDetectedVersion == 0) // New install
- getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().putInt(APP_VERSION, versionCode);
- else if(lastDetectedVersion < versionCode) {
- }
+ preferences.edit().putInt(APP_VERSION, versionCode);
+ Log.d("Dashboard", "detected version code: " + versionCode);
+ Log.d("Dashboard", "last detected version code: " + lastDetectedVersion);
+
+ switch(versionCode) {
+ case 91: // 0.6.0 without Bug #5999
+ if(!preferences.getString(EIP.KEY, "").isEmpty()) {
+ Intent rebuildVpnProfiles = new Intent(getApplicationContext(), EIP.class);
+ rebuildVpnProfiles.setAction(EIP.ACTION_REBUILD_PROFILES);
+ startService(rebuildVpnProfiles);
+ }
+ }
} catch (NameNotFoundException e) {
}
}
@@ -127,8 +135,8 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
if ( requestCode == CONFIGURE_LEAP || requestCode == SWITCH_PROVIDER) {
// It should be equivalent: if ( (requestCode == CONFIGURE_LEAP) || (data!= null && data.hasExtra(STOP_FIRST))) {
if ( resultCode == RESULT_OK ){
- getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().putInt(EIP.PARSED_SERIAL, 0).commit();
- getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().putBoolean(EIP.AUTHED_EIP, authed_eip).commit();
+ preferences.edit().putInt(EIP.PARSED_SERIAL, 0).commit();
+ preferences.edit().putBoolean(EIP.AUTHED_EIP, authed_eip).commit();
Intent updateEIP = new Intent(getApplicationContext(), EIP.class);
updateEIP.setAction(EIP.ACTION_UPDATE_EIP_SERVICE);
startService(updateEIP);
@@ -164,8 +172,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
.setNegativeButton(getResources().getString(R.string.setup_error_close_button), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- SharedPreferences.Editor prefsEdit = getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE).edit();
- prefsEdit.remove(Provider.KEY).commit();
+ preferences.edit().remove(Provider.KEY).commit();
finish();
}
})
@@ -192,7 +199,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
if ( provider.hasEIP()){
eipFragment = new EipServiceFragment();
if (hide_and_turn_on_eip) {
- getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().remove(Dashboard.START_ON_BOOT).commit();
+ preferences.edit().remove(Dashboard.START_ON_BOOT).commit();
Bundle arguments = new Bundle();
arguments.putBoolean(EipServiceFragment.START_ON_BOOT, true);
eipFragment.setArguments(arguments);
@@ -209,7 +216,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
public boolean onPrepareOptionsMenu(Menu menu) {
JSONObject provider_json;
try {
- provider_json = new JSONObject(getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE).getString(Provider.KEY, ""));
+ provider_json = new JSONObject(preferences.getString(Provider.KEY, ""));
JSONObject service_description = provider_json.getJSONObject(Provider.SERVICE);
boolean authed_eip = preferences.getBoolean(EIP.AUTHED_EIP, false);
boolean allow_registered_eip = service_description.getBoolean(Provider.ALLOW_REGISTRATION);
@@ -252,12 +259,12 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
return true;
case R.id.switch_provider:
if (Provider.getInstance().hasEIP()){
- if (getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).getBoolean(EIP.AUTHED_EIP, false)){
+ if (preferences.getBoolean(EIP.AUTHED_EIP, false)){
logOut();
}
eipStop();
}
- getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().clear().commit();
+ preferences.edit().clear().commit();
startActivityForResult(new Intent(this,ConfigurationWizard.class), SWITCH_PROVIDER);
return true;
case R.id.login_button:
@@ -463,7 +470,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
setResult(RESULT_OK);
authed_eip = true;
- getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().putBoolean(EIP.AUTHED_EIP, authed_eip).commit();
+ preferences.edit().putBoolean(EIP.AUTHED_EIP, authed_eip).commit();
invalidateOptionsMenu();
mProgressBar.setVisibility(ProgressBar.GONE);
@@ -475,7 +482,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
logInDialog(resultData);
} else if(resultCode == ProviderAPI.LOGOUT_SUCCESSFUL) {
authed_eip = false;
- getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().putBoolean(EIP.AUTHED_EIP, authed_eip).commit();
+ preferences.edit().putBoolean(EIP.AUTHED_EIP, authed_eip).commit();
mProgressBar.setVisibility(ProgressBar.GONE);
mProgressBar.setProgress(0);
invalidateOptionsMenu();
diff --git a/app/src/main/java/se/leap/bitmaskclient/EIP.java b/app/src/main/java/se/leap/bitmaskclient/EIP.java
index 41299318..43ad3c1f 100644
--- a/app/src/main/java/se/leap/bitmaskclient/EIP.java
+++ b/app/src/main/java/se/leap/bitmaskclient/EIP.java
@@ -86,6 +86,7 @@ public final class EIP extends IntentService {
public final static String ACTION_STOP_EIP = "se.leap.bitmaskclient.STOP_EIP";
public final static String ACTION_UPDATE_EIP_SERVICE = "se.leap.bitmaskclient.UPDATE_EIP_SERVICE";
public final static String ACTION_IS_EIP_RUNNING = "se.leap.bitmaskclient.IS_RUNNING";
+ public final static String ACTION_REBUILD_PROFILES = "se.leap.bitmaskclient.REBUILD_PROFILES";
public final static String EIP_NOTIFICATION = "EIP_NOTIFICATION";
public final static String STATUS = "eip status";
public final static String DATE_FROM_CERTIFICATE = "date from certificate";
@@ -155,6 +156,9 @@ public final class EIP extends IntentService {
this.stopEIP();
else if ( action == ACTION_CHECK_CERT_VALIDITY )
this.checkCertValidity();
+ else if ( action == ACTION_REBUILD_PROFILES ) {
+ this.updateGateways();
+ }
}
/**
@@ -463,6 +467,7 @@ public final class EIP extends IntentService {
cp.parseConfig(new StringReader(certSecretFromSharedPreferences()));
cp.parseConfig(new StringReader("remote-cert-tls server"));
cp.parseConfig(new StringReader("persist-tun"));
+ Log.d(TAG, "persist-tun");
VpnProfile vp = cp.convertProfile();
//vp.mAuthenticationType=VpnProfile.TYPE_STATICKEYS;
mVpnProfile = vp;