mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Upgrade from Telegram 3.8.1 (787) to 3.10.1-(821).
This commit is contained in:
@@ -29,6 +29,7 @@ import org.telegram.ui.Components.URLSpanBotCommand;
|
||||
import org.telegram.ui.Components.URLSpanNoUnderline;
|
||||
import org.telegram.ui.Components.URLSpanNoUnderlineBold;
|
||||
import org.telegram.ui.Components.URLSpanReplacement;
|
||||
import org.telegram.ui.Components.URLSpanUserMention;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.AbstractMap;
|
||||
@@ -313,6 +314,8 @@ public class MessageObject {
|
||||
messageText = LocaleController.getString("ActionMigrateFromGroup", R.string.ActionMigrateFromGroup);
|
||||
} else if (message.action instanceof TLRPC.TL_messageActionPinMessage) {
|
||||
generatePinMessageText(fromUser, fromUser == null ? chats.get(message.to_id.channel_id) : null);
|
||||
} else if (message.action instanceof TLRPC.TL_messageActionHistoryClear) {
|
||||
messageText = LocaleController.getString("HistoryCleared", R.string.HistoryCleared);
|
||||
}
|
||||
}
|
||||
} else if (!isMediaEmpty()) {
|
||||
@@ -369,7 +372,9 @@ public class MessageObject {
|
||||
|
||||
if (messageOwner.message != null && messageOwner.id < 0 && messageOwner.message.length() > 6 && isVideo()) {
|
||||
videoEditedInfo = new VideoEditedInfo();
|
||||
videoEditedInfo.parseString(messageOwner.message);
|
||||
if (!videoEditedInfo.parseString(messageOwner.message)) {
|
||||
videoEditedInfo = null;
|
||||
}
|
||||
}
|
||||
|
||||
generateCaption();
|
||||
@@ -461,6 +466,7 @@ public class MessageObject {
|
||||
}
|
||||
|
||||
public void setType() {
|
||||
int oldType = type;
|
||||
if (messageOwner instanceof TLRPC.TL_message || messageOwner instanceof TLRPC.TL_messageForwarded_old2) {
|
||||
if (isMediaEmpty()) {
|
||||
type = 0;
|
||||
@@ -508,11 +514,17 @@ public class MessageObject {
|
||||
contentType = -1;
|
||||
type = -1;
|
||||
}
|
||||
} else if (messageOwner.action instanceof TLRPC.TL_messageActionHistoryClear) {
|
||||
contentType = -1;
|
||||
type = -1;
|
||||
} else {
|
||||
contentType = 1;
|
||||
type = 10;
|
||||
}
|
||||
}
|
||||
if (oldType != 1000 && oldType != type) {
|
||||
generateThumbs(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void checkLayout() {
|
||||
@@ -879,7 +891,20 @@ public class MessageObject {
|
||||
generateLinkDescription();
|
||||
textLayoutBlocks = new ArrayList<>();
|
||||
|
||||
boolean useManualParse = messageOwner.entities.isEmpty() && (
|
||||
boolean hasEntities;
|
||||
if (messageOwner.send_state != MESSAGE_SEND_STATE_SENT) {
|
||||
hasEntities = false;
|
||||
for (int a = 0; a < messageOwner.entities.size(); a++) {
|
||||
if (!(messageOwner.entities.get(a) instanceof TLRPC.TL_inputMessageEntityMentionName)) {
|
||||
hasEntities = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
hasEntities = !messageOwner.entities.isEmpty();
|
||||
}
|
||||
|
||||
boolean useManualParse = !hasEntities && (
|
||||
messageOwner instanceof TLRPC.TL_message_old ||
|
||||
messageOwner instanceof TLRPC.TL_message_old2 ||
|
||||
messageOwner instanceof TLRPC.TL_message_old3 ||
|
||||
@@ -932,6 +957,10 @@ public class MessageObject {
|
||||
spannable.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface("fonts/ritalic.ttf")), entity.offset, entity.offset + entity.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
} else if (entity instanceof TLRPC.TL_messageEntityCode || entity instanceof TLRPC.TL_messageEntityPre) {
|
||||
spannable.setSpan(new TypefaceSpan(Typeface.MONOSPACE, AndroidUtilities.dp(MessagesController.getInstance().fontSize - 1)), entity.offset, entity.offset + entity.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
} else if (entity instanceof TLRPC.TL_messageEntityMentionName) {
|
||||
spannable.setSpan(new URLSpanUserMention("" + ((TLRPC.TL_messageEntityMentionName) entity).user_id), entity.offset, entity.offset + entity.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
} else if (entity instanceof TLRPC.TL_inputMessageEntityMentionName) {
|
||||
spannable.setSpan(new URLSpanUserMention("" + ((TLRPC.TL_inputMessageEntityMentionName) entity).user_id.user_id), entity.offset, entity.offset + entity.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
} else if (!useManualParse) {
|
||||
String url = messageOwner.message.substring(entity.offset, entity.offset + entity.length);
|
||||
if (entity instanceof TLRPC.TL_messageEntityBotCommand) {
|
||||
@@ -967,7 +996,7 @@ public class MessageObject {
|
||||
maxWidth = Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) - AndroidUtilities.dp(80);
|
||||
}
|
||||
}
|
||||
if (fromUser != null && fromUser.bot) {
|
||||
if (fromUser != null && fromUser.bot || (isMegagroup() || messageOwner.fwd_from != null && messageOwner.fwd_from.channel_id != 0) && !isOut()) {
|
||||
maxWidth -= AndroidUtilities.dp(20);
|
||||
}
|
||||
|
||||
@@ -1177,27 +1206,10 @@ public class MessageObject {
|
||||
return message.media_unread;
|
||||
}
|
||||
|
||||
public boolean isImportant() {
|
||||
return isImportant(messageOwner);
|
||||
}
|
||||
|
||||
public boolean isMegagroup() {
|
||||
return isMegagroup(messageOwner);
|
||||
}
|
||||
|
||||
public static boolean isImportant(TLRPC.Message message) {
|
||||
if (isMegagroup(message)) {
|
||||
return message.post;
|
||||
}
|
||||
if (message.to_id.channel_id != 0) {
|
||||
if (message instanceof TLRPC.TL_message_layer47 || message instanceof TLRPC.TL_message_old7) {
|
||||
return message.to_id.channel_id != 0 && (message.from_id <= 0 || message.mentioned || message.out || (message.flags & TLRPC.MESSAGE_FLAG_HAS_FROM_ID) == 0);
|
||||
}
|
||||
return message.post;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isMegagroup(TLRPC.Message message) {
|
||||
return (message.flags & TLRPC.MESSAGE_FLAG_MEGAGROUP) != 0;
|
||||
}
|
||||
@@ -1467,6 +1479,16 @@ public class MessageObject {
|
||||
}
|
||||
}
|
||||
|
||||
public String getStickerEmoji() {
|
||||
for (int a = 0; a < messageOwner.media.document.attributes.size(); a++) {
|
||||
TLRPC.DocumentAttribute attribute = messageOwner.media.document.attributes.get(a);
|
||||
if (attribute instanceof TLRPC.TL_documentAttributeSticker) {
|
||||
return attribute.alt != null && attribute.alt.length() > 0 ? attribute.alt : null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isSticker() {
|
||||
if (type != 1000) {
|
||||
return type == 13;
|
||||
@@ -1524,6 +1546,22 @@ public class MessageObject {
|
||||
return "";
|
||||
}
|
||||
|
||||
public int getDuration() {
|
||||
TLRPC.Document document;
|
||||
if (type == 0) {
|
||||
document = messageOwner.media.webpage.document;
|
||||
} else {
|
||||
document = messageOwner.media.document;
|
||||
}
|
||||
for (int a = 0; a < document.attributes.size(); a++) {
|
||||
TLRPC.DocumentAttribute attribute = document.attributes.get(a);
|
||||
if (attribute instanceof TLRPC.TL_documentAttributeAudio) {
|
||||
return attribute.duration;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getMusicAuthor() {
|
||||
TLRPC.Document document;
|
||||
if (type == 0) {
|
||||
@@ -1599,7 +1637,7 @@ public class MessageObject {
|
||||
}
|
||||
if (message.to_id.channel_id == 0) {
|
||||
return message.out && (message.media instanceof TLRPC.TL_messageMediaPhoto ||
|
||||
message.media instanceof TLRPC.TL_messageMediaDocument && (isVideoMessage(message) || isGifDocument(message.media.document)) ||
|
||||
message.media instanceof TLRPC.TL_messageMediaDocument && !isStickerMessage(message) ||
|
||||
message.media instanceof TLRPC.TL_messageMediaEmpty ||
|
||||
message.media instanceof TLRPC.TL_messageMediaWebPage ||
|
||||
message.media == null);
|
||||
@@ -1610,9 +1648,9 @@ public class MessageObject {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (chat.megagroup && message.out || !chat.megagroup && (chat.creator || chat.editor && isOut(message)) && isImportant(message)) {
|
||||
if (chat.megagroup && message.out || !chat.megagroup && (chat.creator || chat.editor && isOut(message)) && message.post) {
|
||||
if (message.media instanceof TLRPC.TL_messageMediaPhoto ||
|
||||
message.media instanceof TLRPC.TL_messageMediaDocument && (isVideoMessage(message) || isGifDocument(message.media.document)) ||
|
||||
message.media instanceof TLRPC.TL_messageMediaDocument && !isStickerMessage(message) ||
|
||||
message.media instanceof TLRPC.TL_messageMediaEmpty ||
|
||||
message.media instanceof TLRPC.TL_messageMediaWebPage ||
|
||||
message.media == null) {
|
||||
|
||||
Reference in New Issue
Block a user