aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-01-01 18:50:14 -0500
committerAllan Wang <me@allanwang.ca>2019-01-01 18:50:14 -0500
commitbc6566bc92d073e64a8c51a681ff01ba973d7ee7 (patch)
tree1d128c403556f7f1595b71e89f24638f941123bb
parent7d737fcb844fbf9b0e8cbcb05fc09ef122d708a8 (diff)
downloadfrost-bc6566bc92d073e64a8c51a681ff01ba973d7ee7.tar.gz
frost-bc6566bc92d073e64a8c51a681ff01ba973d7ee7.tar.bz2
frost-bc6566bc92d073e64a8c51a681ff01ba973d7ee7.zip
Convert fade out to suspended function in login
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt11
1 files changed, 7 insertions, 4 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt
index b5521e3e..150d29f4 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt
@@ -91,13 +91,16 @@ class LoginActivity : BaseActivity() {
val cookie = web.loadLogin { refresh(it != 100) }
L.d { "Login found" }
FbCookie.save(cookie.id)
- web.fadeOut(onFinish = {
- profile.fadeIn()
- this@LoginActivity.launch { loadInfo(cookie) }
- })
+ webFadeOut()
+ profile.fadeIn()
+ loadInfo(cookie)
}
}
+ private suspend fun webFadeOut(): Unit = suspendCancellableCoroutine { cont ->
+ web.fadeOut { cont.resume(Unit) }
+ }
+
private fun refresh(refreshing: Boolean) {
refreshChannel.offer(refreshing)
}