diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2023-08-15 03:36:29 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2023-08-15 03:36:29 +0000 |
commit | 27e84d18f6d6cbfc47f2ec370eb7f6fa8432dde3 (patch) | |
tree | a5fa94394f70459505b64b6d6c4e379692bc8fbe | |
parent | 054d5985b1faa3217a648b7dfd1b003afbc0aed6 (diff) | |
download | infinity-for-reddit-27e84d18f6d6cbfc47f2ec370eb7f6fa8432dde3.tar infinity-for-reddit-27e84d18f6d6cbfc47f2ec370eb7f6fa8432dde3.tar.gz infinity-for-reddit-27e84d18f6d6cbfc47f2ec370eb7f6fa8432dde3.tar.bz2 infinity-for-reddit-27e84d18f6d6cbfc47f2ec370eb7f6fa8432dde3.tar.lz infinity-for-reddit-27e84d18f6d6cbfc47f2ec370eb7f6fa8432dde3.tar.xz infinity-for-reddit-27e84d18f6d6cbfc47f2ec370eb7f6fa8432dde3.tar.zst infinity-for-reddit-27e84d18f6d6cbfc47f2ec370eb7f6fa8432dde3.zip |
Probably fixed key reuse in PostPagingSource caused by NSFW posts being disabled by Reddit.
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java index bd2b51e8..86216dcb 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java @@ -58,6 +58,7 @@ public class PostPagingSource extends ListenableFuturePagingSource<String, Post> private String userWhere; private String multiRedditPath; private LinkedHashSet<Post> postLinkedHashSet; + private String previousLastItem; PostPagingSource(Executor executor, Retrofit retrofit, String accessToken, String accountName, SharedPreferences sharedPreferences, @@ -188,6 +189,11 @@ public class PostPagingSource extends ListenableFuturePagingSource<String, Post> return new LoadResult.Error<>(new Exception("Error parsing posts")); } else { int currentPostsSize = postLinkedHashSet.size(); + if (lastItem != null && lastItem.equals(previousLastItem)) { + lastItem = null; + } + previousLastItem = lastItem; + postLinkedHashSet.addAll(newPosts); if (currentPostsSize == postLinkedHashSet.size()) { return new LoadResult.Page<>(new ArrayList<>(), null, lastItem); |