Update emojis in about status.

This commit is contained in:
mtang-signal
2024-10-07 13:38:32 -07:00
parent ca0062f46e
commit d0162d0b21
7 changed files with 3 additions and 39 deletions

View File

@@ -438,7 +438,7 @@ final class GroupMemberListAdapter extends RecyclerView.Adapter<GroupMemberListA
pendingMembers.getInviteCount(),
displayName, pendingMembers.getInviteCount());
bindImageAndText(inviter, displayText, inviter.getFilteredAbout());
bindImageAndText(inviter, displayText, inviter.getAbout());
if (pendingMembers.isCancellable() && adminActionsListener != null) {
popupMenu.setMenu(R.menu.others_invite_pending_menu,

View File

@@ -65,7 +65,6 @@ public class EditAboutFragment extends Fragment implements EditProfileActivity.E
private ImageView emojiView;
private EditText bodyView;
private TextView countView;
private TextView errorView;
private CircularProgressMaterialButton saveButton;
private EditAboutViewModel viewModel;
private LifecycleDisposable lifecycleDisposable;
@@ -82,7 +81,6 @@ public class EditAboutFragment extends Fragment implements EditProfileActivity.E
this.emojiView = view.findViewById(R.id.edit_about_emoji);
this.bodyView = view.findViewById(R.id.edit_about_body);
this.countView = view.findViewById(R.id.edit_about_count);
this.errorView = view.findViewById(R.id.edit_about_error);
this.saveButton = view.findViewById(R.id.edit_about_save);
lifecycleDisposable = new LifecycleDisposable();
@@ -96,7 +94,6 @@ public class EditAboutFragment extends Fragment implements EditProfileActivity.E
EditTextUtil.addGraphemeClusterLimitFilter(bodyView, ABOUT_MAX_GLYPHS);
this.bodyView.addTextChangedListener(new AfterTextChanged(editable -> {
checkValidText(editable.toString());
trimFieldToMaxByteLength(editable);
presentCount(editable.toString());
}));
@@ -131,21 +128,6 @@ public class EditAboutFragment extends Fragment implements EditProfileActivity.E
ViewUtil.focusAndMoveCursorToEndAndOpenKeyboard(bodyView);
}
private void checkValidText(String text) {
boolean isInvalid = false;
for (Character emoji : StringUtil.FILTERED_EMOJIS) {
if (text.contains(Character.toString(emoji))) {
isInvalid = true;
break;
}
}
int colorRes = isInvalid ? R.color.signal_colorError : R.color.signal_colorPrimary;
bodyView.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(requireContext(), colorRes)));
errorView.setVisibility(isInvalid ? View.VISIBLE : View.GONE);
saveButton.setEnabled(!isInvalid);
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
outState.putString(KEY_SELECTED_EMOJI, selectedEmoji);

View File

@@ -367,11 +367,8 @@ class Recipient(
/** The badge to feature on a recipient's avatar, if any. */
val featuredBadge: Badge? = badges.firstOrNull()
/** A string filtering out banned emojis from the about text */
val filteredAbout: String? by lazy { about?.filterNot { StringUtil.FILTERED_EMOJIS.contains(it) } }
/** A string combining the about emoji + text for displaying various places. */
val combinedAboutAndEmoji: String? by lazy { listOf(aboutEmoji, filteredAbout).filter { it.isNotNullOrBlank() }.joinToString(separator = " ").nullIfBlank() }
val combinedAboutAndEmoji: String? by lazy { listOf(aboutEmoji, about).filter { it.isNotNullOrBlank() }.joinToString(separator = " ").nullIfBlank() }
/** Whether or not we should blur the recipient's avatar when showing it in the chat list and other locations. */
val shouldBlurAvatar: Boolean

View File

@@ -96,7 +96,7 @@ class AboutSheet : ComposeBottomSheetDialogFragment() {
displayName = recipient.get().getDisplayName(requireContext()),
shortName = recipient.get().getShortDisplayName(requireContext()),
profileName = recipient.get().profileName.toString(),
about = recipient.get().filteredAbout,
about = recipient.get().about,
verified = verified,
hasAvatar = recipient.get().profileAvatarFileDetails.hasFile(),
recipientForAvatar = recipient.get(),