diff options
author | cyBerta <cyberta@riseup.net> | 2017-12-14 19:01:28 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2017-12-14 19:01:28 +0100 |
commit | 25d215400d500bdb7537e604ed91ced586821ef2 (patch) | |
tree | cb29df26bec196f8628947897a5fe9977b00a229 /app/src/main/java/se/leap/bitmaskclient/Dashboard.java | |
parent | b84f9942a3f87f9d1e589221ed2eb3900518d8d9 (diff) | |
parent | 18e24819eed388d349dbf6d7cd21534d7074bf5d (diff) |
Update constants renaming
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/Dashboard.java')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/Dashboard.java | 47 |
1 files changed, 11 insertions, 36 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java index 1a4adc1d..f1e7b3bd 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java +++ b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java @@ -1,20 +1,4 @@ -/** - * Copyright (c) 2013 LEAP Encryption Access Project and contributers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -/** +/* * Copyright (c) 2013 LEAP Encryption Access Project and contributers * * This program is free software: you can redistribute it and/or modify @@ -57,14 +41,12 @@ import java.net.URL; import butterknife.ButterKnife; import butterknife.InjectView; -import de.blinkt.openvpn.core.VpnStatus; -import se.leap.bitmaskclient.eip.Constants; import se.leap.bitmaskclient.userstatus.SessionDialog; import se.leap.bitmaskclient.userstatus.User; import se.leap.bitmaskclient.userstatus.UserStatusFragment; -import static se.leap.bitmaskclient.eip.Constants.IS_ALWAYS_ON; -import static se.leap.bitmaskclient.eip.Constants.RESTART_ON_BOOT; +import static se.leap.bitmaskclient.Constants.EIP_IS_ALWAYS_ON; +import static se.leap.bitmaskclient.Constants.EIP_RESTART_ON_BOOT; /** * The main user facing Activity of Bitmask Android, consisting of status, controls, @@ -79,7 +61,6 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec protected static final int SWITCH_PROVIDER = 1; public static final String TAG = Dashboard.class.getSimpleName(); - public static final String SHARED_PREFERENCES = "LEAPPreferences"; public static final String ACTION_QUIT = "quit"; /** @@ -113,18 +94,14 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - preferences = getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE); + preferences = getSharedPreferences(Constants.SHARED_PREFERENCES, MODE_PRIVATE); fragment_manager = new FragmentManagerEnhanced(getFragmentManager()); - ProviderAPICommand.initialize(this); providerAPI_result_receiver = new ProviderAPIResultReceiver(new Handler(), this); if (dashboardContext == null) { dashboardContext = this; - - VpnStatus.initLogCache(getApplicationContext().getCacheDir()); handleVersion(); - User.init(getString(R.string.default_username)); } prepareEIP(savedInstanceState); @@ -180,13 +157,11 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec private void handleVersion() { try { int versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode; - int lastDetectedVersion = preferences.getInt(APP_VERSION, 0); - preferences.edit().putInt(APP_VERSION, versionCode).apply(); switch (versionCode) { case 91: // 0.6.0 without Bug #5999 case 101: // 0.8.0 - if (!preferences.getString(Constants.KEY, "").isEmpty()) + if (!preferences.getString(Constants.PROVIDER_KEY, "").isEmpty()) eip_fragment.updateEipService(); break; } @@ -205,8 +180,8 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec private void handleIntentExtras(Intent intent) { if (intent.hasExtra(ACTION_ASK_TO_CANCEL_VPN)) { handleVpnCancellation(intent); - } else if (intent.hasExtra(RESTART_ON_BOOT)) { - Log.d(TAG, "Dashboard: RESTART_ON_BOOT"); + } else if (intent.hasExtra(EIP_RESTART_ON_BOOT)) { + Log.d(TAG, "Dashboard: EIP_RESTART_ON_BOOT"); prepareEIP(null); } else if (intent.hasExtra(ACTION_CONFIGURE_ALWAYS_ON_PROFILE)) { Log.d(TAG, "Dashboard: ACTION_CONFIGURE_ALWAYS_ON_PROFILE"); @@ -255,7 +230,7 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec configureLeapProvider(); } else { Log.d(TAG, "vpn provider is configured"); - buildDashboard(getIntent().getBooleanExtra(RESTART_ON_BOOT, false)); + buildDashboard(getIntent().getBooleanExtra(EIP_RESTART_ON_BOOT, false)); user_status_fragment.restoreSessionStatus(savedInstanceState); } } else { @@ -338,7 +313,7 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec VpnFragment eip_fragment = new VpnFragment(); if (hideAndTurnOnEipOnBoot && !isAlwaysOn()) { - preferences.edit().remove(Constants.RESTART_ON_BOOT).apply(); + preferences.edit().remove(EIP_RESTART_ON_BOOT).apply(); Bundle arguments = new Bundle(); arguments.putBoolean(VpnFragment.START_EIP_ON_BOOT, true); Log.d(TAG, "set START_EIP_ON_BOOT argument for eip_fragment"); @@ -353,7 +328,7 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec * @return */ private boolean isAlwaysOn() { - return preferences.getBoolean(IS_ALWAYS_ON, false); + return preferences.getBoolean(EIP_IS_ALWAYS_ON, false); } @@ -405,7 +380,7 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec public void downloadVpnCertificate() { boolean is_authenticated = User.loggedIn(); - boolean allowed_anon = preferences.getBoolean(Constants.ALLOWED_ANON, false); + boolean allowed_anon = preferences.getBoolean(Constants.PROVIDER_ALLOW_ANONYMOUS, false); if (allowed_anon || is_authenticated) ProviderAPICommand.execute(Bundle.EMPTY, ProviderAPI.DOWNLOAD_CERTIFICATE, providerAPI_result_receiver); else |