aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-01-04 01:56:04 -0500
committerAllan Wang <me@allanwang.ca>2019-01-04 01:56:04 -0500
commit339ce9db98c1e6dfb1c8d69f81806680b1efa666 (patch)
tree75b3366004ddf08359490d4d4b83d63366c0a68d /app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt
parent8c77e02e89dfec7bff04a397dfc82613ccd1242a (diff)
downloadfrost-339ce9db98c1e6dfb1c8d69f81806680b1efa666.tar.gz
frost-339ce9db98c1e6dfb1c8d69f81806680b1efa666.tar.bz2
frost-339ce9db98c1e6dfb1c8d69f81806680b1efa666.zip
Convert global continuations to completable deferred
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt16
1 files changed, 0 insertions, 16 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt
index 53ea6e67..3663f908 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt
@@ -45,22 +45,6 @@ val fbAuth = Flyweight<String, RequestAuth>(GlobalScope, 100, 3600000 /* an hour
}
/**
- * Synchronously fetch [RequestAuth] from cookie
- * [action] will only be called if a valid auth is found.
- * Otherwise, [fail] will be called
- */
-fun String?.fbRequest(fail: () -> Unit = {}, action: RequestAuth.() -> Unit) {
- if (this == null) return fail()
- try {
- val auth = runBlocking { fbAuth.fetch(this@fbRequest) }
- auth.action()
- } catch (e: Exception) {
- L.e { "Failed auth for ${hashCode()}: ${e.message}" }
- fail()
- }
-}
-
-/**
* Underlying container for all fb requests
*/
data class RequestAuth(