diff options
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java | 6 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/user/FetchUserData.java | 5 |
2 files changed, 3 insertions, 8 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 37eb42f3..f9c4eac2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java @@ -30,9 +30,6 @@ public interface RedditAPI { Call<String> getAccessToken(@HeaderMap Map<String, String> headers, @FieldMap Map<String, String> params); @GET("r/{subredditName}/about.json?raw_json=1") - Call<String> getSubredditData(@Path("subredditName") String subredditName); - - @GET("r/{subredditName}/about.json?raw_json=1") Call<String> getSubredditDataOauth(@Path("subredditName") String subredditName, @HeaderMap Map<String, String> headers); @GET("subreddits/mine/subscriber?raw_json=1") @@ -48,9 +45,6 @@ public interface RedditAPI { @GET("comments/{id}.json?raw_json=1") Call<String> getPostOauth(@Path("id") String id, @HeaderMap Map<String, String> headers); - @GET("user/{username}/about.json?raw_json=1") - Call<String> getUserData(@Path("username") String username); - @GET("user/{username}/about.json?raw_json=1&limit=100") Call<String> getUserDataOauth(@HeaderMap Map<String, String> headers, @Path("username") String username); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/user/FetchUserData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/user/FetchUserData.java index a94eef35..55c47c3d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/user/FetchUserData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/user/FetchUserData.java @@ -4,6 +4,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import java.util.ArrayList; +import java.util.HashMap; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.SortType; @@ -24,8 +25,8 @@ public class FetchUserData { RedditAPI api = retrofit.create(RedditAPI.class); Call<String> userInfo; - if (redditDataRoomDatabase == null) { - userInfo = api.getUserData(userName); + if (accessToken == null) { + userInfo = api.getUserDataOauth(new HashMap<>(), userName); } else { userInfo = api.getUserDataOauth(APIUtils.getOAuthHeader(accessToken), userName); } |