diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2013-12-28 11:10:33 +0100 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2013-12-28 11:16:33 +0100 |
| commit | 58d4c70c00ed1de52e8cda665a77230b249906ac (patch) | |
| tree | 924af3cccdc831fe00c4a6fe27483e1775c6a70e /main/src/cgeo/geocaching/CgeoApplication.java | |
| parent | 8a4a97f46ac02d7475a4a9532cb3b80800dcda90 (diff) | |
| download | cgeo-58d4c70c00ed1de52e8cda665a77230b249906ac.zip cgeo-58d4c70c00ed1de52e8cda665a77230b249906ac.tar.gz cgeo-58d4c70c00ed1de52e8cda665a77230b249906ac.tar.bz2 | |
fix #3480: quasi-systematic concurrent logins
The login procedure was initiated in both `onCreate()` and `onResume()`.
It has been limited to `onResume()` and refactored as to not manipulate
a global variable.
Also, the previous code prevented cgeo from retrying a failed login to
one of the cache providers if another had succeeded, as every provider
cleared `setLogin()` in case of success. This has been fixed as well.
Diffstat (limited to 'main/src/cgeo/geocaching/CgeoApplication.java')
| -rw-r--r-- | main/src/cgeo/geocaching/CgeoApplication.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/CgeoApplication.java b/main/src/cgeo/geocaching/CgeoApplication.java index 3d2f758..2500d10 100644 --- a/main/src/cgeo/geocaching/CgeoApplication.java +++ b/main/src/cgeo/geocaching/CgeoApplication.java @@ -16,7 +16,7 @@ public class CgeoApplication extends Application { private volatile GeoDataProvider geo; private volatile DirectionProvider dir; - public boolean checkLogin = true; // c:geo is just launched + private boolean forceRelog = false; // c:geo needs to log into cache providers public boolean showLoginToast = true; //login toast shown just once. private boolean liveMapHintShown = false; // livemap hint has been shown final private StatusUpdater statusUpdater = new StatusUpdater(); @@ -150,4 +150,22 @@ public class CgeoApplication extends Application { liveMapHintShown = true; } + /** + * Check if cgeo must relog even if already logged in. + * + * @return <code>true</code> if it is necessary to relog + */ + public boolean mustRelog() { + final boolean mustLogin = forceRelog; + forceRelog = false; + return mustLogin; + } + + /** + * Force cgeo to relog when reaching the main activity. + */ + public void forceRelog() { + forceRelog = true; + } + } |
