summaryrefslogtreecommitdiff
path: root/src/se/leap/leapclient/ConfigHelper.java
diff options
context:
space:
mode:
authorSean Leonard <meanderingcode@aetherislands.net>2013-07-10 11:23:21 -0600
committerSean Leonard <meanderingcode@aetherislands.net>2013-07-19 15:09:14 -0600
commite85eb39a9cfa209eb5503657d9724d1eebd2be0b (patch)
tree8497184cd4a39fd3eaeefda77b066ca32752cb15 /src/se/leap/leapclient/ConfigHelper.java
parent6614dface821c5f975dba47bc6150783c25ee468 (diff)
Only parse eip-services.json if the serial has incremented
Diffstat (limited to 'src/se/leap/leapclient/ConfigHelper.java')
-rw-r--r--src/se/leap/leapclient/ConfigHelper.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/se/leap/leapclient/ConfigHelper.java b/src/se/leap/leapclient/ConfigHelper.java
index c5a37be5..0c589c41 100644
--- a/src/se/leap/leapclient/ConfigHelper.java
+++ b/src/se/leap/leapclient/ConfigHelper.java
@@ -49,6 +49,7 @@ public class ConfigHelper {
LOG_OUT = "logOut",
DOWNLOAD_CERTIFICATE = "downloadUserAuthedCertificate",
API_VERSION_KEY = "api_version",
+ API_RETURN_SERIAL_KEY = "serial",
RESULT_KEY = "result",
RECEIVER_KEY = "receiver",
PROVIDER_KEY = "provider",
@@ -58,6 +59,7 @@ public class ConfigHelper {
CERT_KEY = "cert",
KEY_KEY = "key",
EIP_SERVICE_KEY = "eip",
+ EIP_PARSED_SERIAL = "eip_parsed_serial",
TYPE_OF_CERTIFICATE = "type_of_certificate",
ANON_CERTIFICATE = "anon_certificate",
AUTHED_CERTIFICATE = "authed_certificate",
@@ -162,6 +164,17 @@ public class ConfigHelper {
}
/**
+ * Saves an int into class scope Shared Preferences
+ *
+ * @param shared_preferences_key
+ * @param value
+ */
+ protected static void saveSharedPref(String shared_preferences_key, int value) {
+ SharedPreferences.Editor shared_preferences_editor = shared_preferences.edit();
+ shared_preferences_editor.putInt(shared_preferences_key, value).commit();
+ }
+
+ /**
* Gets String object from class scope Shared Preferences
* @param shared_preferences_key
* @return the string correspondent to the key parameter
@@ -199,6 +212,16 @@ public class ConfigHelper {
}
return value;
}
+
+ /**
+ * Get an int from SharedPreferences
+ *
+ * @param shared_preferences_key Key to retrieve
+ * @return The value for the key or 0
+ */
+ protected static int getIntFromSharedPref(String shared_preferences_key) {
+ return shared_preferences.getInt(shared_preferences_key, 0);
+ }
/*
* This method defaults to false.