diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2014-11-28 01:54:42 +0100 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2014-11-28 01:54:42 +0100 |
commit | 05e5d126293d682788f720816e5b010b11eaa829 (patch) | |
tree | 4050fce30d98cd4563f43ccdf9f6198769f48430 /main/src/cgeo/geocaching/connector/gc/GCLogin.java | |
parent | 7fbeb61433d7297eb05aff9c762b555239f59490 (diff) | |
download | cgeo-05e5d126293d682788f720816e5b010b11eaa829.zip cgeo-05e5d126293d682788f720816e5b010b11eaa829.tar.gz cgeo-05e5d126293d682788f720816e5b010b11eaa829.tar.bz2 |
Add GCLogin tests
Diffstat (limited to 'main/src/cgeo/geocaching/connector/gc/GCLogin.java')
-rw-r--r-- | main/src/cgeo/geocaching/connector/gc/GCLogin.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/main/src/cgeo/geocaching/connector/gc/GCLogin.java b/main/src/cgeo/geocaching/connector/gc/GCLogin.java index 667866b..faa57d1 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCLogin.java +++ b/main/src/cgeo/geocaching/connector/gc/GCLogin.java @@ -267,12 +267,17 @@ public class GCLogin extends AbstractLogin { return null; } + @Nullable + static String retrieveHomeLocation() { + final String result = Network.getResponseData(Network.getRequest("https://www.geocaching.com/account/settings/homelocation")); + return TextUtils.getMatch(result, GCConstants.PATTERN_HOME_LOCATION, null); + } + private static void setHomeLocation() { RxUtils.networkScheduler.createWorker().schedule(new Action0() { @Override public void call() { - final String result = Network.getResponseData(Network.getRequest("https://www.geocaching.com/account/settings/homelocation")); - final String homeLocationStr = TextUtils.getMatch(result, GCConstants.PATTERN_HOME_LOCATION, null); + final String homeLocationStr = retrieveHomeLocation(); if (StringUtils.isNotBlank(homeLocationStr) && !StringUtils.equals(homeLocationStr, Settings.getHomeLocation())) { Log.i("Setting home location to " + homeLocationStr); Settings.setHomeLocation(homeLocationStr); |