From d13b34ed0d7cff3936160c88571daa5419b8b07b Mon Sep 17 00:00:00 2001 From: Matthieu <24-artectrex@users.noreply.shinice.net> Date: Sun, 14 Mar 2021 23:03:36 +0100 Subject: [PATCH] Update for paging dependency update --- .../feeds/uncachedFeeds/profile/ProfilePagingSource.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/com/h/pixeldroid/posts/feeds/uncachedFeeds/profile/ProfilePagingSource.kt b/app/src/main/java/com/h/pixeldroid/posts/feeds/uncachedFeeds/profile/ProfilePagingSource.kt index fba34d11..e58301bb 100644 --- a/app/src/main/java/com/h/pixeldroid/posts/feeds/uncachedFeeds/profile/ProfilePagingSource.kt +++ b/app/src/main/java/com/h/pixeldroid/posts/feeds/uncachedFeeds/profile/ProfilePagingSource.kt @@ -1,6 +1,7 @@ package com.h.pixeldroid.posts.feeds.uncachedFeeds.profile import androidx.paging.PagingSource +import androidx.paging.PagingState import com.h.pixeldroid.utils.api.PixelfedAPI import com.h.pixeldroid.utils.api.objects.Status import retrofit2.HttpException @@ -31,4 +32,9 @@ class ProfilePagingSource( LoadResult.Error(exception) } } + + override fun getRefreshKey(state: PagingState): String? = + state.anchorPosition?.run { + state.closestItemToPosition(this)?.id + } } \ No newline at end of file