Fix issue #115 - Allow to set replies in "unlisted" (enabled by default)

This commit is contained in:
Thomas 2022-11-08 10:40:02 +01:00
parent 59a8b5da17
commit fa989a4084
4 changed files with 22 additions and 0 deletions

View File

@ -628,6 +628,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
statusDraftList.get(0).mentions.add(mention);
}
//There are other mentions to
if (statusReply.mentions != null && statusReply.mentions.size() > 0) {
for (Mention mentionTmp : statusReply.mentions) {
@ -732,6 +733,11 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
status.id = Helper.generateIdString();
status.mentions = statusList.get(position).mentions;
status.visibility = statusList.get(position).visibility;
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(ComposeActivity.this);
boolean unlistedReplies = sharedpreferences.getBoolean(getString(R.string.SET_UNLISTED_REPLIES), true);
if (status.visibility.equalsIgnoreCase("public") && unlistedReplies) {
status.visibility = "unlisted";
}
status.spoiler_text = statusList.get(position).spoiler_text;
status.sensitive = statusList.get(position).sensitive;
statusList.add(status);

View File

@ -1206,6 +1206,10 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
} else {
statusDraft.visibility = "public";
}
boolean unlistedReplies = sharedpreferences.getBoolean(context.getString(R.string.SET_UNLISTED_REPLIES), true);
if (position == 0 && unlistedReplies && statusDraft.visibility.equalsIgnoreCase("public") && statusList.size() > 1) {
statusDraft.visibility = "unlisted";
}
}
switch (statusDraft.visibility.toLowerCase()) {

View File

@ -997,6 +997,8 @@
<string name="SET_ART_WITH_NSFW" translatable="false">SET_ART_WITH_NSFW</string>
<string name="SET_VIDEO_CACHE" translatable="false">SET_VIDEO_CACHE</string>
<string name="SET_WATERMARK" translatable="false">SET_WATERMARK</string>
<string name="SET_UNLISTED_REPLIES" translatable="false">SET_UNLISTED_REPLIES</string>
<string name="SET_WATERMARK_TEXT" translatable="false">SET_WATERMARK_TEXT</string>
<string name="SET_PROXY_PASSWORD" translatable="false">SET_PROXY_PASSWORD</string>
<string name="SET_PROXY_LOGIN" translatable="false">SET_PROXY_LOGIN</string>
@ -1563,4 +1565,6 @@
<string name="edited_message_at">Edited at %1$s</string>
<string name="created_message_at">Created at %1$s</string>
<string name="max_indentation_thread">Max indentation in threads</string>
<string name="set_unlisted_replies">Unlisted replies</string>
<string name="set_unlisted_replies_indication">It only concerns \"public\" replies. When enabled, your replies will automatically have the visibility \"unlisted\" instead of \"public\"</string>
</resources>

View File

@ -30,6 +30,14 @@
app:summary="@string/set_resize_video_indication"
app:title="@string/set_resize_video" />
-->
<SwitchPreferenceCompat
app:defaultValue="true"
app:iconSpaceReserved="false"
app:key="@string/SET_UNLISTED_REPLIES"
app:singleLineTitle="false"
app:summary="@string/set_unlisted_replies_indication"
app:title="@string/set_unlisted_replies" />
<SwitchPreferenceCompat
app:defaultValue="false"
app:iconSpaceReserved="false"