From e89cbdf02983da6d044d2e7f747219521b21e805 Mon Sep 17 00:00:00 2001 From: SessionHero01 <180888785+SessionHero01@users.noreply.github.com> Date: Fri, 25 Oct 2024 10:26:18 +1100 Subject: [PATCH] Renamed group terminology --- .../securesms/MediaPreviewActivity.java | 2 +- .../components/ProfilePictureView.kt | 2 +- .../securesms/configs/ConfigToDatabaseSync.kt | 2 +- .../contacts/ContactSelectionListLoader.kt | 10 +- .../contacts/SelectContactsLoader.kt | 2 +- .../securesms/contacts/UserView.kt | 2 +- .../conversation/ConversationActionBarView.kt | 7 +- .../DisappearingMessages.kt | 2 +- .../DisappearingMessagesViewModel.kt | 10 +- .../conversation/v2/ConversationActivityV2.kt | 24 ++-- .../conversation/v2/ConversationViewModel.kt | 26 ++-- .../v2/DeleteOptionsBottomSheet.kt | 5 +- .../conversation/v2/dialogs/DownloadDialog.kt | 8 +- .../v2/mention/MentionViewModel.kt | 4 +- .../menus/ConversationActionModeCallback.kt | 3 +- .../v2/menus/ConversationMenuHelper.kt | 19 ++- .../v2/messages/ControlMessageView.kt | 6 +- .../v2/messages/VisibleMessageView.kt | 8 +- .../v2/utilities/ResendMessageUtilities.kt | 2 +- .../securesms/database/MmsDatabase.kt | 4 +- .../securesms/database/Storage.kt | 121 +++++++++--------- .../securesms/database/ThreadDatabase.java | 2 +- .../database/model/MessageRecord.java | 2 +- .../securesms/dependencies/ConfigFactory.kt | 6 +- .../home/ConversationOptionsBottomSheet.kt | 12 +- .../securesms/home/ConversationView.kt | 2 +- .../securesms/home/HomeActivity.kt | 8 +- .../securesms/home/UserDetailsBottomSheet.kt | 10 +- .../securesms/media/MediaOverviewViewModel.kt | 2 +- .../messagerequests/MessageRequestsAdapter.kt | 4 +- .../AndroidAutoReplyReceiver.java | 2 +- .../notifications/DefaultMessageNotifier.kt | 10 +- .../notifications/MarkReadReceiver.kt | 2 +- .../MultipleRecipientNotificationBuilder.kt | 4 +- .../securesms/notifications/ReplyMethod.java | 2 +- .../SingleRecipientNotificationBuilder.java | 5 +- .../repository/ConversationRepository.kt | 15 +-- .../securesms/util/SessionMetaProtocol.kt | 6 +- .../securesms/util/SharedConfigUtils.kt | 7 +- .../DisappearingMessagesViewModelTest.kt | 4 +- .../v2/ConversationViewModelTest.kt | 7 +- .../conversation/v2/MentionViewModelTest.kt | 2 +- .../messaging/messages/Destination.kt | 4 +- .../ReceivedMessageHandler.kt | 4 +- .../session/libsession/utilities/Address.kt | 16 ++- .../libsession/utilities/GroupRecord.kt | 4 +- .../utilities/recipients/MessageType.kt | 4 +- .../utilities/recipients/Recipient.java | 31 ++--- .../recipients/RecipientProvider.java | 6 +- 49 files changed, 210 insertions(+), 242 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/MediaPreviewActivity.java b/app/src/main/java/org/thoughtcrime/securesms/MediaPreviewActivity.java index bc2b49da99..c714aa0eea 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/MediaPreviewActivity.java +++ b/app/src/main/java/org/thoughtcrime/securesms/MediaPreviewActivity.java @@ -440,7 +440,7 @@ public class MediaPreviewActivity extends PassphraseRequiredActionBarActivity im } private void sendMediaSavedNotificationIfNeeded() { - if (conversationRecipient.isGroupRecipient()) return; + if (conversationRecipient.isGroupOrCommunityRecipient()) return; DataExtractionNotification message = new DataExtractionNotification(new DataExtractionNotification.Kind.MediaSaved(SnodeAPI.getNowWithOffset())); MessageSender.send(message, conversationRecipient.getAddress()); } diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/ProfilePictureView.kt b/app/src/main/java/org/thoughtcrime/securesms/components/ProfilePictureView.kt index 1d5728076b..d881d9d33c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/ProfilePictureView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/ProfilePictureView.kt @@ -53,7 +53,7 @@ class ProfilePictureView @JvmOverloads constructor( fun update(recipient: Recipient) { this.recipient = recipient - recipient.run { update(address, isLegacyClosedGroupRecipient, isOpenGroupInboxRecipient) } + recipient.run { update(address, isLegacyGroupRecipient, isCommunityInboxRecipient) } } fun update( diff --git a/app/src/main/java/org/thoughtcrime/securesms/configs/ConfigToDatabaseSync.kt b/app/src/main/java/org/thoughtcrime/securesms/configs/ConfigToDatabaseSync.kt index 93861e293b..e070a38fc0 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/configs/ConfigToDatabaseSync.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/configs/ConfigToDatabaseSync.kt @@ -298,7 +298,7 @@ class ConfigToDatabaseSync @Inject constructor( buildMap(reader.count) { var current = reader.next while (current != null) { - if (current.recipient?.isClosedGroupV2Recipient == true) { + if (current.recipient?.isGroupV2Recipient == true) { put(AccountId(current.recipient.address.serialize()), current.threadId) } diff --git a/app/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListLoader.kt b/app/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListLoader.kt index 8b9dedb6ba..7bfb8dd54c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListLoader.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListLoader.kt @@ -33,7 +33,7 @@ class ContactSelectionListLoader(context: Context, val mode: Int, val filter: St } val list = mutableListOf() if (isFlagSet(DisplayMode.FLAG_CLOSED_GROUPS)) { - list.addAll(getClosedGroups(contacts)) + list.addAll(getGroups(contacts)) } if (isFlagSet(DisplayMode.FLAG_OPEN_GROUPS)) { list.addAll(getCommunities(contacts)) @@ -46,14 +46,12 @@ class ContactSelectionListLoader(context: Context, val mode: Int, val filter: St private fun getContacts(contacts: List): List { return getItems(contacts, context.getString(R.string.contactContacts)) { - !it.isGroupRecipient + !it.isGroupOrCommunityRecipient } } - private fun getClosedGroups(contacts: List): List { - return getItems(contacts, context.getString(R.string.conversationsGroups)) { - it.address.isLegacyClosedGroup || it.address.isClosedGroupV2 - } + private fun getGroups(contacts: List): List { + return getItems(contacts, context.getString(R.string.conversationsGroups)) { it.address.isGroup } } private fun getCommunities(contacts: List): List { diff --git a/app/src/main/java/org/thoughtcrime/securesms/contacts/SelectContactsLoader.kt b/app/src/main/java/org/thoughtcrime/securesms/contacts/SelectContactsLoader.kt index b1706affea..5b9c5ad9d1 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/contacts/SelectContactsLoader.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/contacts/SelectContactsLoader.kt @@ -9,7 +9,7 @@ class SelectContactsLoader(context: Context, private val usersToExclude: Set { val contacts = ContactUtilities.getAllContacts(context) return contacts.filter { - !it.isGroupRecipient && !usersToExclude.contains(it.address.toString()) && it.hasApprovedMe() + !it.isGroupOrCommunityRecipient && !usersToExclude.contains(it.address.toString()) && it.hasApprovedMe() }.map { it.address.toString() } diff --git a/app/src/main/java/org/thoughtcrime/securesms/contacts/UserView.kt b/app/src/main/java/org/thoughtcrime/securesms/contacts/UserView.kt index 77f579e14d..8cfd58f097 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/contacts/UserView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/contacts/UserView.kt @@ -56,7 +56,7 @@ class UserView : LinearLayout { val address = user.address.serialize() binding.profilePictureView.update(user) binding.actionIndicatorImageView.setImageResource(R.drawable.ic_baseline_edit_24) - binding.nameTextView.text = if (user.isGroupRecipient) user.name else getUserDisplayName(address) + binding.nameTextView.text = if (user.isGroupOrCommunityRecipient) user.name else getUserDisplayName(address) when (actionIndicator) { ActionIndicator.None -> { binding.actionIndicatorImageView.visibility = View.GONE diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationActionBarView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationActionBarView.kt index b3bb4e5b87..4ef040f49e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationActionBarView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationActionBarView.kt @@ -12,7 +12,6 @@ import androidx.recyclerview.widget.RecyclerView import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback import com.google.android.material.tabs.TabLayoutMediator import dagger.hilt.android.AndroidEntryPoint -import kotlin.time.Duration.Companion.milliseconds import network.loki.messenger.R import network.loki.messenger.databinding.ViewConversationActionBarBinding import network.loki.messenger.databinding.ViewConversationSettingBinding @@ -81,7 +80,7 @@ class ConversationActionBarView @JvmOverloads constructor( ) { this.delegate = delegate binding.profilePictureView.layoutParams = resources.getDimensionPixelSize( - if (recipient.isClosedGroupV2Recipient) R.dimen.medium_profile_picture_size else R.dimen.small_profile_picture_size + if (recipient.isGroupV2Recipient) R.dimen.medium_profile_picture_size else R.dimen.small_profile_picture_size ).let { LayoutParams(it, it) } update(recipient, openGroup, config) } @@ -134,12 +133,12 @@ class ConversationActionBarView @JvmOverloads constructor( ) } - if (recipient.isGroupRecipient) { + if (recipient.isGroupOrCommunityRecipient) { val title = if (recipient.isCommunityRecipient) { val userCount = openGroup?.let { lokiApiDb.getUserCount(it.room, it.server) } ?: 0 resources.getQuantityString(R.plurals.membersActive, userCount, userCount) } else { - val userCount = if (recipient.isClosedGroupV2Recipient) { + val userCount = if (recipient.isGroupV2Recipient) { storage.getMembers(recipient.address.serialize()).size } else { // legacy closed groups groupDb.getGroupMemberAddresses(recipient.address.toGroupString(), true).size diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/disappearingmessages/DisappearingMessages.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/disappearingmessages/DisappearingMessages.kt index b16e4e37e2..e509c11824 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/disappearingmessages/DisappearingMessages.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/disappearingmessages/DisappearingMessages.kt @@ -58,7 +58,7 @@ class DisappearingMessages @Inject constructor( text = if (message.expiresIn == 0L) R.string.confirm else R.string.set, contentDescriptionRes = if (message.expiresIn == 0L) R.string.AccessibilityId_confirm else R.string.AccessibilityId_setButton ) { - set(message.threadId, message.recipient.address, message.expiryMode, message.recipient.isClosedGroupV2Recipient) + set(message.threadId, message.recipient.address, message.expiryMode, message.recipient.isGroupV2Recipient) } cancelButton() } diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/disappearingmessages/DisappearingMessagesViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/disappearingmessages/DisappearingMessagesViewModel.kt index f6ecca4ab4..e842ff3374 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/disappearingmessages/DisappearingMessagesViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/disappearingmessages/DisappearingMessagesViewModel.kt @@ -60,25 +60,25 @@ class DisappearingMessagesViewModel( viewModelScope.launch { val expiryMode = storage.getExpirationConfiguration(threadId)?.expiryMode ?: ExpiryMode.NONE val recipient = threadDb.getRecipientForThreadId(threadId)?: return@launch - val groupRecord = recipient.takeIf { it.isLegacyClosedGroupRecipient || it.isClosedGroupV2Recipient } + val groupRecord = recipient.takeIf { it.isLegacyGroupRecipient || it.isGroupV2Recipient } ?.run { groupDb.getGroup(address.toGroupString()).orNull() } val isAdmin = when { - recipient.isClosedGroupV2Recipient -> { + recipient.isGroupV2Recipient -> { // Handle the new closed group functionality storage.getMembers(recipient.address.serialize()).any { it.sessionId == textSecurePreferences.getLocalNumber() && it.admin } } - recipient.isLegacyClosedGroupRecipient -> { + recipient.isLegacyGroupRecipient -> { // Handle as legacy group groupRecord?.admins?.any{ it.serialize() == textSecurePreferences.getLocalNumber() } == true } - else -> !recipient.isGroupRecipient + else -> !recipient.isGroupOrCommunityRecipient } _state.update { it.copy( address = recipient.address, - isGroup = recipient.isGroupRecipient, + isGroup = recipient.isGroupOrCommunityRecipient, isNoteToSelf = recipient.address.serialize() == textSecurePreferences.getLocalNumber(), isSelfAdmin = isAdmin, expiryMode = expiryMode, diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index f0358adbf8..e530e7526d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -37,7 +37,6 @@ import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.core.content.ContextCompat -import androidx.core.view.isGone import androidx.core.view.isVisible import androidx.fragment.app.DialogFragment import androidx.lifecycle.Lifecycle @@ -57,17 +56,13 @@ import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.channels.BufferOverflow import kotlinx.coroutines.channels.Channel -import kotlinx.coroutines.flow.collect -import kotlinx.coroutines.delay import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.mapNotNull -import kotlinx.coroutines.flow.onCompletion import kotlinx.coroutines.flow.receiveAsFlow -import kotlinx.coroutines.flow.takeWhile import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import network.loki.messenger.R @@ -168,8 +163,6 @@ import org.thoughtcrime.securesms.dependencies.ConfigFactory import org.thoughtcrime.securesms.giph.ui.GiphyActivity import org.thoughtcrime.securesms.groups.OpenGroupManager import org.thoughtcrime.securesms.home.search.getSearchName -import org.thoughtcrime.securesms.home.HomeActivity -import org.thoughtcrime.securesms.home.startHomeActivity import org.thoughtcrime.securesms.linkpreview.LinkPreviewRepository import org.thoughtcrime.securesms.linkpreview.LinkPreviewUtil import org.thoughtcrime.securesms.linkpreview.LinkPreviewViewModel @@ -188,7 +181,6 @@ import org.thoughtcrime.securesms.reactions.ReactionsDialogFragment import org.thoughtcrime.securesms.reactions.any.ReactWithAnyEmojiDialogFragment import org.thoughtcrime.securesms.showSessionDialog import org.thoughtcrime.securesms.util.ActivityDispatcher -import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities import org.thoughtcrime.securesms.util.DateUtils import org.thoughtcrime.securesms.util.MediaUtil import org.thoughtcrime.securesms.util.NetworkUtils @@ -815,7 +807,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe // called from onCreate private fun setUpBlockedBanner() { - val recipient = viewModel.recipient?.takeUnless { it.isGroupRecipient } ?: return + val recipient = viewModel.recipient?.takeUnless { it.isGroupOrCommunityRecipient } ?: return binding.blockedBannerTextView.text = applicationContext.getString(R.string.blockBlockedDescription) binding.blockedBanner.isVisible = recipient.isBlocked binding.blockedBanner.setOnClickListener { viewModel.unblock() } @@ -838,7 +830,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe } private fun setUpLegacyGroupBanner() { - val shouldDisplayBanner = viewModel.recipient?.isLegacyClosedGroupRecipient ?: return + val shouldDisplayBanner = viewModel.recipient?.isLegacyGroupRecipient ?: return with(binding) { outdatedGroupBanner.isVisible = shouldDisplayBanner @@ -1190,7 +1182,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe } // 10n1 and groups - recipient.is1on1 || recipient.isGroupRecipient -> { + recipient.is1on1 || recipient.isGroupOrCommunityRecipient -> { Phrase.from(applicationContext, R.string.groupNoMessages) .put(GROUP_NAME_KEY, recipient.toShortString()) .format() @@ -1241,7 +1233,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe val recipient = viewModel.recipient ?: return Log.w("Loki", "Recipient was null for block action") val invitingAdmin = viewModel.invitingAdmin - val name = if (recipient.isClosedGroupV2Recipient && invitingAdmin != null) { + val name = if (recipient.isGroupV2Recipient && invitingAdmin != null) { invitingAdmin.getSearchName() } else { recipient.toShortString() @@ -1291,7 +1283,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe // TODO: don't need to allow new closed group check here, removed in new disappearing messages override fun showDisappearingMessages(thread: Recipient) { - if (thread.isLegacyClosedGroupRecipient) { + if (thread.isLegacyGroupRecipient) { groupDb.getGroup(thread.address.toGroupString()).orNull()?.run { if (!isActive) return } } Intent(this, DisappearingMessagesActivity::class.java) @@ -1719,7 +1711,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe } override fun onReactionLongClicked(messageId: MessageId, emoji: String?) { - if (viewModel.recipient?.isGroupRecipient == true) { + if (viewModel.recipient?.isGroupOrCommunityRecipient == true) { val isUserModerator = viewModel.openGroup?.let { openGroup -> val userPublicKey = textSecurePreferences.getLocalNumber() ?: return@let false OpenGroupManager.isUserModerator(this, openGroup.id, userPublicKey, viewModel.blindedPublicKey) @@ -2339,7 +2331,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe private fun sendScreenshotNotification() { val recipient = viewModel.recipient ?: return - if (recipient.isGroupRecipient) return + if (recipient.isGroupOrCommunityRecipient) return val kind = DataExtractionNotification.Kind.Screenshot() val message = DataExtractionNotification(kind) MessageSender.send(message, recipient.address) @@ -2347,7 +2339,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe private fun sendMediaSavedNotification() { val recipient = viewModel.recipient ?: return - if (recipient.isGroupRecipient) { return } + if (recipient.isGroupOrCommunityRecipient) { return } val timestamp = SnodeAPI.nowWithOffset val kind = DataExtractionNotification.Kind.MediaSaved(timestamp) val message = DataExtractionNotification(kind) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt index cf0ab176e6..4c7c775e90 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt @@ -123,8 +123,8 @@ class ConversationViewModel( val blindedRecipient: Recipient? get() = _recipient.value?.let { recipient -> when { - recipient.isOpenGroupOutboxRecipient -> recipient - recipient.isOpenGroupInboxRecipient -> repository.maybeGetBlindedRecipient(recipient) + recipient.isCommunityOutboxRecipient -> recipient + recipient.isCommunityInboxRecipient -> repository.maybeGetBlindedRecipient(recipient) else -> null } } @@ -137,7 +137,7 @@ class ConversationViewModel( val invitingAdmin: Recipient? get() { val recipient = recipient ?: return null - if (!recipient.isClosedGroupV2Recipient) return null + if (!recipient.isGroupV2Recipient) return null return repository.getInvitingAdmin(threadId) } @@ -151,14 +151,14 @@ class ConversationViewModel( private val closedGroupMembers: List get() { val recipient = recipient ?: return emptyList() - if (!recipient.isClosedGroupV2Recipient) return emptyList() + if (!recipient.isGroupV2Recipient) return emptyList() return storage.getMembers(recipient.address.serialize()) } val isClosedGroupAdmin: Boolean get() { val recipient = recipient ?: return false - return !recipient.isClosedGroupV2Recipient || + return !recipient.isGroupV2Recipient || (closedGroupMembers.firstOrNull { it.sessionId == storage.getUserPublicKey() }?.admin ?: false) } @@ -174,7 +174,7 @@ class ConversationViewModel( val isMessageRequestThread : Boolean get() { val recipient = recipient ?: return false - return !recipient.isLocalNumber && !recipient.isLegacyClosedGroupRecipient && !recipient.isCommunityRecipient && !recipient.isApproved + return !recipient.isLocalNumber && !recipient.isLegacyGroupRecipient && !recipient.isCommunityRecipient && !recipient.isApproved } val canReactToMessages: Boolean @@ -230,8 +230,8 @@ class ConversationViewModel( */ private fun shouldShowInput(recipient: Recipient?): Boolean { return when { - recipient?.isClosedGroupV2Recipient == true -> !repository.isGroupReadOnly(recipient) - recipient?.isLegacyClosedGroupRecipient == true -> { + recipient?.isGroupV2Recipient == true -> !repository.isGroupReadOnly(recipient) + recipient?.isLegacyGroupRecipient == true -> { groupDb.getGroup(recipient.address.toGroupString()).orNull()?.isActive == true } openGroup != null -> openGroup?.canWrite == true @@ -253,7 +253,7 @@ class ConversationViewModel( (!recipient.isApproved && !recipient.isLocalNumber) && // Req 4: the type of conversation supports message request - (recipient.is1on1 || recipient.isClosedGroupV2Recipient) && + (recipient.is1on1 || recipient.isGroupV2Recipient) && // Req 2: we haven't sent a message to them before !threadDb.getLastSeenAndHasSent(threadId).second() && @@ -263,14 +263,14 @@ class ConversationViewModel( ) { return MessageRequestUiState.Visible( - acceptButtonText = if (recipient.isGroupRecipient) { + acceptButtonText = if (recipient.isGroupOrCommunityRecipient) { R.string.messageRequestGroupInviteDescription } else { R.string.messageRequestsAcceptDescription }, // You can block a 1to1 conversation, or a normal groups v2 conversation - showBlockButton = recipient.is1on1 || recipient.isClosedGroupV2Recipient, - declineButtonText = if (recipient.isClosedGroupV2Recipient) { + showBlockButton = recipient.is1on1 || recipient.isGroupV2Recipient, + declineButtonText = if (recipient.isGroupV2Recipient) { R.string.delete } else { R.string.decline @@ -311,7 +311,7 @@ class ConversationViewModel( fun block() { // inviting admin will be true if this request is a closed group message request val recipient = invitingAdmin ?: recipient ?: return Log.w("Loki", "Recipient was null for block action") - if (recipient.isContactRecipient || recipient.isClosedGroupV2Recipient) { + if (recipient.isContactRecipient || recipient.isGroupV2Recipient) { repository.setBlocked(threadId, recipient, true) } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/DeleteOptionsBottomSheet.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/DeleteOptionsBottomSheet.kt index 404f091922..0c3d314439 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/DeleteOptionsBottomSheet.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/DeleteOptionsBottomSheet.kt @@ -12,7 +12,6 @@ import network.loki.messenger.databinding.FragmentDeleteMessageBottomSheetBindin import org.session.libsession.messaging.contacts.Contact import org.session.libsession.utilities.recipients.Recipient import org.thoughtcrime.securesms.database.SessionContactDatabase -import org.thoughtcrime.securesms.util.UiModeUtilities import javax.inject.Inject @AndroidEntryPoint @@ -59,11 +58,11 @@ class DeleteOptionsBottomSheet : BottomSheetDialogFragment(), View.OnClickListen if (recipient.isLocalNumber) { binding.deleteForEveryoneTextView.text = getString(R.string.clearMessagesForMe) - } else if (!recipient.isGroupRecipient && !contact.isNullOrEmpty()) { + } else if (!recipient.isGroupOrCommunityRecipient && !contact.isNullOrEmpty()) { binding.deleteForEveryoneTextView.text = resources.getString(R.string.clearMessagesForEveryone) } - binding.deleteForEveryoneTextView.isVisible = !recipient.isLegacyClosedGroupRecipient + binding.deleteForEveryoneTextView.isVisible = !recipient.isLegacyGroupRecipient binding.deleteForMeTextView.setOnClickListener(this) binding.deleteForEveryoneTextView.setOnClickListener(this) binding.cancelTextView.setOnClickListener(this) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/dialogs/DownloadDialog.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/dialogs/DownloadDialog.kt index 1f84f09ceb..216541c0ba 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/dialogs/DownloadDialog.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/dialogs/DownloadDialog.kt @@ -1,11 +1,7 @@ package org.thoughtcrime.securesms.conversation.v2.dialogs import android.app.Dialog -import android.graphics.Typeface import android.os.Bundle -import android.text.Spannable -import android.text.SpannableStringBuilder -import android.text.style.StyleSpan import androidx.fragment.app.DialogFragment import com.squareup.phrase.Phrase import dagger.hilt.android.AndroidEntryPoint @@ -39,8 +35,8 @@ class AutoDownloadDialog(private val threadRecipient: Recipient, val displayName = when { threadRecipient.isCommunityRecipient -> storage.getOpenGroup(threadId)?.name ?: "UNKNOWN" - threadRecipient.isLegacyClosedGroupRecipient -> storage.getGroup(threadRecipient.address.toGroupString())?.title ?: "UNKNOWN" - threadRecipient.isClosedGroupV2Recipient -> threadRecipient.name ?: "UNKNOWN" + threadRecipient.isLegacyGroupRecipient -> storage.getGroup(threadRecipient.address.toGroupString())?.title ?: "UNKNOWN" + threadRecipient.isGroupV2Recipient -> threadRecipient.name ?: "UNKNOWN" else -> storage.getContactWithAccountID(threadRecipient.address.serialize())?.displayName(Contact.ContactContext.REGULAR) ?: "UNKNOWN" } title(getString(R.string.attachmentsAutoDownloadModalTitle)) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/mention/MentionViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/mention/MentionViewModel.kt index 143951d2bb..b0ea0d399e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/mention/MentionViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/mention/MentionViewModel.kt @@ -85,11 +85,11 @@ class MentionViewModel( } val memberIDs = when { - recipient.isLegacyClosedGroupRecipient -> { + recipient.isLegacyGroupRecipient -> { groupDatabase.getGroupMemberAddresses(recipient.address.toGroupString(), false) .map { it.serialize() } } - recipient.isClosedGroupV2Recipient -> { + recipient.isGroupV2Recipient -> { storage.getMembers(recipient.address.serialize()).map { it.sessionId } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/menus/ConversationActionModeCallback.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/menus/ConversationActionModeCallback.kt index 690dccf02d..a4c2685dc3 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/menus/ConversationActionModeCallback.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/menus/ConversationActionModeCallback.kt @@ -10,7 +10,6 @@ import org.session.libsession.messaging.utilities.SodiumUtilities import org.session.libsession.utilities.TextSecurePreferences import org.session.libsignal.utilities.IdPrefix import org.session.libsignal.utilities.AccountId -import org.session.libsignal.utilities.Log import org.thoughtcrime.securesms.conversation.v2.ConversationAdapter import org.thoughtcrime.securesms.database.model.MediaMmsMessageRecord import org.thoughtcrime.securesms.database.model.MessageRecord @@ -64,7 +63,7 @@ class ConversationActionModeCallback(private val adapter: ConversationAdapter, p menu.findItem(R.id.menu_context_copy).isVisible = !containsControlMessage && hasText // Copy Account ID menu.findItem(R.id.menu_context_copy_public_key).isVisible = - (thread.isGroupRecipient && !thread.isCommunityRecipient && selectedItems.size == 1 && firstMessage.individualRecipient.address.toString() != userPublicKey) + (thread.isGroupOrCommunityRecipient && !thread.isCommunityRecipient && selectedItems.size == 1 && firstMessage.individualRecipient.address.toString() != userPublicKey) // Message detail menu.findItem(R.id.menu_message_details).isVisible = selectedItems.size == 1 // Resend diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/menus/ConversationMenuHelper.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/menus/ConversationMenuHelper.kt index fe05022937..7f4a4bf5b2 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/menus/ConversationMenuHelper.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/menus/ConversationMenuHelper.kt @@ -44,7 +44,6 @@ import org.thoughtcrime.securesms.calls.WebRtcCallActivity import org.thoughtcrime.securesms.contacts.SelectContactsActivity import org.thoughtcrime.securesms.conversation.v2.ConversationActivityV2 import org.thoughtcrime.securesms.conversation.v2.utilities.NotificationUtils -import org.thoughtcrime.securesms.database.Storage import org.thoughtcrime.securesms.dependencies.ConfigFactory import org.thoughtcrime.securesms.dependencies.DatabaseComponent import org.thoughtcrime.securesms.groups.EditGroupActivity @@ -75,7 +74,7 @@ object ConversationMenuHelper { // Base menu (options that should always be present) inflater.inflate(R.menu.menu_conversation, menu) // Expiring messages - if (!isCommunity && (thread.hasApprovedMe() || thread.isLegacyClosedGroupRecipient || thread.isLocalNumber)) { + if (!isCommunity && (thread.hasApprovedMe() || thread.isLegacyGroupRecipient || thread.isLocalNumber)) { inflater.inflate(R.menu.menu_conversation_expiration, menu) } // One-on-one chat menu allows copying the account id @@ -91,12 +90,12 @@ object ConversationMenuHelper { } } // (Legacy) Closed group menu (options that should only be present in closed groups) - if (thread.isLegacyClosedGroupRecipient) { + if (thread.isLegacyGroupRecipient) { inflater.inflate(R.menu.menu_conversation_legacy_group, menu) } // Groups v2 menu - if (thread.isClosedGroupV2Recipient) { + if (thread.isGroupV2Recipient) { val hasAdminKey = configFactory.withUserConfigs { it.userGroups.getClosedGroup(thread.address.serialize())?.hasAdminKey() } if (hasAdminKey == true) { inflater.inflate(R.menu.menu_conversation_groups_v2_admin, menu) @@ -116,7 +115,7 @@ object ConversationMenuHelper { inflater.inflate(R.menu.menu_conversation_unmuted, menu) } - if (thread.isGroupRecipient && !thread.isMuted) { + if (thread.isGroupOrCommunityRecipient && !thread.isMuted) { inflater.inflate(R.menu.menu_conversation_notification_settings, menu) } @@ -260,7 +259,7 @@ object ConversationMenuHelper { } } if (icon == null) { - icon = IconCompat.createWithResource(context, if (thread.isGroupRecipient) R.mipmap.ic_group_shortcut else R.mipmap.ic_person_shortcut) + icon = IconCompat.createWithResource(context, if (thread.isGroupOrCommunityRecipient) R.mipmap.ic_group_shortcut else R.mipmap.ic_person_shortcut) } return icon } @@ -319,11 +318,11 @@ object ConversationMenuHelper { private fun editClosedGroup(context: Context, thread: Recipient) { when { - thread.isClosedGroupV2Recipient -> { + thread.isGroupV2Recipient -> { context.startActivity(EditGroupActivity.createIntent(context, thread.address.serialize())) } - thread.isLegacyClosedGroupRecipient -> { + thread.isLegacyGroupRecipient -> { val intent = Intent(context, EditLegacyGroupActivity::class.java) val groupID: String = thread.address.toGroupString() intent.putExtra(groupIDKey, groupID) @@ -341,7 +340,7 @@ object ConversationMenuHelper { groupManager: GroupManagerV2, ): ReceiveChannel? { when { - thread.isLegacyClosedGroupRecipient -> { + thread.isLegacyGroupRecipient -> { val group = DatabaseComponent.get(context).groupDatabase().getGroup(thread.address.toGroupString()).orNull() val admins = group.admins val accountID = TextSecurePreferences.getLocalNumber(context) @@ -364,7 +363,7 @@ object ConversationMenuHelper { ) } - thread.isClosedGroupV2Recipient -> { + thread.isGroupV2Recipient -> { val accountId = AccountId(thread.address.serialize()) val group = configFactory.withUserConfigs { it.userGroups.getClosedGroup(accountId.hexString) } ?: return null val name = configFactory.withGroupConfigs(accountId) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/ControlMessageView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/ControlMessageView.kt index 9a322d44ee..ba5ff85ed6 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/ControlMessageView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/ControlMessageView.kt @@ -4,7 +4,6 @@ import android.Manifest import android.content.Context import android.content.Intent import android.util.AttributeSet -import android.util.Log import android.view.LayoutInflater import android.view.View import android.widget.LinearLayout @@ -12,7 +11,6 @@ import androidx.core.content.res.ResourcesCompat import androidx.core.view.isGone import androidx.core.view.isVisible import androidx.recyclerview.widget.RecyclerView -import com.squareup.phrase.Phrase import dagger.hilt.android.AndroidEntryPoint import network.loki.messenger.R import network.loki.messenger.databinding.ViewControlMessageBinding @@ -78,7 +76,7 @@ class ControlMessageView : LinearLayout { val threadRecipient = DatabaseComponent.get(context).threadDatabase().getRecipientForThreadId(message.threadId) - if (threadRecipient?.isClosedGroupV2Recipient == true) { + if (threadRecipient?.isGroupV2Recipient == true) { expirationTimerView.setTimerIcon() } else { expirationTimerView.setExpirationTime(message.expireStarted, message.expiresIn) @@ -87,7 +85,7 @@ class ControlMessageView : LinearLayout { followSetting.isVisible = ExpirationConfiguration.isNewConfigEnabled && !message.isOutgoing && message.expiryMode != (MessagingModuleConfiguration.shared.storage.getExpirationConfiguration(message.threadId)?.expiryMode ?: ExpiryMode.NONE) - && threadRecipient?.isGroupRecipient != true + && threadRecipient?.isGroupOrCommunityRecipient != true if (followSetting.isVisible) { binding.controlContentView.setOnClickListener { disappearingMessages.showFollowSettingDialog(context, message) } diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageView.kt index 4a6acbcfdf..38ed670673 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageView.kt @@ -16,7 +16,6 @@ import android.view.MotionEvent import android.view.View import android.view.ViewGroup import android.widget.FrameLayout -import android.widget.LinearLayout import androidx.annotation.ColorInt import androidx.annotation.DrawableRes import androidx.annotation.StringRes @@ -61,7 +60,6 @@ import org.thoughtcrime.securesms.groups.OpenGroupManager import org.thoughtcrime.securesms.home.UserDetailsBottomSheet import com.bumptech.glide.Glide import com.bumptech.glide.RequestManager -import org.session.libsignal.utilities.Log import org.thoughtcrime.securesms.database.model.MmsMessageRecord import org.thoughtcrime.securesms.util.DateUtils import org.thoughtcrime.securesms.util.disableClipping @@ -155,14 +153,14 @@ class VisibleMessageView : FrameLayout { replyDisabled = message.isOpenGroupInvitation val threadID = message.threadId val thread = threadDb.getRecipientForThreadId(threadID) ?: return - val isGroupThread = thread.isGroupRecipient + val isGroupThread = thread.isGroupOrCommunityRecipient val isStartOfMessageCluster = isStartOfMessageCluster(message, previous, isGroupThread) val isEndOfMessageCluster = isEndOfMessageCluster(message, next, isGroupThread) // Show profile picture and sender name if this is a group thread AND the message is incoming binding.moderatorIconImageView.isVisible = false binding.profilePictureView.visibility = when { - thread.isGroupRecipient && !message.isOutgoing && isEndOfMessageCluster -> View.VISIBLE - thread.isGroupRecipient -> View.INVISIBLE + thread.isGroupOrCommunityRecipient && !message.isOutgoing && isEndOfMessageCluster -> View.VISIBLE + thread.isGroupOrCommunityRecipient -> View.INVISIBLE else -> View.GONE } diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/utilities/ResendMessageUtilities.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/utilities/ResendMessageUtilities.kt index c1d6987904..8215eecd9b 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/utilities/ResendMessageUtilities.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/utilities/ResendMessageUtilities.kt @@ -34,7 +34,7 @@ object ResendMessageUtilities { message.text = messageRecord.body } message.sentTimestamp = messageRecord.timestamp - if (recipient.isGroupRecipient) { + if (recipient.isGroupOrCommunityRecipient) { message.groupPublicKey = recipient.address.toGroupString() } else { message.recipient = messageRecord.recipient.address.serialize() diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/MmsDatabase.kt b/app/src/main/java/org/thoughtcrime/securesms/database/MmsDatabase.kt index 5fe29979bd..3a13690e8b 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/MmsDatabase.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/MmsDatabase.kt @@ -162,7 +162,7 @@ class MmsDatabase(context: Context, databaseHelper: SQLCipherOpenHelper) : Messa val ourAddress = messageId.address val columnName = if (deliveryReceipt) DELIVERY_RECEIPT_COUNT else READ_RECEIPT_COUNT - if (ourAddress.equals(theirAddress) || theirAddress.isGroup) { + if (ourAddress.equals(theirAddress) || theirAddress.isGroupOrCommunity) { val id = cursor.getLong(cursor.getColumnIndexOrThrow(ID)) val threadId = cursor.getLong(cursor.getColumnIndexOrThrow(THREAD_ID)) val status = @@ -779,7 +779,7 @@ class MmsDatabase(context: Context, databaseHelper: SQLCipherOpenHelper) : Messa contentValues, insertListener, ) - if (message.recipient.address.isGroup) { + if (message.recipient.address.isGroupOrCommunity) { val members = get(context).groupDatabase() .getGroupMembers(message.recipient.address.toGroupString(), false) val receiptDatabase = get(context).groupReceiptDatabase() diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt b/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt index af4845b564..3348853276 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt @@ -67,7 +67,6 @@ import org.session.libsession.utilities.recipients.Recipient import org.session.libsession.utilities.recipients.Recipient.DisappearingState import org.session.libsession.utilities.recipients.MessageType import org.session.libsession.utilities.recipients.getType -import org.session.libsignal.crypto.ecc.DjbECPrivateKey import org.session.libsignal.crypto.ecc.DjbECPublicKey import org.session.libsignal.crypto.ecc.ECKeyPair import org.session.libsignal.messages.SignalServiceAttachmentPointer @@ -134,73 +133,73 @@ open class Storage @Inject constructor( val localUserAddress = getUserPublicKey() ?: return if (!getRecipientApproved(address) && localUserAddress != address.serialize()) return // don't store unapproved / message requests - if (address.isGroup) { - when { - address.isLegacyClosedGroup -> { - val accountId = GroupUtil.doubleDecodeGroupId(address.serialize()) - val closedGroup = getGroup(address.toGroupString()) - if (closedGroup != null && closedGroup.isActive) { - configFactory.withMutableUserConfigs { configs -> - val legacyGroup = configs.userGroups.getOrConstructLegacyGroupInfo(accountId) - configs.userGroups.set(legacyGroup) - val newVolatileParams = configs.convoInfoVolatile.getOrConstructLegacyGroup(accountId).copy( - lastRead = clock.currentTimeMills(), - ) - configs.convoInfoVolatile.set(newVolatileParams) - } - - } - } - address.isClosedGroupV2 -> { + when { + address.isLegacyGroup -> { + val accountId = GroupUtil.doubleDecodeGroupId(address.serialize()) + val closedGroup = getGroup(address.toGroupString()) + if (closedGroup != null && closedGroup.isActive) { configFactory.withMutableUserConfigs { configs -> - val accountId = address.serialize() - configs.userGroups.getClosedGroup(accountId) - ?: return@withMutableUserConfigs Log.d("Closed group doesn't exist locally", NullPointerException()) - - configs.convoInfoVolatile.getOrConstructClosedGroup(accountId) + val legacyGroup = configs.userGroups.getOrConstructLegacyGroupInfo(accountId) + configs.userGroups.set(legacyGroup) + val newVolatileParams = configs.convoInfoVolatile.getOrConstructLegacyGroup(accountId).copy( + lastRead = clock.currentTimeMills(), + ) + configs.convoInfoVolatile.set(newVolatileParams) } } - address.isCommunity -> { - // these should be added on the group join / group info fetch - Log.w("Loki", "Thread created called for open group address, not adding any extra information") - } } - } else if (address.isContact) { - // non-standard contact prefixes: 15, 00 etc shouldn't be stored in config - if (AccountId(address.serialize()).prefix != IdPrefix.STANDARD) return - // don't update our own address into the contacts DB - if (getUserPublicKey() != address.serialize()) { + address.isGroupV2 -> { configFactory.withMutableUserConfigs { configs -> - configs.contacts.upsertContact(address.serialize()) { - priority = PRIORITY_VISIBLE + val accountId = address.serialize() + configs.userGroups.getClosedGroup(accountId) + ?: return@withMutableUserConfigs Log.d("Closed group doesn't exist locally", NullPointerException()) + + configs.convoInfoVolatile.getOrConstructClosedGroup(accountId) + } + + } + address.isCommunity -> { + // these should be added on the group join / group info fetch + Log.w("Loki", "Thread created called for open group address, not adding any extra information") + } + + address.isContact -> { + // non-standard contact prefixes: 15, 00 etc shouldn't be stored in config + if (AccountId(address.serialize()).prefix != IdPrefix.STANDARD) return + // don't update our own address into the contacts DB + if (getUserPublicKey() != address.serialize()) { + configFactory.withMutableUserConfigs { configs -> + configs.contacts.upsertContact(address.serialize()) { + priority = PRIORITY_VISIBLE + } } + } else { + configFactory.withMutableUserConfigs { configs -> + configs.userProfile.setNtsPriority(PRIORITY_VISIBLE) + } + + threadDatabase.setHasSent(threadId, true) } - } else { + configFactory.withMutableUserConfigs { configs -> - configs.userProfile.setNtsPriority(PRIORITY_VISIBLE) + configs.convoInfoVolatile.getOrConstructOneToOne(address.serialize()) } - - threadDatabase.setHasSent(threadId, true) - } - - configFactory.withMutableUserConfigs { configs -> - configs.convoInfoVolatile.getOrConstructOneToOne(address.serialize()) } } } override fun threadDeleted(address: Address, threadId: Long) { configFactory.withMutableUserConfigs { configs -> - if (address.isGroup) { - if (address.isLegacyClosedGroup) { + if (address.isGroupOrCommunity) { + if (address.isLegacyGroup) { val accountId = GroupUtil.doubleDecodeGroupId(address.serialize()) configs.convoInfoVolatile.eraseLegacyClosedGroup(accountId) configs.userGroups.eraseLegacyGroup(accountId) } else if (address.isCommunity) { // these should be removed in the group leave / handling new configs Log.w("Loki", "Thread delete called for open group address, expecting to be handled elsewhere") - } else if (address.isClosedGroupV2) { + } else if (address.isGroupV2) { Log.w("Loki", "Thread delete called for closed group address, expecting to be handled elsewhere") } } else { @@ -327,17 +326,17 @@ open class Storage @Inject constructor( getRecipientForThread(threadId)?.let { recipient -> val currentLastRead = threadDb.getLastSeenAndHasSent(threadId).first() // don't set the last read in the volatile if we didn't set it in the DB - if (!threadDb.markAllAsRead(threadId, recipient.isGroupRecipient, lastSeenTime, force) && !force) return + if (!threadDb.markAllAsRead(threadId, recipient.isGroupOrCommunityRecipient, lastSeenTime, force) && !force) return // don't process configs for inbox recipients - if (recipient.isOpenGroupInboxRecipient) return + if (recipient.isCommunityInboxRecipient) return configFactory.withMutableUserConfigs { configs -> val config = configs.convoInfoVolatile val convo = when { // recipient closed group - recipient.isLegacyClosedGroupRecipient -> config.getOrConstructLegacyGroup(GroupUtil.doubleDecodeGroupId(recipient.address.serialize())) - recipient.isClosedGroupV2Recipient -> config.getOrConstructClosedGroup(recipient.address.serialize()) + recipient.isLegacyGroupRecipient -> config.getOrConstructLegacyGroup(GroupUtil.doubleDecodeGroupId(recipient.address.serialize())) + recipient.isGroupV2Recipient -> config.getOrConstructClosedGroup(recipient.address.serialize()) // recipient is open group recipient.isCommunityRecipient -> { val openGroupJoinUrl = getOpenGroup(threadId)?.joinURL ?: return@withMutableUserConfigs @@ -409,7 +408,7 @@ open class Storage @Inject constructor( senderAddress } val targetRecipient = Recipient.from(context, targetAddress, false) - if (!targetRecipient.isGroupRecipient) { + if (!targetRecipient.isGroupOrCommunityRecipient) { if (isUserSender || isUserBlindedSender) { setRecipientApproved(targetRecipient, true) } else { @@ -1390,9 +1389,9 @@ open class Storage @Inject constructor( configs.contacts.upsertContact(threadRecipient.address.serialize()) { priority = if (isPinned) PRIORITY_PINNED else PRIORITY_VISIBLE } - } else if (threadRecipient.isGroupRecipient) { + } else if (threadRecipient.isGroupOrCommunityRecipient) { when { - threadRecipient.isLegacyClosedGroupRecipient -> { + threadRecipient.isLegacyGroupRecipient -> { threadRecipient.address.serialize() .let(GroupUtil::doubleDecodeGroupId) .let(configs.userGroups::getOrConstructLegacyGroupInfo) @@ -1400,7 +1399,7 @@ open class Storage @Inject constructor( .let(configs.userGroups::set) } - threadRecipient.isClosedGroupV2Recipient -> { + threadRecipient.isGroupV2Recipient -> { val newGroupInfo = configs.userGroups .getOrConstructClosedGroup(threadRecipient.address.serialize()) .copy(priority = if (isPinned) PRIORITY_PINNED else PRIORITY_VISIBLE) @@ -1586,8 +1585,8 @@ open class Storage @Inject constructor( val recipient = reader.current.recipient val address = recipient.address.serialize() val blindedId = when { - recipient.isGroupRecipient -> null - recipient.isOpenGroupInboxRecipient -> GroupUtil.getDecodedOpenGroupInboxAccountId(address) + recipient.isGroupOrCommunityRecipient -> null + recipient.isCommunityInboxRecipient -> GroupUtil.getDecodedOpenGroupInboxAccountId(address) else -> address.takeIf { AccountId(it).prefix == IdPrefix.BLINDED } } ?: continue mappingDb.getBlindedIdMapping(blindedId).firstOrNull()?.let { @@ -1668,7 +1667,7 @@ open class Storage @Inject constructor( } override fun getRecipientApproved(address: Address): Boolean { - return address.isClosedGroupV2 || recipientDatabase.getApproved(address) + return address.isGroupV2 || recipientDatabase.getApproved(address) } override fun setRecipientApproved(recipient: Recipient, approved: Boolean) { @@ -1864,14 +1863,14 @@ open class Storage @Inject constructor( recipient.address.serialize().takeIf { it.startsWith(IdPrefix.STANDARD.value) } ?.let { configFactory.withUserConfigs { configs -> configs.contacts.get(it)?.expiryMode } } } - recipient.isClosedGroupV2Recipient -> { + recipient.isGroupV2Recipient -> { configFactory.withGroupConfigs(AccountId(recipient.address.serialize())) { configs -> configs.groupInfo.getExpiryTimer() }.let { if (it == 0L) ExpiryMode.NONE else ExpiryMode.AfterSend(it) } } - recipient.isLegacyClosedGroupRecipient -> { + recipient.isLegacyGroupRecipient -> { // read it from group config if exists GroupUtil.doubleDecodeGroupId(recipient.address.serialize()) .let { id -> configFactory.withUserConfigs { it.userGroups.getLegacyGroupInfo(id) } } @@ -1899,7 +1898,7 @@ open class Storage @Inject constructor( lokiAPIDatabase.setLastLegacySenderAddress(recipient.address.serialize(), null) } - if (recipient.isLegacyClosedGroupRecipient) { + if (recipient.isLegacyGroupRecipient) { val groupPublicKey = GroupUtil.addressToGroupAccountId(recipient.address) configFactory.withMutableUserConfigs { @@ -1907,7 +1906,7 @@ open class Storage @Inject constructor( ?.copy(disappearingTimer = expiryMode.expirySeconds) ?: return@withMutableUserConfigs it.userGroups.set(groupInfo) } - } else if (recipient.isClosedGroupV2Recipient) { + } else if (recipient.isGroupV2Recipient) { val groupSessionId = AccountId(recipient.address.serialize()) configFactory.withMutableGroupConfigs(groupSessionId) { configs -> configs.groupInfo.setExpiryTimer(expiryMode.expirySeconds) diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java b/app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java index 8868173b00..f9b204a836 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java @@ -665,7 +665,7 @@ public class ThreadDatabase extends Database { threadId = cursor.getLong(cursor.getColumnIndexOrThrow(ID)); } else { DatabaseComponent.get(context).recipientDatabase().setProfileSharing(recipient, true); - threadId = createThreadForRecipient(recipient.getAddress(), recipient.isGroupRecipient(), distributionType); + threadId = createThreadForRecipient(recipient.getAddress(), recipient.isGroupOrCommunityRecipient(), distributionType); created = true; } if (created && updateListener != null) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/model/MessageRecord.java b/app/src/main/java/org/thoughtcrime/securesms/database/model/MessageRecord.java index 87d2ee34c4..062b4f1e31 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/model/MessageRecord.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/model/MessageRecord.java @@ -131,7 +131,7 @@ public abstract class MessageRecord extends DisplayRecord { ); } else if (isExpirationTimerUpdate()) { int seconds = (int) (getExpiresIn() / 1000); - boolean isGroup = DatabaseComponent.get(context).threadDatabase().getRecipientForThreadId(getThreadId()).isGroupRecipient(); + boolean isGroup = DatabaseComponent.get(context).threadDatabase().getRecipientForThreadId(getThreadId()).isGroupOrCommunityRecipient(); return new SpannableString(UpdateMessageBuilder.INSTANCE.buildExpirationTimerMessage(context, seconds, isGroup, getIndividualRecipient().getAddress().serialize(), isOutgoing(), getTimestamp(), expireStarted)); } else if (isDataExtractionNotification()) { if (isScreenshotNotification()) return new SpannableString((UpdateMessageBuilder.INSTANCE.buildDataExtractionMessage(context, DataExtractionNotificationInfoMessage.Kind.SCREENSHOT, getIndividualRecipient().getAddress().serialize()))); diff --git a/app/src/main/java/org/thoughtcrime/securesms/dependencies/ConfigFactory.kt b/app/src/main/java/org/thoughtcrime/securesms/dependencies/ConfigFactory.kt index f3bb2bfa2a..0b00e12445 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/dependencies/ConfigFactory.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/dependencies/ConfigFactory.kt @@ -545,18 +545,18 @@ private fun MutableConversationVolatileConfig.initFrom(storage: StorageProtocol, val (base, room, pubKey) = BaseCommunityInfo.parseFullUrl(openGroup.joinURL) ?: continue getOrConstructCommunity(base, room, pubKey) } - recipient.isClosedGroupV2Recipient -> { + recipient.isGroupV2Recipient -> { // It's probably safe to assume there will never be a case where new closed groups will ever be there before a dump is created... // but just in case... getOrConstructClosedGroup(recipient.address.serialize()) } - recipient.isLegacyClosedGroupRecipient -> { + recipient.isLegacyGroupRecipient -> { val groupPublicKey = GroupUtil.doubleDecodeGroupId(recipient.address.serialize()) getOrConstructLegacyGroup(groupPublicKey) } recipient.isContactRecipient -> { if (recipient.isLocalNumber) null // this is handled by the user profile NTS data - else if (recipient.isOpenGroupInboxRecipient) null // specifically exclude + else if (recipient.isCommunityInboxRecipient) null // specifically exclude else if (!recipient.address.serialize().startsWith(IdPrefix.STANDARD.value)) null else getOrConstructOneToOne(recipient.address.serialize()) } diff --git a/app/src/main/java/org/thoughtcrime/securesms/home/ConversationOptionsBottomSheet.kt b/app/src/main/java/org/thoughtcrime/securesms/home/ConversationOptionsBottomSheet.kt index f6b177de6d..241ce4d373 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/home/ConversationOptionsBottomSheet.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/home/ConversationOptionsBottomSheet.kt @@ -68,7 +68,7 @@ class ConversationOptionsBottomSheet(private val parentContext: Context) : Botto if (!this::thread.isInitialized) { return dismiss() } val recipient = thread.recipient val isCurrentUserInGroup = group?.members?.map { it.toString() }?.contains(publicKey) ?: false - if (!recipient.isGroupRecipient && !recipient.isLocalNumber) { + if (!recipient.isGroupOrCommunityRecipient && !recipient.isLocalNumber) { binding.detailsTextView.visibility = View.VISIBLE binding.unblockTextView.visibility = if (recipient.isBlocked) View.VISIBLE else View.GONE binding.blockTextView.visibility = if (recipient.isBlocked) View.GONE else View.VISIBLE @@ -78,7 +78,7 @@ class ConversationOptionsBottomSheet(private val parentContext: Context) : Botto } else { binding.detailsTextView.visibility = View.GONE } - binding.copyConversationId.visibility = if (!recipient.isGroupRecipient && !recipient.isLocalNumber) View.VISIBLE else View.GONE + binding.copyConversationId.visibility = if (!recipient.isGroupOrCommunityRecipient && !recipient.isLocalNumber) View.VISIBLE else View.GONE binding.copyConversationId.setOnClickListener(this) binding.copyCommunityUrl.visibility = if (recipient.isCommunityRecipient) View.VISIBLE else View.GONE binding.copyCommunityUrl.setOnClickListener(this) @@ -86,18 +86,18 @@ class ConversationOptionsBottomSheet(private val parentContext: Context) : Botto binding.muteNotificationsTextView.isVisible = !recipient.isMuted && !recipient.isLocalNumber binding.unMuteNotificationsTextView.setOnClickListener(this) binding.muteNotificationsTextView.setOnClickListener(this) - binding.notificationsTextView.isVisible = recipient.isGroupRecipient && !recipient.isMuted + binding.notificationsTextView.isVisible = recipient.isGroupOrCommunityRecipient && !recipient.isMuted binding.notificationsTextView.setOnClickListener(this) // delete binding.deleteTextView.apply { - isVisible = recipient.isContactRecipient || (recipient.isGroupRecipient && !isCurrentUserInGroup) + isVisible = recipient.isContactRecipient || (recipient.isGroupOrCommunityRecipient && !isCurrentUserInGroup) setOnClickListener(this@ConversationOptionsBottomSheet) // the text and content description will change depending on the type when{ // groups and communities - recipient.isGroupRecipient -> { + recipient.isGroupOrCommunityRecipient -> { text = context.getString(R.string.leave) contentDescription = context.getString(R.string.AccessibilityId_leave) } @@ -115,7 +115,7 @@ class ConversationOptionsBottomSheet(private val parentContext: Context) : Botto } } } - binding.leaveTextView.isVisible = recipient.isGroupRecipient && isCurrentUserInGroup + binding.leaveTextView.isVisible = recipient.isGroupOrCommunityRecipient && isCurrentUserInGroup binding.leaveTextView.setOnClickListener(this) binding.markAllAsReadTextView.isVisible = thread.unreadCount > 0 || diff --git a/app/src/main/java/org/thoughtcrime/securesms/home/ConversationView.kt b/app/src/main/java/org/thoughtcrime/securesms/home/ConversationView.kt index 2243aaea91..75555d12cf 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/home/ConversationView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/home/ConversationView.kt @@ -99,7 +99,7 @@ class ConversationView : LinearLayout { binding.unreadCountIndicator.isVisible = (unreadCount != 0 && !thread.isRead) || (configFactory.withUserConfigs { it.convoInfoVolatile.getConversationUnread(thread) }) binding.unreadMentionTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize) - binding.unreadMentionIndicator.isVisible = (thread.unreadMentionCount != 0 && thread.recipient.address.isGroup) + binding.unreadMentionIndicator.isVisible = (thread.unreadMentionCount != 0 && thread.recipient.address.isGroupOrCommunity) val senderDisplayName = getTitle(thread.recipient) ?: thread.recipient.address.toString() binding.conversationViewDisplayNameTextView.text = senderDisplayName diff --git a/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt index 8acb514c19..b0e42275a9 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt @@ -442,7 +442,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(), } bottomSheet.onCopyConversationId = onCopyConversationId@{ bottomSheet.dismiss() - if (!thread.recipient.isGroupRecipient && !thread.recipient.isLocalNumber) { + if (!thread.recipient.isGroupOrCommunityRecipient && !thread.recipient.isLocalNumber) { val clip = ClipData.newPlainText("Account ID", thread.recipient.address.toString()) val manager = getSystemService(CLIPBOARD_SERVICE) as ClipboardManager manager.setPrimaryClip(clip) @@ -583,7 +583,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(), val threadID = thread.threadId val recipient = thread.recipient - if (recipient.isClosedGroupV2Recipient || recipient.isLegacyClosedGroupRecipient) { + if (recipient.isGroupV2Recipient || recipient.isLegacyGroupRecipient) { ConversationMenuHelper.leaveClosedGroup( context = this, thread = recipient, @@ -601,7 +601,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(), var positiveButtonId: Int = R.string.yes var negativeButtonId: Int = R.string.no - if (recipient.isGroupRecipient) { + if (recipient.isGroupOrCommunityRecipient) { val group = groupDatabase.getGroup(recipient.address.toString()).orNull() // If you are an admin of this group you can delete it @@ -666,7 +666,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(), ApplicationContext.getInstance(context).messageNotifier.updateNotification(context) // Notify the user - val toastMessage = if (recipient.isGroupRecipient) R.string.groupMemberYouLeft else R.string.conversationsDeleted + val toastMessage = if (recipient.isGroupOrCommunityRecipient) R.string.groupMemberYouLeft else R.string.conversationsDeleted Toast.makeText(context, toastMessage, Toast.LENGTH_LONG).show() } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/home/UserDetailsBottomSheet.kt b/app/src/main/java/org/thoughtcrime/securesms/home/UserDetailsBottomSheet.kt index d5fad90c4a..c21f7d37e8 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/home/UserDetailsBottomSheet.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/home/UserDetailsBottomSheet.kt @@ -59,7 +59,7 @@ class UserDetailsBottomSheet: BottomSheetDialogFragment() { profilePictureView.update(recipient) nameTextViewContainer.visibility = View.VISIBLE nameTextViewContainer.setOnClickListener { - if (recipient.isOpenGroupInboxRecipient || recipient.isOpenGroupOutboxRecipient) return@setOnClickListener + if (recipient.isCommunityInboxRecipient || recipient.isCommunityOutboxRecipient) return@setOnClickListener nameTextViewContainer.visibility = View.INVISIBLE nameEditTextContainer.visibility = View.VISIBLE nicknameEditText.text = null @@ -87,12 +87,12 @@ class UserDetailsBottomSheet: BottomSheetDialogFragment() { nameTextView.text = recipient.name ?: publicKey // Uses the Contact API internally nameEditIcon.isVisible = threadRecipient.isContactRecipient - && !threadRecipient.isOpenGroupInboxRecipient - && !threadRecipient.isOpenGroupOutboxRecipient + && !threadRecipient.isCommunityInboxRecipient + && !threadRecipient.isCommunityOutboxRecipient publicKeyTextView.isVisible = !threadRecipient.isCommunityRecipient - && !threadRecipient.isOpenGroupInboxRecipient - && !threadRecipient.isOpenGroupOutboxRecipient + && !threadRecipient.isCommunityInboxRecipient + && !threadRecipient.isCommunityOutboxRecipient messageButton.isVisible = !threadRecipient.isCommunityRecipient || IdPrefix.fromValue(publicKey)?.isBlinded() == true publicKeyTextView.text = publicKey publicKeyTextView.setOnLongClickListener { diff --git a/app/src/main/java/org/thoughtcrime/securesms/media/MediaOverviewViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/media/MediaOverviewViewModel.kt index b856745e47..0356dd3238 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/media/MediaOverviewViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/media/MediaOverviewViewModel.kt @@ -282,7 +282,7 @@ class MediaOverviewViewModel( // in groups/communities) if (selectedMedia.any { !it.mediaRecord.isOutgoing } && successCount > 0 && - !address.isGroup) { + !address.isGroupOrCommunity) { withContext(Dispatchers.Default) { val timestamp = SnodeAPI.nowWithOffset val kind = DataExtractionNotification.Kind.MediaSaved(timestamp) diff --git a/app/src/main/java/org/thoughtcrime/securesms/messagerequests/MessageRequestsAdapter.kt b/app/src/main/java/org/thoughtcrime/securesms/messagerequests/MessageRequestsAdapter.kt index 59ab267587..3f6cb482c5 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/messagerequests/MessageRequestsAdapter.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/messagerequests/MessageRequestsAdapter.kt @@ -32,7 +32,7 @@ class MessageRequestsAdapter( view.setOnClickListener { view.thread?.let { listener.onConversationClick(it) } } view.setOnLongClickListener { view.thread?.let { thread -> - showPopupMenu(view, thread.recipient.isGroupRecipient, thread.invitingAdminId) + showPopupMenu(view, thread.recipient.isGroupOrCommunityRecipient, thread.invitingAdminId) } true } @@ -52,7 +52,7 @@ class MessageRequestsAdapter( private fun showPopupMenu(view: MessageRequestView, groupRecipient: Boolean, invitingAdmin: String?) { val popupMenu = PopupMenu(ContextThemeWrapper(context, R.style.PopupMenu_MessageRequests), view) // still show the block option if we have an inviting admin for the group - if ((groupRecipient && invitingAdmin == null) || view.thread!!.recipient.isOpenGroupInboxRecipient) { + if ((groupRecipient && invitingAdmin == null) || view.thread!!.recipient.isCommunityInboxRecipient) { popupMenu.menuInflater.inflate(R.menu.menu_group_request, popupMenu.menu) } else { popupMenu.menuInflater.inflate(R.menu.menu_message_request, popupMenu.menu) diff --git a/app/src/main/java/org/thoughtcrime/securesms/notifications/AndroidAutoReplyReceiver.java b/app/src/main/java/org/thoughtcrime/securesms/notifications/AndroidAutoReplyReceiver.java index 91f0941479..31a368687c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/AndroidAutoReplyReceiver.java +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/AndroidAutoReplyReceiver.java @@ -93,7 +93,7 @@ public class AndroidAutoReplyReceiver extends BroadcastReceiver { long expiresInMillis = expiryMode == null ? 0 : expiryMode.getExpiryMillis(); long expireStartedAt = expiryMode instanceof ExpiryMode.AfterSend ? message.getSentTimestamp() : 0L; - if (recipient.isGroupRecipient()) { + if (recipient.isGroupOrCommunityRecipient()) { Log.w("AndroidAutoReplyReceiver", "GroupRecipient, Sending media message"); OutgoingMediaMessage reply = OutgoingMediaMessage.from(message, recipient, Collections.emptyList(), null, null, expiresInMillis, 0); try { diff --git a/app/src/main/java/org/thoughtcrime/securesms/notifications/DefaultMessageNotifier.kt b/app/src/main/java/org/thoughtcrime/securesms/notifications/DefaultMessageNotifier.kt index 7f6bae5e17..acf98ac0d8 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/DefaultMessageNotifier.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/DefaultMessageNotifier.kt @@ -28,8 +28,6 @@ import android.database.Cursor import android.os.AsyncTask import android.os.Build import android.text.TextUtils -import android.widget.Toast -import androidx.camera.core.impl.utils.ContextUtil.getApplicationContext import androidx.core.app.ActivityCompat import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat @@ -69,8 +67,6 @@ import org.thoughtcrime.securesms.database.model.MmsMessageRecord import org.thoughtcrime.securesms.database.model.ReactionRecord import org.thoughtcrime.securesms.dependencies.DatabaseComponent.Companion.get import org.thoughtcrime.securesms.mms.SlideDeck -import org.thoughtcrime.securesms.permissions.Permissions -import org.thoughtcrime.securesms.preferences.ShareLogsDialog import org.thoughtcrime.securesms.service.KeyCachingService import org.thoughtcrime.securesms.util.SessionMetaProtocol.canUserReplyToNotification import org.thoughtcrime.securesms.util.SpanUtil @@ -171,7 +167,7 @@ class DefaultMessageNotifier : MessageNotifier { val threads = get(context).threadDatabase() val recipient = threads.getRecipientForThreadId(threadId) - if (recipient != null && !recipient.isGroupRecipient && threads.getMessageCount(threadId) == 1 && + if (recipient != null && !recipient.isGroupOrCommunityRecipient && threads.getMessageCount(threadId) == 1 && !(recipient.isApproved || threads.getLastSeenAndHasSent(threadId).second()) ) { removeHasHiddenMessageRequests(context) @@ -485,7 +481,7 @@ class DefaultMessageNotifier : MessageNotifier { if (threadId != -1L) { threadRecipients = threadDatabase.getRecipientForThreadId(threadId) - messageRequest = threadRecipients != null && !threadRecipients.isGroupRecipient && + messageRequest = threadRecipients != null && !threadRecipients.isGroupOrCommunityRecipient && !threadRecipients.isApproved && !threadDatabase.getLastSeenAndHasSent(threadId).second() if (messageRequest && (threadDatabase.getMessageCount(threadId) > 1 || !hasHiddenMessageRequests(context))) { continue @@ -558,7 +554,7 @@ class DefaultMessageNotifier : MessageNotifier { .findLast() if (lastReact.isPresent) { - if (threadRecipients != null && !threadRecipients.isGroupRecipient) { + if (threadRecipients != null && !threadRecipients.isGroupOrCommunityRecipient) { val reaction = lastReact.get() val reactor = Recipient.from(context, fromSerialized(reaction.author), false) val emoji = Phrase.from(context, R.string.emojiReactsNotification).put(EMOJI_KEY, reaction.emoji).format().toString() diff --git a/app/src/main/java/org/thoughtcrime/securesms/notifications/MarkReadReceiver.kt b/app/src/main/java/org/thoughtcrime/securesms/notifications/MarkReadReceiver.kt index ae823ac559..fee729cf42 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/MarkReadReceiver.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/MarkReadReceiver.kt @@ -73,7 +73,7 @@ class MarkReadReceiver : BroadcastReceiver() { .filter { it.expiryType == ExpiryType.AFTER_READ } .map { it.syncMessageId } .filter { mmsSmsDatabase.getMessageForTimestamp(it.timetamp)?.run { - isExpirationTimerUpdate && threadDb.getRecipientForThreadId(threadId)?.isGroupRecipient == true } == false + isExpirationTimerUpdate && threadDb.getRecipientForThreadId(threadId)?.isGroupOrCommunityRecipient == true } == false } .forEach { messageExpirationManager.startDisappearAfterRead(it.timetamp, it.address.serialize()) } diff --git a/app/src/main/java/org/thoughtcrime/securesms/notifications/MultipleRecipientNotificationBuilder.kt b/app/src/main/java/org/thoughtcrime/securesms/notifications/MultipleRecipientNotificationBuilder.kt index a526f9e8f2..dc13beed33 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/MultipleRecipientNotificationBuilder.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/MultipleRecipientNotificationBuilder.kt @@ -40,7 +40,7 @@ class MultipleRecipientNotificationBuilder(context: Context, privacy: Notificati fun setMostRecentSender(recipient: Recipient, threadRecipient: Recipient) { var displayName = recipient.toShortString() - if (threadRecipient.isGroupRecipient) { + if (threadRecipient.isGroupOrCommunityRecipient) { displayName = getGroupDisplayName(recipient, threadRecipient.isCommunityRecipient) } if (privacy.isDisplayContact) { @@ -69,7 +69,7 @@ class MultipleRecipientNotificationBuilder(context: Context, privacy: Notificati fun addMessageBody(sender: Recipient, threadRecipient: Recipient, body: CharSequence?) { var displayName = sender.toShortString() - if (threadRecipient.isGroupRecipient) { + if (threadRecipient.isGroupOrCommunityRecipient) { displayName = getGroupDisplayName(sender, threadRecipient.isCommunityRecipient) } if (privacy.isDisplayMessage) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/notifications/ReplyMethod.java b/app/src/main/java/org/thoughtcrime/securesms/notifications/ReplyMethod.java index be2ab1d31d..43b8b1d55f 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/ReplyMethod.java +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/ReplyMethod.java @@ -11,7 +11,7 @@ public enum ReplyMethod { SecureMessage; public static @NonNull ReplyMethod forRecipient(Context context, Recipient recipient) { - if (recipient.isGroupRecipient()) { + if (recipient.isGroupOrCommunityRecipient()) { return ReplyMethod.GroupMessage; } return ReplyMethod.SecureMessage; diff --git a/app/src/main/java/org/thoughtcrime/securesms/notifications/SingleRecipientNotificationBuilder.java b/app/src/main/java/org/thoughtcrime/securesms/notifications/SingleRecipientNotificationBuilder.java index 6764f46069..0b22de8d3b 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/SingleRecipientNotificationBuilder.java +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/SingleRecipientNotificationBuilder.java @@ -29,7 +29,6 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy; import org.session.libsession.avatars.ContactPhoto; import org.session.libsession.messaging.contacts.Contact; import org.session.libsession.utilities.NotificationPrivacyPreference; -import org.session.libsession.utilities.TextSecurePreferences; import org.session.libsession.utilities.Util; import org.session.libsession.utilities.recipients.Recipient; import org.session.libsignal.utilities.Log; @@ -119,7 +118,7 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil { SpannableStringBuilder stringBuilder = new SpannableStringBuilder(); - if (privacy.isDisplayContact() && threadRecipient.isGroupRecipient()) { + if (privacy.isDisplayContact() && threadRecipient.isGroupOrCommunityRecipient()) { String displayName = getGroupDisplayName(individualRecipient, threadRecipient.isCommunityRecipient()); stringBuilder.append(Util.getBoldedString(displayName + ": ")); } @@ -207,7 +206,7 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil { SpannableStringBuilder stringBuilder = new SpannableStringBuilder(); - if (privacy.isDisplayContact() && threadRecipient.isGroupRecipient()) { + if (privacy.isDisplayContact() && threadRecipient.isGroupOrCommunityRecipient()) { String displayName = getGroupDisplayName(individualRecipient, threadRecipient.isCommunityRecipient()); stringBuilder.append(Util.getBoldedString(displayName + ": ")); } diff --git a/app/src/main/java/org/thoughtcrime/securesms/repository/ConversationRepository.kt b/app/src/main/java/org/thoughtcrime/securesms/repository/ConversationRepository.kt index 9a956af37c..383562a17c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/repository/ConversationRepository.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/repository/ConversationRepository.kt @@ -28,7 +28,6 @@ import org.session.libsession.snode.utilities.await import org.session.libsession.utilities.Address import org.session.libsession.utilities.GroupUtil import org.session.libsession.utilities.TextSecurePreferences -import org.session.libsession.utilities.getClosedGroup import org.session.libsession.utilities.recipients.Recipient import org.session.libsignal.utilities.AccountId import org.thoughtcrime.securesms.database.DatabaseContentProviders @@ -113,7 +112,7 @@ class DefaultConversationRepository @Inject constructor( } override fun maybeGetBlindedRecipient(recipient: Recipient): Recipient? { - if (!recipient.isOpenGroupInboxRecipient) return null + if (!recipient.isCommunityInboxRecipient) return null return Recipient.from( context, Address.fromSerialized(GroupUtil.getDecodedOpenGroupInboxAccountId(recipient.address.serialize())), @@ -173,7 +172,7 @@ class DefaultConversationRepository @Inject constructor( override fun isGroupReadOnly(recipient: Recipient): Boolean { // We only care about group v2 recipient - if (!recipient.isClosedGroupV2Recipient) { + if (!recipient.isGroupV2Recipient) { return false } @@ -304,7 +303,7 @@ class DefaultConversationRepository @Inject constructor( recipient: Recipient, messages: Set ) { - if (recipient.isLegacyClosedGroupRecipient) { + if (recipient.isLegacyGroupRecipient) { val publicKey = recipient.address messages.forEach { message -> @@ -343,7 +342,7 @@ class DefaultConversationRepository @Inject constructor( } private fun shouldSendUnsendRequest(recipient: Recipient): Boolean { - return recipient.is1on1 || recipient.isLegacyClosedGroupRecipient + return recipient.is1on1 || recipient.isLegacyGroupRecipient } private fun buildUnsendRequest(message: MessageRecord): UnsendRequest { @@ -383,7 +382,7 @@ class DefaultConversationRepository @Inject constructor( while (reader.next != null) { deleteMessageRequest(reader.current) val recipient = reader.current.recipient - if (block && !recipient.isClosedGroupV2Recipient) { + if (block && !recipient.isGroupV2Recipient) { setBlocked(reader.current.threadId, recipient, true) } } @@ -394,7 +393,7 @@ class DefaultConversationRepository @Inject constructor( override suspend fun acceptMessageRequest(threadId: Long, recipient: Recipient) = runCatching { withContext(Dispatchers.Default) { storage.setRecipientApproved(recipient, true) - if (recipient.isClosedGroupV2Recipient) { + if (recipient.isGroupV2Recipient) { groupManager.respondToInvitation( AccountId(recipient.address.serialize()), approved = true @@ -418,7 +417,7 @@ class DefaultConversationRepository @Inject constructor( override suspend fun declineMessageRequest(threadId: Long, recipient: Recipient): Result = runCatching { withContext(Dispatchers.Default) { sessionJobDb.cancelPendingMessageSendJobs(threadId) - if (recipient.isClosedGroupV2Recipient) { + if (recipient.isGroupV2Recipient) { groupManager.respondToInvitation( AccountId(recipient.address.serialize()), approved = false diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/SessionMetaProtocol.kt b/app/src/main/java/org/thoughtcrime/securesms/util/SessionMetaProtocol.kt index c10e1b635d..cf140baefe 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/SessionMetaProtocol.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/util/SessionMetaProtocol.kt @@ -40,7 +40,7 @@ object SessionMetaProtocol { @JvmStatic fun shouldSendDeliveryReceipt(message: SignalServiceDataMessage, address: Address): Boolean { - if (address.isGroup) { return false } + if (address.isGroupOrCommunity) { return false } val hasBody = message.body.isPresent && message.body.get().isNotEmpty() val hasAttachment = message.attachments.isPresent && message.attachments.get().isNotEmpty() val hasLinkPreview = message.previews.isPresent && message.previews.get().isNotEmpty() @@ -49,11 +49,11 @@ object SessionMetaProtocol { @JvmStatic fun shouldSendReadReceipt(recipient: Recipient): Boolean { - return !recipient.isGroupRecipient && recipient.isApproved && !recipient.isBlocked + return !recipient.isGroupOrCommunityRecipient && recipient.isApproved && !recipient.isBlocked } @JvmStatic fun shouldSendTypingIndicator(recipient: Recipient): Boolean { - return !recipient.isGroupRecipient && recipient.isApproved && !recipient.isBlocked + return !recipient.isGroupOrCommunityRecipient && recipient.isApproved && !recipient.isBlocked } } \ No newline at end of file diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/SharedConfigUtils.kt b/app/src/main/java/org/thoughtcrime/securesms/util/SharedConfigUtils.kt index 3c65458207..d044d9f8c0 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/SharedConfigUtils.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/util/SharedConfigUtils.kt @@ -1,6 +1,5 @@ package org.thoughtcrime.securesms.util -import network.loki.messenger.libsession_util.ConversationVolatileConfig import network.loki.messenger.libsession_util.ReadableConversationVolatileConfig import org.session.libsession.messaging.MessagingModuleConfiguration import org.session.libsession.utilities.GroupUtil @@ -10,12 +9,12 @@ import org.thoughtcrime.securesms.database.model.ThreadRecord fun ReadableConversationVolatileConfig.getConversationUnread(thread: ThreadRecord): Boolean { val recipient = thread.recipient if (recipient.isContactRecipient - && recipient.isOpenGroupInboxRecipient + && recipient.isCommunityInboxRecipient && recipient.address.serialize().startsWith(IdPrefix.STANDARD.value)) { return getOneToOne(recipient.address.serialize())?.unread == true - } else if (recipient.isClosedGroupV2Recipient) { + } else if (recipient.isGroupV2Recipient) { return getClosedGroup(recipient.address.serialize())?.unread == true - } else if (recipient.isLegacyClosedGroupRecipient) { + } else if (recipient.isLegacyGroupRecipient) { return getLegacyClosedGroup(GroupUtil.doubleDecodeGroupId(recipient.address.toGroupString()))?.unread == true } else if (recipient.isCommunityRecipient) { val openGroup = MessagingModuleConfiguration.shared.storage.getOpenGroup(thread.threadId) ?: return false diff --git a/app/src/test/java/org/thoughtcrime/securesms/conversation/disappearingmessages/DisappearingMessagesViewModelTest.kt b/app/src/test/java/org/thoughtcrime/securesms/conversation/disappearingmessages/DisappearingMessagesViewModelTest.kt index 186028d275..56b6778884 100644 --- a/app/src/test/java/org/thoughtcrime/securesms/conversation/disappearingmessages/DisappearingMessagesViewModelTest.kt +++ b/app/src/test/java/org/thoughtcrime/securesms/conversation/disappearingmessages/DisappearingMessagesViewModelTest.kt @@ -443,8 +443,8 @@ class DisappearingMessagesViewModelTest { mockStuff(mode) whenever(recipient.address).thenReturn(GROUP_ADDRESS) - whenever(recipient.isGroupRecipient).thenReturn(true) - whenever(recipient.isLegacyClosedGroupRecipient).thenReturn(true) + whenever(recipient.isGroupOrCommunityRecipient).thenReturn(true) + whenever(recipient.isLegacyGroupRecipient).thenReturn(true) whenever(groupDb.getGroup(any())).thenReturn(Optional.of(groupRecord)) whenever(groupRecord.admins).thenReturn( buildList { diff --git a/app/src/test/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModelTest.kt b/app/src/test/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModelTest.kt index f99a3ef7df..b26af83a9f 100644 --- a/app/src/test/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModelTest.kt +++ b/app/src/test/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModelTest.kt @@ -4,7 +4,6 @@ import android.app.Application import com.goterl.lazysodium.utils.KeyPair import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.first -import org.hamcrest.CoreMatchers.endsWith import org.hamcrest.CoreMatchers.equalTo import org.hamcrest.CoreMatchers.notNullValue import org.hamcrest.CoreMatchers.nullValue @@ -166,8 +165,8 @@ class ConversationViewModelTest: BaseViewModelTest() { @Test fun `open group recipient should have no blinded recipient`() { whenever(recipient.isCommunityRecipient).thenReturn(true) - whenever(recipient.isOpenGroupOutboxRecipient).thenReturn(false) - whenever(recipient.isOpenGroupInboxRecipient).thenReturn(false) + whenever(recipient.isCommunityOutboxRecipient).thenReturn(false) + whenever(recipient.isCommunityInboxRecipient).thenReturn(false) assertThat(viewModel.blindedRecipient, nullValue()) } @@ -180,7 +179,7 @@ class ConversationViewModelTest: BaseViewModelTest() { @Test fun `contact recipient should hide input bar if not accepting requests`() { - whenever(recipient.isOpenGroupInboxRecipient).thenReturn(true) + whenever(recipient.isCommunityInboxRecipient).thenReturn(true) val blinded = mock { whenever(it.blocksCommunityMessageRequests).thenReturn(true) } diff --git a/app/src/test/java/org/thoughtcrime/securesms/conversation/v2/MentionViewModelTest.kt b/app/src/test/java/org/thoughtcrime/securesms/conversation/v2/MentionViewModelTest.kt index ba4befde10..6040de0b55 100644 --- a/app/src/test/java/org/thoughtcrime/securesms/conversation/v2/MentionViewModelTest.kt +++ b/app/src/test/java/org/thoughtcrime/securesms/conversation/v2/MentionViewModelTest.kt @@ -74,7 +74,7 @@ class MentionViewModelTest { threadDatabase = mock { on { getRecipientForThreadId(threadID) } doAnswer { mock { - on { isClosedGroupV2Recipient } doReturn false + on { isGroupV2Recipient } doReturn false on { isCommunityRecipient } doReturn true on { isContactRecipient } doReturn false } diff --git a/libsession/src/main/java/org/session/libsession/messaging/messages/Destination.kt b/libsession/src/main/java/org/session/libsession/messaging/messages/Destination.kt index 0ac85c86b3..7c40616dec 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/messages/Destination.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/messages/Destination.kt @@ -41,7 +41,7 @@ sealed class Destination { address.isContact -> { Contact(address.contactIdentifier()) } - address.isLegacyClosedGroup -> { + address.isLegacyGroup -> { val groupID = address.toGroupString() val groupPublicKey = GroupUtil.doubleDecodeGroupID(groupID).toHexString() LegacyClosedGroup(groupPublicKey) @@ -61,7 +61,7 @@ sealed class Destination { groupInboxId.last() ) } - address.isClosedGroupV2 -> { + address.isGroupV2 -> { ClosedGroup(address.serialize()) } else -> { diff --git a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt index 94d93b5742..739f67dfee 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt @@ -407,7 +407,7 @@ fun MessageReceiver.handleVisibleMessage( ) } // Handle group invite response if new closed group - if (threadRecipient?.isClosedGroupV2Recipient == true) { + if (threadRecipient?.isGroupV2Recipient == true) { GlobalScope.launch { try { MessagingModuleConfiguration.shared.groupManagerV2 @@ -464,7 +464,7 @@ fun MessageReceiver.handleVisibleMessage( // Cancel any typing indicators if needed cancelTypingIndicatorsIfNeeded(message.sender!!) // Parse reaction if needed - val threadIsGroup = threadRecipient?.isGroupRecipient == true + val threadIsGroup = threadRecipient?.isGroupOrCommunityRecipient == true message.reaction?.let { reaction -> if (reaction.react == true) { reaction.serverId = message.openGroupServerMessageID?.toString() ?: message.serverHash.orEmpty() diff --git a/libsession/src/main/java/org/session/libsession/utilities/Address.kt b/libsession/src/main/java/org/session/libsession/utilities/Address.kt index 6fb747152d..6b1a47f7b9 100644 --- a/libsession/src/main/java/org/session/libsession/utilities/Address.kt +++ b/libsession/src/main/java/org/session/libsession/utilities/Address.kt @@ -18,11 +18,9 @@ class Address private constructor(address: String) : Parcelable, Comparable MessageType.COMMUNITY isLocalNumber -> MessageType.NOTE_TO_SELF - isLegacyClosedGroupRecipient -> MessageType.LEGACY_GROUP - isClosedGroupV2Recipient -> MessageType.GROUPS_V2 + isLegacyGroupRecipient -> MessageType.LEGACY_GROUP + isGroupV2Recipient -> MessageType.GROUPS_V2 else -> MessageType.ONE_ON_ONE } \ No newline at end of file diff --git a/libsession/src/main/java/org/session/libsession/utilities/recipients/Recipient.java b/libsession/src/main/java/org/session/libsession/utilities/recipients/Recipient.java index f20b240846..8f21a9f60a 100644 --- a/libsession/src/main/java/org/session/libsession/utilities/recipients/Recipient.java +++ b/libsession/src/main/java/org/session/libsession/utilities/recipients/Recipient.java @@ -17,12 +17,9 @@ */ package org.session.libsession.utilities.recipients; -import static org.session.libsession.utilities.IdUtilKt.truncateIdForDisplay; - import android.content.Context; import android.graphics.drawable.Drawable; import android.net.Uri; -import android.os.Build; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -326,7 +323,7 @@ public class Recipient implements RecipientModifiedListener { public synchronized @Nullable String getName() { StorageProtocol storage = MessagingModuleConfiguration.getShared().getStorage(); String accountID = this.address.toString(); - if (isGroupRecipient()) { + if (isGroupOrCommunityRecipient()) { if (this.name == null) { List names = new LinkedList<>(); for (Recipient recipient : participants) { @@ -336,7 +333,7 @@ public class Recipient implements RecipientModifiedListener { } else { return this.name; } - } else if (isOpenGroupInboxRecipient()){ + } else if (isCommunityInboxRecipient()){ String inboxID = GroupUtil.getDecodedOpenGroupInboxAccountId(accountID); Contact contact = storage.getContactWithAccountID(inboxID); if (contact == null) return accountID; @@ -374,7 +371,7 @@ public class Recipient implements RecipientModifiedListener { } public synchronized @NonNull MaterialColor getColor() { - if (isGroupRecipient()) return MaterialColor.GROUP; + if (isGroupOrCommunityRecipient()) return MaterialColor.GROUP; else if (color != null) return color; else if (name != null) return ContactColors.generateFor(name); else return ContactColors.UNKNOWN_COLOR; @@ -458,8 +455,8 @@ public class Recipient implements RecipientModifiedListener { notifyListeners(); } - public boolean isGroupRecipient() { - return address.isGroup(); + public boolean isGroupOrCommunityRecipient() { + return address.isGroupOrCommunity(); } public boolean isContactRecipient() { @@ -471,26 +468,26 @@ public class Recipient implements RecipientModifiedListener { return address.isCommunity(); } - public boolean isOpenGroupOutboxRecipient() { + public boolean isCommunityOutboxRecipient() { return address.isCommunityOutbox(); } - public boolean isOpenGroupInboxRecipient() { + public boolean isCommunityInboxRecipient() { return address.isCommunityInbox(); } - public boolean isLegacyClosedGroupRecipient() { - return address.isLegacyClosedGroup(); + public boolean isLegacyGroupRecipient() { + return address.isLegacyGroup(); } - public boolean isClosedGroupV2Recipient() { - return address.isClosedGroupV2(); + public boolean isGroupV2Recipient() { + return address.isGroupV2(); } @Deprecated public boolean isPushGroupRecipient() { - return address.isGroup(); + return address.isGroupOrCommunity(); } public @NonNull synchronized List getParticipants() { @@ -538,7 +535,7 @@ public class Recipient implements RecipientModifiedListener { public synchronized @Nullable ContactPhoto getContactPhoto() { if (isLocalNumber) return new ProfileContactPhoto(address, String.valueOf(TextSecurePreferences.getProfileAvatarId(context))); - else if (isGroupRecipient() && groupAvatarId != null) return new GroupRecordContactPhoto(address, groupAvatarId); + else if (isGroupOrCommunityRecipient() && groupAvatarId != null) return new GroupRecordContactPhoto(address, groupAvatarId); else if (systemContactPhoto != null) return new SystemContactPhoto(address, systemContactPhoto, 0); else if (profileAvatar != null) return new ProfileContactPhoto(address, profileAvatar); else return null; @@ -813,7 +810,7 @@ public class Recipient implements RecipientModifiedListener { } public synchronized boolean showCallMenu() { - return !isGroupRecipient() && hasApprovedMe(); + return !isGroupOrCommunityRecipient() && hasApprovedMe(); } @Override diff --git a/libsession/src/main/java/org/session/libsession/utilities/recipients/RecipientProvider.java b/libsession/src/main/java/org/session/libsession/utilities/recipients/RecipientProvider.java index bec8549712..60f759fb35 100644 --- a/libsession/src/main/java/org/session/libsession/utilities/recipients/RecipientProvider.java +++ b/libsession/src/main/java/org/session/libsession/utilities/recipients/RecipientProvider.java @@ -84,9 +84,9 @@ class RecipientProvider { @NonNull Optional settings, @NonNull Optional groupRecord) { - if (address.isGroup() && settings.isPresent() && groupRecord.isPresent()) { + if (address.isGroupOrCommunity() && settings.isPresent() && groupRecord.isPresent()) { return Optional.of(getGroupRecipientDetails(context, address, groupRecord, settings, true)); - } else if (!address.isGroup() && settings.isPresent()) { + } else if (!address.isGroupOrCommunity() && settings.isPresent()) { boolean isLocalNumber = address.serialize().equals(TextSecurePreferences.getLocalNumber(context)); return Optional.of(new RecipientDetails(null, null, !TextUtils.isEmpty(settings.get().getSystemDisplayName()), isLocalNumber, settings.get(), null)); } @@ -104,7 +104,7 @@ class RecipientProvider { } private @NonNull RecipientDetails getRecipientDetailsSync(Context context, @NonNull Address address, Optional settings, Optional groupRecord, boolean nestedAsynchronous) { - if (address.isGroup() && !address.isClosedGroupV2()) return getGroupRecipientDetails(context, address, groupRecord, settings, nestedAsynchronous); + if (address.isGroupOrCommunity() && !address.isGroupV2()) return getGroupRecipientDetails(context, address, groupRecord, settings, nestedAsynchronous); else return getIndividualRecipientDetails(context, address, settings); }