From fa989a408486a482d908ff05ed640018d2703359 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 8 Nov 2022 10:40:02 +0100 Subject: [PATCH] Fix issue #115 - Allow to set replies in "unlisted" (enabled by default) --- .../app/fedilab/android/activities/ComposeActivity.java | 6 ++++++ .../app/fedilab/android/ui/drawer/ComposeAdapter.java | 4 ++++ app/src/main/res/values/strings.xml | 4 ++++ app/src/main/res/xml/pref_compose.xml | 8 ++++++++ 4 files changed, 22 insertions(+) diff --git a/app/src/main/java/app/fedilab/android/activities/ComposeActivity.java b/app/src/main/java/app/fedilab/android/activities/ComposeActivity.java index 215fcbec..8df0e9c5 100644 --- a/app/src/main/java/app/fedilab/android/activities/ComposeActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/ComposeActivity.java @@ -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); diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java index 8316d7cf..b1c4f835 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java @@ -1206,6 +1206,10 @@ public class ComposeAdapter extends RecyclerView.Adapter 1) { + statusDraft.visibility = "unlisted"; + } } switch (statusDraft.visibility.toLowerCase()) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 387527eb..d41cbed0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -997,6 +997,8 @@ SET_ART_WITH_NSFW SET_VIDEO_CACHE SET_WATERMARK + SET_UNLISTED_REPLIES + SET_WATERMARK_TEXT SET_PROXY_PASSWORD SET_PROXY_LOGIN @@ -1563,4 +1565,6 @@ Edited at %1$s Created at %1$s Max indentation in threads + Unlisted replies + It only concerns \"public\" replies. When enabled, your replies will automatically have the visibility \"unlisted\" instead of \"public\" diff --git a/app/src/main/res/xml/pref_compose.xml b/app/src/main/res/xml/pref_compose.xml index b3cbfd8c..1d0a2944 100644 --- a/app/src/main/res/xml/pref_compose.xml +++ b/app/src/main/res/xml/pref_compose.xml @@ -30,6 +30,14 @@ app:summary="@string/set_resize_video_indication" app:title="@string/set_resize_video" /> --> + +