From 977495cd448d9f21589a39c67f43848df638bba9 Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Sun, 7 Jan 2024 20:30:21 -0500 Subject: Continue changing anonymous mode. --- .../java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java | 6 ------ .../ml/docilealligator/infinityforreddit/user/FetchUserData.java | 5 +++-- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'app/src/main') 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 @@ -29,9 +29,6 @@ public interface RedditAPI { @POST("api/v1/access_token") Call getAccessToken(@HeaderMap Map headers, @FieldMap Map params); - @GET("r/{subredditName}/about.json?raw_json=1") - Call getSubredditData(@Path("subredditName") String subredditName); - @GET("r/{subredditName}/about.json?raw_json=1") Call getSubredditDataOauth(@Path("subredditName") String subredditName, @HeaderMap Map headers); @@ -48,9 +45,6 @@ public interface RedditAPI { @GET("comments/{id}.json?raw_json=1") Call getPostOauth(@Path("id") String id, @HeaderMap Map headers); - @GET("user/{username}/about.json?raw_json=1") - Call getUserData(@Path("username") String username); - @GET("user/{username}/about.json?raw_json=1&limit=100") Call getUserDataOauth(@HeaderMap Map 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 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); } -- cgit v1.2.3