diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/MmsSmsColumns.java b/app/src/main/java/org/thoughtcrime/securesms/database/MmsSmsColumns.java index d26fc12b2..36b86023e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/MmsSmsColumns.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/MmsSmsColumns.java @@ -70,10 +70,6 @@ public interface MmsSmsColumns { protected static final long GROUP_UPDATE_BIT = 0x10000; protected static final long GROUP_QUIT_BIT = 0x20000; protected static final long EXPIRATION_TIMER_UPDATE_BIT = 0x40000; - protected static final long GROUP_CREATION_BIT = 0x80000; - protected static final long GROUP_NAME_UPDATE_BIT = 0x16000; - protected static final long GROUP_MEMBER_ADDED_BIT = 0x32000; - protected static final long GROUP_MEMBER_REMOVED_BIT = 0x64000; // Encrypted Storage Information XXX public static final long ENCRYPTION_MASK = 0xFF000000; @@ -88,8 +84,6 @@ public interface MmsSmsColumns { // Loki protected static final long ENCRYPTION_LOKI_SESSION_RESTORE_SENT_BIT = 0x01000000; protected static final long ENCRYPTION_LOKI_SESSION_RESTORE_DONE_BIT = 0x00100000; - protected static final long DATA_EXTRACTION_SCREENSHOT_BIT = 0x00010000; - protected static final long DATA_EXTRACTION_MEDIA_SAVED_BIT = 0x00001000; public static boolean isDraftMessageType(long type) { return (type & BASE_TYPE_MASK) == BASE_DRAFT_TYPE; @@ -203,16 +197,6 @@ public interface MmsSmsColumns { return (type & EXPIRATION_TIMER_UPDATE_BIT) != 0; } - // DATA EXTRACTION NOTIFICATION - - public static boolean isDataExtractionScreenshotUpdate(long type) { - return (type & DATA_EXTRACTION_SCREENSHOT_BIT) != 0; - } - - public static boolean isDataExtractionMediaSavedUpdate(long type) { - return (type & DATA_EXTRACTION_MEDIA_SAVED_BIT) != 0; - } - public static boolean isIncomingCall(long type) { return type == INCOMING_CALL_TYPE; } @@ -225,34 +209,14 @@ public interface MmsSmsColumns { return type == MISSED_CALL_TYPE; } - // GROUPS EXPLICIT UPDATES - public static boolean isGroupUpdate(long type) { return (type & GROUP_UPDATE_BIT) != 0; } - public static boolean isGroupCreation(long type) { - return (type & GROUP_CREATION_BIT) != 0; - } - - public static boolean isGroupNameUpdate(long type) { - return (type & GROUP_NAME_UPDATE_BIT) != 0; - } - - public static boolean isGroupMemberAdded(long type) { - return (type & GROUP_MEMBER_ADDED_BIT) != 0; - } - - public static boolean isGroupMemberRemoved(long type) { - return (type & GROUP_MEMBER_REMOVED_BIT) != 0; - } - public static boolean isGroupQuit(long type) { return (type & GROUP_QUIT_BIT) != 0; } - - public static boolean isFailedDecryptType(long type) { return (type & ENCRYPTION_REMOTE_FAILED_BIT) != 0; } diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/model/DisplayRecord.java b/app/src/main/java/org/thoughtcrime/securesms/database/model/DisplayRecord.java index cf712351e..ab40f3381 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/model/DisplayRecord.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/model/DisplayRecord.java @@ -113,14 +113,6 @@ public abstract class DisplayRecord { return SmsDatabase.Types.isGroupUpdate(type); } - public boolean isGroupCreation() { return MmsSmsColumns.Types.isGroupCreation(type); } - - public boolean isGroupNameUpdate() { return MmsSmsColumns.Types.isGroupNameUpdate(type); } - - public boolean isGroupMemberAdded() { return MmsSmsColumns.Types.isGroupMemberAdded(type); } - - public boolean isGroupMemberRemoved() { return MmsSmsColumns.Types.isGroupMemberRemoved(type); } - public boolean isGroupQuit() { return SmsDatabase.Types.isGroupQuit(type); } @@ -133,14 +125,6 @@ public abstract class DisplayRecord { return SmsDatabase.Types.isExpirationTimerUpdate(type); } - public boolean isDataExtractionScreenshot() { - return MmsSmsColumns.Types.isDataExtractionScreenshotUpdate(type); - } - - public boolean isDataExtractionMediaSaved() { - return MmsSmsColumns.Types.isDataExtractionMediaSavedUpdate(type); - } - public boolean isCallLog() { return SmsDatabase.Types.isCallLog(type); } 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 a043e7483..8ac7fac42 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 @@ -90,26 +90,8 @@ public abstract class MessageRecord extends DisplayRecord { @Override public SpannableString getDisplayBody(@NonNull Context context) { - if (isGroupCreation() && isOutgoing()) { - return new SpannableString(context.getString(R.string.MessageRecord_you_created_a_new_group)); - } else if (isGroupCreation()) { - return new SpannableString(context.getString(R.string.MessageRecord_s_created_a_new_group, getIndividualRecipient().toShortString())); - } else if (isGroupUpdate() && isOutgoing()) { - return new SpannableString(context.getString(R.string.MessageRecord_you_updated_group)); - } else if (isGroupUpdate()) { + if (isGroupUpdate() && isOutgoing()) { return new SpannableString(GroupDescription.Companion.getDescription(context, getBody()).toString(getIndividualRecipient())); - } else if (isGroupNameUpdate() && isOutgoing()) { - return new SpannableString(context.getString(R.string.MessageRecord_you_renamed_the_group)); - } else if (isGroupNameUpdate()) { - return new SpannableString(context.getString(R.string.MessageRecord_s_renamed_the_group, getIndividualRecipient().toShortString())); - } else if (isGroupMemberAdded() && isOutgoing()) { - return new SpannableString(context.getString(R.string.MessageRecord_you_added_new_members_to_the_group)); - } else if (isGroupMemberAdded()) { - return new SpannableString(context.getString(R.string.MessageRecord_s_added_new_members_to_the_group, getIndividualRecipient().toShortString())); - } else if (isGroupMemberRemoved() && isOutgoing()) { - return new SpannableString(context.getString(R.string.MessageRecord_you_added_new_members_to_the_group)); - } else if (isGroupMemberRemoved()) { - return new SpannableString(context.getString(R.string.MessageRecord_s_removed_members_from_the_group, getIndividualRecipient().toShortString())); } else if (isGroupQuit() && isOutgoing()) { return new SpannableString(context.getString(R.string.MessageRecord_left_group)); } else if (isGroupQuit()) { @@ -131,12 +113,6 @@ public abstract class MessageRecord extends DisplayRecord { String time = ExpirationUtil.getExpirationDisplayValue(context, seconds); return isOutgoing() ? new SpannableString(context.getString(R.string.MessageRecord_you_set_disappearing_message_time_to_s, time)) : new SpannableString(context.getString(R.string.MessageRecord_s_set_disappearing_message_time_to_s, getIndividualRecipient().toShortString(), time)); - } else if (isDataExtractionScreenshot()) { - return isOutgoing() ? new SpannableString(context.getString(R.string.MessageRecord_you_took_a_screenshot)) - : new SpannableString(context.getString(R.string.MessageRecord_s_took_a_screenshot, getIndividualRecipient().toShortString())); - } else if (isDataExtractionMediaSaved()) { - return isOutgoing() ? new SpannableString(context.getString(R.string.MessageRecord_media_saved_by_you)) - : new SpannableString(context.getString(R.string.MessageRecord_media_saved_by_s, getIndividualRecipient().toShortString())); } else if (isIdentityUpdate()) { return new SpannableString(context.getString(R.string.MessageRecord_your_safety_number_with_s_has_changed, getIndividualRecipient().toShortString())); } else if (isIdentityVerified()) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2d3b0ff67..166f8c42d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -493,14 +493,6 @@ Received a message encrypted using an old version of Session that is no longer supported. Please ask the sender to update to the most recent version and resend the message. You have left the group. You updated the group. - You created a new group. - %1$s created a new group. - You renamed the group. - %1$s renamed the group. - You added new members to the group. - %1$s added new members to the group. - You removed members from the group. - %1$s removed members from the group. You called Contact called Missed call diff --git a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/MessageReceiverHandler.kt b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/MessageReceiverHandler.kt index 1f0a130d0..64a4e39c6 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/MessageReceiverHandler.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/MessageReceiverHandler.kt @@ -256,7 +256,7 @@ private fun handleNewClosedGroup(sender: String, sentTimestamp: Long, groupPubli storage.createGroup(groupID, name, LinkedList(members.map { Address.fromSerialized(it) }), null, null, LinkedList(admins.map { Address.fromSerialized(it) }), formationTimestamp) // Notify the user - storage.insertIncomingInfoMessage(context, sender, groupID, SignalServiceProtos.GroupContext.Type.UPDATE, SignalServiceGroup.Type.NEW, name, members, admins, sentTimestamp) + storage.insertIncomingInfoMessage(context, sender, groupID, SignalServiceProtos.GroupContext.Type.UPDATE, SignalServiceGroup.Type.UPDATE, name, members, admins, sentTimestamp) } storage.setProfileSharing(Address.fromSerialized(groupID), true) // Add the group to the user's set of public keys to poll for @@ -373,7 +373,7 @@ private fun MessageReceiver.handleClosedGroupNameChanged(message: ClosedGroupCon val name = kind.name storage.updateTitle(groupID, name) - storage.insertIncomingInfoMessage(context, senderPublicKey, groupID, SignalServiceProtos.GroupContext.Type.UPDATE, SignalServiceGroup.Type.NAME_UPDATE, name, members, admins, message.sentTimestamp!!) + storage.insertIncomingInfoMessage(context, senderPublicKey, groupID, SignalServiceProtos.GroupContext.Type.UPDATE, SignalServiceGroup.Type.UPDATE, name, members, admins, message.sentTimestamp!!) } private fun MessageReceiver.handleClosedGroupMembersAdded(message: ClosedGroupControlMessage) { @@ -401,7 +401,7 @@ private fun MessageReceiver.handleClosedGroupMembersAdded(message: ClosedGroupCo val threadID = storage.getOrCreateThreadIdFor(Address.fromSerialized(groupID)) storage.insertOutgoingInfoMessage(context, groupID, SignalServiceProtos.GroupContext.Type.UPDATE, name, members, admins, threadID, message.sentTimestamp!!) } else { - storage.insertIncomingInfoMessage(context, senderPublicKey, groupID, SignalServiceProtos.GroupContext.Type.UPDATE, SignalServiceGroup.Type.MEMBER_ADDED, name, members, admins, message.sentTimestamp!!) + storage.insertIncomingInfoMessage(context, senderPublicKey, groupID, SignalServiceProtos.GroupContext.Type.UPDATE, SignalServiceGroup.Type.UPDATE, name, members, admins, message.sentTimestamp!!) } if (userPublicKey in admins) { // send current encryption key to the latest added members @@ -462,7 +462,7 @@ private fun MessageReceiver.handleClosedGroupMembersRemoved(message: ClosedGroup } val (contextType, signalType) = if (senderLeft) SignalServiceProtos.GroupContext.Type.QUIT to SignalServiceGroup.Type.QUIT - else SignalServiceProtos.GroupContext.Type.UPDATE to SignalServiceGroup.Type.MEMBER_REMOVED + else SignalServiceProtos.GroupContext.Type.UPDATE to SignalServiceGroup.Type.UPDATE storage.insertIncomingInfoMessage(context, senderPublicKey, groupID, contextType, signalType, name, members, admins, message.sentTimestamp!!) } diff --git a/libsignal/src/main/java/org/session/libsignal/service/api/messages/SignalServiceGroup.java b/libsignal/src/main/java/org/session/libsignal/service/api/messages/SignalServiceGroup.java index fa84a389f..b50353109 100644 --- a/libsignal/src/main/java/org/session/libsignal/service/api/messages/SignalServiceGroup.java +++ b/libsignal/src/main/java/org/session/libsignal/service/api/messages/SignalServiceGroup.java @@ -37,11 +37,7 @@ public class SignalServiceGroup { UPDATE, DELIVER, QUIT, - REQUEST_INFO, - NEW, - NAME_UPDATE, - MEMBER_ADDED, - MEMBER_REMOVED + REQUEST_INFO } private final byte[] groupId;