Split pinned chats into a separate remote config.

This commit is contained in:
Greyson Parrelli
2024-10-17 20:14:53 -04:00
parent 26c40fb86a
commit 6c326f672d
4 changed files with 16 additions and 8 deletions

View File

@@ -78,9 +78,9 @@ public class FromTextView extends SimpleEmojiTextView {
setText(builder);
if (recipient.isBlocked()) setCompoundDrawablesRelativeWithIntrinsicBounds(getBlocked(), null, null, null);
else if (RemoteConfig.getShowChatFolders() && isPinned) setCompoundDrawablesRelativeWithIntrinsicBounds(getPinned(), null, null, null);
else setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, 0);
if (recipient.isBlocked()) setCompoundDrawablesRelativeWithIntrinsicBounds(getBlocked(), null, null, null);
else if (RemoteConfig.getInlinePinnedChats() && isPinned) setCompoundDrawablesRelativeWithIntrinsicBounds(getPinned(), null, null, null);
else setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, 0);
}
private Drawable getBlocked() {

View File

@@ -193,7 +193,7 @@ abstract class ConversationListDataSource implements PagedDataSource<Long, Conve
totalCount++;
}
if (!RemoteConfig.getShowChatFolders() && pinnedCount != 0) {
if (!RemoteConfig.getInlinePinnedChats() && pinnedCount != 0) {
if (unpinnedCount != 0) {
totalCount += 2;
} else {
@@ -209,7 +209,7 @@ abstract class ConversationListDataSource implements PagedDataSource<Long, Conve
List<Cursor> cursors = new ArrayList<>(5);
long originalLimit = limit;
if (!RemoteConfig.getShowChatFolders() && offset == 0 && hasPinnedHeader()) {
if (!RemoteConfig.getInlinePinnedChats() && offset == 0 && hasPinnedHeader()) {
MatrixCursor pinnedHeaderCursor = new MatrixCursor(ConversationReader.HEADER_COLUMN);
pinnedHeaderCursor.addRow(ConversationReader.PINNED_HEADER);
cursors.add(pinnedHeaderCursor);
@@ -220,7 +220,7 @@ abstract class ConversationListDataSource implements PagedDataSource<Long, Conve
cursors.add(pinnedCursor);
limit -= pinnedCursor.getCount();
if (!RemoteConfig.getShowChatFolders() && offset == 0 && hasUnpinnedHeader()) {
if (!RemoteConfig.getInlinePinnedChats() && offset == 0 && hasUnpinnedHeader()) {
MatrixCursor unpinnedHeaderCursor = new MatrixCursor(ConversationReader.HEADER_COLUMN);
unpinnedHeaderCursor.addRow(ConversationReader.UNPINNED_HEADER);
cursors.add(unpinnedHeaderCursor);
@@ -250,7 +250,7 @@ abstract class ConversationListDataSource implements PagedDataSource<Long, Conve
@VisibleForTesting
int getHeaderOffset() {
if (RemoteConfig.getShowChatFolders()) {
if (RemoteConfig.getInlinePinnedChats()) {
return 0;
} else {
return (hasPinnedHeader() ? 1 : 0) + (hasUnpinnedHeader() ? 1 : 0);

View File

@@ -1111,6 +1111,14 @@ object RemoteConfig {
hotSwappable = true
)
/** Whether or not to use the new pinned chat UI. */
@JvmStatic
val inlinePinnedChats: Boolean by remoteBoolean(
key = "android.inlinePinnedChats",
defaultValue = false,
hotSwappable = true
)
@JvmStatic
@get:JvmName("newCallUi")
val newCallUi: Boolean by remoteBoolean(