mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-14 23:18:43 +00:00
Make pinned chat limit remote configurable.
This commit is contained in:
committed by
Michelle Tang
parent
1ecf42bfd3
commit
f90ba45940
@@ -157,6 +157,7 @@ import org.signal.core.ui.view.Stub;
|
||||
import org.thoughtcrime.securesms.util.CachedInflater;
|
||||
import org.thoughtcrime.securesms.util.ConversationUtil;
|
||||
import org.thoughtcrime.securesms.util.ServiceUtil;
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig;
|
||||
import org.thoughtcrime.securesms.util.SignalLocalMetrics;
|
||||
import org.thoughtcrime.securesms.util.SignalProxyUtil;
|
||||
import org.thoughtcrime.securesms.util.SnapToTopDataObserver;
|
||||
@@ -200,7 +201,6 @@ public class ConversationListFragment extends MainFragment implements Conversati
|
||||
|
||||
private static final String TAG = Log.tag(ConversationListFragment.class);
|
||||
|
||||
private static final int MAXIMUM_PINNED_CONVERSATIONS = 4;
|
||||
private static final int MAX_CHATS_ABOVE_FOLD = 7;
|
||||
private static final int MAX_CONTACTS_ABOVE_FOLD = 5;
|
||||
private static final int MAX_GROUP_MEMBERSHIPS_ABOVE_FOLD = 5;
|
||||
@@ -1139,9 +1139,9 @@ public class ConversationListFragment extends MainFragment implements Conversati
|
||||
.map(conversation -> conversation.getThreadRecord().getThreadId())
|
||||
.toList());
|
||||
|
||||
if (toPin.size() + viewModel.getPinnedCount() > MAXIMUM_PINNED_CONVERSATIONS) {
|
||||
if (toPin.size() + viewModel.getPinnedCount() > RemoteConfig.pinnedChatLimit()) {
|
||||
mainNavigationViewModel.getSnackbarRegistry().emit(new SnackbarState(
|
||||
getString(R.string.conversation_list__you_can_only_pin_up_to_d_chats, MAXIMUM_PINNED_CONVERSATIONS),
|
||||
getString(R.string.conversation_list__you_can_only_pin_up_to_d_chats, RemoteConfig.pinnedChatLimit()),
|
||||
null,
|
||||
Snackbars.Duration.LONG,
|
||||
MainSnackbarHostKey.MainChrome.INSTANCE,
|
||||
@@ -1413,7 +1413,7 @@ public class ConversationListFragment extends MainFragment implements Conversati
|
||||
boolean hasUnread = Stream.of(viewModel.currentSelectedConversations()).anyMatch(conversation -> !conversation.getThreadRecord().isRead());
|
||||
boolean hasUnpinned = Stream.of(viewModel.currentSelectedConversations()).anyMatch(conversation -> !conversation.getThreadRecord().isPinned());
|
||||
boolean hasUnmuted = Stream.of(viewModel.currentSelectedConversations()).anyMatch(conversation -> !conversation.getThreadRecord().getRecipient().live().get().isMuted());
|
||||
boolean canPin = viewModel.getPinnedCount() < MAXIMUM_PINNED_CONVERSATIONS;
|
||||
boolean canPin = viewModel.getPinnedCount() < RemoteConfig.pinnedChatLimit();
|
||||
|
||||
if (mainToolbarViewModel.isInActionMode()) {
|
||||
mainToolbarViewModel.setActionModeCount(count);
|
||||
|
||||
@@ -564,6 +564,15 @@ object RemoteConfig {
|
||||
hotSwappable = true
|
||||
)
|
||||
|
||||
/** The maximum number of pinned conversations a user can have. */
|
||||
@JvmStatic
|
||||
@get:JvmName("pinnedChatLimit")
|
||||
val pinnedChatLimit: Int by remoteInt(
|
||||
key = "global.pinnedChatLimit",
|
||||
defaultValue = 4,
|
||||
hotSwappable = true
|
||||
)
|
||||
|
||||
/** The maximum number of grapheme */
|
||||
@JvmStatic
|
||||
val maxGroupNameGraphemeLength: Int by remoteValue(
|
||||
|
||||
Reference in New Issue
Block a user