summaryrefslogtreecommitdiff
path: root/app/src/release/java/se
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2015-03-13 15:46:15 +0100
committerParménides GV <parmegv@sdf.org>2015-03-13 15:46:15 +0100
commitf476425c42a08e92ecb0cea99908e9b8d635fa69 (patch)
tree66eda60eaed4bce6e25e3107b16907c4601b875e /app/src/release/java/se
parentc5124635b8272d08538889c1a9edfafe4acaf759 (diff)
parentb9120adba28b5d691375ece5a919357e54e86a7f (diff)
Merge branch 'bug/Switching-orientation-doesn't-restore-previous-UI-#6780' into develop
Diffstat (limited to 'app/src/release/java/se')
-rw-r--r--app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java13
-rw-r--r--app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java26
2 files changed, 24 insertions, 15 deletions
diff --git a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java
index abab106d..f5e78e65 100644
--- a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java
+++ b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java
@@ -96,7 +96,6 @@ implements NewProviderDialogInterface, ProviderDetailFragmentInterface, Download
outState.putString(PROGRESSBAR_TEXT, progressbar_description.getText().toString());
if(selected_provider != null)
outState.putParcelable(Provider.KEY, selected_provider);
- outState.putParcelable(ProviderAPI.RECEIVER_KEY, providerAPI_result_receiver);
super.onSaveInstanceState(outState);
}
@@ -113,7 +112,6 @@ implements NewProviderDialogInterface, ProviderDetailFragmentInterface, Download
if (savedInstanceState != null)
restoreState(savedInstanceState);
- else
setUpProviderAPIResultReceiver();
}
@@ -121,9 +119,13 @@ implements NewProviderDialogInterface, ProviderDetailFragmentInterface, Download
progressbar_text = savedInstanceState.getString(PROGRESSBAR_TEXT, "");
provider_name = savedInstanceState.getString(Provider.NAME, "");
selected_provider = savedInstanceState.getParcelable(Provider.KEY);
- progress = savedInstanceState.getInt(PROGRESSBAR_NUMBER, -1);
- providerAPI_result_receiver = savedInstanceState.getParcelable(ProviderAPI.RECEIVER_KEY);
- providerAPI_result_receiver.setReceiver(this);
+
+ if(fragment_manager.findFragmentByTag(ProviderDetailFragment.TAG) == null && setting_up_provider) {
+ if (selected_provider != null)
+ onItemSelectedUi(selected_provider);
+ if (progress > 0)
+ mProgressBar.setProgress(progress);
+ }
}
@Override
@@ -355,6 +357,7 @@ implements NewProviderDialogInterface, ProviderDetailFragmentInterface, Download
DialogFragment newFragment = ProviderDetailFragment.newInstance();
newFragment.show(fragment_transaction, ProviderDetailFragment.TAG);
+ setting_up_provider = false;
}
}
diff --git a/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java
index c8efe0de..184173b2 100644
--- a/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java
+++ b/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java
@@ -31,8 +31,8 @@ import javax.net.ssl.*;
import org.apache.http.client.ClientProtocolException;
import org.json.*;
+import se.leap.bitmaskclient.ProviderListContent.ProviderItem;
import se.leap.bitmaskclient.eip.*;
-
/**
* Implements HTTP api methods used to manage communications with the provider server.
*
@@ -48,8 +48,8 @@ public class ProviderAPI extends IntentService {
TAG = ProviderAPI.class.getSimpleName(),
SET_UP_PROVIDER = "setUpProvider",
DOWNLOAD_NEW_PROVIDER_DOTJSON = "downloadNewProviderDotJSON",
- SRP_REGISTER = "srpRegister",
- SRP_AUTH = "srpAuth",
+ SIGN_UP = "srpRegister",
+ LOG_IN = "srpAuth",
LOG_OUT = "logOut",
DOWNLOAD_CERTIFICATE = "downloadUserAuthedCertificate",
PARAMETERS = "parameters",
@@ -137,25 +137,31 @@ public class ProviderAPI extends IntentService {
receiver.send(PROVIDER_NOK, result);
}
}
- } else if (action.equalsIgnoreCase(SRP_REGISTER)) {
+ } else if (action.equalsIgnoreCase(SIGN_UP)) {
Bundle result = tryToRegister(parameters);
if(result.getBoolean(RESULT_KEY)) {
receiver.send(SUCCESSFUL_SIGNUP, result);
} else {
receiver.send(FAILED_SIGNUP, result);
}
- } else if (action.equalsIgnoreCase(SRP_AUTH)) {
+ } else if (action.equalsIgnoreCase(LOG_IN)) {
+ UserSessionStatus.updateStatus(UserSessionStatus.SessionStatus.LOGGING_IN);
Bundle result = tryToAuthenticate(parameters);
if(result.getBoolean(RESULT_KEY)) {
- receiver.send(SUCCESSFUL_LOGIN, result);
+ receiver.send(SUCCESSFUL_LOGIN, result);
+ UserSessionStatus.updateStatus(UserSessionStatus.SessionStatus.LOGGED_IN);
} else {
- receiver.send(FAILED_LOGIN, result);
+ receiver.send(FAILED_LOGIN, result);
+ UserSessionStatus.updateStatus(UserSessionStatus.SessionStatus.NOT_LOGGED_IN);
}
} else if (action.equalsIgnoreCase(LOG_OUT)) {
+ UserSessionStatus.updateStatus(UserSessionStatus.SessionStatus.LOGGING_OUT);
if(logOut()) {
receiver.send(SUCCESSFUL_LOGOUT, Bundle.EMPTY);
+ UserSessionStatus.updateStatus(UserSessionStatus.SessionStatus.LOGGED_OUT);
} else {
receiver.send(LOGOUT_FAILED, Bundle.EMPTY);
+ UserSessionStatus.updateStatus(UserSessionStatus.SessionStatus.DIDNT_LOG_OUT);
}
} else if (action.equalsIgnoreCase(DOWNLOAD_CERTIFICATE)) {
if(updateVpnCertificate()) {
@@ -177,7 +183,7 @@ public class ProviderAPI extends IntentService {
Bundle result = new Bundle();
int progress = 0;
- String username = task.getString(SessionDialog.USERNAME);
+ String username = User.userName();
String password = task.getString(SessionDialog.PASSWORD);
if(validUserLoginData(username, password)) {
@@ -228,8 +234,8 @@ public class ProviderAPI extends IntentService {
Bundle result = new Bundle();
int progress = 0;
- String username = (String) task.get(SessionDialog.USERNAME);
- String password = (String) task.get(SessionDialog.PASSWORD);
+ String username = User.userName();
+ String password = task.getString(SessionDialog.PASSWORD);
if(validUserLoginData(username, password)) {
result = authenticate(username, password);
broadcastProgress(progress++);