diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-01-08 01:30:21 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-01-08 01:30:21 +0000 |
commit | 977495cd448d9f21589a39c67f43848df638bba9 (patch) | |
tree | 94bbc9161e40f10eb0e0d0a3baf57ccc18266ce8 /app/src | |
parent | 780a719227339c5af28473a87ac2e4641091e33d (diff) | |
download | infinity-for-reddit-977495cd448d9f21589a39c67f43848df638bba9.tar infinity-for-reddit-977495cd448d9f21589a39c67f43848df638bba9.tar.gz infinity-for-reddit-977495cd448d9f21589a39c67f43848df638bba9.tar.bz2 infinity-for-reddit-977495cd448d9f21589a39c67f43848df638bba9.tar.lz infinity-for-reddit-977495cd448d9f21589a39c67f43848df638bba9.tar.xz infinity-for-reddit-977495cd448d9f21589a39c67f43848df638bba9.tar.zst infinity-for-reddit-977495cd448d9f21589a39c67f43848df638bba9.zip |
Continue changing anonymous mode.
Diffstat (limited to '')
-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); } |