aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml/docilealligator/infinityforreddit
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-05-29 20:51:12 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-05-29 20:51:12 +0000
commit392ea8ee9b62b8bcf2c03399d56e47a0394758d4 (patch)
treea3486e5dd893b790343c9372770a07d9a92dc954 /app/src/main/java/ml/docilealligator/infinityforreddit
parentda93713f5c3c90df6af07fb99f164ec109c20f63 (diff)
downloadinfinity-for-reddit-392ea8ee9b62b8bcf2c03399d56e47a0394758d4.tar
infinity-for-reddit-392ea8ee9b62b8bcf2c03399d56e47a0394758d4.tar.gz
infinity-for-reddit-392ea8ee9b62b8bcf2c03399d56e47a0394758d4.tar.bz2
infinity-for-reddit-392ea8ee9b62b8bcf2c03399d56e47a0394758d4.tar.lz
infinity-for-reddit-392ea8ee9b62b8bcf2c03399d56e47a0394758d4.tar.xz
infinity-for-reddit-392ea8ee9b62b8bcf2c03399d56e47a0394758d4.tar.zst
infinity-for-reddit-392ea8ee9b62b8bcf2c03399d56e47a0394758d4.zip
Fix user posts not loading by a stupid workaround.
Diffstat (limited to 'app/src/main/java/ml/docilealligator/infinityforreddit')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java13
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java4
2 files changed, 11 insertions, 6 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java b/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java
index 9db3669e..78bb8bb4 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java
@@ -5,6 +5,7 @@ import com.google.common.util.concurrent.ListenableFuture;
import java.util.Map;
import ml.docilealligator.infinityforreddit.SortType;
+import ml.docilealligator.infinityforreddit.utils.APIUtils;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Call;
@@ -15,6 +16,7 @@ import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
+import retrofit2.http.Header;
import retrofit2.http.HeaderMap;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
@@ -282,10 +284,13 @@ public interface RedditAPI {
ListenableFuture<Response<String>> getSubredditBestPostsListenableFuture(@Path("subredditName") String subredditName, @Path("sortType") SortType.Type sortType,
@Query("t") SortType.Time sortTime, @Query("after") String lastItem);
- @GET("user/{username}/{where}.json?&type=links&raw_json=1&limit=100")
- ListenableFuture<Response<String>> getUserPostsOauthListenableFuture(@Path("username") String username, @Path("where") String where,
- @Query("after") String lastItem, @Query("sort") SortType.Type sortType,
- @Query("t") SortType.Time sortTime, @HeaderMap Map<String, String> headers);
+ @GET("user/{username}/{where}.json?type=links&raw_json=1&limit=100")
+ ListenableFuture<Response<String>> getUserPostsOauthListenableFuture(@Header(APIUtils.AUTHORIZATION_KEY) String authorization,
+ @Path("username") String username,
+ @Path("where") String where,
+ @Query("after") String lastItem,
+ @Query("sort") SortType.Type sortType,
+ @Query("t") SortType.Time sortTime);
@GET("user/{username}/submitted.json?raw_json=1&limit=100")
ListenableFuture<Response<String>> getUserPostsListenableFuture(@Path("username") String username, @Query("after") String lastItem,
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 2d5191a4..7c256d59 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java
@@ -257,8 +257,8 @@ public class PostPagingSource extends ListenableFuturePagingSource<String, Post>
userPosts = api.getUserPostsListenableFuture(subredditOrUserName, loadParams.getKey(), sortType.getType(),
sortType.getTime());
} else {
- userPosts = api.getUserPostsOauthListenableFuture(subredditOrUserName, userWhere, loadParams.getKey(), sortType.getType(),
- sortType.getTime(), APIUtils.getOAuthHeader(accessToken));
+ userPosts = api.getUserPostsOauthListenableFuture(APIUtils.AUTHORIZATION_BASE + accessToken,
+ subredditOrUserName, userWhere, loadParams.getKey(), sortType.getType(), sortType.getTime());
}
ListenableFuture<LoadResult<String, Post>> pageFuture = Futures.transform(userPosts, this::transformData, executor);