aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/dbflow/CookiesDb.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/dbflow/CookiesDb.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/dbflow/CookiesDb.kt13
1 files changed, 9 insertions, 4 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/dbflow/CookiesDb.kt b/app/src/main/kotlin/com/pitchedapps/frost/dbflow/CookiesDb.kt
index d8f349a0..12443cf1 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/dbflow/CookiesDb.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/dbflow/CookiesDb.kt
@@ -1,6 +1,5 @@
package com.pitchedapps.frost.dbflow
-import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Prefs
import com.raizlabs.android.dbflow.annotation.ConflictAction
@@ -23,10 +22,16 @@ object CookiesDb {
@Table(database = CookiesDb::class, allFields = true, primaryKeyConflict = ConflictAction.REPLACE)
data class CookieModel(@PrimaryKey var id: Long = Prefs.userIdDefault, var cookie: String? = null) : BaseModel()
-fun loadFbCookie(): CookieModel? = (select from CookieModel::class where (CookieModel_Table.id eq Prefs.userId)).querySingle()
+fun loadFbCookie(id: Long): CookieModel? = (select from CookieModel::class where (CookieModel_Table.id eq id)).querySingle()
-fun saveFbCookie() {
- CookieModel(FbCookie.userId, FbCookie.webCookie).async save {
+fun saveFbCookie(id: Long, cookie: String?) {
+ CookieModel(id, cookie).async save {
L.d("Fb cookie saved")
}
+}
+
+fun removeCookie(id: Long) {
+ loadFbCookie(id)?.async?.delete({
+ L.d("Fb cookie deleted")
+ })
} \ No newline at end of file