diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-20 15:50:08 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-20 15:50:08 -0700 |
commit | e916afddb89550d7f99f17e1477ad17f3bd770f9 (patch) | |
tree | b9a846da082599295d2671d29eaee74d9310f4c6 /app/src/main/kotlin/com/pitchedapps/frost/facebook | |
parent | 2d7fa0f6d0c152bb9f3fd30370ef510a0d452d00 (diff) | |
download | frost-e916afddb89550d7f99f17e1477ad17f3bd770f9.tar.gz frost-e916afddb89550d7f99f17e1477ad17f3bd770f9.tar.bz2 frost-e916afddb89550d7f99f17e1477ad17f3bd770f9.zip |
Add user switching for notifications
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/facebook')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt index 42232fc6..ac58fb2f 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt @@ -84,4 +84,18 @@ object FbCookie { removeCookie(id) reset(callback) } + + /** + * Notifications may come from different accounts, and we need to switch the cookies to load them + * When coming back to the main app, switch back to our original account before continuing + */ + fun switchBackUser(callback: () -> Unit) { + if (Prefs.prevId != -1L && Prefs.prevId != Prefs.userId) { + switchUser(Prefs.prevId) { + L.d("Switched from ${Prefs.userId} to ${Prefs.prevId}") + Prefs.prevId = -1L + callback() + } + } else callback() + } }
\ No newline at end of file |