summaryrefslogtreecommitdiff
path: root/src/se/leap/bitmaskclient/EIP.java
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2014-01-14 19:44:10 +0100
committerParménides GV <parmegv@sdf.org>2014-01-14 19:54:58 +0100
commit1fe78d00244f52f903435c970c0ebf0071a08f36 (patch)
tree5e4f600dba76a39ab5fa23e13f638e6ce58b29fa /src/se/leap/bitmaskclient/EIP.java
parentdbf1265f736c00aa31289e75818b1ec56311d31c (diff)
No sharedprefs methods in ConfigHelper.
This means we obtain the SharedPreferences object each time we want to use it. This yields to longer code lines while reading and writing to them.
Diffstat (limited to 'src/se/leap/bitmaskclient/EIP.java')
-rw-r--r--src/se/leap/bitmaskclient/EIP.java15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/se/leap/bitmaskclient/EIP.java b/src/se/leap/bitmaskclient/EIP.java
index 2b7fd39f..25ea88f7 100644
--- a/src/se/leap/bitmaskclient/EIP.java
+++ b/src/se/leap/bitmaskclient/EIP.java
@@ -96,13 +96,7 @@ public final class EIP extends IntentService {
context = getApplicationContext();
- try {
- eipDefinition = ConfigHelper.getJsonFromSharedPref(KEY);
- parsedEipSerial = ConfigHelper.getIntFromSharedPref(PARSED_SERIAL);
- } catch (JSONException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ updateEIPService();
this.retreiveVpnService();
}
@@ -250,8 +244,8 @@ public final class EIP extends IntentService {
*/
private void updateEIPService() {
try {
- eipDefinition = ConfigHelper.getJsonFromSharedPref(EIP.KEY);
- parsedEipSerial = ConfigHelper.getIntFromSharedPref(PARSED_SERIAL);
+ eipDefinition = new JSONObject(getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).getString(KEY, ""));
+ parsedEipSerial = getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).getInt(PARSED_SERIAL, 0);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -315,8 +309,7 @@ public final class EIP extends IntentService {
e.printStackTrace();
}
}
-
- ConfigHelper.saveSharedPref(PARSED_SERIAL, eipDefinition.optInt(Provider.API_RETURN_SERIAL));
+ getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).edit().putInt(PARSED_SERIAL, eipDefinition.optInt(Provider.API_RETURN_SERIAL)).commit();
}
/**