diff --git a/app/src/main/java/org/thoughtcrime/securesms/MessageDetailsActivity.java b/app/src/main/java/org/thoughtcrime/securesms/MessageDetailsActivity.java index 79ee15c8a7..cb673cf978 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/MessageDetailsActivity.java +++ b/app/src/main/java/org/thoughtcrime/securesms/MessageDetailsActivity.java @@ -38,11 +38,12 @@ import androidx.loader.content.Loader; import org.session.libsession.messaging.messages.visible.LinkPreview; +import org.session.libsession.messaging.messages.visible.OpenGroupInvitation; import org.session.libsession.messaging.messages.visible.Quote; import org.session.libsession.messaging.messages.visible.VisibleMessage; import org.session.libsession.messaging.open_groups.OpenGroup; import org.session.libsession.messaging.sending_receiving.MessageSender; -import org.session.libsession.messaging.sending_receiving.attachments.Attachment; +import org.session.libsession.messaging.utilities.UpdateMessageData; import org.thoughtcrime.securesms.MessageDetailsRecipientAdapter.RecipientDeliveryStatus; import org.session.libsession.utilities.color.MaterialColor; import org.thoughtcrime.securesms.conversation.ConversationItem; @@ -448,7 +449,18 @@ public class MessageDetailsActivity extends PassphraseRequiredActionBarActivity Recipient recipient = messageRecord.getRecipient(); VisibleMessage message = new VisibleMessage(); message.setId(messageRecord.getId()); - message.setText(messageRecord.getBody()); + if (messageRecord.isOpenGroupInvitation()) { + OpenGroupInvitation openGroupInvitation = new OpenGroupInvitation(); + UpdateMessageData updateMessageData = UpdateMessageData.Companion.fromJSON(messageRecord.getBody()); + if (updateMessageData.getKind() instanceof UpdateMessageData.Kind.OpenGroupInvitation) { + UpdateMessageData.Kind.OpenGroupInvitation data = (UpdateMessageData.Kind.OpenGroupInvitation)updateMessageData.getKind(); + openGroupInvitation.setGroupName(data.getGroupName()); + openGroupInvitation.setGroupUrl(data.getGroupUrl()); + } + message.setOpenGroupInvitation(openGroupInvitation); + } else { + message.setText(messageRecord.getBody()); + } message.setSentTimestamp(messageRecord.getTimestamp()); if (recipient.isGroupRecipient()) { message.setGroupPublicKey(recipient.getAddress().toGroupString()); diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java index 419113ea49..1b7d11e743 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationItem.java @@ -65,7 +65,6 @@ import org.session.libsession.messaging.threads.recipients.Recipient; import org.session.libsession.messaging.threads.recipients.RecipientModifiedListener; import org.session.libsession.messaging.utilities.UpdateMessageData; import org.session.libsession.utilities.GroupUtil; -import org.session.libsession.utilities.OpenGroupUrlParser; import org.session.libsession.utilities.TextSecurePreferences; import org.session.libsession.utilities.ThemeUtil; import org.session.libsession.utilities.Util;