diff options
author | Allan Wang <me@allanwang.ca> | 2019-01-01 18:50:14 -0500 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-01-01 18:50:14 -0500 |
commit | bc6566bc92d073e64a8c51a681ff01ba973d7ee7 (patch) | |
tree | 1d128c403556f7f1595b71e89f24638f941123bb /app/src/main/kotlin | |
parent | 7d737fcb844fbf9b0e8cbcb05fc09ef122d708a8 (diff) | |
download | frost-bc6566bc92d073e64a8c51a681ff01ba973d7ee7.tar.gz frost-bc6566bc92d073e64a8c51a681ff01ba973d7ee7.tar.bz2 frost-bc6566bc92d073e64a8c51a681ff01ba973d7ee7.zip |
Convert fade out to suspended function in login
Diffstat (limited to 'app/src/main/kotlin')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt | 11 |
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) } |