diff options
author | Alex Ning <chineseperson5@gmail.com> | 2020-07-29 06:24:27 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2020-07-29 06:24:27 +0000 |
commit | 2c03eb8d15e40a8fc949a07a3a46e5f829674d61 (patch) | |
tree | 7e75660c3655a6cc73a4991430713b6afaeaf635 /app/src/main/java/ml/docilealligator/infinityforreddit | |
parent | cdf7eaba266dcbd80df8264e3400adebb402d7c8 (diff) | |
download | infinity-for-reddit-2c03eb8d15e40a8fc949a07a3a46e5f829674d61.tar infinity-for-reddit-2c03eb8d15e40a8fc949a07a3a46e5f829674d61.tar.gz infinity-for-reddit-2c03eb8d15e40a8fc949a07a3a46e5f829674d61.tar.bz2 infinity-for-reddit-2c03eb8d15e40a8fc949a07a3a46e5f829674d61.tar.lz infinity-for-reddit-2c03eb8d15e40a8fc949a07a3a46e5f829674d61.tar.xz infinity-for-reddit-2c03eb8d15e40a8fc949a07a3a46e5f829674d61.tar.zst infinity-for-reddit-2c03eb8d15e40a8fc949a07a3a46e5f829674d61.zip |
Version 4.0.1. Block users. Show report menu item even in anonymous mode. Remove Crashy.
Diffstat (limited to 'app/src/main/java/ml/docilealligator/infinityforreddit')
10 files changed, 109 insertions, 122 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/API/RedditAPI.java b/app/src/main/java/ml/docilealligator/infinityforreddit/API/RedditAPI.java index fbfdd32a..1da58727 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/API/RedditAPI.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/API/RedditAPI.java @@ -312,4 +312,9 @@ public interface RedditAPI { @FormUrlEncoded @POST("/api/compose") Call<String> composePrivateMessage(@HeaderMap Map<String, String> headers, @FieldMap Map<String, String> params); + + + @FormUrlEncoded + @POST("api/block_user") + Call<String> blockUser(@HeaderMap Map<String, String> headers, @FieldMap Map<String, String> params); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageOrGifActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageOrGifActivity.java index 5cea5c59..9152c1be 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageOrGifActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageOrGifActivity.java @@ -213,6 +213,7 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa if (view != null) { view.setMinimumDpi(80); + view.setQuickScaleEnabled(true); view.setOnImageEventListener(new SubsamplingScaleImageView.OnImageEventListener() { @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java index 0fbc96b2..362eae60 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java @@ -542,8 +542,6 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS hideItem.setVisible(true); hideItem.setTitle(R.string.action_hide_post); } - - mMenu.findItem(R.id.action_report_view_post_detail_activity).setVisible(true); } else { saveItem.setVisible(false); hideItem.setVisible(false); @@ -1440,6 +1438,10 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS flairBottomSheetFragment.show(getSupportFragmentManager(), flairBottomSheetFragment.getTag()); return true; case R.id.action_report_view_post_detail_activity: + if (mAccessToken == null) { + Toast.makeText(this, R.string.login_first, Toast.LENGTH_SHORT).show(); + return true; + } Intent intent = new Intent(this, ReportActivity.class); intent.putExtra(ReportActivity.EXTRA_SUBREDDIT_NAME, mPost.getSubredditName()); intent.putExtra(ReportActivity.EXTRA_THING_FULLNAME, mPost.getFullName()); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java index 426f6504..1ceed6e1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java @@ -4,6 +4,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.res.ColorStateList; import android.content.res.Resources; +import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; @@ -56,29 +57,30 @@ import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; import ml.docilealligator.infinityforreddit.AsyncTask.CheckIsFollowingUserAsyncTask; import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostLayoutBottomSheetFragment; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.SortTimeBottomSheetFragment; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.UserThingSortTypeBottomSheetFragment; import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.DeleteThing; import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent; import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; -import ml.docilealligator.infinityforreddit.User.FetchUserData; import ml.docilealligator.infinityforreddit.Fragment.CommentsListingFragment; import ml.docilealligator.infinityforreddit.Fragment.PostFragment; -import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostLayoutBottomSheetFragment; -import ml.docilealligator.infinityforreddit.BottomSheetFragment.SortTimeBottomSheetFragment; -import ml.docilealligator.infinityforreddit.BottomSheetFragment.UserThingSortTypeBottomSheetFragment; import ml.docilealligator.infinityforreddit.FragmentCommunicator; import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.Message.ReadMessage; import ml.docilealligator.infinityforreddit.Post.PostDataSource; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.Message.ReadMessage; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.SortType; import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserDao; +import ml.docilealligator.infinityforreddit.User.BlockUser; +import ml.docilealligator.infinityforreddit.User.FetchUserData; import ml.docilealligator.infinityforreddit.User.UserDao; import ml.docilealligator.infinityforreddit.User.UserData; -import ml.docilealligator.infinityforreddit.User.UserViewModel; import ml.docilealligator.infinityforreddit.User.UserFollowing; +import ml.docilealligator.infinityforreddit.User.UserViewModel; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.Utils.Utils; import pl.droidsonroids.gif.GifImageView; @@ -653,10 +655,44 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } return true; case R.id.action_send_private_message_view_user_detail_activity: + if (mAccessToken == null) { + Toast.makeText(this, R.string.login_first, Toast.LENGTH_SHORT).show(); + return true; + } + Intent pmIntent = new Intent(this, SendPrivateMessageActivity.class); pmIntent.putExtra(SendPrivateMessageActivity.EXTRA_RECIPIENT_USERNAME, username); startActivity(pmIntent); return true; + case R.id.action_report_view_user_detail_activity: + Intent reportIntent = new Intent(this, LinkResolverActivity.class); + reportIntent.setData(Uri.parse("https://www.reddithelp.com/en/categories/rules-reporting/account-and-community-restrictions/what-should-i-do-if-i-see-something-i")); + startActivity(reportIntent); + return true; + case R.id.action_block_user_view_user_detail_activity: + if (mAccessToken == null) { + Toast.makeText(this, R.string.login_first, Toast.LENGTH_SHORT).show(); + return true; + } + + new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) + .setTitle(R.string.block_user) + .setMessage(R.string.are_you_sure) + .setPositiveButton(R.string.yes, (dialogInterface, i) + -> BlockUser.blockUser(mOauthRetrofit, mAccessToken, username, new BlockUser.BlockUserListener() { + @Override + public void success() { + Toast.makeText(ViewUserDetailActivity.this, R.string.block_user_success, Toast.LENGTH_SHORT).show(); + } + + @Override + public void failed() { + Toast.makeText(ViewUserDetailActivity.this, R.string.block_user_failed, Toast.LENGTH_SHORT).show(); + } + })) + .setNegativeButton(R.string.no, null) + .show(); + return true; } return false; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java index 3a30ba62..7dd17c41 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java @@ -409,7 +409,7 @@ public class CustomThemeWrapper { public int getAwardedCommentBackgroundColor() { return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.AWARDED_COMMENT_BACKGROUND_COLOR, - getDefaultColor("#FFF162", "#FF6400", "#FF6400")); + getDefaultColor("#FFFFFF", "#242424", "#000000")); } public int getNavBarColor() { @@ -550,7 +550,7 @@ public class CustomThemeWrapper { customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D"); customTheme.sendMessageIconColor = Color.parseColor("#4185F4"); customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#8EDFBA"); - customTheme.awardedCommentBackgroundColor = Color.parseColor("#FFF162"); + customTheme.awardedCommentBackgroundColor = Color.parseColor("#FFFFFF"); customTheme.navBarColor = Color.parseColor("#FFFFFF"); customTheme.isLightStatusBar = false; customTheme.isLightNavBar = true; @@ -635,7 +635,7 @@ public class CustomThemeWrapper { customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D"); customTheme.sendMessageIconColor = Color.parseColor("#4185F4"); customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#21C561"); - customTheme.awardedCommentBackgroundColor = Color.parseColor("#FF6400"); + customTheme.awardedCommentBackgroundColor = Color.parseColor("#242424"); customTheme.navBarColor = Color.parseColor("#121212"); customTheme.isLightStatusBar = false; customTheme.isLightNavBar = false; @@ -720,7 +720,7 @@ public class CustomThemeWrapper { customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D"); customTheme.sendMessageIconColor = Color.parseColor("#4185F4"); customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#21C561"); - customTheme.awardedCommentBackgroundColor = Color.parseColor("#FF6400"); + customTheme.awardedCommentBackgroundColor = Color.parseColor("#000000"); customTheme.navBarColor = Color.parseColor("#000000"); customTheme.isLightStatusBar = false; customTheme.isLightNavBar = false; @@ -805,7 +805,7 @@ public class CustomThemeWrapper { customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D"); customTheme.sendMessageIconColor = Color.parseColor("#4185F4"); customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#8EDFBA"); - customTheme.awardedCommentBackgroundColor = Color.parseColor("#FFF162"); + customTheme.awardedCommentBackgroundColor = Color.parseColor("#FFFFFF"); customTheme.navBarColor = Color.parseColor("#FFFFFF"); customTheme.isLightStatusBar = true; customTheme.isLightNavBar = true; @@ -890,7 +890,7 @@ public class CustomThemeWrapper { customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D"); customTheme.sendMessageIconColor = Color.parseColor("#4185F4"); customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#21C561"); - customTheme.awardedCommentBackgroundColor = Color.parseColor("#FF6400"); + customTheme.awardedCommentBackgroundColor = Color.parseColor("#242424"); customTheme.navBarColor = Color.parseColor("#121212"); customTheme.isLightStatusBar = false; customTheme.isLightNavBar = false; @@ -975,7 +975,7 @@ public class CustomThemeWrapper { customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D"); customTheme.sendMessageIconColor = Color.parseColor("#4185F4"); customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#21C561"); - customTheme.awardedCommentBackgroundColor = Color.parseColor("#FF6400"); + customTheme.awardedCommentBackgroundColor = Color.parseColor("#000000"); customTheme.navBarColor = Color.parseColor("#000000"); customTheme.isLightStatusBar = false; customTheme.isLightNavBar = false; @@ -1060,7 +1060,7 @@ public class CustomThemeWrapper { customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D"); customTheme.sendMessageIconColor = Color.parseColor("#4185F4"); customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#8EDFBA"); - customTheme.awardedCommentBackgroundColor = Color.parseColor("#FFF162"); + customTheme.awardedCommentBackgroundColor = Color.parseColor("#FFFFFF"); customTheme.navBarColor = Color.parseColor("#FFFFFF"); customTheme.isLightStatusBar = false; customTheme.isLightNavBar = true; @@ -1145,7 +1145,7 @@ public class CustomThemeWrapper { customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D"); customTheme.sendMessageIconColor = Color.parseColor("#4185F4"); customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#21C561"); - customTheme.awardedCommentBackgroundColor = Color.parseColor("#FF6400"); + customTheme.awardedCommentBackgroundColor = Color.parseColor("#242424"); customTheme.navBarColor = Color.parseColor("#121212"); customTheme.isLightStatusBar = false; customTheme.isLightNavBar = false; @@ -1230,7 +1230,7 @@ public class CustomThemeWrapper { customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D"); customTheme.sendMessageIconColor = Color.parseColor("#4185F4"); customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#21C561"); - customTheme.awardedCommentBackgroundColor = Color.parseColor("#FF6400"); + customTheme.awardedCommentBackgroundColor = Color.parseColor("#000000"); customTheme.navBarColor = Color.parseColor("#000000"); customTheme.isLightStatusBar = false; customTheme.isLightNavBar = false; @@ -1315,7 +1315,7 @@ public class CustomThemeWrapper { customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D"); customTheme.sendMessageIconColor = Color.parseColor("#4185F4"); customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#21C561"); - customTheme.awardedCommentBackgroundColor = Color.parseColor("#FF6400"); + customTheme.awardedCommentBackgroundColor = Color.parseColor("#393A59"); customTheme.navBarColor = Color.parseColor("#393A59"); customTheme.isLightStatusBar = false; customTheme.isLightNavBar = false; @@ -1400,7 +1400,7 @@ public class CustomThemeWrapper { customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D"); customTheme.sendMessageIconColor = Color.parseColor("#4185F4"); customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#8EDFBA"); - customTheme.awardedCommentBackgroundColor = Color.parseColor("#FFF162"); + customTheme.awardedCommentBackgroundColor = Color.parseColor("#C0F0F4"); customTheme.navBarColor = Color.parseColor("#D48AE0"); customTheme.isLightStatusBar = true; customTheme.isLightNavBar = true; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewRedditGalleryImageOrGifFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewRedditGalleryImageOrGifFragment.java index 0b466749..015e57c7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewRedditGalleryImageOrGifFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewRedditGalleryImageOrGifFragment.java @@ -131,6 +131,7 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment { if (view != null) { view.setMinimumDpi(80); + view.setQuickScaleEnabled(true); view.setOnImageEventListener(new SubsamplingScaleImageView.OnImageEventListener() { @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsFragment.java deleted file mode 100644 index 04bdc0e9..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsFragment.java +++ /dev/null @@ -1,54 +0,0 @@ -package ml.docilealligator.infinityforreddit.Settings; - -import android.app.Activity; -import android.content.Context; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import androidx.annotation.NonNull; -import androidx.fragment.app.Fragment; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -import com.crazylegend.crashyreporter.CrashyReporter; - -import butterknife.BindView; -import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.R; - -public class CrashReportsFragment extends Fragment { - - @BindView(R.id.recycler_view_crash_reports_fragment) - RecyclerView recyclerView; - private Activity activity; - private CrashReportsRecyclerViewAdapter adapter; - private LinearLayoutManager linearLayoutManager; - - public CrashReportsFragment() { - // Required empty public constructor - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - // Inflate the layout for this fragment - View rootView = inflater.inflate(R.layout.fragment_crash_reports, container, false); - - ButterKnife.bind(this, rootView); - - adapter = new CrashReportsRecyclerViewAdapter(CrashyReporter.INSTANCE.getLogsAsStrings()); - linearLayoutManager = new LinearLayoutManager(activity); - recyclerView.setLayoutManager(linearLayoutManager); - recyclerView.setAdapter(adapter); - - return rootView; - } - - @Override - public void onAttach(@NonNull Context context) { - super.onAttach(context); - this.activity = (Activity) context; - } -}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsRecyclerViewAdapter.java deleted file mode 100644 index 82c43795..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CrashReportsRecyclerViewAdapter.java +++ /dev/null @@ -1,46 +0,0 @@ -package ml.docilealligator.infinityforreddit.Settings; - -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - -import java.util.List; - -import ml.docilealligator.infinityforreddit.R; - -class CrashReportsRecyclerViewAdapter extends RecyclerView.Adapter<CrashReportsRecyclerViewAdapter.CrashReportViewHolder> { - private List<String> crashReports; - - public CrashReportsRecyclerViewAdapter(List<String> crashReports) { - this.crashReports = crashReports; - } - - @NonNull - @Override - public CrashReportViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - return new CrashReportViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_crash_report, parent, false)); - } - - @Override - public void onBindViewHolder(@NonNull CrashReportViewHolder holder, int position) { - holder.crashReportTextView.setText(crashReports.get(holder.getAdapterPosition())); - } - - @Override - public int getItemCount() { - return crashReports == null ? 0 : crashReports.size(); - } - - class CrashReportViewHolder extends RecyclerView.ViewHolder { - TextView crashReportTextView; - - public CrashReportViewHolder(@NonNull View itemView) { - super(itemView); - crashReportTextView = (TextView) itemView; - } - } -}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/User/BlockUser.java b/app/src/main/java/ml/docilealligator/infinityforreddit/User/BlockUser.java new file mode 100644 index 00000000..ca6dd1d1 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/User/BlockUser.java @@ -0,0 +1,40 @@ +package ml.docilealligator.infinityforreddit.User; + +import androidx.annotation.NonNull; + +import java.util.HashMap; +import java.util.Map; + +import ml.docilealligator.infinityforreddit.API.RedditAPI; +import ml.docilealligator.infinityforreddit.Utils.APIUtils; +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; +import retrofit2.Retrofit; + +public class BlockUser { + public interface BlockUserListener { + void success(); + void failed(); + } + + public static void blockUser(Retrofit oauthRetrofit, String accessToken, String username, BlockUserListener blockUserListener) { + Map<String, String> params = new HashMap<>(); + params.put(APIUtils.NAME_KEY, username); + oauthRetrofit.create(RedditAPI.class).blockUser(APIUtils.getOAuthHeader(accessToken), params).enqueue(new Callback<String>() { + @Override + public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) { + if (response.isSuccessful()) { + blockUserListener.success(); + } else { + blockUserListener.failed(); + } + } + + @Override + public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { + blockUserListener.failed(); + } + }); + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/APIUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/APIUtils.java index 1b00e57a..f824eafa 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/APIUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/APIUtils.java @@ -35,13 +35,13 @@ public class APIUtils { public static final String DURATION_KEY = "duration"; public static final String DURATION = "permanent"; public static final String SCOPE_KEY = "scope"; - public static final String SCOPE = "identity edit flair history modconfig modflair modlog modposts modwiki mysubreddits privatemessages read report save submit subscribe vote wikiedit wikiread"; + public static final String SCOPE = "identity edit flair history modconfig modflair modlog modposts modwiki mysubreddits privatemessages read report save submit subscribe vote wikiedit wikiread creddits modcontributors modmail modothers livemanage account modself"; public static final String ACCESS_TOKEN_KEY = "access_token"; public static final String AUTHORIZATION_KEY = "Authorization"; public static final String AUTHORIZATION_BASE = "bearer "; public static final String USER_AGENT_KEY = "User-Agent"; - public static final String USER_AGENT = "android:ml.docilealligator.infinityforreddit:v3.2.0 (by /u/Hostilenemy)"; + public static final String USER_AGENT = "android:ml.docilealligator.infinityforreddit:v4.0.1 (by /u/Hostilenemy)"; public static final String GRANT_TYPE_KEY = "grant_type"; public static final String GRANT_TYPE_REFRESH_TOKEN = "refresh_token"; @@ -95,6 +95,8 @@ public class APIUtils { public static final String SUBJECT_KEY = "subject"; public static final String TO_KEY = "to"; + public static final String NAME_KEY = "name"; + public static Map<String, String> getHttpBasicAuthHeader() { Map<String, String> params = new HashMap<>(); String credentials = String.format("%s:%s", APIUtils.CLIENT_ID, ""); |