diff options
author | Allan Wang <me@allanwang.ca> | 2018-12-26 18:37:47 -0500 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2018-12-26 18:37:47 -0500 |
commit | 7d85262ada198501d2d5844e1196c9b45f4a38f5 (patch) | |
tree | 2f62f4f8b6adde7cb4508ec093179b91cf674b20 /app/src/main/kotlin | |
parent | bddb58f035b9190732f22db4b2cc1464b68fff17 (diff) | |
download | frost-7d85262ada198501d2d5844e1196c9b45f4a38f5.tar.gz frost-7d85262ada198501d2d5844e1196c9b45f4a38f5.tar.bz2 frost-7d85262ada198501d2d5844e1196c9b45f4a38f5.zip |
Support old fbRequest
Diffstat (limited to 'app/src/main/kotlin')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt | 5 |
1 files changed, 3 insertions, 2 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 0692fbfd..50da367d 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 @@ -29,6 +29,7 @@ import com.pitchedapps.frost.utils.L import io.reactivex.Single import io.reactivex.schedulers.Schedulers import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.runBlocking import okhttp3.Call import okhttp3.FormBody import okhttp3.OkHttpClient @@ -39,7 +40,7 @@ import org.apache.commons.text.StringEscapeUtils /** * Created by Allan Wang on 21/12/17. */ - val fbAuth = Flyweight<String, RequestAuth>(GlobalScope, 100,3600000 /* an hour */) { +val fbAuth = Flyweight<String, RequestAuth>(GlobalScope, 100, 3600000 /* an hour */) { it.getAuth() } @@ -51,7 +52,7 @@ import org.apache.commons.text.StringEscapeUtils fun String?.fbRequest(fail: () -> Unit = {}, action: RequestAuth.() -> Unit) { if (this == null) return fail() try { - val auth = fbAuth(this).blockingGet() + val auth = runBlocking { fbAuth.fetch(this@fbRequest) } auth.action() } catch (e: Exception) { L.e { "Failed auth for ${hashCode()}: ${e.message}" } |