Auto follow threads in channel optional

Stephen Paul Weber created

Off by default

Change summary

src/cheogram/res/values/strings.xml                               | 2 
src/main/java/eu/siacs/conversations/ui/ConversationFragment.java | 4 
src/main/res/values/defaults.xml                                  | 1 
src/main/res/xml/preferences.xml                                  | 5 +
4 files changed, 12 insertions(+)

Detailed changes

src/cheogram/res/values/strings.xml 🔗

@@ -39,4 +39,6 @@
     <string name="pref_broadcast_last_activity_summary">Allow contacts to see when you were last active in the app</string>
     <string name="visitor">Muted</string>
     <string name="you_are_not_participating">You are muted</string>
+    <string name="pref_follow_thread_in_channel">Auto-follow thread in channels</string>
+    <string name="pref_follow_thread_in_channel_summary">Set the thread marker to match the message currently being looked at</string>
 </resources>

src/main/java/eu/siacs/conversations/ui/ConversationFragment.java 🔗

@@ -2502,6 +2502,10 @@ public class ConversationFragment extends XmppFragment
             if (message == null) {
                 newThread();
             } else {
+                if (conversation.getMode() == Conversation.MODE_MULTI) {
+                    if (!activity.xmppConnectionService.getBooleanPreference("follow_thread_in_channel", R.bool.follow_thread_in_channel)) return;
+                }
+
                 setThread(message.getThread());
             }
         }

src/main/res/values/defaults.xml 🔗

@@ -46,6 +46,7 @@
     <string name="default_channel_discovery">JABBER_NETWORK</string>
     <bool name="prevent_screenshots">false</bool>
     <bool name="dialler_integration_incoming">true</bool>
+    <bool name="follow_thread_in_channel">false</bool>
     <string name="default_push_server">up.conversations.im</string>
     <string name="default_push_account">none</string>
 </resources>

src/main/res/xml/preferences.xml 🔗

@@ -355,6 +355,11 @@
                     android:title="@string/pref_show_connection_options" />
             </PreferenceCategory>
             <PreferenceCategory android:title="@string/pref_input_options">
+                <CheckBoxPreference
+                    android:defaultValue="@bool/follow_thread_in_channel"
+                    android:key="follow_thread_in_channel"
+                    android:summary="@string/pref_follow_thread_in_channel_summary"
+                    android:title="@string/pref_follow_thread_in_channel" />
                 <CheckBoxPreference
                     android:defaultValue="@bool/start_searching"
                     android:key="start_searching"