revert changes regarding explicit group updates as it's now in a separate PR

This commit is contained in:
Brice-W
2021-03-19 16:39:41 +11:00
parent 2ca8b1acb1
commit 5dcb3d77d4
6 changed files with 6 additions and 94 deletions

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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()) {

View File

@@ -493,14 +493,6 @@
<string name="MessageRecord_message_encrypted_with_a_legacy_protocol_version_that_is_no_longer_supported">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.</string>
<string name="MessageRecord_left_group">You have left the group.</string>
<string name="MessageRecord_you_updated_group">You updated the group.</string>
<string name="MessageRecord_you_created_a_new_group">You created a new group.</string>
<string name="MessageRecord_s_created_a_new_group">%1$s created a new group.</string>
<string name="MessageRecord_you_renamed_the_group">You renamed the group.</string>
<string name="MessageRecord_s_renamed_the_group">%1$s renamed the group.</string>
<string name="MessageRecord_you_added_new_members_to_the_group">You added new members to the group.</string>
<string name="MessageRecord_s_added_new_members_to_the_group">%1$s added new members to the group.</string>
<string name="MessageRecord_you_removed_members_from_the_group">You removed members from the group.</string>
<string name="MessageRecord_s_removed_members_from_the_group">%1$s removed members from the group.</string>
<string name="MessageRecord_you_called">You called</string>
<string name="MessageRecord_called_you">Contact called</string>
<string name="MessageRecord_missed_call">Missed call</string>