From c1d13ccd8f78601142a33273093e1b3cadaead58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Tue, 19 Aug 2014 19:43:46 +0200 Subject: Rebuild vpn profiles if upgraded to versionCode 91 --- .../main/java/se/leap/bitmaskclient/Dashboard.java | 20 ++++++++++---------- app/src/main/java/se/leap/bitmaskclient/EIP.java | 8 +++++--- 2 files changed, 15 insertions(+), 13 deletions(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java index 74b6f9af..761afc0a 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java +++ b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java @@ -105,17 +105,17 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf int versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode; int lastDetectedVersion = preferences.getInt(APP_VERSION, 0); preferences.edit().putInt(APP_VERSION, versionCode); - if(lastDetectedVersion != 0) { - switch(versionCode) { - case 90: // 0.6.0 - if(!preferences.getString(EIP.KEY, "").isEmpty()) { - Intent removeVpnProfiles = new Intent(getApplicationContext(), EIP.class); - removeVpnProfiles.setAction(EIP.ACTION_REMOVE_PROFILES); - startService(removeVpnProfiles); - } + 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) { } } diff --git a/app/src/main/java/se/leap/bitmaskclient/EIP.java b/app/src/main/java/se/leap/bitmaskclient/EIP.java index 686efc69..43ad3c1f 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EIP.java +++ b/app/src/main/java/se/leap/bitmaskclient/EIP.java @@ -86,7 +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_REMOVE_PROFILES = "se.leap.bitmaskclient.REMOVE_PROFILES"; + 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"; @@ -156,8 +156,9 @@ public final class EIP extends IntentService { this.stopEIP(); else if ( action == ACTION_CHECK_CERT_VALIDITY ) this.checkCertValidity(); - else if ( action == ACTION_REMOVE_PROFILES ) - this.deleteAllVpnProfiles(); + else if ( action == ACTION_REBUILD_PROFILES ) { + this.updateGateways(); + } } /** @@ -466,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; -- cgit v1.2.3