diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2011-10-19 14:40:40 +0200 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2011-10-19 14:46:30 +0200 |
commit | 2294612badd2eb7a4bca8ef9de33964bb5e69b2b (patch) | |
tree | 8ebc819787900a8fde2730559442da7eb28239b9 /main/src/cgeo/geocaching/Settings.java | |
parent | c513f04efba4c0dcc430e51402f453caae319adc (diff) | |
download | cgeo-2294612badd2eb7a4bca8ef9de33964bb5e69b2b.zip cgeo-2294612badd2eb7a4bca8ef9de33964bb5e69b2b.tar.gz cgeo-2294612badd2eb7a4bca8ef9de33964bb5e69b2b.tar.bz2 |
Save cookie store to preferences
The cookie store is saved just after a succesful login to
geocaching.com, and cookies are restored when the activity
is restarted.
See issue #686.
Diffstat (limited to 'main/src/cgeo/geocaching/Settings.java')
-rw-r--r-- | main/src/cgeo/geocaching/Settings.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/Settings.java b/main/src/cgeo/geocaching/Settings.java index 777332d..5386316 100644 --- a/main/src/cgeo/geocaching/Settings.java +++ b/main/src/cgeo/geocaching/Settings.java @@ -67,6 +67,7 @@ public final class Settings { private static final String KEY_LOAD_DIRECTION_IMG = "loaddirectionimg"; private static final String KEY_GC_CUSTOM_DATE = "gccustomdate"; private static final String KEY_SHOW_WAYPOINTS_THRESHOLD = "gcshowwaypointsthreshold"; + private static final String KEY_COOKIE_STORE = "cookiestore"; private final static int unitsMetric = 1; private final static int unitsImperial = 2; @@ -262,6 +263,26 @@ public final class Settings { return sharedPrefs.getString(KEY_SIGNATURE, null); } + public static boolean setCookieStore(final String cookies) { + return editSharedSettings(new PrefRunnable() { + + @Override + public void edit(final Editor edit) { + if (StringUtils.isBlank(cookies)) { + // erase cookies + edit.remove(KEY_COOKIE_STORE); + } else { + // save cookies + edit.putString(KEY_COOKIE_STORE, cookies); + } + } + }); + } + + public static String getCookieStore() { + return sharedPrefs.getString(KEY_COOKIE_STORE, null); + } + public static String setCacheType(final String cacheTypeIn) { editSharedSettings(new PrefRunnable() { @Override |