summaryrefslogtreecommitdiff
path: root/app/src/debug/java/se
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2015-01-26 14:18:56 +0100
committerParménides GV <parmegv@sdf.org>2015-01-30 11:59:06 +0100
commit7d046fda66e8933b509b854077b7acfb3b3b7c40 (patch)
tree77565f7d76bfc2b1bd734bd2e216169f2d657547 /app/src/debug/java/se
parent1ad87b35085616d645fdae18bb03cbead03bd6c9 (diff)
Don't reuse last session dialog.
It was giving problems when trying to change the arguments.
Diffstat (limited to 'app/src/debug/java/se')
-rw-r--r--app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java4
-rw-r--r--app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java22
-rw-r--r--app/src/debug/java/se/leap/bitmaskclient/ProviderDetailFragment.java34
3 files changed, 32 insertions, 28 deletions
diff --git a/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java
index faf3779a..27984147 100644
--- a/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java
+++ b/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java
@@ -428,6 +428,10 @@ implements NewProviderDialogInterface, ProviderDetailFragmentInterface, Download
return super.onOptionsItemSelected(item);
}
}
+
+ public void showAllProviders() {
+ adapter.showAllProviders();
+ }
@Override
public void login() {
diff --git a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java
index 1dbe11d3..0650f0ad 100644
--- a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java
+++ b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java
@@ -179,28 +179,28 @@ public class ProviderAPI extends IntentService {
}
private Bundle tryToRegister(Bundle task) {
- Bundle session_id_bundle = new Bundle();
+ Bundle result = new Bundle();
int progress = 0;
- String username = (String) task.get(SessionDialog.USERNAME);
- String password = (String) task.get(SessionDialog.PASSWORD);
+ String username = task.getString(SessionDialog.USERNAME);
+ String password = task.getString(SessionDialog.PASSWORD);
if(validUserLoginData(username, password)) {
- session_id_bundle = register(username, password);
+ result = register(username, password);
broadcastProgress(progress++);
} else {
if(!wellFormedPassword(password)) {
- session_id_bundle.putBoolean(RESULT_KEY, false);
- session_id_bundle.putString(SessionDialog.USERNAME, username);
- session_id_bundle.putBoolean(SessionDialog.PASSWORD_INVALID_LENGTH, true);
+ result.putBoolean(RESULT_KEY, false);
+ result.putString(SessionDialog.USERNAME, username);
+ result.putBoolean(SessionDialog.PASSWORD_INVALID_LENGTH, true);
}
- if(username.isEmpty()) {
- session_id_bundle.putBoolean(RESULT_KEY, false);
- session_id_bundle.putBoolean(SessionDialog.USERNAME_MISSING, true);
+ if(!validUsername(username)) {
+ result.putBoolean(RESULT_KEY, false);
+ result.putBoolean(SessionDialog.USERNAME_MISSING, true);
}
}
- return session_id_bundle;
+ return result;
}
private Bundle register(String username, String password) {
diff --git a/app/src/debug/java/se/leap/bitmaskclient/ProviderDetailFragment.java b/app/src/debug/java/se/leap/bitmaskclient/ProviderDetailFragment.java
index d6f482ca..4b46e48f 100644
--- a/app/src/debug/java/se/leap/bitmaskclient/ProviderDetailFragment.java
+++ b/app/src/debug/java/se/leap/bitmaskclient/ProviderDetailFragment.java
@@ -1,17 +1,17 @@
-package se.leap.bitmaskclient;
-
-import org.json.*;
-
-import se.leap.bitmaskclient.R;
-import se.leap.bitmaskclient.eip.Constants;
-import se.leap.bitmaskclient.ProviderListContent.ProviderItem;
-
-import android.app.*;
-import android.content.*;
-import android.os.Bundle;
-import android.view.*;
-import android.widget.TextView;
-
+package se.leap.bitmaskclient;
+
+import org.json.*;
+
+import se.leap.bitmaskclient.R;
+import se.leap.bitmaskclient.eip.Constants;
+import se.leap.bitmaskclient.ProviderListContent.ProviderItem;
+
+import android.app.*;
+import android.content.*;
+import android.os.Bundle;
+import android.view.*;
+import android.widget.TextView;
+
public class ProviderDetailFragment extends DialogFragment {
final public static String TAG = "providerDetailFragment";
@@ -61,7 +61,7 @@ public class ProviderDetailFragment extends DialogFragment {
private boolean anon_allowed(JSONObject provider_json) {
try {
JSONObject service_description = provider_json.getJSONObject(Provider.SERVICE);
- return service_description.has(Constants.ALLOWED_ANON) && service_description.getBoolean(Constants.ALLOWED_ANON);
+ return service_description.has(Constants.ALLOWED_ANON) && service_description.getBoolean(Constants.ALLOWED_ANON);
} catch (JSONException e) {
return false;
}
@@ -80,8 +80,8 @@ public class ProviderDetailFragment extends DialogFragment {
public void onCancel(DialogInterface dialog) {
super.onCancel(dialog);
SharedPreferences.Editor editor = getActivity().getSharedPreferences(Dashboard.SHARED_PREFERENCES, Activity.MODE_PRIVATE).edit();
- editor.remove(Provider.KEY).remove(ProviderItem.DANGER_ON).remove(Constants.ALLOWED_ANON).remove(Constants.KEY).commit();
- interface_with_configuration_wizard.showAllProviders();
+ editor.remove(Provider.KEY).remove(ProviderItem.DANGER_ON).remove(Constants.ALLOWED_ANON).remove(Constants.KEY).commit();
+ interface_with_configuration_wizard.showAllProviders();
}
public static DialogFragment newInstance() {