summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java6
-rw-r--r--app/src/main/AndroidManifest.xml2
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Dashboard.java35
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/EIP.java5
-rw-r--r--app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java2
5 files changed, 31 insertions, 19 deletions
diff --git a/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java
index cf013f3a..153cb731 100644
--- a/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java
+++ b/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java
@@ -96,7 +96,7 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- preferences = getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE);
+ preferences = preferences;
setContentView(R.layout.configuration_wizard_activity);
mProgressBar = (ProgressBar) findViewById(R.id.progressbar_configuration_wizard);
@@ -230,7 +230,7 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD
mProgressBar.setVisibility(ProgressBar.GONE);
mProgressBar.setProgress(0);
progressbar_description.setVisibility(TextView.GONE);
- getSharedPreferences(Dashboard.SHARED_PREFERENCES, Activity.MODE_PRIVATE).edit().remove(Provider.KEY).commit();
+ preferences.edit().remove(Provider.KEY).commit();
setting_up_provider = false;
showAllProviders();
}
@@ -497,7 +497,7 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD
}
private void autoSelectProvider(String provider_main_url, boolean danger_on) {
- getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().putBoolean(ProviderItem.DANGER_ON, danger_on).commit();
+ preferences.edit().putBoolean(ProviderItem.DANGER_ON, danger_on).commit();
onItemSelected(getId(provider_main_url));
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 507e5bb0..0c55bf78 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -17,7 +17,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="se.leap.bitmaskclient"
- android:versionCode="90"
+ android:versionCode="91"
android:versionName="0.6.0" >
<uses-permission android:name="android.permission.INTERNET" />
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;
diff --git a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java
index a6b009e3..b5a57234 100644
--- a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java
+++ b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java
@@ -227,7 +227,7 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD
mProgressBar.setVisibility(ProgressBar.GONE);
mProgressBar.setProgress(0);
progressbar_description.setVisibility(TextView.GONE);
- getSharedPreferences(Dashboard.SHARED_PREFERENCES, Activity.MODE_PRIVATE).edit().remove(Provider.KEY).commit();
+ preferences.edit().remove(Provider.KEY).commit();
setting_up_provider = false;
showAllProviders();
}