kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix crash when getting update body on main thread.
rodzic
e2dbaa605b
commit
5175375483
|
@ -1055,7 +1055,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
|||
mediaThumbnailStub.require().setDownloadClickListener(downloadClickListener);
|
||||
mediaThumbnailStub.require().setOnLongClickListener(passthroughClickListener);
|
||||
mediaThumbnailStub.require().setOnClickListener(passthroughClickListener);
|
||||
mediaThumbnailStub.require().showShade(TextUtils.isEmpty(messageRecord.getDisplayBody(getContext())) && !hasExtraText(messageRecord));
|
||||
mediaThumbnailStub.require().showShade(messageRecord.isDisplayBodyEmpty(getContext()) && !hasExtraText(messageRecord));
|
||||
|
||||
if (!messageRecord.isOutgoing()) {
|
||||
mediaThumbnailStub.require().setConversationColor(getDefaultBubbleColor(hasWallpaper));
|
||||
|
@ -1166,7 +1166,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
|||
}
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(current.getDisplayBody(getContext()))) {
|
||||
if (!current.isDisplayBodyEmpty(getContext())) {
|
||||
bottomStart = 0;
|
||||
bottomEnd = 0;
|
||||
}
|
||||
|
@ -1194,7 +1194,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
|||
}
|
||||
|
||||
private void setSharedContactCorners(@NonNull MessageRecord current, @NonNull Optional<MessageRecord> previous, @NonNull Optional<MessageRecord> next, boolean isGroupThread) {
|
||||
if (TextUtils.isEmpty(messageRecord.getDisplayBody(getContext()))){
|
||||
if (messageRecord.isDisplayBodyEmpty(getContext())){
|
||||
if (isSingularMessage(current, previous, next, isGroupThread) || isEndOfMessageCluster(current, next, isGroupThread)) {
|
||||
sharedContactStub.get().setSingularStyle();
|
||||
} else if (current.isOutgoing()) {
|
||||
|
@ -1414,9 +1414,9 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
|||
private ConversationItemFooter getActiveFooter(@NonNull MessageRecord messageRecord) {
|
||||
if (hasNoBubble(messageRecord) && stickerFooter != null) {
|
||||
return stickerFooter;
|
||||
} else if (hasSharedContact(messageRecord) && TextUtils.isEmpty(messageRecord.getDisplayBody(getContext()))) {
|
||||
} else if (hasSharedContact(messageRecord) && messageRecord.isDisplayBodyEmpty(getContext())) {
|
||||
return sharedContactStub.get().getFooter();
|
||||
} else if (hasOnlyThumbnail(messageRecord) && TextUtils.isEmpty(messageRecord.getDisplayBody(getContext()))) {
|
||||
} else if (hasOnlyThumbnail(messageRecord) && messageRecord.isDisplayBodyEmpty(getContext())) {
|
||||
return mediaThumbnailStub.require().getFooter();
|
||||
} else {
|
||||
return footer;
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.text.SpannableString;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.WorkerThread;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
|
@ -108,6 +109,7 @@ public class MediaMmsMessageRecord extends MmsMessageRecord {
|
|||
}
|
||||
|
||||
@Override
|
||||
@WorkerThread
|
||||
public SpannableString getDisplayBody(@NonNull Context context) {
|
||||
if (MmsDatabase.Types.isChatSessionRefresh(type)) {
|
||||
return emphasisAdded(context.getString(R.string.MmsMessageRecord_bad_encrypted_mms_message));
|
||||
|
|
|
@ -26,6 +26,7 @@ import androidx.annotation.ColorInt;
|
|||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.WorkerThread;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
@ -131,6 +132,7 @@ public abstract class MessageRecord extends DisplayRecord {
|
|||
}
|
||||
|
||||
@Override
|
||||
@WorkerThread
|
||||
public SpannableString getDisplayBody(@NonNull Context context) {
|
||||
UpdateDescription updateDisplayBody = getUpdateDisplayBody(context);
|
||||
|
||||
|
@ -203,6 +205,10 @@ public abstract class MessageRecord extends DisplayRecord {
|
|||
return null;
|
||||
}
|
||||
|
||||
public boolean isDisplayBodyEmpty(@NonNull Context context) {
|
||||
return getUpdateDisplayBody(context) == null && getBody().isEmpty();
|
||||
}
|
||||
|
||||
public boolean isSelfCreatedGroup() {
|
||||
DecryptedGroupV2Context decryptedGroupV2Context = getDecryptedGroupV2Context();
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.content.Context;
|
|||
import android.text.SpannableString;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.WorkerThread;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.database.MmsSmsColumns;
|
||||
|
@ -64,6 +65,7 @@ public class SmsMessageRecord extends MessageRecord {
|
|||
}
|
||||
|
||||
@Override
|
||||
@WorkerThread
|
||||
public SpannableString getDisplayBody(@NonNull Context context) {
|
||||
if (SmsDatabase.Types.isChatSessionRefresh(type)) {
|
||||
return emphasisAdded(context.getString(R.string.MessageRecord_chat_session_refreshed));
|
||||
|
|
|
@ -31,7 +31,7 @@ fun MessageRecord.hasAudio(): Boolean =
|
|||
isMms && (this as MmsMessageRecord).slideDeck.audioSlide != null
|
||||
|
||||
fun MessageRecord.isCaptionlessMms(context: Context): Boolean =
|
||||
getDisplayBody(context).isEmpty() && isMms && (this as MmsMessageRecord).slideDeck.textSlide == null
|
||||
isMms && isDisplayBodyEmpty(context) && (this as MmsMessageRecord).slideDeck.textSlide == null
|
||||
|
||||
fun MessageRecord.hasThumbnail(): Boolean =
|
||||
isMms && (this as MmsMessageRecord).slideDeck.thumbnailSlide != null
|
||||
|
|
Ładowanie…
Reference in New Issue