Update copy

This commit is contained in:
SessionHero01
2024-10-15 15:40:41 +11:00
parent e0ea98abdd
commit b8e98ec9ed
6 changed files with 43 additions and 18 deletions

View File

@@ -1059,7 +1059,7 @@ open class Storage @Inject constructor(
}
override fun insertGroupInviteControlMessage(sentTimestamp: Long, senderPublicKey: String, closedGroup: AccountId, groupName: String): Long? {
val updateData = UpdateMessageData(UpdateMessageData.Kind.GroupInvitation(senderPublicKey, groupName))
val updateData = UpdateMessageData(UpdateMessageData.Kind.GroupInvitation(closedGroup.hexString, senderPublicKey, groupName))
return insertUpdateControlMessage(updateData, sentTimestamp, senderPublicKey, closedGroup)
}

View File

@@ -24,6 +24,7 @@ import android.text.style.StyleSpan;
import androidx.annotation.NonNull;
import org.session.libsession.messaging.MessagingModuleConfiguration;
import org.session.libsession.messaging.calls.CallMessageType;
import org.session.libsession.messaging.sending_receiving.data_extraction.DataExtractionNotificationInfoMessage;
import org.session.libsession.messaging.utilities.UpdateMessageBuilder;
@@ -118,7 +119,16 @@ public abstract class MessageRecord extends DisplayRecord {
public CharSequence getDisplayBody(@NonNull Context context) {
if (isGroupUpdateMessage()) {
UpdateMessageData updateMessageData = UpdateMessageData.Companion.fromJSON(getBody());
return new SpannableString(UpdateMessageBuilder.INSTANCE.buildGroupUpdateMessage(context, updateMessageData, getIndividualRecipient().getAddress().serialize(), isOutgoing(), true));
if (updateMessageData == null) {
return "";
}
return new SpannableString(UpdateMessageBuilder.buildGroupUpdateMessage(
context,
updateMessageData,
MessagingModuleConfiguration.getShared().getConfigFactory(),
isOutgoing())
);
} else if (isExpirationTimerUpdate()) {
int seconds = (int) (getExpiresIn() / 1000);
boolean isGroup = DatabaseComponent.get(context).threadDatabase().getRecipientForThreadId(getThreadId()).isGroupRecipient();

View File

@@ -556,7 +556,6 @@ class GroupManagerV2Impl @Inject constructor(
val responseData = GroupUpdateMessage.newBuilder()
.setInviteResponse(inviteResponse)
val responseMessage = GroupUpdated(responseData.build())
storage.clearMessages(threadId)
// this will fail the first couple of times :)
MessageSender.send(
responseMessage,

View File

@@ -404,11 +404,12 @@ class DefaultConversationRepository @Inject constructor(
destination = Destination.from(recipient.address),
isSyncMessage = recipient.isLocalNumber
).await()
// add a control message for our user
storage.insertMessageRequestResponseFromYou(threadId)
}
threadDb.setHasSent(threadId, true)
// add a control message for our user
storage.insertMessageRequestResponseFromYou(threadId)
}
}