summaryrefslogtreecommitdiff
path: root/src/se/leap/leapclient/EIP.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/se/leap/leapclient/EIP.java')
-rw-r--r--src/se/leap/leapclient/EIP.java28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/se/leap/leapclient/EIP.java b/src/se/leap/leapclient/EIP.java
index e0685c15..b0c22e50 100644
--- a/src/se/leap/leapclient/EIP.java
+++ b/src/se/leap/leapclient/EIP.java
@@ -62,6 +62,14 @@ public final class EIP extends IntentService {
public final static String ACTION_UPDATE_EIP_SERVICE = "se.leap.leapclient.UPDATE_EIP_SERVICE";
public final static String ACTION_IS_EIP_RUNNING = "se.leap.leapclient.IS_RUNNING";
public final static String EIP_NOTIFICATION = "EIP_NOTIFICATION";
+ public final static String ALLOWED_ANON = "allow_anonymous";
+ public final static String CERTIFICATE = "certificate";
+ public final static String PRIVATE_KEY = "private_key";
+ public final static String KEY = "eip";
+ public final static String PARSED_SERIAL = "eip_parsed_serial";
+ public final static String SERVICE_API_PATH = "config/eip-service.json";
+ public final static String RECEIVER_TAG = "receiverTag";
+ public final static String REQUEST_TAG = "requestTag";
private static Context context;
private static ResultReceiver mReceiver;
@@ -86,8 +94,8 @@ public final class EIP extends IntentService {
context = getApplicationContext();
try {
- eipDefinition = ConfigHelper.getJsonFromSharedPref(ConfigHelper.EIP_SERVICE_KEY);
- parsedEipSerial = ConfigHelper.getIntFromSharedPref(ConfigHelper.EIP_PARSED_SERIAL);
+ eipDefinition = ConfigHelper.getJsonFromSharedPref(KEY);
+ parsedEipSerial = ConfigHelper.getIntFromSharedPref(PARSED_SERIAL);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -107,7 +115,7 @@ public final class EIP extends IntentService {
@Override
protected void onHandleIntent(Intent intent) {
String action = intent.getAction();
- mReceiver = intent.getParcelableExtra(ConfigHelper.RECEIVER_TAG);
+ mReceiver = intent.getParcelableExtra(RECEIVER_TAG);
if ( action == ACTION_IS_EIP_RUNNING )
this.isRunning();
@@ -150,7 +158,7 @@ public final class EIP extends IntentService {
resultCode = (running) ? Activity.RESULT_CANCELED
: Activity.RESULT_OK;
Bundle resultData = new Bundle();
- resultData.putString(ConfigHelper.REQUEST_TAG, EIP_NOTIFICATION);
+ resultData.putString(REQUEST_TAG, EIP_NOTIFICATION);
mReceiver.send(resultCode, resultData);
mPending = null;
@@ -163,7 +171,7 @@ public final class EIP extends IntentService {
if (mReceiver != null){
Bundle resultData = new Bundle();
- resultData.putString(ConfigHelper.REQUEST_TAG, EIP_NOTIFICATION);
+ resultData.putString(REQUEST_TAG, EIP_NOTIFICATION);
mReceiver.send(Activity.RESULT_CANCELED, resultData);
}
}
@@ -181,7 +189,7 @@ public final class EIP extends IntentService {
*/
private void isRunning() {
Bundle resultData = new Bundle();
- resultData.putString(ConfigHelper.REQUEST_TAG, ACTION_IS_EIP_RUNNING);
+ resultData.putString(REQUEST_TAG, ACTION_IS_EIP_RUNNING);
int resultCode = Activity.RESULT_CANCELED;
if (mBound) {
resultCode = (mVpnService.isRunning()) ? Activity.RESULT_OK : Activity.RESULT_CANCELED;
@@ -208,7 +216,7 @@ public final class EIP extends IntentService {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(LaunchVPN.EXTRA_KEY, activeGateway.mVpnProfile.getUUID().toString() );
intent.putExtra(LaunchVPN.EXTRA_NAME, activeGateway.mVpnProfile.getName() );
- intent.putExtra(ConfigHelper.RECEIVER_TAG, mReceiver);
+ intent.putExtra(RECEIVER_TAG, mReceiver);
startActivity(intent);
mPending = ACTION_START_EIP;
}
@@ -225,7 +233,7 @@ public final class EIP extends IntentService {
if (mReceiver != null){
Bundle resultData = new Bundle();
- resultData.putString(ConfigHelper.REQUEST_TAG, ACTION_STOP_EIP);
+ resultData.putString(REQUEST_TAG, ACTION_STOP_EIP);
mReceiver.send(Activity.RESULT_OK, resultData);
}
}
@@ -237,7 +245,7 @@ public final class EIP extends IntentService {
*/
private void updateEIPService() {
try {
- eipDefinition = ConfigHelper.getJsonFromSharedPref(ConfigHelper.EIP_SERVICE_KEY);
+ eipDefinition = ConfigHelper.getJsonFromSharedPref(EIP.KEY);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -294,7 +302,7 @@ public final class EIP extends IntentService {
}
}
- ConfigHelper.saveSharedPref(ConfigHelper.EIP_PARSED_SERIAL, eipDefinition.optInt(ConfigHelper.API_RETURN_SERIAL_KEY));
+ ConfigHelper.saveSharedPref(PARSED_SERIAL, eipDefinition.optInt(Provider.API_RETURN_SERIAL));
}
/**