mirror of
https://github.com/Docile-Alligator/Infinity-For-Reddit
synced 2024-07-03 08:18:40 +00:00
Fix user posts not loading by a stupid workaround.
This commit is contained in:
parent
da93713f5c
commit
392ea8ee9b
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user