diff options
author | Parménides GV <parmegv@sdf.org> | 2013-08-01 12:22:48 +0200 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2013-08-01 12:22:48 +0200 |
commit | 21e71b0b8916264d7499254fb36a0ee533018224 (patch) | |
tree | ef84fa7c3acd4d501eaebc394dce4a16ca1cae8b /src/se/leap/leapclient/Dashboard.java | |
parent | a1a03615cb9c4f978142b234f028e718eb91a103 (diff) |
ProviderAPI intent receives actions and parameters.
We no longer use BundleExtras named as the action ProviderAPI is
intended to perform, but we standardise this name
(ProviderAPI.PARAMETERS), and use setAction to pass that action string.
Diffstat (limited to 'src/se/leap/leapclient/Dashboard.java')
-rw-r--r-- | src/se/leap/leapclient/Dashboard.java | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/se/leap/leapclient/Dashboard.java b/src/se/leap/leapclient/Dashboard.java index 063cd3cd..b652bb73 100644 --- a/src/se/leap/leapclient/Dashboard.java +++ b/src/se/leap/leapclient/Dashboard.java @@ -213,20 +213,21 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf Intent provider_API_command = new Intent(this, ProviderAPI.class); - Bundle method_and_parameters = new Bundle(); - method_and_parameters.putString(ConfigHelper.USERNAME_KEY, username); - method_and_parameters.putString(ConfigHelper.PASSWORD_KEY, password); + Bundle parameters = new Bundle(); + parameters.putString(ConfigHelper.USERNAME_KEY, username); + parameters.putString(ConfigHelper.PASSWORD_KEY, password); JSONObject provider_json; try { provider_json = new JSONObject(preferences.getString(ConfigHelper.PROVIDER_KEY, "")); - method_and_parameters.putString(ConfigHelper.API_URL_KEY, provider_json.getString(ConfigHelper.API_URL_KEY) + "/" + provider_json.getString(ConfigHelper.API_VERSION_KEY)); + parameters.putString(ConfigHelper.API_URL_KEY, provider_json.getString(ConfigHelper.API_URL_KEY) + "/" + provider_json.getString(ConfigHelper.API_VERSION_KEY)); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } - provider_API_command.putExtra(ConfigHelper.SRP_AUTH, method_and_parameters); + provider_API_command.setAction(ProviderAPI.SRP_AUTH); + provider_API_command.putExtra(ProviderAPI.PARAMETERS, parameters); provider_API_command.putExtra(ConfigHelper.RECEIVER_KEY, providerAPI_result_receiver); if(mProgressDialog != null) mProgressDialog.dismiss(); @@ -242,18 +243,19 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf providerAPI_result_receiver.setReceiver(this); Intent provider_API_command = new Intent(this, ProviderAPI.class); - Bundle method_and_parameters = new Bundle(); + Bundle parameters = new Bundle(); JSONObject provider_json; try { provider_json = new JSONObject(preferences.getString(ConfigHelper.PROVIDER_KEY, "")); - method_and_parameters.putString(ConfigHelper.API_URL_KEY, provider_json.getString(ConfigHelper.API_URL_KEY) + "/" + provider_json.getString(ConfigHelper.API_VERSION_KEY)); + parameters.putString(ConfigHelper.API_URL_KEY, provider_json.getString(ConfigHelper.API_URL_KEY) + "/" + provider_json.getString(ConfigHelper.API_VERSION_KEY)); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } - provider_API_command.putExtra(ConfigHelper.LOG_OUT, method_and_parameters); + provider_API_command.setAction(ProviderAPI.LOG_OUT); + provider_API_command.putExtra(ProviderAPI.PARAMETERS, parameters); provider_API_command.putExtra(ConfigHelper.RECEIVER_KEY, providerAPI_result_receiver); if(mProgressDialog != null) mProgressDialog.dismiss(); @@ -292,12 +294,13 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf Intent provider_API_command = new Intent(this, ProviderAPI.class); - Bundle method_and_parameters = new Bundle(); - method_and_parameters.putString(ConfigHelper.TYPE_OF_CERTIFICATE, ConfigHelper.AUTHED_CERTIFICATE); - method_and_parameters.putString(ConfigHelper.SESSION_ID_COOKIE_KEY, session_id.getName()); - method_and_parameters.putString(ConfigHelper.SESSION_ID_KEY, session_id.getValue()); + Bundle parameters = new Bundle(); + parameters.putString(ConfigHelper.TYPE_OF_CERTIFICATE, ConfigHelper.AUTHED_CERTIFICATE); + parameters.putString(ConfigHelper.SESSION_ID_COOKIE_KEY, session_id.getName()); + parameters.putString(ConfigHelper.SESSION_ID_KEY, session_id.getValue()); - provider_API_command.putExtra(ConfigHelper.DOWNLOAD_CERTIFICATE, method_and_parameters); + provider_API_command.setAction(ProviderAPI.DOWNLOAD_CERTIFICATE); + provider_API_command.putExtra(ProviderAPI.PARAMETERS, parameters); provider_API_command.putExtra(ConfigHelper.RECEIVER_KEY, providerAPI_result_receiver); startService(provider_API_command); |