summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Dashboard.java36
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/EIP.java2
2 files changed, 21 insertions, 17 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
index 395e9987..b139f73f 100644
--- a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
+++ b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
@@ -433,22 +433,8 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
hideProgressBar();
setResult(RESULT_OK);
- Intent updateEIP = new Intent(getApplicationContext(), EIP.class);
- ResultReceiver eip_receiver = new ResultReceiver(new Handler()){
- protected void onReceiveResult(int resultCode, Bundle resultData){
- super.onReceiveResult(resultCode, resultData);
- String request = resultData.getString(Constants.REQUEST_TAG);
- if (resultCode == Activity.RESULT_OK){
- if(authed_eip)
- eipStart();
- else
- eipStatus.setText("Certificate updated");
- }
- }
- };
- updateEIP.putExtra(Constants.RECEIVER_TAG, eip_receiver);
- updateEIP.setAction(Constants.ACTION_UPDATE_EIP_SERVICE);
- startService(updateEIP);
+
+ updateEipService();
} else if(resultCode == ProviderAPI.INCORRECTLY_DOWNLOADED_CERTIFICATE) {
changeStatusMessage(resultCode);
hideProgressBar();
@@ -456,6 +442,24 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
}
}
+ private void updateEipService() {
+ Intent updateEIP = new Intent(getApplicationContext(), EIP.class);
+ updateEIP.setAction(Constants.ACTION_UPDATE_EIP_SERVICE);
+ ResultReceiver receiver = new ResultReceiver(new Handler()) {
+ protected void onReceiveResult(int resultCode, Bundle resultData) {
+ String request = resultData.getString(Constants.REQUEST_TAG);
+ if(request.equalsIgnoreCase(Constants.ACTION_UPDATE_EIP_SERVICE)) {
+ if(resultCode == Activity.RESULT_OK) {
+ if(authed_eip)
+ eipStart();
+ }
+ }
+ }
+ };
+ updateEIP.putExtra(Constants.RECEIVER_TAG, receiver);
+ startService(updateEIP);
+ }
+
private void changeStatusMessage(final int previous_result_code) {
// TODO Auto-generated method stub
ResultReceiver eip_status_receiver = new ResultReceiver(new Handler()){
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
index 2b9f120d..9f81f263 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
@@ -194,7 +194,7 @@ public final class EIP extends IntentService {
refreshEipDefinition();
deleteAllVpnProfiles();
updateGateways();
- if(mReceiver != null) mReceiver.send(Activity.RESULT_OK, Bundle.EMPTY);
+ tellToReceiver(ACTION_UPDATE_EIP_SERVICE, Activity.RESULT_OK);
}
private void refreshEipDefinition() {