Remove unused context arguments in RecipientUtil.

fork-5.53.8
Cody Henthorne 2022-10-06 08:57:30 -04:00 zatwierdzone przez Greyson Parrelli
rodzic db0bca00ec
commit bef83e4c0c
14 zmienionych plików z 50 dodań i 50 usunięć

Wyświetl plik

@ -69,7 +69,7 @@ class BlockedUsersRepository {
void unblock(@NonNull RecipientId recipientId, @NonNull Runnable success) { void unblock(@NonNull RecipientId recipientId, @NonNull Runnable success) {
SignalExecutors.BOUNDED.execute(() -> { SignalExecutors.BOUNDED.execute(() -> {
RecipientUtil.unblock(context, Recipient.resolved(recipientId)); RecipientUtil.unblock(Recipient.resolved(recipientId));
success.run(); success.run();
}); });
} }

Wyświetl plik

@ -175,7 +175,7 @@ class ConversationSettingsRepository(
fun unblock(recipientId: RecipientId) { fun unblock(recipientId: RecipientId) {
SignalExecutors.BOUNDED.execute { SignalExecutors.BOUNDED.execute {
val recipient = Recipient.resolved(recipientId) val recipient = Recipient.resolved(recipientId)
RecipientUtil.unblock(context, recipient) RecipientUtil.unblock(recipient)
} }
} }
@ -189,7 +189,7 @@ class ConversationSettingsRepository(
fun unblock(groupId: GroupId) { fun unblock(groupId: GroupId) {
SignalExecutors.BOUNDED.execute { SignalExecutors.BOUNDED.execute {
val recipient = Recipient.externalGroupExact(groupId) val recipient = Recipient.externalGroupExact(groupId)
RecipientUtil.unblock(context, recipient) RecipientUtil.unblock(recipient)
} }
} }

Wyświetl plik

@ -1286,7 +1286,7 @@ public class ConversationParentFragment extends Fragment
final Context context = requireContext().getApplicationContext(); final Context context = requireContext().getApplicationContext();
BlockUnblockDialog.showUnblockFor(requireContext(), getLifecycle(), recipient.get(), () -> { BlockUnblockDialog.showUnblockFor(requireContext(), getLifecycle(), recipient.get(), () -> {
SignalExecutors.BOUNDED.execute(() -> { SignalExecutors.BOUNDED.execute(() -> {
RecipientUtil.unblock(context, recipient.get()); RecipientUtil.unblock(recipient.get());
}); });
}); });
} }
@ -2232,7 +2232,7 @@ public class ConversationParentFragment extends Fragment
} }
private void initializeLinkPreviewObserver() { private void initializeLinkPreviewObserver() {
linkPreviewViewModel = new ViewModelProvider(this, new LinkPreviewViewModel.Factory(new LinkPreviewRepository())).get(LinkPreviewViewModel.class); linkPreviewViewModel = new ViewModelProvider(this, (ViewModelProvider.Factory) new LinkPreviewViewModel.Factory(new LinkPreviewRepository())).get(LinkPreviewViewModel.class);
linkPreviewViewModel.getLinkPreviewState().observe(getViewLifecycleOwner(), previewState -> { linkPreviewViewModel.getLinkPreviewState().observe(getViewLifecycleOwner(), previewState -> {
if (previewState == null) return; if (previewState == null) return;
@ -2252,7 +2252,7 @@ public class ConversationParentFragment extends Fragment
private void initializeSearchObserver() { private void initializeSearchObserver() {
ConversationSearchViewModel.Factory viewModelFactory = new ConversationSearchViewModel.Factory(getString(R.string.note_to_self)); ConversationSearchViewModel.Factory viewModelFactory = new ConversationSearchViewModel.Factory(getString(R.string.note_to_self));
searchViewModel = new ViewModelProvider(this, viewModelFactory).get(ConversationSearchViewModel.class); searchViewModel = new ViewModelProvider(this, (ViewModelProvider.Factory) viewModelFactory).get(ConversationSearchViewModel.class);
searchViewModel.getSearchResults().observe(getViewLifecycleOwner(), result -> { searchViewModel.getSearchResults().observe(getViewLifecycleOwner(), result -> {
if (result == null) return; if (result == null) return;
@ -2269,7 +2269,7 @@ public class ConversationParentFragment extends Fragment
private void initializeStickerObserver() { private void initializeStickerObserver() {
StickerSearchRepository repository = new StickerSearchRepository(requireContext()); StickerSearchRepository repository = new StickerSearchRepository(requireContext());
stickerViewModel = new ViewModelProvider(this, new ConversationStickerViewModel.Factory(requireActivity().getApplication(), repository)) stickerViewModel = new ViewModelProvider(this, (ViewModelProvider.Factory) new ConversationStickerViewModel.Factory(requireActivity().getApplication(), repository))
.get(ConversationStickerViewModel.class); .get(ConversationStickerViewModel.class);
stickerViewModel.getStickerResults().observe(getViewLifecycleOwner(), stickers -> { stickerViewModel.getStickerResults().observe(getViewLifecycleOwner(), stickers -> {
@ -2308,7 +2308,7 @@ public class ConversationParentFragment extends Fragment
} }
private void initializeViewModel(@NonNull ConversationIntents.Args args) { private void initializeViewModel(@NonNull ConversationIntents.Args args) {
this.viewModel = new ViewModelProvider(this, new ConversationViewModel.Factory()).get(ConversationViewModel.class); this.viewModel = new ViewModelProvider(this, (ViewModelProvider.Factory) new ConversationViewModel.Factory()).get(ConversationViewModel.class);
this.viewModel.setArgs(args); this.viewModel.setArgs(args);
this.viewModel.getEvents().observe(getViewLifecycleOwner(), this::onViewModelEvent); this.viewModel.getEvents().observe(getViewLifecycleOwner(), this::onViewModelEvent);
@ -2316,7 +2316,7 @@ public class ConversationParentFragment extends Fragment
} }
private void initializeGroupViewModel() { private void initializeGroupViewModel() {
groupViewModel = new ViewModelProvider(this, new ConversationGroupViewModel.Factory()).get(ConversationGroupViewModel.class); groupViewModel = new ViewModelProvider(this, (ViewModelProvider.Factory) new ConversationGroupViewModel.Factory()).get(ConversationGroupViewModel.class);
recipient.observe(this, groupViewModel::onRecipientChange); recipient.observe(this, groupViewModel::onRecipientChange);
groupViewModel.getGroupActiveState().observe(getViewLifecycleOwner(), unused -> invalidateOptionsMenu()); groupViewModel.getGroupActiveState().observe(getViewLifecycleOwner(), unused -> invalidateOptionsMenu());
groupViewModel.getReviewState().observe(getViewLifecycleOwner(), this::presentGroupReviewBanner); groupViewModel.getReviewState().observe(getViewLifecycleOwner(), this::presentGroupReviewBanner);

Wyświetl plik

@ -740,7 +740,7 @@ public class ConversationListFragment extends MainFragment implements ActionMode
ConversationListViewModel.Factory viewModelFactory = new ConversationListViewModel.Factory(isArchived(), ConversationListViewModel.Factory viewModelFactory = new ConversationListViewModel.Factory(isArchived(),
getString(R.string.note_to_self)); getString(R.string.note_to_self));
viewModel = new ViewModelProvider(this, viewModelFactory).get(ConversationListViewModel.class); viewModel = new ViewModelProvider(this, (ViewModelProvider.Factory) viewModelFactory).get(ConversationListViewModel.class);
viewModel.getSearchResult().observe(getViewLifecycleOwner(), this::onSearchResultChanged); viewModel.getSearchResult().observe(getViewLifecycleOwner(), this::onSearchResultChanged);
viewModel.getMegaphone().observe(getViewLifecycleOwner(), this::onMegaphoneChanged); viewModel.getMegaphone().observe(getViewLifecycleOwner(), this::onMegaphoneChanged);

Wyświetl plik

@ -1535,7 +1535,7 @@ public class ThreadDatabase extends Database {
private @Nullable Extra getExtrasFor(@NonNull MessageRecord record) { private @Nullable Extra getExtrasFor(@NonNull MessageRecord record) {
Recipient threadRecipient = record.isOutgoing() ? record.getRecipient() : getRecipientForThreadId(record.getThreadId()); Recipient threadRecipient = record.isOutgoing() ? record.getRecipient() : getRecipientForThreadId(record.getThreadId());
boolean messageRequestAccepted = RecipientUtil.isMessageRequestAccepted(context, record.getThreadId(), threadRecipient); boolean messageRequestAccepted = RecipientUtil.isMessageRequestAccepted(record.getThreadId(), threadRecipient);
RecipientId individualRecipientId = record.getIndividualRecipient().getId(); RecipientId individualRecipientId = record.getIndividualRecipient().getId();
//noinspection ConstantConditions //noinspection ConstantConditions

Wyświetl plik

@ -189,7 +189,7 @@ public final class PushGroupSendJob extends PushSendJob {
log(TAG, String.valueOf(message.getSentTimeMillis()), "Sending message: " + messageId + ", Recipient: " + message.getRecipient().getId() + ", Thread: " + threadId + ", Attachments: " + buildAttachmentString(message.getAttachments())); log(TAG, String.valueOf(message.getSentTimeMillis()), "Sending message: " + messageId + ", Recipient: " + message.getRecipient().getId() + ", Thread: " + threadId + ", Attachments: " + buildAttachmentString(message.getAttachments()));
if (!groupRecipient.resolve().isProfileSharing() && !database.isGroupQuitMessage(messageId)) { if (!groupRecipient.resolve().isProfileSharing() && !database.isGroupQuitMessage(messageId)) {
RecipientUtil.shareProfileIfFirstSecureMessage(context, groupRecipient); RecipientUtil.shareProfileIfFirstSecureMessage(groupRecipient);
} }
List<Recipient> target; List<Recipient> target;

Wyświetl plik

@ -124,7 +124,7 @@ public class PushMediaSendJob extends PushSendJob {
try { try {
log(TAG, String.valueOf(message.getSentTimeMillis()), "Sending message: " + messageId + ", Recipient: " + message.getRecipient().getId() + ", Thread: " + threadId + ", Attachments: " + buildAttachmentString(message.getAttachments())); log(TAG, String.valueOf(message.getSentTimeMillis()), "Sending message: " + messageId + ", Recipient: " + message.getRecipient().getId() + ", Thread: " + threadId + ", Attachments: " + buildAttachmentString(message.getAttachments()));
RecipientUtil.shareProfileIfFirstSecureMessage(context, message.getRecipient()); RecipientUtil.shareProfileIfFirstSecureMessage(message.getRecipient());
Recipient recipient = message.getRecipient().fresh(); Recipient recipient = message.getRecipient().fresh();
byte[] profileKey = recipient.getProfileKey(); byte[] profileKey = recipient.getProfileKey();

Wyświetl plik

@ -89,7 +89,7 @@ public class PushTextSendJob extends PushSendJob {
try { try {
log(TAG, String.valueOf(record.getDateSent()), "Sending message: " + messageId + ", Recipient: " + record.getRecipient().getId() + ", Thread: " + record.getThreadId()); log(TAG, String.valueOf(record.getDateSent()), "Sending message: " + messageId + ", Recipient: " + record.getRecipient().getId() + ", Thread: " + record.getThreadId());
RecipientUtil.shareProfileIfFirstSecureMessage(context, record.getRecipient()); RecipientUtil.shareProfileIfFirstSecureMessage(record.getRecipient());
Recipient recipient = record.getRecipient().resolve(); Recipient recipient = record.getRecipient().resolve();
byte[] profileKey = recipient.getProfileKey(); byte[] profileKey = recipient.getProfileKey();

Wyświetl plik

@ -253,7 +253,7 @@ final class MessageRequestRepository {
executor.execute(() -> { executor.execute(() -> {
Recipient recipient = liveRecipient.resolve(); Recipient recipient = liveRecipient.resolve();
RecipientUtil.unblock(context, recipient); RecipientUtil.unblock(recipient);
if (TextSecurePreferences.isMultiDevice(context)) { if (TextSecurePreferences.isMultiDevice(context)) {
ApplicationDependencies.getJobManager().add(MultiDeviceMessageRequestResponseJob.forAccept(liveRecipient.getId())); ApplicationDependencies.getJobManager().add(MultiDeviceMessageRequestResponseJob.forAccept(liveRecipient.getId()));
@ -277,6 +277,6 @@ final class MessageRequestRepository {
Long threadId = SignalDatabase.threads().getThreadIdFor(recipient.getId()); Long threadId = SignalDatabase.threads().getThreadIdFor(recipient.getId());
return threadId != null && return threadId != null &&
(RecipientUtil.hasSentMessageInThread(context, threadId) || RecipientUtil.isPreMessageRequestThread(context, threadId)); (RecipientUtil.hasSentMessageInThread(threadId) || RecipientUtil.isPreMessageRequestThread(threadId));
} }
} }

Wyświetl plik

@ -312,7 +312,7 @@ public final class MessageContentProcessor {
if (content.isNeedsReceipt() && messageId != null) { if (content.isNeedsReceipt() && messageId != null) {
handleNeedsDeliveryReceipt(content, message, messageId); handleNeedsDeliveryReceipt(content, message, messageId);
} else if (!content.isNeedsReceipt()) { } else if (!content.isNeedsReceipt()) {
if (RecipientUtil.shouldHaveProfileKey(context, threadRecipient)) { if (RecipientUtil.shouldHaveProfileKey(threadRecipient)) {
Log.w(TAG, "Received an unsealed sender message from " + senderRecipient.getId() + ", but they should already have our profile key. Correcting."); Log.w(TAG, "Received an unsealed sender message from " + senderRecipient.getId() + ", but they should already have our profile key. Correcting.");
if (groupId.isPresent() && groupId.get().isV2()) { if (groupId.isPresent() && groupId.get().isV2()) {

Wyświetl plik

@ -172,7 +172,7 @@ public class RecipientUtil {
SignalDatabase.recipients().setBlocked(recipient.getId(), true); SignalDatabase.recipients().setBlocked(recipient.getId(), true);
if (recipient.isSystemContact() || recipient.isProfileSharing() || isProfileSharedViaGroup(context, recipient)) { if (recipient.isSystemContact() || recipient.isProfileSharing() || isProfileSharedViaGroup(recipient)) {
SignalDatabase.recipients().setProfileSharing(recipient.getId(), false); SignalDatabase.recipients().setProfileSharing(recipient.getId(), false);
ApplicationDependencies.getJobManager().startChain(new RefreshOwnProfileJob()) ApplicationDependencies.getJobManager().startChain(new RefreshOwnProfileJob())
@ -185,7 +185,7 @@ public class RecipientUtil {
} }
@WorkerThread @WorkerThread
public static void unblock(@NonNull Context context, @NonNull Recipient recipient) { public static void unblock(@NonNull Recipient recipient) {
if (!isBlockable(recipient)) { if (!isBlockable(recipient)) {
throw new AssertionError("Recipient is not blockable!"); throw new AssertionError("Recipient is not blockable!");
} }
@ -221,7 +221,7 @@ public class RecipientUtil {
return true; return true;
} }
return isMessageRequestAccepted(context, threadId, threadRecipient); return isMessageRequestAccepted(threadId, threadRecipient);
} }
/** /**
@ -234,7 +234,7 @@ public class RecipientUtil {
} }
Long threadId = SignalDatabase.threads().getThreadIdFor(threadRecipient.getId()); Long threadId = SignalDatabase.threads().getThreadIdFor(threadRecipient.getId());
return isMessageRequestAccepted(context, threadId, threadRecipient); return isMessageRequestAccepted(threadId, threadRecipient);
} }
/** /**
@ -242,33 +242,33 @@ public class RecipientUtil {
* is more likely to return false. * is more likely to return false.
*/ */
@WorkerThread @WorkerThread
public static boolean isCallRequestAccepted(@NonNull Context context, @Nullable Recipient threadRecipient) { public static boolean isCallRequestAccepted(@Nullable Recipient threadRecipient) {
if (threadRecipient == null) { if (threadRecipient == null) {
return true; return true;
} }
Long threadId = SignalDatabase.threads().getThreadIdFor(threadRecipient.getId()); Long threadId = SignalDatabase.threads().getThreadIdFor(threadRecipient.getId());
return isCallRequestAccepted(context, threadId, threadRecipient); return isCallRequestAccepted(threadId, threadRecipient);
} }
/** /**
* @return True if a conversation existed before we enabled message requests, otherwise false. * @return True if a conversation existed before we enabled message requests, otherwise false.
*/ */
@WorkerThread @WorkerThread
public static boolean isPreMessageRequestThread(@NonNull Context context, @Nullable Long threadId) { public static boolean isPreMessageRequestThread(@Nullable Long threadId) {
long beforeTime = SignalStore.misc().getMessageRequestEnableTime(); long beforeTime = SignalStore.misc().getMessageRequestEnableTime();
return threadId != null && SignalDatabase.mmsSms().getConversationCount(threadId, beforeTime) > 0; return threadId != null && SignalDatabase.mmsSms().getConversationCount(threadId, beforeTime) > 0;
} }
@WorkerThread @WorkerThread
public static void shareProfileIfFirstSecureMessage(@NonNull Context context, @NonNull Recipient recipient) { public static void shareProfileIfFirstSecureMessage(@NonNull Recipient recipient) {
if (recipient.isProfileSharing()) { if (recipient.isProfileSharing()) {
return; return;
} }
long threadId = SignalDatabase.threads().getThreadIdIfExistsFor(recipient.getId()); long threadId = SignalDatabase.threads().getThreadIdIfExistsFor(recipient.getId());
if (isPreMessageRequestThread(context, threadId)) { if (isPreMessageRequestThread(threadId)) {
return; return;
} }
@ -290,7 +290,7 @@ public class RecipientUtil {
/** /**
* @return True if this recipient should already have your profile key, otherwise false. * @return True if this recipient should already have your profile key, otherwise false.
*/ */
public static boolean shouldHaveProfileKey(@NonNull Context context, @NonNull Recipient recipient) { public static boolean shouldHaveProfileKey(@NonNull Recipient recipient) {
if (recipient.isBlocked()) { if (recipient.isBlocked()) {
return false; return false;
} }
@ -327,33 +327,33 @@ public class RecipientUtil {
} }
@WorkerThread @WorkerThread
public static boolean isMessageRequestAccepted(@NonNull Context context, @Nullable Long threadId, @Nullable Recipient threadRecipient) { public static boolean isMessageRequestAccepted(@Nullable Long threadId, @Nullable Recipient threadRecipient) {
return threadRecipient == null || return threadRecipient == null ||
threadRecipient.isSelf() || threadRecipient.isSelf() ||
threadRecipient.isProfileSharing() || threadRecipient.isProfileSharing() ||
threadRecipient.isSystemContact() || threadRecipient.isSystemContact() ||
threadRecipient.isForceSmsSelection() || threadRecipient.isForceSmsSelection() ||
!threadRecipient.isRegistered() || !threadRecipient.isRegistered() ||
hasSentMessageInThread(context, threadId) || hasSentMessageInThread(threadId) ||
noSecureMessagesAndNoCallsInThread(context, threadId) || noSecureMessagesAndNoCallsInThread(threadId) ||
isPreMessageRequestThread(context, threadId); isPreMessageRequestThread(threadId);
} }
@WorkerThread @WorkerThread
private static boolean isCallRequestAccepted(@NonNull Context context, @Nullable Long threadId, @NonNull Recipient threadRecipient) { private static boolean isCallRequestAccepted(@Nullable Long threadId, @NonNull Recipient threadRecipient) {
return threadRecipient.isProfileSharing() || return threadRecipient.isProfileSharing() ||
threadRecipient.isSystemContact() || threadRecipient.isSystemContact() ||
hasSentMessageInThread(context, threadId) || hasSentMessageInThread(threadId) ||
isPreMessageRequestThread(context, threadId); isPreMessageRequestThread(threadId);
} }
@WorkerThread @WorkerThread
public static boolean hasSentMessageInThread(@NonNull Context context, @Nullable Long threadId) { public static boolean hasSentMessageInThread(@Nullable Long threadId) {
return threadId != null && SignalDatabase.mmsSms().getOutgoingSecureConversationCount(threadId) != 0; return threadId != null && SignalDatabase.mmsSms().getOutgoingSecureConversationCount(threadId) != 0;
} }
@WorkerThread @WorkerThread
private static boolean noSecureMessagesAndNoCallsInThread(@NonNull Context context, @Nullable Long threadId) { private static boolean noSecureMessagesAndNoCallsInThread(@Nullable Long threadId) {
if (threadId == null) { if (threadId == null) {
return true; return true;
} }
@ -363,7 +363,7 @@ public class RecipientUtil {
} }
@WorkerThread @WorkerThread
private static boolean isProfileSharedViaGroup(@NonNull Context context, @NonNull Recipient recipient) { private static boolean isProfileSharedViaGroup(@NonNull Recipient recipient) {
return Stream.of(SignalDatabase.groups().getPushGroupsContainingMember(recipient.getId())) return Stream.of(SignalDatabase.groups().getPushGroupsContainingMember(recipient.getId()))
.anyMatch(group -> Recipient.resolved(group.getRecipientId()).isProfileSharing()); .anyMatch(group -> Recipient.resolved(group.getRecipientId()).isProfileSharing());
} }

Wyświetl plik

@ -170,7 +170,7 @@ final class RecipientDialogViewModel extends ViewModel {
} }
void onUnblockClicked(@NonNull FragmentActivity activity) { void onUnblockClicked(@NonNull FragmentActivity activity) {
recipientDialogRepository.getRecipient(recipient -> BlockUnblockDialog.showUnblockFor(activity, activity.getLifecycle(), recipient, () -> RecipientUtil.unblock(context, recipient))); recipientDialogRepository.getRecipient(recipient -> BlockUnblockDialog.showUnblockFor(activity, activity.getLifecycle(), recipient, () -> RecipientUtil.unblock(recipient)));
} }
void onViewSafetyNumberClicked(@NonNull Activity activity, @NonNull IdentityRecord identityRecord) { void onViewSafetyNumberClicked(@NonNull Activity activity, @NonNull IdentityRecord identityRecord) {

Wyświetl plik

@ -136,7 +136,7 @@ public abstract class WebRtcActionProcessor {
SignalServiceCallMessage callMessage = SignalServiceCallMessage.forOffer(offerMessage, true, destinationDeviceId); SignalServiceCallMessage callMessage = SignalServiceCallMessage.forOffer(offerMessage, true, destinationDeviceId);
Recipient callRecipient = currentState.getCallInfoState().getCallRecipient(); Recipient callRecipient = currentState.getCallInfoState().getCallRecipient();
RecipientUtil.shareProfileIfFirstSecureMessage(context, callRecipient); RecipientUtil.shareProfileIfFirstSecureMessage(callRecipient);
webRtcInteractor.sendCallMessage(callMetadata.getRemotePeer(), callMessage); webRtcInteractor.sendCallMessage(callMetadata.getRemotePeer(), callMessage);
return currentState; return currentState;
@ -179,7 +179,7 @@ public abstract class WebRtcActionProcessor {
return currentState; return currentState;
} }
if (!RecipientUtil.isCallRequestAccepted(context.getApplicationContext(), callMetadata.getRemotePeer().getRecipient())) { if (!RecipientUtil.isCallRequestAccepted(callMetadata.getRemotePeer().getRecipient())) {
Log.w(tag, "Caller is untrusted."); Log.w(tag, "Caller is untrusted.");
currentState = currentState.getActionProcessor().handleSendHangup(currentState, callMetadata, WebRtcData.HangupMetadata.fromType(HangupMessage.Type.NEED_PERMISSION), true); currentState = currentState.getActionProcessor().handleSendHangup(currentState, callMetadata, WebRtcData.HangupMetadata.fromType(HangupMessage.Type.NEED_PERMISSION), true);
webRtcInteractor.insertMissedCall(callMetadata.getRemotePeer(), receivedOfferMetadata.getServerReceivedTimestamp(), offerMetadata.getOfferType() == OfferMessage.Type.VIDEO_CALL); webRtcInteractor.insertMissedCall(callMetadata.getRemotePeer(), receivedOfferMetadata.getServerReceivedTimestamp(), offerMetadata.getOfferType() == OfferMessage.Type.VIDEO_CALL);

Wyświetl plik

@ -217,7 +217,7 @@ public class RecipientUtilTest {
when(mockMmsSmsDatabase.getOutgoingSecureConversationCount(anyLong())).thenReturn(0); when(mockMmsSmsDatabase.getOutgoingSecureConversationCount(anyLong())).thenReturn(0);
// WHEN // WHEN
RecipientUtil.shareProfileIfFirstSecureMessage(context, recipient); RecipientUtil.shareProfileIfFirstSecureMessage(recipient);
// THEN // THEN
verify(mockRecipientDatabase).setProfileSharing(recipient.getId(), true); verify(mockRecipientDatabase).setProfileSharing(recipient.getId(), true);
@ -230,7 +230,7 @@ public class RecipientUtilTest {
when(mockMmsSmsDatabase.getOutgoingSecureConversationCount(anyLong())).thenReturn(5); when(mockMmsSmsDatabase.getOutgoingSecureConversationCount(anyLong())).thenReturn(5);
// WHEN // WHEN
RecipientUtil.shareProfileIfFirstSecureMessage(context, recipient); RecipientUtil.shareProfileIfFirstSecureMessage(recipient);
// THEN // THEN
verify(mockRecipientDatabase, never()).setProfileSharing(recipient.getId(), true); verify(mockRecipientDatabase, never()).setProfileSharing(recipient.getId(), true);