|
|
@ -23,6 +23,7 @@ import android.text.style.RelativeSizeSpan;
|
|
|
|
import android.text.style.StyleSpan;
|
|
|
|
import android.text.style.StyleSpan;
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
|
|
|
|
|
|
|
|
import org.session.libsession.messaging.MessagingModuleConfiguration;
|
|
|
|
import org.session.libsession.messaging.MessagingModuleConfiguration;
|
|
|
|
import org.session.libsession.messaging.calls.CallMessageType;
|
|
|
|
import org.session.libsession.messaging.calls.CallMessageType;
|
|
|
@ -56,6 +57,9 @@ public abstract class MessageRecord extends DisplayRecord {
|
|
|
|
private final List<ReactionRecord> reactions;
|
|
|
|
private final List<ReactionRecord> reactions;
|
|
|
|
private final boolean hasMention;
|
|
|
|
private final boolean hasMention;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
|
|
|
|
private UpdateMessageData groupUpdateMessage;
|
|
|
|
|
|
|
|
|
|
|
|
public final boolean isNotDisappearAfterRead() {
|
|
|
|
public final boolean isNotDisappearAfterRead() {
|
|
|
|
return expireStarted == getTimestamp();
|
|
|
|
return expireStarted == getTimestamp();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -115,10 +119,43 @@ public abstract class MessageRecord extends DisplayRecord {
|
|
|
|
return isExpirationTimerUpdate() || isCallLog() || isDataExtractionNotification();
|
|
|
|
return isExpirationTimerUpdate() || isCallLog() || isDataExtractionNotification();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @return Decoded group update message. Only valid if the message is a group update message.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
|
|
|
|
public UpdateMessageData getGroupUpdateMessage() {
|
|
|
|
|
|
|
|
if (isGroupUpdateMessage()) {
|
|
|
|
|
|
|
|
groupUpdateMessage = UpdateMessageData.Companion.fromJSON(getBody());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return groupUpdateMessage;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @return Whether the date text can be shown for this message. By default, every message
|
|
|
|
|
|
|
|
* can show a date break, only certain messages can't. Note: a positive value
|
|
|
|
|
|
|
|
* DOES NOT guarantee the date break will be shown, only a negative value can
|
|
|
|
|
|
|
|
* hide the date break.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public boolean canShowDateBreak() {
|
|
|
|
|
|
|
|
UpdateMessageData update = getGroupUpdateMessage();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (update == null) {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (update.getKind() instanceof UpdateMessageData.Kind.GroupDestroyed ||
|
|
|
|
|
|
|
|
update.getKind() instanceof UpdateMessageData.Kind.GroupKicked) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public CharSequence getDisplayBody(@NonNull Context context) {
|
|
|
|
public CharSequence getDisplayBody(@NonNull Context context) {
|
|
|
|
if (isGroupUpdateMessage()) {
|
|
|
|
if (isGroupUpdateMessage()) {
|
|
|
|
UpdateMessageData updateMessageData = UpdateMessageData.Companion.fromJSON(getBody());
|
|
|
|
UpdateMessageData updateMessageData = getGroupUpdateMessage();
|
|
|
|
if (updateMessageData == null) {
|
|
|
|
if (updateMessageData == null) {
|
|
|
|
return "";
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|