summaryrefslogtreecommitdiff
path: root/src/se
diff options
context:
space:
mode:
authorcyBerta <richy@cyborgsociety.org>2013-12-03 22:05:12 +0100
committerParménides GV <parmegv@sdf.org>2013-12-04 16:03:48 +0100
commit8c54cb758514aef996a362d0c021bf0f93006ea2 (patch)
treeb14b7a59b66a64cd28689bfdffdf5847bc92c936 /src/se
parent017e493dc7c7e0565000d2afa76eb93c1fa5c2d6 (diff)
logout simplified and logs removed
Diffstat (limited to 'src/se')
-rw-r--r--src/se/leap/bitmaskclient/ConfigurationWizard.java52
-rw-r--r--src/se/leap/bitmaskclient/Dashboard.java22
2 files changed, 16 insertions, 58 deletions
diff --git a/src/se/leap/bitmaskclient/ConfigurationWizard.java b/src/se/leap/bitmaskclient/ConfigurationWizard.java
index 5babf9a6..7ecc1652 100644
--- a/src/se/leap/bitmaskclient/ConfigurationWizard.java
+++ b/src/se/leap/bitmaskclient/ConfigurationWizard.java
@@ -102,7 +102,6 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn
Bundle arguments = new Bundle();
int configuration_wizard_request_code = getIntent().getIntExtra(Dashboard.REQUEST_CODE, -1);
if(configuration_wizard_request_code == Dashboard.SWITCH_PROVIDER) {
- Log.d(TAG, "onCreate - Request_Code: Switch Provider");
arguments.putBoolean(ProviderListFragment.SHOW_ALL_PROVIDERS, true);
}
provider_list_fragment.setArguments(arguments);
@@ -369,7 +368,6 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn
downloadJSONFiles(mSelectedProvider);
}
} catch (JSONException e) {
- Log.d(TAG, "saveProviderJson("+provider.id + " = " + provider.name + ") failed");
setResult(RESULT_CANCELED);
finish();
}
@@ -500,19 +498,10 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn
provider_API_command.setAction(ProviderAPI.UPDATE_PROVIDER_DOTJSON);
provider_API_command.putExtra(ProviderAPI.PARAMETERS, parameters);
provider_API_command.putExtra(ProviderAPI.RECEIVER_KEY, providerAPI_result_receiver);
- Log.d(TAG, "updateProviderDotJson... right after resetting old connection, starts Service ");
startService(provider_API_command);
}
- /*private void resetOldConnection(){
- Log.d(TAG, "resetOldConnection... EIPStop()");
- if (Provider.getInstance().hasEIP()){
- Log.d(TAG, "resetOldConnection... Provider has EIP");
- eipStop();
- }
-
- }*/
-
+
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.configuration_wizard_activity, menu);
@@ -549,15 +538,7 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn
fragment_transaction.replace(R.id.configuration_wizard_layout, newFragment, AboutFragment.TAG).commit();
}
}
-
-/* private void eipStop(){
- // TODO validate "action"...how do we get the list of intent-filters for a class via Android API?
- Intent eip_intent = new Intent(this, EIP.class);
- eip_intent.setAction(EIP.ACTION_STOP_EIP);
- // eip_intent.putExtra(EIP.RECEIVER_TAG, eip_receiver);
- startService(eip_intent);
- }
-*/
+
public void showAllProviders() {
provider_list_fragment = (ProviderListFragment) getFragmentManager().findFragmentByTag(ProviderListFragment.TAG);
if(provider_list_fragment != null)
@@ -568,37 +549,16 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn
public void login() {
- Intent ask_login = new Intent();
+ Intent ask_login = new Intent(this, Dashboard.class);
ask_login.putExtra(LogInDialog.VERB, LogInDialog.VERB);
-
- if (Provider.getInstance().hasEIP()){
- if (ConfigHelper.getBoolFromSharedPref(EIP.AUTHED_EIP)){
- ask_login.putExtra(Dashboard.LOGOUT_FIRST, Dashboard.LOGOUT_FIRST);
- Log.d(TAG, "login() -> there was an authed EIP authed before");
- }
- Log.d(TAG, "use_anonymously() -> STOP_FIRST!");
- ask_login.putExtra(Dashboard.STOP_FIRST, Dashboard.STOP_FIRST);
- Log.d(TAG, "use_anonymously() -> ask_login has: " + ask_login.getExtras());
-
- }
- setResult(RESULT_OK, ask_login);
+ startActivityForResult(ask_login, Dashboard.CONFIGURE_LEAP);
finish();
}
@Override
public void use_anonymously() {
- Intent stopFirst = new Intent();
- if (Provider.getInstance().hasEIP()){
- if (ConfigHelper.getBoolFromSharedPref(EIP.AUTHED_EIP)){
- stopFirst.putExtra(Dashboard.LOGOUT_FIRST, Dashboard.LOGOUT_FIRST);
- Log.d(TAG, "use_anonymously() -> there was an authed EIP before");
- }
- Log.d(TAG, "use_anonymously() -> STOP_FIRST!");
- stopFirst.putExtra(Dashboard.STOP_FIRST, Dashboard.STOP_FIRST);
-
- }
- Log.d(TAG, "use_anonymously() ");
- setResult(RESULT_OK, stopFirst);
+ Intent intent = new Intent(this, Dashboard.class);
+ startActivityForResult(intent, Dashboard.CONFIGURE_LEAP);
finish();
}
}
diff --git a/src/se/leap/bitmaskclient/Dashboard.java b/src/se/leap/bitmaskclient/Dashboard.java
index 24cf13f6..65ff2800 100644
--- a/src/se/leap/bitmaskclient/Dashboard.java
+++ b/src/se/leap/bitmaskclient/Dashboard.java
@@ -70,8 +70,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
final public static String SHARED_PREFERENCES = "LEAPPreferences";
final public static String ACTION_QUIT = "quit";
public static final String REQUEST_CODE = "request_code";
- public static final String LOGOUT_FIRST = "logout_first";
- public static final String STOP_FIRST = "stop_first";
+
@@ -124,18 +123,12 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
protected void onActivityResult(int requestCode, int resultCode, Intent data){
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 ){
- if ((data != null) && (data.hasExtra(STOP_FIRST))){
- Log.d(TAG_EIP_FRAGMENT, "onActivityResult() -> eipStop!");
- eipStop();
- } else{
- Log.d(TAG_EIP_FRAGMENT, "onActivityResult() -> has no Extra STOP_FIRST");
- }
-
+ if ( resultCode == RESULT_OK ){
ConfigHelper.saveSharedPref(EIP.PARSED_SERIAL, 0);
ConfigHelper.saveSharedPref(EIP.AUTHED_EIP, authed_eip);
startService( new Intent(EIP.ACTION_UPDATE_EIP_SERVICE) );
buildDashboard();
+
if(data != null && data.hasExtra(LogInDialog.VERB)) {
View view = ((ViewGroup)findViewById(android.R.id.content)).getChildAt(0);
logInDialog(view, Bundle.EMPTY);
@@ -146,7 +139,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
configErrorDialog();
}
}
-
+
/**
* Dialog shown when encountering a configuration error. Such errors require
* reconfiguring LEAP or aborting the application.
@@ -244,6 +237,12 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
startActivity(intent);
return true;
case R.id.switch_provider:
+ if (Provider.getInstance().hasEIP()){
+ if (ConfigHelper.getBoolFromSharedPref(EIP.AUTHED_EIP)){
+ logOut();
+ }
+ eipStop();
+ }
startActivityForResult(new Intent(this,ConfigurationWizard.class), SWITCH_PROVIDER);
return true;
case R.id.login_button:
@@ -482,7 +481,6 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
eip_intent.setAction(EIP.ACTION_STOP_EIP);
// eip_intent.putExtra(EIP.RECEIVER_TAG, eip_receiver);
startService(eip_intent);
- Log.d(TAG_EIP_FRAGMENT, "eipStop() -> service started to stop");
}