diff options
author | cyBerta <richy@cyborgsociety.org> | 2013-11-15 04:02:00 +0100 |
---|---|---|
committer | cyBerta <richy@cyborgsociety.org> | 2013-11-15 04:02:00 +0100 |
commit | bcd95893fdffdedab297690f0c705e28ffa103bb (patch) | |
tree | 4480f29895833848128678053d87a913824a7905 /src/se/leap/bitmaskclient/Dashboard.java | |
parent | 3c5f545eee991c545724911664297bb3fe9f3680 (diff) | |
parent | b7659879a814c76cd241570c19a05494bef7ff4b (diff) |
Merge branch 'feature/action-bar-overflow-menu-and-upper-action-item' into develop
Diffstat (limited to 'src/se/leap/bitmaskclient/Dashboard.java')
-rw-r--r-- | src/se/leap/bitmaskclient/Dashboard.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/se/leap/bitmaskclient/Dashboard.java b/src/se/leap/bitmaskclient/Dashboard.java index 97367e25..601428e2 100644 --- a/src/se/leap/bitmaskclient/Dashboard.java +++ b/src/se/leap/bitmaskclient/Dashboard.java @@ -66,7 +66,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf private TextView providerNameTV; - private boolean authed = false; + private boolean authed_eip = false; public ProviderAPIResultReceiver providerAPI_result_receiver; @@ -79,6 +79,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf ConfigHelper.setSharedPreferences(getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE)); preferences = ConfigHelper.shared_preferences; + authed_eip = ConfigHelper.getBoolFromSharedPref(EIP.AUTHED_EIP); if (ConfigHelper.getStringFromSharedPref(Provider.KEY).isEmpty()) startActivityForResult(new Intent(this,ConfigurationWizard.class),CONFIGURE_LEAP); else @@ -89,6 +90,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf protected void onActivityResult(int requestCode, int resultCode, Intent data){ if ( requestCode == CONFIGURE_LEAP ) { if ( resultCode == RESULT_OK ){ + ConfigHelper.saveSharedPref(EIP.AUTHED_EIP, authed_eip); startService( new Intent(EIP.ACTION_UPDATE_EIP_SERVICE) ); buildDashboard(); if(data != null && data.hasExtra(LogInDialog.VERB)) { @@ -157,7 +159,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf provider_json = ConfigHelper.getJsonFromSharedPref(Provider.KEY); JSONObject service_description = provider_json.getJSONObject(Provider.SERVICE); if(service_description.getBoolean(Provider.ALLOW_REGISTRATION)) { - if(authed) { + if(authed_eip) { menu.findItem(R.id.login_button).setVisible(false); menu.findItem(R.id.logout_button).setVisible(true); } else { @@ -313,7 +315,8 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf String session_id_cookie_key = resultData.getString(ProviderAPI.SESSION_ID_COOKIE_KEY); String session_id_string = resultData.getString(ProviderAPI.SESSION_ID_KEY); setResult(RESULT_OK); - authed = true; + authed_eip = true; + ConfigHelper.saveSharedPref(EIP.AUTHED_EIP, authed_eip); invalidateOptionsMenu(); //Cookie session_id = new BasicClientCookie(session_id_cookie_key, session_id_string); @@ -322,7 +325,8 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf mProgressDialog.dismiss(); logInDialog(getCurrentFocus(), resultData); } else if(resultCode == ProviderAPI.LOGOUT_SUCCESSFUL) { - authed = false; + authed_eip = false; + ConfigHelper.saveSharedPref(EIP.AUTHED_EIP, authed_eip); invalidateOptionsMenu(); setResult(RESULT_OK); mProgressDialog.dismiss(); |