Remove Message Requests feature flag.
This commit is contained in:
parent
f2fe81d9b5
commit
3d7cffef2b
36 changed files with 81 additions and 285 deletions
|
@ -98,7 +98,7 @@ public final class AvatarPreviewActivity extends PassphraseRequiredActionBarActi
|
|||
})
|
||||
.into(avatar);
|
||||
|
||||
toolbar.setTitle(recipient.toShortString(context));
|
||||
toolbar.setTitle(recipient.getDisplayName(context));
|
||||
});
|
||||
|
||||
avatar.setOnClickListener(v -> toggleUiVisibility());
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ConfirmIdentityDialog extends AlertDialog {
|
|||
super(context);
|
||||
|
||||
Recipient recipient = Recipient.resolved(mismatch.getRecipientId(context));
|
||||
String name = recipient.toShortString(context);
|
||||
String name = recipient.getDisplayName(context);
|
||||
String introduction = context.getString(R.string.ConfirmIdentityDialog_your_safety_number_with_s_has_changed, name, name);
|
||||
SpannableString spannableString = new SpannableString(introduction + " " +
|
||||
context.getString(R.string.ConfirmIdentityDialog_you_may_wish_to_verify_your_safety_number_with_this_contact));
|
||||
|
|
|
@ -522,7 +522,7 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
|||
|
||||
if (failIfNotPush && !isPush) {
|
||||
results.add(new Result(null, false, activity.getString(R.string.GroupCreateActivity_cannot_add_non_push_to_existing_group,
|
||||
recipient.toShortString(activity))));
|
||||
recipient.getDisplayName(activity))));
|
||||
} else if (TextUtils.equals(TextSecurePreferences.getLocalNumber(activity), recipient.getE164().or(""))) {
|
||||
results.add(new Result(null, false, activity.getString(R.string.GroupCreateActivity_youre_already_in_the_group)));
|
||||
} else {
|
||||
|
|
|
@ -181,7 +181,7 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||
private @NonNull String getTitleText(@NonNull MediaItem mediaItem) {
|
||||
String from;
|
||||
if (mediaItem.outgoing) from = getString(R.string.MediaPreviewActivity_you);
|
||||
else if (mediaItem.recipient != null) from = mediaItem.recipient.toShortString(this);
|
||||
else if (mediaItem.recipient != null) from = mediaItem.recipient.getDisplayName(this);
|
||||
else from = "";
|
||||
|
||||
if (showThread) {
|
||||
|
@ -193,7 +193,7 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||
if (threadRecipient.isLocalNumber()) {
|
||||
from = getString(R.string.note_to_self);
|
||||
} else {
|
||||
to = threadRecipient.toShortString(this);
|
||||
to = threadRecipient.getDisplayName(this);
|
||||
}
|
||||
} else {
|
||||
to = getString(R.string.MediaPreviewActivity_you);
|
||||
|
|
|
@ -239,7 +239,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
|
|||
else this.avatar.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
|
||||
this.avatar.setBackgroundColor(recipient.getColor().toActionBarColor(this));
|
||||
this.toolbarLayout.setTitle(recipient.toShortString(this));
|
||||
this.toolbarLayout.setTitle(recipient.getDisplayName(this));
|
||||
this.toolbarLayout.setContentScrimColor(recipient.getColor().toActionBarColor(this));
|
||||
}
|
||||
|
||||
|
@ -439,14 +439,8 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
|
|||
colorPreference.setColors(MaterialColors.CONVERSATION_PALETTE.asConversationColorArray(requireActivity()));
|
||||
colorPreference.setColor(recipient.getColor().toActionBarColor(requireActivity()));
|
||||
|
||||
if (FeatureFlags.profileDisplay()) {
|
||||
aboutPreference.setTitle(recipient.getDisplayName(requireContext()));
|
||||
aboutPreference.setSummary(recipient.resolve().getE164().or(""));
|
||||
} else {
|
||||
aboutPreference.setTitle(formatRecipient(recipient));
|
||||
aboutPreference.setSummary(recipient.getCustomLabel());
|
||||
}
|
||||
|
||||
aboutPreference.setTitle(recipient.getDisplayName(requireContext()));
|
||||
aboutPreference.setSummary(recipient.resolve().getE164().or(""));
|
||||
aboutPreference.setState(recipient.getRegistered() == RecipientDatabase.RegisteredState.REGISTERED, recipient.isBlocked());
|
||||
|
||||
IdentityUtil.getRemoteIdentityKey(getActivity(), recipient).addListener(new ListenableFuture.Listener<Optional<IdentityRecord>>() {
|
||||
|
|
|
@ -486,7 +486,7 @@ public class VerifyIdentityActivity extends PassphraseRequiredActionBarActivity
|
|||
}
|
||||
|
||||
private void setRecipientText(Recipient recipient) {
|
||||
description.setText(Html.fromHtml(String.format(getActivity().getString(R.string.verify_display_fragment__if_you_wish_to_verify_the_security_of_your_end_to_end_encryption_with_s), recipient.toShortString(getContext()))));
|
||||
description.setText(Html.fromHtml(String.format(getActivity().getString(R.string.verify_display_fragment__if_you_wish_to_verify_the_security_of_your_end_to_end_encryption_with_s), recipient.getDisplayName(getContext()))));
|
||||
description.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class FromTextView extends EmojiTextView {
|
|||
}
|
||||
|
||||
public void setText(Recipient recipient, boolean read, @Nullable String suffix) {
|
||||
String fromString = recipient.toShortString(getContext());
|
||||
String fromString = recipient.getDisplayName(getContext());
|
||||
|
||||
int typeface;
|
||||
|
||||
|
@ -61,19 +61,6 @@ public class FromTextView extends EmojiTextView {
|
|||
|
||||
if (recipient.isLocalNumber()) {
|
||||
builder.append(getContext().getString(R.string.note_to_self));
|
||||
} else if (!FeatureFlags.profileDisplay() && recipient.getName(getContext()) == null && !recipient.getProfileName().isEmpty()) {
|
||||
SpannableString profileName = new SpannableString(" (~" + recipient.getProfileName().toString() + ") ");
|
||||
profileName.setSpan(new CenterAlignedRelativeSizeSpan(0.75f), 0, profileName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
profileName.setSpan(new TypefaceSpan("sans-serif-light"), 0, profileName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
profileName.setSpan(new ForegroundColorSpan(ResUtil.getColor(getContext(), R.attr.conversation_list_item_subject_color)), 0, profileName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
if (ViewCompat.getLayoutDirection(this) == ViewCompat.LAYOUT_DIRECTION_RTL){
|
||||
builder.append(profileName);
|
||||
builder.append(fromSpan);
|
||||
} else {
|
||||
builder.append(fromSpan);
|
||||
builder.append(profileName);
|
||||
}
|
||||
} else {
|
||||
builder.append(fromSpan);
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
|
|||
boolean outgoing = messageType != MESSAGE_TYPE_INCOMING;
|
||||
|
||||
authorView.setText(author.isLocalNumber() ? getContext().getString(R.string.QuoteView_you)
|
||||
: author.toShortString(getContext()));
|
||||
: author.getDisplayName(getContext()));
|
||||
|
||||
// We use the raw color resource because Android 4.x was struggling with tints here
|
||||
quoteBarView.setImageResource(author.getColor().toQuoteBarColorResource(getContext(), outgoing));
|
||||
|
|
|
@ -274,7 +274,7 @@ public class ContactsCursorLoader extends CursorLoader {
|
|||
String stringId = recipient.isGroup() ? recipient.requireGroupId().toString() : recipient.getE164().or(recipient.getEmail()).or("");
|
||||
|
||||
recentConversations.addRow(new Object[] { recipient.getId().serialize(),
|
||||
recipient.toShortString(getContext()),
|
||||
recipient.getDisplayName(getContext()),
|
||||
stringId,
|
||||
ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE,
|
||||
"",
|
||||
|
|
|
@ -495,7 +495,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
titleView.setTitle(glideRequests, recipientSnapshot);
|
||||
setActionBarColor(recipientSnapshot.getColor());
|
||||
setBlockedUserState(recipientSnapshot, isSecureText, isDefaultSms);
|
||||
setGroupShareProfileReminder(recipientSnapshot);
|
||||
calculateCharactersRemaining();
|
||||
|
||||
if (recipientSnapshot.getGroupId().isPresent() && recipientSnapshot.getGroupId().get().isV2()) {
|
||||
|
@ -1965,7 +1964,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
titleView.setVerified(identityRecords.isVerified());
|
||||
setBlockedUserState(recipient, isSecureText, isDefaultSms);
|
||||
setActionBarColor(recipient.getColor());
|
||||
setGroupShareProfileReminder(recipient);
|
||||
updateReminders();
|
||||
updateDefaultSubscriptionId(recipient.getDefaultSubscriptionId());
|
||||
initializeSecurity(isSecureText, isDefaultSms);
|
||||
|
@ -2147,12 +2145,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
}
|
||||
|
||||
private void setBlockedUserState(Recipient recipient, boolean isSecureText, boolean isDefaultSms) {
|
||||
if (recipient.isBlocked() && !FeatureFlags.messageRequests()) {
|
||||
unblockButton.setVisibility(View.VISIBLE);
|
||||
inputPanel.setVisibility(View.GONE);
|
||||
makeDefaultSmsButton.setVisibility(View.GONE);
|
||||
registerButton.setVisibility(View.GONE);
|
||||
} else if (!isSecureText && isPushGroupConversation()) {
|
||||
if (!isSecureText && isPushGroupConversation()) {
|
||||
unblockButton.setVisibility(View.GONE);
|
||||
inputPanel.setVisibility(View.GONE);
|
||||
makeDefaultSmsButton.setVisibility(View.GONE);
|
||||
|
@ -2170,19 +2163,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
}
|
||||
}
|
||||
|
||||
private void setGroupShareProfileReminder(@NonNull Recipient recipient) {
|
||||
if (FeatureFlags.messageRequests()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (recipient.isPushGroup() && !recipient.isProfileSharing()) {
|
||||
groupShareProfileView.get().setRecipient(recipient);
|
||||
groupShareProfileView.get().setVisibility(View.VISIBLE);
|
||||
} else if (groupShareProfileView.resolved()) {
|
||||
groupShareProfileView.get().setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void calculateCharactersRemaining() {
|
||||
String messageBody = composeText.getTextTrimmed();
|
||||
TransportOption transportOption = sendButton.getSelectedTransport();
|
||||
|
@ -2396,10 +2376,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
long id = fragment.stageOutgoingMessage(message);
|
||||
|
||||
SimpleTask.run(() -> {
|
||||
if (!FeatureFlags.messageRequests() && initiating) {
|
||||
DatabaseFactory.getRecipientDatabase(this).setProfileSharing(recipient.getId(), true);
|
||||
}
|
||||
|
||||
long resultId = MessageSender.sendPushWithPreUploadedMedia(this, secureMessage, result.getPreUploadResults(), threadId, () -> fragment.releaseOutgoingMessage(id));
|
||||
|
||||
int deleted = DatabaseFactory.getAttachmentDatabase(this).deleteAbandonedPreuploadedAttachments();
|
||||
|
@ -2470,10 +2446,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
final long id = fragment.stageOutgoingMessage(outgoingMessage);
|
||||
|
||||
SimpleTask.run(() -> {
|
||||
if (!FeatureFlags.messageRequests() && initiating) {
|
||||
DatabaseFactory.getRecipientDatabase(this).setProfileSharing(recipient.getId(), true);
|
||||
}
|
||||
|
||||
return MessageSender.send(context, outgoingMessage, threadId, forceSms, () -> fragment.releaseOutgoingMessage(id));
|
||||
}, result -> {
|
||||
sendComplete(result);
|
||||
|
@ -2517,10 +2489,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
new AsyncTask<OutgoingTextMessage, Void, Long>() {
|
||||
@Override
|
||||
protected Long doInBackground(OutgoingTextMessage... messages) {
|
||||
if (!FeatureFlags.messageRequests() && initiating) {
|
||||
DatabaseFactory.getRecipientDatabase(context).setProfileSharing(recipient.getId(), true);
|
||||
}
|
||||
|
||||
return MessageSender.send(context, messages[0], threadId, forceSms, () -> fragment.releaseOutgoingMessage(id));
|
||||
}
|
||||
|
||||
|
@ -3150,7 +3118,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
String[] unverifiedNames = new String[unverifiedIdentities.size()];
|
||||
|
||||
for (int i=0;i<unverifiedIdentities.size();i++) {
|
||||
unverifiedNames[i] = Recipient.resolved(unverifiedIdentities.get(i).getRecipientId()).toShortString(ConversationActivity.this);
|
||||
unverifiedNames[i] = Recipient.resolved(unverifiedIdentities.get(i).getRecipientId()).getDisplayName(ConversationActivity.this);
|
||||
}
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(ConversationActivity.this);
|
||||
|
|
|
@ -198,13 +198,10 @@ public class ConversationFragment extends Fragment {
|
|||
list.setItemAnimator(null);
|
||||
|
||||
snapToTopDataObserver = new ConversationSnapToTopDataObserver(list, new ConversationScrollRequestValidator());
|
||||
conversationBanner = (ConversationBannerView) inflater.inflate(R.layout.conversation_item_banner, container, false);
|
||||
topLoadMoreView = (ViewSwitcher) inflater.inflate(R.layout.load_more_header, container, false);
|
||||
bottomLoadMoreView = (ViewSwitcher) inflater.inflate(R.layout.load_more_header, container, false);
|
||||
|
||||
if (FeatureFlags.messageRequests()) {
|
||||
conversationBanner = (ConversationBannerView) inflater.inflate(R.layout.conversation_item_banner, container, false);
|
||||
}
|
||||
|
||||
topLoadMoreView = (ViewSwitcher) inflater.inflate(R.layout.load_more_header, container, false);
|
||||
bottomLoadMoreView = (ViewSwitcher) inflater.inflate(R.layout.load_more_header, container, false);
|
||||
initializeLoadMoreView(topLoadMoreView);
|
||||
initializeLoadMoreView(bottomLoadMoreView);
|
||||
|
||||
|
@ -216,8 +213,6 @@ public class ConversationFragment extends Fragment {
|
|||
this::handleReplyMessage
|
||||
).attachToRecyclerView(list);
|
||||
|
||||
setupListLayoutListeners();
|
||||
|
||||
this.conversationViewModel = ViewModelProviders.of(requireActivity(), new ConversationViewModel.Factory()).get(ConversationViewModel.class);
|
||||
conversationViewModel.getMessages().observe(this, list -> {
|
||||
if (getListAdapter() != null && !list.getDataSource().isInvalid()) {
|
||||
|
@ -232,26 +227,6 @@ public class ConversationFragment extends Fragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
private void setupListLayoutListeners() {
|
||||
if (!FeatureFlags.messageRequests()) {
|
||||
return;
|
||||
}
|
||||
|
||||
list.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> setListVerticalTranslation());
|
||||
|
||||
list.addOnChildAttachStateChangeListener(new RecyclerView.OnChildAttachStateChangeListener() {
|
||||
@Override
|
||||
public void onChildViewAttachedToWindow(@NonNull View view) {
|
||||
setListVerticalTranslation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChildViewDetachedFromWindow(@NonNull View view) {
|
||||
setListVerticalTranslation();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setListVerticalTranslation() {
|
||||
if (list.canScrollVertically(1) || list.canScrollVertically(-1) || list.getChildCount() == 0) {
|
||||
list.setTranslationY(0);
|
||||
|
@ -447,7 +422,7 @@ public class ConversationFragment extends Fragment {
|
|||
setLastSeen(conversationViewModel.getLastSeen());
|
||||
|
||||
emptyConversationBanner.setVisibility(View.GONE);
|
||||
} else if (FeatureFlags.messageRequests() && threadId == -1) {
|
||||
} else if (threadId == -1) {
|
||||
emptyConversationBanner.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
@ -884,18 +859,14 @@ public class ConversationFragment extends Fragment {
|
|||
}
|
||||
|
||||
Runnable afterScroll = () -> {
|
||||
if (FeatureFlags.messageRequests()) {
|
||||
adapter.setFooterView(conversationBanner);
|
||||
if (!conversation.isMessageRequestAccepted()) {
|
||||
snapToTopDataObserver.requestScrollPosition(adapter.getItemCount() - 1);
|
||||
}
|
||||
} else {
|
||||
adapter.setFooterView(null);
|
||||
adapter.setFooterView(conversationBanner);
|
||||
if (!conversation.isMessageRequestAccepted()) {
|
||||
snapToTopDataObserver.requestScrollPosition(adapter.getItemCount() - 1);
|
||||
}
|
||||
|
||||
setLastSeen(conversation.getLastSeen());
|
||||
|
||||
if (FeatureFlags.messageRequests() && !conversation.hasPreMessageRequestMessages()) {
|
||||
if (!conversation.hasPreMessageRequestMessages()) {
|
||||
clearHeaderIfNotTyping(adapter);
|
||||
} else {
|
||||
if (!conversation.hasSent() && !recipient.get().isSystemContact() && !recipient.get().isGroup() && recipient.get().getRegistered() == RecipientDatabase.RegisteredState.REGISTERED) {
|
||||
|
@ -925,7 +896,7 @@ public class ConversationFragment extends Fragment {
|
|||
.withOnPerformScroll((layoutManager, position) -> layoutManager.scrollToPositionWithOffset(position, list.getHeight()))
|
||||
.withOnScrollRequestComplete(afterScroll)
|
||||
.submit();
|
||||
} else if (FeatureFlags.messageRequests()) {
|
||||
} else {
|
||||
snapToTopDataObserver.buildScrollPosition(adapter.getItemCount() - 1)
|
||||
.withOnScrollRequestComplete(afterScroll)
|
||||
.submit();
|
||||
|
|
|
@ -1002,21 +1002,8 @@ public class ConversationItem extends LinearLayout implements BindableConversati
|
|||
@SuppressLint("SetTextI18n")
|
||||
private void setGroupMessageStatus(MessageRecord messageRecord, Recipient recipient) {
|
||||
if (groupThread && !messageRecord.isOutgoing() && groupSender != null && groupSenderProfileName != null) {
|
||||
|
||||
if (FeatureFlags.profileDisplay()) {
|
||||
groupSender.setText(recipient.getDisplayName(getContext()));
|
||||
groupSenderProfileName.setVisibility(View.GONE);
|
||||
} else {
|
||||
groupSender.setText(recipient.toShortString(context));
|
||||
|
||||
if (recipient.getName(context) == null && !recipient.getProfileName().isEmpty()) {
|
||||
groupSenderProfileName.setText("~" + recipient.getProfileName().toString());
|
||||
groupSenderProfileName.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
groupSenderProfileName.setText(null);
|
||||
groupSenderProfileName.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
groupSender.setText(recipient.getDisplayName(getContext()));
|
||||
groupSenderProfileName.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,16 +113,9 @@ public class ConversationTitleView extends RelativeLayout {
|
|||
}
|
||||
|
||||
private void setRecipientTitle(Recipient recipient) {
|
||||
if (FeatureFlags.profileDisplay()) {
|
||||
if (recipient.isGroup()) setGroupRecipientTitle(recipient);
|
||||
else if (recipient.isLocalNumber()) setSelfTitle();
|
||||
else setIndividualRecipientTitle(recipient);
|
||||
} else {
|
||||
if (recipient.isGroup()) setGroupRecipientTitle(recipient);
|
||||
else if (recipient.isLocalNumber()) setSelfTitle();
|
||||
else if (TextUtils.isEmpty(recipient.getName(getContext()))) setNonContactRecipientTitle(recipient);
|
||||
else setContactRecipientTitle(recipient);
|
||||
}
|
||||
if (recipient.isGroup()) setGroupRecipientTitle(recipient);
|
||||
else if (recipient.isLocalNumber()) setSelfTitle();
|
||||
else setIndividualRecipientTitle(recipient);
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
|
@ -138,25 +131,8 @@ public class ConversationTitleView extends RelativeLayout {
|
|||
updateSubtitleVisibility();
|
||||
}
|
||||
|
||||
private void setContactRecipientTitle(Recipient recipient) {
|
||||
this.title.setText(recipient.getName(getContext()));
|
||||
|
||||
if (TextUtils.isEmpty(recipient.getCustomLabel())) {
|
||||
this.subtitle.setText(null);
|
||||
} else {
|
||||
this.subtitle.setText(recipient.getCustomLabel());
|
||||
}
|
||||
|
||||
updateSubtitleVisibility();
|
||||
}
|
||||
|
||||
private void setGroupRecipientTitle(Recipient recipient) {
|
||||
if (FeatureFlags.profileDisplay()) {
|
||||
this.title.setText(recipient.getDisplayName(getContext()));
|
||||
} else {
|
||||
this.title.setText(recipient.getName(getContext()));
|
||||
}
|
||||
|
||||
this.title.setText(recipient.getDisplayName(getContext()));
|
||||
this.subtitle.setText(Stream.of(recipient.getParticipants())
|
||||
.sorted((a, b) -> Boolean.compare(a.isLocalNumber(), b.isLocalNumber()))
|
||||
.map(r -> r.isLocalNumber() ? getResources().getString(R.string.ConversationTitleView_you)
|
||||
|
|
|
@ -428,7 +428,7 @@ public class ConversationListItem extends RelativeLayout
|
|||
} else if (SmsDatabase.Types.isMissedCall(thread.getType())) {
|
||||
return emphasisAdded(context.getString(org.thoughtcrime.securesms.R.string.ThreadRecord_missed_call));
|
||||
} else if (SmsDatabase.Types.isJoinedType(thread.getType())) {
|
||||
return emphasisAdded(context.getString(R.string.ThreadRecord_s_is_on_signal, thread.getRecipient().toShortString(context)));
|
||||
return emphasisAdded(context.getString(R.string.ThreadRecord_s_is_on_signal, thread.getRecipient().getDisplayName(context)));
|
||||
} else if (SmsDatabase.Types.isExpirationTimerUpdate(thread.getType())) {
|
||||
int seconds = (int)(thread.getExpiresIn() / 1000);
|
||||
if (seconds <= 0) {
|
||||
|
@ -440,7 +440,7 @@ public class ConversationListItem extends RelativeLayout
|
|||
if (thread.getRecipient().isGroup()) {
|
||||
return emphasisAdded(context.getString(R.string.ThreadRecord_safety_number_changed));
|
||||
} else {
|
||||
return emphasisAdded(context.getString(R.string.ThreadRecord_your_safety_number_with_s_has_changed, thread.getRecipient().toShortString(context)));
|
||||
return emphasisAdded(context.getString(R.string.ThreadRecord_your_safety_number_with_s_has_changed, thread.getRecipient().getDisplayName(context)));
|
||||
}
|
||||
} else if (SmsDatabase.Types.isIdentityVerified(thread.getType())) {
|
||||
return emphasisAdded(context.getString(R.string.ThreadRecord_you_marked_verified));
|
||||
|
|
|
@ -116,32 +116,32 @@ public abstract class MessageRecord extends DisplayRecord {
|
|||
} else if (isGroupQuit() && isOutgoing()) {
|
||||
return new SpannableString(context.getString(R.string.MessageRecord_left_group));
|
||||
} else if (isGroupQuit()) {
|
||||
return new SpannableString(context.getString(R.string.ConversationItem_group_action_left, getIndividualRecipient().toShortString(context)));
|
||||
return new SpannableString(context.getString(R.string.ConversationItem_group_action_left, getIndividualRecipient().getDisplayName(context)));
|
||||
} else if (isIncomingCall()) {
|
||||
return new SpannableString(context.getString(R.string.MessageRecord_s_called_you, getIndividualRecipient().toShortString(context)));
|
||||
return new SpannableString(context.getString(R.string.MessageRecord_s_called_you, getIndividualRecipient().getDisplayName(context)));
|
||||
} else if (isOutgoingCall()) {
|
||||
return new SpannableString(context.getString(R.string.MessageRecord_you_called));
|
||||
} else if (isMissedCall()) {
|
||||
return new SpannableString(context.getString(R.string.MessageRecord_missed_call));
|
||||
} else if (isJoined()) {
|
||||
return new SpannableString(context.getString(R.string.MessageRecord_s_joined_signal, getIndividualRecipient().toShortString(context)));
|
||||
return new SpannableString(context.getString(R.string.MessageRecord_s_joined_signal, getIndividualRecipient().getDisplayName(context)));
|
||||
} else if (isExpirationTimerUpdate()) {
|
||||
int seconds = (int)(getExpiresIn() / 1000);
|
||||
if (seconds <= 0) {
|
||||
return isOutgoing() ? new SpannableString(context.getString(R.string.MessageRecord_you_disabled_disappearing_messages))
|
||||
: new SpannableString(context.getString(R.string.MessageRecord_s_disabled_disappearing_messages, getIndividualRecipient().toShortString(context)));
|
||||
: new SpannableString(context.getString(R.string.MessageRecord_s_disabled_disappearing_messages, getIndividualRecipient().getDisplayName(context)));
|
||||
}
|
||||
String time = ExpirationUtil.getExpirationDisplayValue(context, seconds);
|
||||
return isOutgoing() ? new SpannableString(context.getString(R.string.MessageRecord_you_set_disappearing_message_time_to_s, time))
|
||||
: new SpannableString(context.getString(R.string.MessageRecord_s_set_disappearing_message_time_to_s, getIndividualRecipient().toShortString(context), time));
|
||||
: new SpannableString(context.getString(R.string.MessageRecord_s_set_disappearing_message_time_to_s, getIndividualRecipient().getDisplayName(context), time));
|
||||
} else if (isIdentityUpdate()) {
|
||||
return new SpannableString(context.getString(R.string.MessageRecord_your_safety_number_with_s_has_changed, getIndividualRecipient().toShortString(context)));
|
||||
return new SpannableString(context.getString(R.string.MessageRecord_your_safety_number_with_s_has_changed, getIndividualRecipient().getDisplayName(context)));
|
||||
} else if (isIdentityVerified()) {
|
||||
if (isOutgoing()) return new SpannableString(context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_verified, getIndividualRecipient().toShortString(context)));
|
||||
else return new SpannableString(context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_verified_from_another_device, getIndividualRecipient().toShortString(context)));
|
||||
if (isOutgoing()) return new SpannableString(context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_verified, getIndividualRecipient().getDisplayName(context)));
|
||||
else return new SpannableString(context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_verified_from_another_device, getIndividualRecipient().getDisplayName(context)));
|
||||
} else if (isIdentityDefault()) {
|
||||
if (isOutgoing()) return new SpannableString(context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_unverified, getIndividualRecipient().toShortString(context)));
|
||||
else return new SpannableString(context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_unverified_from_another_device, getIndividualRecipient().toShortString(context)));
|
||||
if (isOutgoing()) return new SpannableString(context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_unverified, getIndividualRecipient().getDisplayName(context)));
|
||||
else return new SpannableString(context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_unverified_from_another_device, getIndividualRecipient().getDisplayName(context)));
|
||||
}
|
||||
|
||||
return new SpannableString(getBody());
|
||||
|
@ -178,7 +178,7 @@ public abstract class MessageRecord extends DisplayRecord {
|
|||
}
|
||||
|
||||
/**
|
||||
* Describes a UUID by it's corresponding recipient's {@link Recipient#toShortString}.
|
||||
* Describes a UUID by it's corresponding recipient's {@link Recipient#getDisplayName(Context)}.
|
||||
*/
|
||||
private static class ShortStringDescriptionStrategy implements GroupsV2UpdateMessageProducer.DescribeMemberStrategy {
|
||||
|
||||
|
@ -193,7 +193,7 @@ public abstract class MessageRecord extends DisplayRecord {
|
|||
if (UuidUtil.UNKNOWN_UUID.equals(uuid)) {
|
||||
return context.getString(R.string.MessageRecord_unknown);
|
||||
}
|
||||
return Recipient.resolved(RecipientId.from(uuid, null)).toShortString(context);
|
||||
return Recipient.resolved(RecipientId.from(uuid, null)).getDisplayName(context);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ public class SmsMessageRecord extends MessageRecord {
|
|||
} else if (isEndSession() && isOutgoing()) {
|
||||
return emphasisAdded(context.getString(R.string.SmsMessageRecord_secure_session_reset));
|
||||
} else if (isEndSession()) {
|
||||
return emphasisAdded(context.getString(R.string.SmsMessageRecord_secure_session_reset_s, getIndividualRecipient().toShortString(context)));
|
||||
return emphasisAdded(context.getString(R.string.SmsMessageRecord_secure_session_reset_s, getIndividualRecipient().getDisplayName(context)));
|
||||
} else if (SmsDatabase.Types.isUnsupportedMessageType(type)) {
|
||||
return emphasisAdded(context.getString(R.string.SmsMessageRecord_this_message_could_not_be_processed_because_it_was_sent_from_a_newer_version));
|
||||
} else if (SmsDatabase.Types.isInvalidMessageType(type)) {
|
||||
|
|
|
@ -110,7 +110,7 @@ public final class GroupV1MessageProcessor {
|
|||
|
||||
Recipient sender = Recipient.externalPush(context, content.getSender());
|
||||
|
||||
if (FeatureFlags.messageRequests() && (sender.isSystemContact() || sender.isProfileSharing())) {
|
||||
if (sender.isSystemContact() || sender.isProfileSharing()) {
|
||||
Log.i(TAG, "Auto-enabling profile sharing because 'adder' is trusted. contact: " + sender.isSystemContact() + ", profileSharing: " + sender.isProfileSharing());
|
||||
DatabaseFactory.getRecipientDatabase(context).setProfileSharing(Recipient.externalGroup(context, id).getId(), true);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ public final class MiscellaneousValues extends SignalStoreValues {
|
|||
|
||||
@Override
|
||||
void onFirstEverAppLaunch() {
|
||||
putLong(MESSAGE_REQUEST_ENABLE_TIME, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public long getLastPrekeyRefreshTime() {
|
||||
|
@ -25,11 +26,7 @@ public final class MiscellaneousValues extends SignalStoreValues {
|
|||
}
|
||||
|
||||
public long getMessageRequestEnableTime() {
|
||||
return getLong(MESSAGE_REQUEST_ENABLE_TIME, 0);
|
||||
}
|
||||
|
||||
public void setMessageRequestEnableTime(long time) {
|
||||
putLong(MESSAGE_REQUEST_ENABLE_TIME, time);
|
||||
return getLong(MESSAGE_REQUEST_ENABLE_TIME, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public long getLastProfileRefreshTime() {
|
||||
|
|
|
@ -37,9 +37,14 @@ public final class SignalStore {
|
|||
}
|
||||
|
||||
public static void onFirstEverAppLaunch() {
|
||||
kbsValues().onFirstEverAppLaunch();
|
||||
registrationValues().onFirstEverAppLaunch();
|
||||
pinValues().onFirstEverAppLaunch();
|
||||
remoteConfigValues().onFirstEverAppLaunch();
|
||||
storageServiceValues().onFirstEverAppLaunch();
|
||||
uiHints().onFirstEverAppLaunch();
|
||||
tooltips().onFirstEverAppLaunch();
|
||||
misc().onFirstEverAppLaunch();
|
||||
}
|
||||
|
||||
public static @NonNull KbsValues kbsValues() {
|
||||
|
@ -93,28 +98,4 @@ public final class SignalStore {
|
|||
private static @NonNull KeyValueStore getStore() {
|
||||
return INSTANCE.store;
|
||||
}
|
||||
|
||||
private static void putBlob(@NonNull String key, byte[] value) {
|
||||
getStore().beginWrite().putBlob(key, value).apply();
|
||||
}
|
||||
|
||||
private static void putBoolean(@NonNull String key, boolean value) {
|
||||
getStore().beginWrite().putBoolean(key, value).apply();
|
||||
}
|
||||
|
||||
private static void putFloat(@NonNull String key, float value) {
|
||||
getStore().beginWrite().putFloat(key, value).apply();
|
||||
}
|
||||
|
||||
private static void putInteger(@NonNull String key, int value) {
|
||||
getStore().beginWrite().putInteger(key, value).apply();
|
||||
}
|
||||
|
||||
private static void putLong(@NonNull String key, long value) {
|
||||
getStore().beginWrite().putLong(key, value).apply();
|
||||
}
|
||||
|
||||
private static void putString(@NonNull String key, String value) {
|
||||
getStore().beginWrite().putString(key, value).apply();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -389,15 +389,15 @@ final class MediaGalleryAllAdapter extends StickyHeaderGridAdapter {
|
|||
|
||||
if (showThread && (from.isLocalNumber() || thread.isGroup())) {
|
||||
if (from.isLocalNumber()) {
|
||||
return context.getString(R.string.MediaOverviewActivity_sent_by_you_to_s, thread.toShortString(context));
|
||||
return context.getString(R.string.MediaOverviewActivity_sent_by_you_to_s, thread.getDisplayName(context));
|
||||
} else {
|
||||
return context.getString(R.string.MediaOverviewActivity_sent_by_s_to_s, from.toShortString(context), thread.toShortString(context));
|
||||
return context.getString(R.string.MediaOverviewActivity_sent_by_s_to_s, from.getDisplayName(context), thread.getDisplayName(context));
|
||||
}
|
||||
} else {
|
||||
if (from.isLocalNumber()) {
|
||||
return context.getString(R.string.MediaOverviewActivity_sent_by_you);
|
||||
} else {
|
||||
return context.getString(R.string.MediaOverviewActivity_sent_by_s, from.toShortString(context));
|
||||
return context.getString(R.string.MediaOverviewActivity_sent_by_s, from.getDisplayName(context));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,8 +200,8 @@ public final class MediaOverviewActivity extends PassphraseRequiredActionBarActi
|
|||
SimpleTask.run(() -> DatabaseFactory.getThreadDatabase(this).getRecipientForThreadId(threadId),
|
||||
(recipient) -> {
|
||||
if (recipient != null) {
|
||||
getSupportActionBar().setTitle(recipient.toShortString(this));
|
||||
recipient.live().observe(this, r -> getSupportActionBar().setTitle(r.toShortString(this)));
|
||||
getSupportActionBar().setTitle(recipient.getDisplayName(this));
|
||||
recipient.live().observe(this, r -> getSupportActionBar().setTitle(r.getDisplayName(this)));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -220,8 +220,7 @@ public final class Megaphones {
|
|||
}
|
||||
|
||||
private static boolean shouldShowMessageRequestsMegaphone() {
|
||||
boolean userHasAProfileName = Recipient.self().getProfileName() != ProfileName.EMPTY;
|
||||
return FeatureFlags.messageRequests() && !userHasAProfileName;
|
||||
return Recipient.self().getProfileName() == ProfileName.EMPTY;
|
||||
}
|
||||
|
||||
public enum Event {
|
||||
|
|
|
@ -140,7 +140,7 @@ public class MessageRequestViewModel extends ViewModel {
|
|||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
private void loadMessageRequestAccepted(@NonNull Recipient recipient) {
|
||||
if (FeatureFlags.messageRequests() && recipient.isBlocked()) {
|
||||
if (recipient.isBlocked()) {
|
||||
displayState.postValue(DisplayState.DISPLAY_MESSAGE_REQUEST);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public abstract class AbstractNotificationBuilder extends NotificationCompat.Bui
|
|||
|
||||
protected CharSequence getStyledMessage(@NonNull Recipient recipient, @Nullable CharSequence message) {
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder();
|
||||
builder.append(Util.getBoldedString(recipient.toShortString(context)));
|
||||
builder.append(Util.getBoldedString(recipient.getDisplayName(context)));
|
||||
builder.append(": ");
|
||||
builder.append(message == null ? "" : message);
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public class MultipleRecipientNotificationBuilder extends AbstractNotificationBu
|
|||
public void setMostRecentSender(Recipient recipient) {
|
||||
if (privacy.isDisplayContact()) {
|
||||
setContentText(context.getString(R.string.MessageNotifier_most_recent_from_s,
|
||||
recipient.toShortString(context)));
|
||||
recipient.getDisplayName(context)));
|
||||
}
|
||||
|
||||
if (recipient.getNotificationChannel() != null) {
|
||||
|
@ -68,7 +68,7 @@ public class MultipleRecipientNotificationBuilder extends AbstractNotificationBu
|
|||
if (privacy.isDisplayMessage()) {
|
||||
messageBodies.add(getStyledMessage(sender, body));
|
||||
} else if (privacy.isDisplayContact()) {
|
||||
messageBodies.add(Util.getBoldedString(sender.toShortString(context)));
|
||||
messageBodies.add(Util.getBoldedString(sender.getDisplayName(context)));
|
||||
}
|
||||
|
||||
if (privacy.isDisplayContact() && sender.getContactUri() != null) {
|
||||
|
|
|
@ -76,7 +76,7 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil
|
|||
setChannelId(channelId != null ? channelId : NotificationChannels.getMessagesChannel(context));
|
||||
|
||||
if (privacy.isDisplayContact()) {
|
||||
setContentTitle(recipient.toShortString(context));
|
||||
setContentTitle(recipient.getDisplayName(context));
|
||||
|
||||
if (recipient.getContactUri() != null) {
|
||||
addPerson(recipient.getContactUri().toString());
|
||||
|
@ -124,7 +124,7 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil
|
|||
SpannableStringBuilder stringBuilder = new SpannableStringBuilder();
|
||||
|
||||
if (privacy.isDisplayContact() && threadRecipients.isGroup()) {
|
||||
stringBuilder.append(Util.getBoldedString(individualRecipient.toShortString(context) + ": "));
|
||||
stringBuilder.append(Util.getBoldedString(individualRecipient.getDisplayName(context) + ": "));
|
||||
}
|
||||
|
||||
if (privacy.isDisplayMessage()) {
|
||||
|
|
|
@ -63,7 +63,7 @@ public class BlockedContactListItem extends RelativeLayout implements RecipientF
|
|||
final TextView nameView = this.nameView;
|
||||
|
||||
contactPhotoImage.setAvatar(glideRequests, recipient, false);
|
||||
nameView.setText(recipient.toShortString(getContext()));
|
||||
nameView.setText(recipient.getDisplayName(getContext()));
|
||||
}
|
||||
|
||||
public Recipient getRecipient() {
|
||||
|
|
|
@ -42,7 +42,7 @@ public class UnknownSenderView extends FrameLayout {
|
|||
|
||||
new AlertDialog.Builder(getContext())
|
||||
.setIconAttribute(R.attr.dialog_alert_icon)
|
||||
.setTitle(getContext().getString(R.string.UnknownSenderView_block_s, recipient.toShortString(context)))
|
||||
.setTitle(getContext().getString(R.string.UnknownSenderView_block_s, recipient.getDisplayName(context)))
|
||||
.setMessage(R.string.UnknownSenderView_blocked_contacts_will_no_longer_be_able_to_send_you_messages_or_call_you)
|
||||
.setPositiveButton(R.string.UnknownSenderView_block, (dialog, which) -> {
|
||||
new AsyncTask<Void, Void, Void>() {
|
||||
|
@ -70,7 +70,7 @@ public class UnknownSenderView extends FrameLayout {
|
|||
|
||||
new AlertDialog.Builder(getContext())
|
||||
.setIconAttribute(R.attr.dialog_info_icon)
|
||||
.setTitle(getContext().getString(R.string.UnknownSenderView_share_profile_with_s, recipient.toShortString(context)))
|
||||
.setTitle(getContext().getString(R.string.UnknownSenderView_share_profile_with_s, recipient.getDisplayName(context)))
|
||||
.setMessage(R.string.UnknownSenderView_the_easiest_way_to_share_your_profile_information_is_to_add_the_sender_to_your_contacts)
|
||||
.setPositiveButton(R.string.UnknownSenderView_share_profile, (dialog, which) -> {
|
||||
new AsyncTask<Void, Void, Void>() {
|
||||
|
|
|
@ -404,7 +404,7 @@ public class Recipient {
|
|||
List<String> names = new LinkedList<>();
|
||||
|
||||
for (Recipient recipient : participants) {
|
||||
names.add(recipient.toShortString(context));
|
||||
names.add(recipient.getDisplayName(context));
|
||||
}
|
||||
|
||||
return Util.join(names, ", ");
|
||||
|
@ -413,15 +413,6 @@ public class Recipient {
|
|||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO [UUID] -- Remove once UUID Feature Flag is removed
|
||||
*/
|
||||
@Deprecated
|
||||
public @NonNull String toShortString(@NonNull Context context) {
|
||||
if (FeatureFlags.profileDisplay()) return getDisplayName(context);
|
||||
else return Optional.fromNullable(getName(context)).or(getSmsAddress()).or("");
|
||||
}
|
||||
|
||||
/**
|
||||
* False iff it {@link #getDisplayName} would fall back to e164, email or unknown.
|
||||
*/
|
||||
|
@ -600,11 +591,6 @@ public class Recipient {
|
|||
return profileName;
|
||||
}
|
||||
|
||||
public @Nullable String getCustomLabel() {
|
||||
if (FeatureFlags.profileDisplay()) throw new AssertionError("This method should never be called if PROFILE_DISPLAY is enabled.");
|
||||
return customLabel;
|
||||
}
|
||||
|
||||
public @Nullable String getProfileAvatar() {
|
||||
return profileAvatar;
|
||||
}
|
||||
|
|
|
@ -98,10 +98,7 @@ public class RecipientUtil {
|
|||
DatabaseFactory.getRecipientDatabase(context).setBlocked(recipient.getId(), false);
|
||||
ApplicationDependencies.getJobManager().add(new MultiDeviceBlockedUpdateJob());
|
||||
StorageSyncHelper.scheduleSyncForDataChange();
|
||||
|
||||
if (FeatureFlags.messageRequests()) {
|
||||
ApplicationDependencies.getJobManager().add(MultiDeviceMessageRequestResponseJob.forAccept(recipient.getId()));
|
||||
}
|
||||
ApplicationDependencies.getJobManager().add(MultiDeviceMessageRequestResponseJob.forAccept(recipient.getId()));
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
|
@ -127,7 +124,7 @@ public class RecipientUtil {
|
|||
*/
|
||||
@WorkerThread
|
||||
public static boolean isMessageRequestAccepted(@NonNull Context context, long threadId) {
|
||||
if (!FeatureFlags.messageRequests() || threadId < 0) {
|
||||
if (threadId < 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -146,7 +143,7 @@ public class RecipientUtil {
|
|||
*/
|
||||
@WorkerThread
|
||||
public static boolean isMessageRequestAccepted(@NonNull Context context, @Nullable Recipient threadRecipient) {
|
||||
if (!FeatureFlags.messageRequests() || threadRecipient == null) {
|
||||
if (threadRecipient == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -159,20 +156,12 @@ public class RecipientUtil {
|
|||
*/
|
||||
@WorkerThread
|
||||
public static boolean isPreMessageRequestThread(@NonNull Context context, long threadId) {
|
||||
if (!FeatureFlags.messageRequests()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
long beforeTime = SignalStore.misc().getMessageRequestEnableTime();
|
||||
return DatabaseFactory.getMmsSmsDatabase(context).getConversationCount(threadId, beforeTime) > 0;
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
public static void shareProfileIfFirstSecureMessage(@NonNull Context context, @NonNull Recipient recipient) {
|
||||
if (!FeatureFlags.messageRequests()) {
|
||||
return;
|
||||
}
|
||||
|
||||
long threadId = DatabaseFactory.getThreadDatabase(context).getThreadIdIfExistsFor(recipient);
|
||||
|
||||
if (isPreMessageRequestThread(context, threadId)) {
|
||||
|
|
|
@ -114,7 +114,7 @@ final class RecipientDialogViewModel extends ViewModel {
|
|||
|
||||
void onMakeGroupAdminClicked(@NonNull Activity activity) {
|
||||
new AlertDialog.Builder(activity)
|
||||
.setMessage(context.getString(R.string.RecipientBottomSheet_s_will_be_able_to_edit_group, Objects.requireNonNull(recipient.getValue()).toShortString(context)))
|
||||
.setMessage(context.getString(R.string.RecipientBottomSheet_s_will_be_able_to_edit_group, Objects.requireNonNull(recipient.getValue()).getDisplayName(context)))
|
||||
.setPositiveButton(R.string.RecipientBottomSheet_make_group_admin,
|
||||
(dialog, which) -> {
|
||||
adminActionBusy.setValue(true);
|
||||
|
@ -132,7 +132,7 @@ final class RecipientDialogViewModel extends ViewModel {
|
|||
|
||||
void onRemoveGroupAdminClicked(@NonNull Activity activity) {
|
||||
new AlertDialog.Builder(activity)
|
||||
.setMessage(context.getString(R.string.RecipientBottomSheet_remove_s_as_group_admin, Objects.requireNonNull(recipient.getValue()).toShortString(context)))
|
||||
.setMessage(context.getString(R.string.RecipientBottomSheet_remove_s_as_group_admin, Objects.requireNonNull(recipient.getValue()).getDisplayName(context)))
|
||||
.setPositiveButton(R.string.RecipientBottomSheet_remove_as_admin,
|
||||
(dialog, which) -> {
|
||||
adminActionBusy.setValue(true);
|
||||
|
@ -151,7 +151,7 @@ final class RecipientDialogViewModel extends ViewModel {
|
|||
void onRemoveFromGroupClicked(@NonNull Activity activity, @NonNull Runnable onSuccess) {
|
||||
recipientDialogRepository.getGroupName(title ->
|
||||
new AlertDialog.Builder(activity)
|
||||
.setMessage(context.getString(R.string.RecipientBottomSheet_remove_s_from_s, Objects.requireNonNull(recipient.getValue()).toShortString(context), title))
|
||||
.setMessage(context.getString(R.string.RecipientBottomSheet_remove_s_from_s, Objects.requireNonNull(recipient.getValue()).getDisplayName(context), title))
|
||||
.setPositiveButton(R.string.RecipientBottomSheet_remove,
|
||||
(dialog, which) -> {
|
||||
adminActionBusy.setValue(true);
|
||||
|
|
|
@ -49,7 +49,7 @@ public class DirectShareService extends ChooserTargetService {
|
|||
|
||||
while ((record = reader.getNext()) != null) {
|
||||
Recipient recipient = Recipient.resolved(record.getRecipient().getId());
|
||||
String name = recipient.toShortString(this);
|
||||
String name = recipient.getDisplayName(this);
|
||||
|
||||
Bitmap avatar;
|
||||
|
||||
|
|
|
@ -50,7 +50,6 @@ public final class FeatureFlags {
|
|||
private static final long FETCH_INTERVAL = TimeUnit.HOURS.toMillis(2);
|
||||
|
||||
private static final String UUIDS = "android.uuids";
|
||||
private static final String MESSAGE_REQUESTS = "android.messageRequests";
|
||||
private static final String USERNAMES = "android.usernames";
|
||||
private static final String PINS_FOR_ALL_MANDATORY = "android.pinsForAllMandatory";
|
||||
private static final String PINS_MEGAPHONE_KILL_SWITCH = "android.pinsMegaphoneKillSwitch";
|
||||
|
@ -75,7 +74,6 @@ public final class FeatureFlags {
|
|||
PINS_FOR_ALL_MANDATORY,
|
||||
PINS_MEGAPHONE_KILL_SWITCH,
|
||||
PROFILE_NAMES_MEGAPHONE,
|
||||
MESSAGE_REQUESTS,
|
||||
ATTACHMENTS_V3,
|
||||
REMOTE_DELETE,
|
||||
PROFILE_FOR_CALLING,
|
||||
|
@ -130,7 +128,6 @@ public final class FeatureFlags {
|
|||
* desired test state.
|
||||
*/
|
||||
private static final Map<String, OnFlagChange> FLAG_CHANGE_LISTENERS = new HashMap<String, OnFlagChange>() {{
|
||||
put(MESSAGE_REQUESTS, (change) -> SignalStore.misc().setMessageRequestEnableTime(change == Change.ENABLED ? System.currentTimeMillis() : 0));
|
||||
put(VERSIONED_PROFILES, (change) -> {
|
||||
if (change == Change.ENABLED) {
|
||||
ApplicationDependencies.getJobManager().add(new ProfileUploadJob());
|
||||
|
@ -195,16 +192,6 @@ public final class FeatureFlags {
|
|||
return getBoolean(UUIDS, false);
|
||||
}
|
||||
|
||||
/** Favoring profile names when displaying contacts. */
|
||||
public static synchronized boolean profileDisplay() {
|
||||
return messageRequests();
|
||||
}
|
||||
|
||||
/** MessageRequest stuff */
|
||||
public static synchronized boolean messageRequests() {
|
||||
return getBoolean(MESSAGE_REQUESTS, false);
|
||||
}
|
||||
|
||||
/** Creating usernames, sending messages by username. Requires {@link #uuids()}. */
|
||||
public static synchronized boolean usernames() {
|
||||
boolean value = getBoolean(USERNAMES, false);
|
||||
|
@ -240,7 +227,7 @@ public final class FeatureFlags {
|
|||
|
||||
/** Whether or not profile sharing is required for calling */
|
||||
public static boolean profileForCalling() {
|
||||
return messageRequests() && getBoolean(PROFILE_FOR_CALLING, false);
|
||||
return getBoolean(PROFILE_FOR_CALLING, false);
|
||||
}
|
||||
|
||||
/** Whether or not to display Calling PIP */
|
||||
|
|
|
@ -119,7 +119,7 @@ public final class GroupUtil {
|
|||
|
||||
public String toString(Recipient sender) {
|
||||
StringBuilder description = new StringBuilder();
|
||||
description.append(context.getString(R.string.MessageRecord_s_updated_group, sender.toShortString(context)));
|
||||
description.append(context.getString(R.string.MessageRecord_s_updated_group, sender.getDisplayName(context)));
|
||||
|
||||
if (groupContext == null) {
|
||||
return description.toString();
|
||||
|
@ -162,7 +162,7 @@ public final class GroupUtil {
|
|||
StringBuilder result = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < recipients.size(); i++) {
|
||||
result.append(Recipient.live(recipients.get(i)).get().toShortString(context));
|
||||
result.append(Recipient.live(recipients.get(i)).get().getDisplayName(context));
|
||||
|
||||
if (i != recipients.size() -1 )
|
||||
result.append(", ");
|
||||
|
|
|
@ -232,11 +232,11 @@ public class IdentityUtil {
|
|||
if (recipients.isEmpty()) return null;
|
||||
|
||||
if (recipients.size() == 1) {
|
||||
String name = recipients.get(0).toShortString(context);
|
||||
String name = recipients.get(0).getDisplayName(context);
|
||||
return context.getString(resourceOne, name);
|
||||
} else {
|
||||
String firstName = recipients.get(0).toShortString(context);
|
||||
String secondName = recipients.get(1).toShortString(context);
|
||||
String firstName = recipients.get(0).getDisplayName(context);
|
||||
String secondName = recipients.get(1).getDisplayName(context);
|
||||
|
||||
if (recipients.size() == 2) {
|
||||
return context.getString(resourceTwo, firstName, secondName);
|
||||
|
|
|
@ -41,26 +41,12 @@ public class RecipientUtilTest {
|
|||
when(DatabaseFactory.getThreadDatabase(any())).thenReturn(mockThreadDatabase);
|
||||
when(DatabaseFactory.getMmsSmsDatabase(any())).thenReturn(mockMmsSmsDatabase);
|
||||
when(DatabaseFactory.getRecipientDatabase(any())).thenReturn(mockRecipientDatabase);
|
||||
|
||||
mockStatic(FeatureFlags.class);
|
||||
when(FeatureFlags.messageRequests()).thenReturn(true);
|
||||
|
||||
when(recipient.getId()).thenReturn(RecipientId.from(5));
|
||||
when(recipient.resolve()).thenReturn(recipient);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenMessageRequestsFlagDisabled_whenIsThreadMessageRequestAccepted_thenIExpectTrue() {
|
||||
// GIVEN
|
||||
when(FeatureFlags.messageRequests()).thenReturn(false);
|
||||
|
||||
// WHEN
|
||||
boolean result = RecipientUtil.isMessageRequestAccepted(context, 1);
|
||||
|
||||
// THEN
|
||||
assertTrue(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenThreadIsNegativeOne_whenIsThreadMessageRequestAccepted_thenIExpectTrue() {
|
||||
// WHEN
|
||||
|
@ -158,18 +144,6 @@ public class RecipientUtilTest {
|
|||
assertTrue(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenMessageRequestsFlagIsOff_whenIsRecipientMessageRequestAccepted_thenIExpectTrue() {
|
||||
// GIVEN
|
||||
when(FeatureFlags.messageRequests()).thenReturn(false);
|
||||
|
||||
// WHEN
|
||||
boolean result = RecipientUtil.isMessageRequestAccepted(context, recipient);
|
||||
|
||||
// THEN
|
||||
assertTrue(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenNonZeroOutgoingSecureMessageCount_whenIsRecipientMessageRequestAccepted_thenIExpectTrue() {
|
||||
// GIVEN
|
||||
|
|
Loading…
Add table
Reference in a new issue