diff options
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragments.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragments.kt | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragments.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragments.kt index d9d518b1..54ea388d 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragments.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragments.kt @@ -71,16 +71,17 @@ class MenuFragment : GenericRecyclerFragment<MenuItemData, IItem<*, *>>() { ClickableIItemContract.bindEvents(adapter) } - override suspend fun reloadImpl(progress: (Int) -> Unit): List<MenuItemData>? = withContext(Dispatchers.IO) { - val cookie = FbCookie.webCookie ?: return@withContext null - progress(10) - val auth = fbAuth.fetch(cookie).await() - progress(30) - val data = auth.getMenuData().invoke() ?: return@withContext null - if (data.data.isEmpty()) return@withContext null - progress(70) - val items = data.flatMapValid() - progress(90) - return@withContext items - } + override suspend fun reloadImpl(progress: (Int) -> Unit): List<MenuItemData>? = + withContext(Dispatchers.IO) { + val cookie = FbCookie.webCookie ?: return@withContext null + progress(10) + val auth = fbAuth.fetch(cookie).await() + progress(30) + val data = auth.getMenuData().invoke() ?: return@withContext null + if (data.data.isEmpty()) return@withContext null + progress(70) + val items = data.flatMapValid() + progress(90) + return@withContext items + } } |