From b82e4d9d375c7e287107d39a516cafb4c08e08f2 Mon Sep 17 00:00:00 2001 From: Balazs Toldi Date: Wed, 26 Jul 2023 21:45:10 +0200 Subject: [PATCH] Filter saved posts Signed-off-by: Balazs Toldi --- .../activities/AccountSavedThingActivity.java | 4 ---- .../main/java/eu/toldi/infinityforlemmy/apis/LemmyAPI.java | 1 + .../java/eu/toldi/infinityforlemmy/post/PostPagingSource.java | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/activities/AccountSavedThingActivity.java b/app/src/main/java/eu/toldi/infinityforlemmy/activities/AccountSavedThingActivity.java index bab57a61..d980ea71 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/activities/AccountSavedThingActivity.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/activities/AccountSavedThingActivity.java @@ -45,14 +45,10 @@ import eu.toldi.infinityforlemmy.post.PostPagingSource; import eu.toldi.infinityforlemmy.readpost.InsertReadPost; import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils; import eu.toldi.infinityforlemmy.utils.Utils; -import retrofit2.Retrofit; public class AccountSavedThingActivity extends BaseActivity implements ActivityToolbarInterface, PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, MarkPostAsReadInterface { - @Inject - @Named("oauth") - Retrofit mOauthRetrofit; @Inject RedditDataRoomDatabase mRedditDataRoomDatabase; @Inject diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/apis/LemmyAPI.java b/app/src/main/java/eu/toldi/infinityforlemmy/apis/LemmyAPI.java index 2a5e6e1b..52091f3b 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/apis/LemmyAPI.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/apis/LemmyAPI.java @@ -34,6 +34,7 @@ public interface LemmyAPI { @Query("sort") String sort, @Query("page") Integer page, @Query("limit") Integer limit, + @Query("saved_only") Boolean saved_only, @Query("auth") String access_token); @GET("api/v3/community/list") diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/post/PostPagingSource.java b/app/src/main/java/eu/toldi/infinityforlemmy/post/PostPagingSource.java index 917b2d8f..1c0f36cb 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/post/PostPagingSource.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/post/PostPagingSource.java @@ -252,7 +252,7 @@ public class PostPagingSource extends ListenableFuturePagingSource> loadUserPosts(@NonNull LoadParams loadParams, LemmyAPI api) { ListenableFuture> userPosts; - userPosts = api.getUserPosts(subredditOrUserName, sortType.getType().value,loadParams.getKey(),25,accessToken); + userPosts = api.getUserPosts(subredditOrUserName, sortType.getType().value, loadParams.getKey(), 25, userWhere.equals(USER_WHERE_SAVED), accessToken); ListenableFuture> pageFuture = Futures.transform(userPosts, this::transformData, executor);