aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java23
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java16
2 files changed, 21 insertions, 18 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java
index 058dbc98..fc207a02 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java
@@ -68,7 +68,11 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
if (postType == TYPE_SUBREDDIT) {
this.subredditOrUserName = path;
} else {
- multiRedditPath = path;
+ if (path.endsWith("/")) {
+ multiRedditPath = path + sortType.getType().value;
+ } else {
+ multiRedditPath = path + "/" + sortType.getType().value;
+ }
}
paginationNetworkStateLiveData = new MutableLiveData<>();
initialLoadStateLiveData = new MutableLiveData<>();
@@ -747,17 +751,16 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
Call<String> getPost;
if (accessToken == null) {
if (sortType.getTime() != null) {
- getPost = api.getMultiRedditPosts(multiRedditPath, lastItem, sortType.getType().value,
- sortType.getTime().value);
+ getPost = api.getMultiRedditPosts(multiRedditPath, lastItem, sortType.getTime().value);
} else {
- getPost = api.getMultiRedditPosts(multiRedditPath, lastItem, sortType.getType().value);
+ getPost = api.getMultiRedditPosts(multiRedditPath, lastItem);
}
} else {
if (sortType.getTime() != null) {
- getPost = api.getMultiRedditPostsOauth(multiRedditPath, lastItem, sortType.getType().value,
+ getPost = api.getMultiRedditPostsOauth(multiRedditPath, lastItem,
sortType.getTime().value, RedditUtils.getOAuthHeader(accessToken));
} else {
- getPost = api.getMultiRedditPostsOauth(multiRedditPath, lastItem, sortType.getType().value,
+ getPost = api.getMultiRedditPostsOauth(multiRedditPath, lastItem,
RedditUtils.getOAuthHeader(accessToken));
}
}
@@ -817,17 +820,17 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
Call<String> getPost;
if (accessToken == null) {
if (sortType.getTime() != null) {
- getPost = api.getMultiRedditPosts(multiRedditPath, after, sortType.getType().value,
+ getPost = api.getMultiRedditPosts(multiRedditPath, after,
sortType.getTime().value);
} else {
- getPost = api.getMultiRedditPosts(multiRedditPath, after, sortType.getType().value);
+ getPost = api.getMultiRedditPosts(multiRedditPath, after);
}
} else {
if (sortType.getTime() != null) {
- getPost = api.getMultiRedditPostsOauth(multiRedditPath, after, sortType.getType().value,
+ getPost = api.getMultiRedditPostsOauth(multiRedditPath, after,
sortType.getTime().value, RedditUtils.getOAuthHeader(accessToken));
} else {
- getPost = api.getMultiRedditPostsOauth(multiRedditPath, after, sortType.getType().value,
+ getPost = api.getMultiRedditPostsOauth(multiRedditPath, after,
RedditUtils.getOAuthHeader(accessToken));
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java
index 73b1df87..848e8807 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java
@@ -273,19 +273,19 @@ public interface RedditAPI {
Call<String> getUserMultiReddits(@Path("username") String username);
@GET("{multipath}?raw_json=1")
- Call<String> getMultiRedditPosts(@Path(value = "multipath", encoded = true) String multiPath, @Query("after") String after,
- @Query("sort") String sortType);
+ Call<String> getMultiRedditPosts(@Path(value = "multipath", encoded = true) String multiPath,
+ @Query("after") String after);
@GET("{multipath}?raw_json=1")
- Call<String> getMultiRedditPosts(@Path(value = "multipath", encoded = true) String multiPath, @Query("after") String after,
- @Query("sort") String sortType, @Query("t") String sortTime);
+ Call<String> getMultiRedditPosts(@Path(value = "multipath", encoded = true) String multiPath,
+ @Query("after") String after, @Query("t") String sortTime);
@GET("{multipath}.json?raw_json=1")
- Call<String> getMultiRedditPostsOauth(@Path(value = "multipath", encoded = true) String multiPath, @Query("after") String after,
- @Query("sort") String sortType, @Query("t") String sortTime,
+ Call<String> getMultiRedditPostsOauth(@Path(value = "multipath", encoded = true) String multiPath,
+ @Query("after") String after, @Query("t") String sortTime,
@HeaderMap Map<String, String> headers);
@GET("{multipath}.json?raw_json=1")
- Call<String> getMultiRedditPostsOauth(@Path(value = "multipath", encoded = true) String multiPath, @Query("after") String after,
- @Query("sort") String sortType, @HeaderMap Map<String, String> headers);
+ Call<String> getMultiRedditPostsOauth(@Path(value = "multipath", encoded = true) String multiPath,
+ @Query("after") String after, @HeaderMap Map<String, String> headers);
}