From 449c3953ce79947554bbfd6ed0386d68aa9f04bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Wed, 22 Apr 2015 14:20:09 +0200 Subject: Avoid the check for a null provider. A provider can be asked if it's configured or not, so that we don't find more provider = null issues. I've created a DefaultedURL which links to https://example.net, so that we can initialize an URL. I use composition instead of inheritance, since URL class is final. --- app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'app/src/release/java/se/leap') diff --git a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java index 68ff9e47..2742e1e9 100644 --- a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -98,8 +98,7 @@ public class ConfigurationWizard extends Activity outState.putInt(PROGRESSBAR_NUMBER, mProgressBar.getProgress()); if (progressbar_description != null) outState.putString(PROGRESSBAR_TEXT, progressbar_description.getText().toString()); - if (selected_provider != null) - outState.putParcelable(Provider.KEY, selected_provider); + outState.putParcelable(Provider.KEY, selected_provider); super.onSaveInstanceState(outState); } @@ -125,8 +124,7 @@ public class ConfigurationWizard extends Activity selected_provider = savedInstanceState.getParcelable(Provider.KEY); if (fragment_manager.findFragmentByTag(ProviderDetailFragment.TAG) == null && setting_up_provider) { - if (selected_provider != null) - onItemSelectedUi(); + onItemSelectedUi(); if (progress > 0) mProgressBar.setProgress(progress); } -- cgit v1.2.3 From 8707f9e9a07f8c53955df14ef9b26d13a0eb60da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Mon, 27 Apr 2015 17:10:20 +0200 Subject: testEveryProvider also works --- app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java | 4 ---- 1 file changed, 4 deletions(-) (limited to 'app/src/release/java/se/leap') diff --git a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java index 2742e1e9..eed9413b 100644 --- a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -193,8 +193,6 @@ public class ConfigurationWizard extends Activity mProgressBar.incrementProgressBy(1); hideProgressBar(); - setResult(RESULT_OK); - showProviderDetails(); } } else if (resultCode == ProviderAPI.PROVIDER_NOK) { @@ -211,8 +209,6 @@ public class ConfigurationWizard extends Activity hideProgressBar(); showProviderDetails(); - - setResult(RESULT_OK); } else if (resultCode == ProviderAPI.INCORRECTLY_DOWNLOADED_CERTIFICATE) { hideProgressBar(); -- cgit v1.2.3 From f008b5ec8e1c74968e4a605d2de5423edf91b854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Wed, 29 Apr 2015 12:25:24 +0200 Subject: Creating a user session fragment. I've separated the user session management to it, and encapsulated ProviderAPICommand into its own class. Putting the fragment statically in dashboard.xml isn't working, Android complains about it being duplicated, so I'm going to add it dynamically. --- app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java | 1 + app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'app/src/release/java/se/leap') diff --git a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java index eed9413b..93a604ff 100644 --- a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -39,6 +39,7 @@ import se.leap.bitmaskclient.NewProviderDialog.NewProviderDialogInterface; import se.leap.bitmaskclient.ProviderAPIResultReceiver.Receiver; import se.leap.bitmaskclient.ProviderDetailFragment.ProviderDetailFragmentInterface; import se.leap.bitmaskclient.eip.Constants; +import se.leap.bitmaskclient.userstatus.SessionDialog; /** * Activity that builds and shows the list of known available providers. diff --git a/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java index a96556bc..917fc966 100644 --- a/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java @@ -36,8 +36,10 @@ import org.apache.http.client.*; import org.json.*; import org.thoughtcrime.ssl.pinning.util.*; -import se.leap.bitmaskclient.ProviderListContent.ProviderItem; import se.leap.bitmaskclient.eip.*; +import se.leap.bitmaskclient.userstatus.SessionDialog; +import se.leap.bitmaskclient.userstatus.User; +import se.leap.bitmaskclient.userstatus.UserSessionStatus; /** * Implements HTTP api methods used to manage communications with the provider server. -- cgit v1.2.3 From 9a54c425f6d96e1872899eabf78fb60082a8d234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Wed, 29 Apr 2015 18:21:03 +0200 Subject: Functional. --- app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'app/src/release/java/se/leap') diff --git a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java index 93a604ff..61c6b7cf 100644 --- a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -165,8 +165,7 @@ public class ConfigurationWizard extends Activity } private void setUpProviderAPIResultReceiver() { - providerAPI_result_receiver = new ProviderAPIResultReceiver(new Handler()); - providerAPI_result_receiver.setReceiver(this); + providerAPI_result_receiver = new ProviderAPIResultReceiver(new Handler(), this); providerAPI_broadcast_receiver_update = new ProviderAPIBroadcastReceiver_Update(); IntentFilter update_intent_filter = new IntentFilter(ProviderAPI.UPDATE_PROGRESSBAR); -- cgit v1.2.3 From 237e51e09ea7ae13c4cdf7fd9247447f6d75fb9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Thu, 30 Apr 2015 13:51:43 +0200 Subject: Works smoothly, correct texts. Next step: beautify. --- .../release/java/se/leap/bitmaskclient/ProviderAPI.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'app/src/release/java/se/leap') diff --git a/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java index 917fc966..a3f7db6a 100644 --- a/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java @@ -39,7 +39,7 @@ import org.thoughtcrime.ssl.pinning.util.*; import se.leap.bitmaskclient.eip.*; import se.leap.bitmaskclient.userstatus.SessionDialog; import se.leap.bitmaskclient.userstatus.User; -import se.leap.bitmaskclient.userstatus.UserSessionStatus; +import se.leap.bitmaskclient.userstatus.UserStatus; /** * Implements HTTP api methods used to manage communications with the provider server. @@ -143,7 +143,7 @@ public class ProviderAPI extends IntentService { } } } else if (action.equalsIgnoreCase(SIGN_UP)) { - UserSessionStatus.updateStatus(UserSessionStatus.SessionStatus.SIGNING_UP, resources); + UserStatus.updateStatus(UserStatus.SessionStatus.SIGNING_UP, resources); Bundle result = tryToRegister(parameters); if (result.getBoolean(RESULT_KEY)) { receiver.send(SUCCESSFUL_SIGNUP, result); @@ -151,23 +151,23 @@ public class ProviderAPI extends IntentService { receiver.send(FAILED_SIGNUP, result); } } else if (action.equalsIgnoreCase(LOG_IN)) { - UserSessionStatus.updateStatus(UserSessionStatus.SessionStatus.LOGGING_IN, resources); + UserStatus.updateStatus(UserStatus.SessionStatus.LOGGING_IN, resources); Bundle result = tryToAuthenticate(parameters); if (result.getBoolean(RESULT_KEY)) { receiver.send(SUCCESSFUL_LOGIN, result); - UserSessionStatus.updateStatus(UserSessionStatus.SessionStatus.LOGGED_IN, resources); + UserStatus.updateStatus(UserStatus.SessionStatus.LOGGED_IN, resources); } else { receiver.send(FAILED_LOGIN, result); - UserSessionStatus.updateStatus(UserSessionStatus.SessionStatus.NOT_LOGGED_IN, resources); + UserStatus.updateStatus(UserStatus.SessionStatus.NOT_LOGGED_IN, resources); } } else if (action.equalsIgnoreCase(LOG_OUT)) { - UserSessionStatus.updateStatus(UserSessionStatus.SessionStatus.LOGGING_OUT, resources); + UserStatus.updateStatus(UserStatus.SessionStatus.LOGGING_OUT, resources); if (logOut()) { receiver.send(SUCCESSFUL_LOGOUT, Bundle.EMPTY); - UserSessionStatus.updateStatus(UserSessionStatus.SessionStatus.LOGGED_OUT, resources); + UserStatus.updateStatus(UserStatus.SessionStatus.LOGGED_OUT, resources); } else { receiver.send(LOGOUT_FAILED, Bundle.EMPTY); - UserSessionStatus.updateStatus(UserSessionStatus.SessionStatus.DIDNT_LOG_OUT, resources); + UserStatus.updateStatus(UserStatus.SessionStatus.DIDNT_LOG_OUT, resources); } } else if (action.equalsIgnoreCase(DOWNLOAD_CERTIFICATE)) { if (updateVpnCertificate()) { -- cgit v1.2.3