aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-02-02 15:33:14 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-02-02 15:33:14 +0000
commit36c7cfcc6bd9b3be1eb51303d2c3448e85401eac (patch)
tree10afa2bcfd79260c0dcc621b5218136159269332
parentb7b9a7f3bd0c7c7d5dd3ed86db7c0929defb1ba6 (diff)
downloadinfinity-for-reddit-36c7cfcc6bd9b3be1eb51303d2c3448e85401eac.tar
infinity-for-reddit-36c7cfcc6bd9b3be1eb51303d2c3448e85401eac.tar.gz
infinity-for-reddit-36c7cfcc6bd9b3be1eb51303d2c3448e85401eac.tar.bz2
infinity-for-reddit-36c7cfcc6bd9b3be1eb51303d2c3448e85401eac.tar.lz
infinity-for-reddit-36c7cfcc6bd9b3be1eb51303d2c3448e85401eac.tar.xz
infinity-for-reddit-36c7cfcc6bd9b3be1eb51303d2c3448e85401eac.tar.zst
infinity-for-reddit-36c7cfcc6bd9b3be1eb51303d2c3448e85401eac.zip
Prepare to add quarantined subreddit support.
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/LoadSubredditIconAsyncTask.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/FetchSubredditData.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSubscription.java2
7 files changed, 12 insertions, 9 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java
index 30100d86..145fdadc 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java
@@ -935,7 +935,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
}
@Override
- public void onFetchSubredditDataFail() {
+ public void onFetchSubredditDataFail(boolean isQuarantined) {
mRespectSubredditRecommendedSortType = false;
ViewPostDetailActivity.this.sortType = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, SortType.Type.BEST.value.toUpperCase());
if (ViewPostDetailActivity.this.sortType != null) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java
index 3bf7fdf8..cd514c0f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java
@@ -519,7 +519,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
}
@Override
- public void onFetchSubredditDataFail() {
+ public void onFetchSubredditDataFail(boolean isQuarantined) {
makeSnackbar(R.string.cannot_fetch_subreddit_info, true);
mFetchSubredditInfoSuccess = false;
}
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 1799ff57..67da922d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java
@@ -346,4 +346,7 @@ public interface RedditAPI {
Call<String> addSubredditToMultiReddit(@HeaderMap Map<String, String> headers, @FieldMap Map<String, String> params,
@Path(value = "multipath", encoded = true) String multipath, @Path("subredditName") String subredditName);
+ @FormUrlEncoded
+ @POST("/api/quarantine_optin?raw_json=1")
+ Call<String> optInQuarantinedSubreddit(@HeaderMap Map<String, String> headers, @FieldMap Map<String, String> params);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/LoadSubredditIconAsyncTask.java b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/LoadSubredditIconAsyncTask.java
index 7092bae7..695e4e46 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/LoadSubredditIconAsyncTask.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/LoadSubredditIconAsyncTask.java
@@ -57,7 +57,7 @@ public class LoadSubredditIconAsyncTask extends AsyncTask<Void, Void, Void> {
}
@Override
- public void onFetchSubredditDataFail() {
+ public void onFetchSubredditDataFail(boolean isQuarantined) {
loadSubredditIconAsyncTaskListener.loadIconSuccess(null);
}
});
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java
index 571350ce..b6fb5795 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SidebarFragment.java
@@ -193,7 +193,7 @@ public class SidebarFragment extends Fragment {
}
@Override
- public void onFetchSubredditDataFail() {
+ public void onFetchSubredditDataFail(boolean isQuarantined) {
swipeRefreshLayout.setRefreshing(false);
Toast.makeText(activity, R.string.cannot_fetch_sidebar, Toast.LENGTH_SHORT).show();
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/FetchSubredditData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/FetchSubredditData.java
index 37587ede..b5e9b553 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/FetchSubredditData.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/FetchSubredditData.java
@@ -31,17 +31,17 @@ public class FetchSubredditData {
@Override
public void onParseSubredditDataFail() {
- fetchSubredditDataListener.onFetchSubredditDataFail();
+ fetchSubredditDataListener.onFetchSubredditDataFail(false);
}
});
} else {
- fetchSubredditDataListener.onFetchSubredditDataFail();
+ fetchSubredditDataListener.onFetchSubredditDataFail(response.code() == 403);
}
}
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
- fetchSubredditDataListener.onFetchSubredditDataFail();
+ fetchSubredditDataListener.onFetchSubredditDataFail(false);
}
});
}
@@ -84,7 +84,7 @@ public class FetchSubredditData {
public interface FetchSubredditDataListener {
void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers);
- void onFetchSubredditDataFail();
+ void onFetchSubredditDataFail(boolean isQuarantined);
}
interface FetchSubredditListingDataListener {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSubscription.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSubscription.java
index 52664234..31615903 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSubscription.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSubscription.java
@@ -56,7 +56,7 @@ public class SubredditSubscription {
}
@Override
- public void onFetchSubredditDataFail() {
+ public void onFetchSubredditDataFail(boolean isQuarantined) {
}
});