aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt14
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