mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 14:35:03 +01:00
Update to 2.3.2
This commit is contained in:
parent
4e03bc1a75
commit
213c2269c0
14 changed files with 234 additions and 66 deletions
|
@ -82,7 +82,7 @@ android {
|
|||
defaultConfig {
|
||||
minSdkVersion 8
|
||||
targetSdkVersion 21
|
||||
versionCode 414
|
||||
versionName "2.3.1"
|
||||
versionCode 415
|
||||
versionName "2.3.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,11 @@ LOCAL_SRC_FILES := \
|
|||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_ARM_MODE := arm
|
||||
ifeq ($(TARGET_ARCH_ABI),armeabi)
|
||||
LOCAL_ARM_MODE := thumb
|
||||
else
|
||||
LOCAL_ARM_MODE := arm
|
||||
endif
|
||||
LOCAL_MODULE := sqlite
|
||||
LOCAL_CFLAGS := -w -std=gnu99 -O2 -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_USED -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
|
||||
LOCAL_CFLAGS += -DANDROID_NDK -DDISABLE_IMPORTGL -fno-strict-aliasing -fprefetch-loop-arrays -DAVOID_TABLES -DANDROID_TILE_BASED_DECODE -DANDROID_ARMV6_IDCT -DHAVE_STRCHRNUL=0
|
||||
|
@ -106,7 +110,11 @@ LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA
|
|||
LOCAL_CFLAGS += -DANDROID_NDK -DDISABLE_IMPORTGL -fno-strict-aliasing -fprefetch-loop-arrays -DAVOID_TABLES -DANDROID_TILE_BASED_DECODE -DANDROID_ARMV6_IDCT -ffast-math
|
||||
LOCAL_CPPFLAGS := -DBSD=1 -ffast-math -O2 -funroll-loops
|
||||
LOCAL_LDLIBS := -ljnigraphics -llog
|
||||
LOCAL_ARM_MODE := arm
|
||||
ifeq ($(TARGET_ARCH_ABI),armeabi)
|
||||
LOCAL_ARM_MODE := thumb
|
||||
else
|
||||
LOCAL_ARM_MODE := arm
|
||||
endif
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
./opus/src/opus.c \
|
||||
|
|
Binary file not shown.
|
@ -1350,9 +1350,13 @@ public class MediaController implements NotificationCenter.NotificationCenterDel
|
|||
fileDecodingQueue.postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (playingMessageObject != null && playingMessageObject.audioProgress != 0) {
|
||||
lastPlayPcm = (long)(currentTotalPcmDuration * playingMessageObject.audioProgress);
|
||||
seekOpusFile(playingMessageObject.audioProgress);
|
||||
try {
|
||||
if (playingMessageObject != null && playingMessageObject.audioProgress != 0) {
|
||||
lastPlayPcm = (long)(currentTotalPcmDuration * playingMessageObject.audioProgress);
|
||||
seekOpusFile(playingMessageObject.audioProgress);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
}
|
||||
synchronized (playerSync) {
|
||||
freePlayerBuffers.addAll(usedPlayerBuffers);
|
||||
|
|
|
@ -60,6 +60,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
private ArrayList<Integer> loadingFullChats = new ArrayList<>();
|
||||
private ArrayList<Integer> loadedFullChats = new ArrayList<>();
|
||||
|
||||
private ArrayList<Integer> reloadingMessages = new ArrayList<>();
|
||||
|
||||
private boolean gettingNewDeleteTask = false;
|
||||
private int currentDeletingTaskTime = 0;
|
||||
private ArrayList<Integer> currentDeletingTaskMids = null;
|
||||
|
@ -314,6 +316,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
loadedFullUsers.clear();
|
||||
loadingFullUsers.clear();
|
||||
loadedFullUsers.clear();
|
||||
reloadingMessages.clear();
|
||||
|
||||
updatesStartWaitTime = 0;
|
||||
currentDeletingTaskTime = 0;
|
||||
|
@ -548,6 +551,47 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
ConnectionsManager.getInstance().bindRequestToGuid(reqId, classGuid);
|
||||
}
|
||||
|
||||
private void reloadMessages(final ArrayList<Integer> mids, final long dialog_id) {
|
||||
final TLRPC.TL_messages_getMessages req = new TLRPC.TL_messages_getMessages();
|
||||
for (Integer mid : mids) {
|
||||
if (reloadingMessages.contains(mid)) {
|
||||
continue;
|
||||
}
|
||||
req.id.add(mid);
|
||||
}
|
||||
if (req.id.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
reloadingMessages.addAll(req.id);
|
||||
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
|
||||
@Override
|
||||
public void run(TLObject response, TLRPC.TL_error error) {
|
||||
if (error == null) {
|
||||
TLRPC.messages_Messages messagesRes = (TLRPC.messages_Messages) response;
|
||||
MessagesStorage.getInstance().putMessages(messagesRes, dialog_id);
|
||||
|
||||
final ArrayList<MessageObject> objects = new ArrayList<>();
|
||||
ArrayList<Integer> messagesToReload = null;
|
||||
for (TLRPC.Message message : messagesRes.messages) {
|
||||
message.dialog_id = dialog_id;
|
||||
final HashMap<Integer, TLRPC.User> usersLocal = new HashMap<>();
|
||||
for (TLRPC.User u : messagesRes.users) {
|
||||
usersLocal.put(u.id, u);
|
||||
}
|
||||
objects.add(new MessageObject(message, usersLocal, 2));
|
||||
}
|
||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.replaceMessagesObjects, dialog_id, objects);
|
||||
}
|
||||
});
|
||||
}
|
||||
reloadingMessages.removeAll(req.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void processNewDifferenceParams(int seq, int pts, int date) {
|
||||
if (MessagesStorage.lastSeqValue + 1 == seq) {
|
||||
if (seq != -1) {
|
||||
|
@ -1443,9 +1487,21 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
usersLocal.put(u.id, u);
|
||||
}
|
||||
final ArrayList<MessageObject> objects = new ArrayList<>();
|
||||
ArrayList<Integer> messagesToReload = null;
|
||||
for (TLRPC.Message message : messagesRes.messages) {
|
||||
message.dialog_id = dialog_id;
|
||||
objects.add(new MessageObject(message, usersLocal, 2));
|
||||
if (isCache && message.media instanceof TLRPC.TL_messageMediaUnsupported) {
|
||||
if (message.media.bytes.length == 0 || message.media.bytes.length == 1 && message.media.bytes[0] < TLRPC.LAYER) {
|
||||
if (messagesToReload == null) {
|
||||
messagesToReload = new ArrayList<>();
|
||||
}
|
||||
messagesToReload.add(message.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (messagesToReload != null) {
|
||||
reloadMessages(messagesToReload, dialog_id);
|
||||
}
|
||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
|
|
|
@ -2734,6 +2734,8 @@ public class MessagesStorage {
|
|||
|
||||
int downloadMediaMask = 0;
|
||||
for (TLRPC.Message message : messages) {
|
||||
fixUnsupportedMedia(message);
|
||||
|
||||
long dialog_id = message.dialog_id;
|
||||
if (dialog_id == 0) {
|
||||
if (message.to_id.chat_id != 0) {
|
||||
|
@ -3499,6 +3501,15 @@ public class MessagesStorage {
|
|||
}
|
||||
}
|
||||
|
||||
private void fixUnsupportedMedia(TLRPC.Message message) {
|
||||
if (message != null && message.media instanceof TLRPC.TL_messageMediaUnsupported && message.media.bytes != null) {
|
||||
if (message.media.bytes.length == 0) {
|
||||
message.media.bytes = new byte[1];
|
||||
message.media.bytes[0] = TLRPC.LAYER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void putMessages(final TLRPC.messages_Messages messages, final long dialog_id) {
|
||||
if (messages.messages.isEmpty()) {
|
||||
return;
|
||||
|
@ -3512,6 +3523,7 @@ public class MessagesStorage {
|
|||
SQLitePreparedStatement state = database.executeFast("REPLACE INTO messages VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
SQLitePreparedStatement state2 = database.executeFast("REPLACE INTO media VALUES(?, ?, ?, ?)");
|
||||
for (TLRPC.Message message : messages.messages) {
|
||||
fixUnsupportedMedia(message);
|
||||
state.requery();
|
||||
ByteBufferDesc data = buffersStorage.getFreeBuffer(message.getObjectSize());
|
||||
message.serializeToStream(data);
|
||||
|
@ -3680,6 +3692,7 @@ public class MessagesStorage {
|
|||
uid = -dialog.peer.chat_id;
|
||||
}
|
||||
TLRPC.Message message = new_dialogMessage.get(dialog.top_message);
|
||||
fixUnsupportedMedia(message);
|
||||
ByteBufferDesc data = buffersStorage.getFreeBuffer(message.getObjectSize());
|
||||
message.serializeToStream(data);
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ public class NotificationCenter {
|
|||
public static final int privacyRulesUpdated = totalEvents++;
|
||||
public static final int updateMessageMedia = totalEvents++;
|
||||
public static final int recentImagesDidLoaded = totalEvents++;
|
||||
public static final int replaceMessagesObjects = totalEvents++;
|
||||
|
||||
public static final int httpFileDidLoaded = totalEvents++;
|
||||
public static final int httpFileDidFailedLoad = totalEvents++;
|
||||
|
|
|
@ -38,7 +38,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
|
||||
public class SecretChatHelper {
|
||||
|
||||
public static final int CURRENT_SECRET_CHAT_LAYER = 20;
|
||||
public static final int CURRENT_SECRET_CHAT_LAYER = 23;
|
||||
|
||||
private ArrayList<Integer> sendingNotifyLayer = new ArrayList<>();
|
||||
private HashMap<Integer, ArrayList<TLRPC.TL_decryptedMessageHolder>> secretHolesQueue = new HashMap<>();
|
||||
|
|
|
@ -1032,38 +1032,57 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
|
|||
reqSend.media.user_id = user.id;
|
||||
SecretChatHelper.getInstance().performSendEncryptedRequest(reqSend, newMsgObj.messageOwner, encryptedChat, null, null);
|
||||
} else if (type == 7) {
|
||||
reqSend.media = new TLRPC.TL_decryptedMessageMediaDocument();
|
||||
reqSend.media.size = document.size;
|
||||
if (!(document.thumb instanceof TLRPC.TL_photoSizeEmpty)) {
|
||||
reqSend.media.thumb = document.thumb.bytes;
|
||||
reqSend.media.thumb_h = document.thumb.h;
|
||||
reqSend.media.thumb_w = document.thumb.w;
|
||||
} else {
|
||||
reqSend.media.thumb = new byte[0];
|
||||
reqSend.media.thumb_h = 0;
|
||||
reqSend.media.thumb_w = 0;
|
||||
}
|
||||
reqSend.media.file_name = FileLoader.getDocumentFileName(document);
|
||||
reqSend.media.mime_type = document.mime_type;
|
||||
if (document.access_hash == 0) {
|
||||
DelayedMessage delayedMessage = new DelayedMessage();
|
||||
delayedMessage.originalPath = originalPath;
|
||||
delayedMessage.sendEncryptedRequest = reqSend;
|
||||
delayedMessage.type = 2;
|
||||
delayedMessage.obj = newMsgObj;
|
||||
delayedMessage.encryptedChat = encryptedChat;
|
||||
if (path != null && path.length() > 0 && path.startsWith("http")) {
|
||||
delayedMessage.httpLocation = path;
|
||||
boolean isSticker = false;
|
||||
for (TLRPC.DocumentAttribute attribute : document.attributes) {
|
||||
if (attribute instanceof TLRPC.TL_documentAttributeSticker) {
|
||||
isSticker = true;
|
||||
}
|
||||
delayedMessage.documentLocation = document;
|
||||
performSendDelayedMessage(delayedMessage);
|
||||
}
|
||||
if (isSticker) {
|
||||
reqSend.media = new TLRPC.TL_decryptedMessageMediaExternalDocument();
|
||||
reqSend.media.id = document.id;
|
||||
reqSend.media.date = document.date;
|
||||
reqSend.media.mime_type = document.mime_type;
|
||||
reqSend.media.size = document.size;
|
||||
((TLRPC.TL_decryptedMessageMediaExternalDocument) reqSend.media).thumbImage = document.thumb;
|
||||
reqSend.media.dc_id = document.dc_id;
|
||||
reqSend.media.attributes = document.attributes;
|
||||
SecretChatHelper.getInstance().performSendEncryptedRequest(reqSend, newMsgObj.messageOwner, encryptedChat, null, null);
|
||||
} else {
|
||||
TLRPC.TL_inputEncryptedFile encryptedFile = new TLRPC.TL_inputEncryptedFile();
|
||||
encryptedFile.id = document.id;
|
||||
encryptedFile.access_hash = document.access_hash;
|
||||
reqSend.media.key = document.key;
|
||||
reqSend.media.iv = document.iv;
|
||||
SecretChatHelper.getInstance().performSendEncryptedRequest(reqSend, newMsgObj.messageOwner, encryptedChat, encryptedFile, null);
|
||||
reqSend.media = new TLRPC.TL_decryptedMessageMediaDocument();
|
||||
reqSend.media.size = document.size;
|
||||
if (!(document.thumb instanceof TLRPC.TL_photoSizeEmpty)) {
|
||||
reqSend.media.thumb = document.thumb.bytes;
|
||||
reqSend.media.thumb_h = document.thumb.h;
|
||||
reqSend.media.thumb_w = document.thumb.w;
|
||||
} else {
|
||||
reqSend.media.thumb = new byte[0];
|
||||
reqSend.media.thumb_h = 0;
|
||||
reqSend.media.thumb_w = 0;
|
||||
}
|
||||
reqSend.media.file_name = FileLoader.getDocumentFileName(document);
|
||||
reqSend.media.mime_type = document.mime_type;
|
||||
|
||||
if (document.access_hash == 0) {
|
||||
DelayedMessage delayedMessage = new DelayedMessage();
|
||||
delayedMessage.originalPath = originalPath;
|
||||
delayedMessage.sendEncryptedRequest = reqSend;
|
||||
delayedMessage.type = 2;
|
||||
delayedMessage.obj = newMsgObj;
|
||||
delayedMessage.encryptedChat = encryptedChat;
|
||||
if (path != null && path.length() > 0 && path.startsWith("http")) {
|
||||
delayedMessage.httpLocation = path;
|
||||
}
|
||||
delayedMessage.documentLocation = document;
|
||||
performSendDelayedMessage(delayedMessage);
|
||||
} else {
|
||||
TLRPC.TL_inputEncryptedFile encryptedFile = new TLRPC.TL_inputEncryptedFile();
|
||||
encryptedFile.id = document.id;
|
||||
encryptedFile.access_hash = document.access_hash;
|
||||
reqSend.media.key = document.key;
|
||||
reqSend.media.iv = document.iv;
|
||||
SecretChatHelper.getInstance().performSendEncryptedRequest(reqSend, newMsgObj.messageOwner, encryptedChat, encryptedFile, null);
|
||||
}
|
||||
}
|
||||
} else if (type == 8) {
|
||||
if (AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) {
|
||||
|
@ -1544,6 +1563,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
|
|||
}
|
||||
|
||||
boolean isEncrypted = (int)dialog_id == 0;
|
||||
boolean allowSticker = !isEncrypted;
|
||||
|
||||
String name = f.getName();
|
||||
if (name == null) {
|
||||
|
@ -1591,7 +1611,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
|
|||
FileLog.e("tmessages", e);
|
||||
}
|
||||
}
|
||||
if (document.mime_type.equals("image/webp") && !isEncrypted) {
|
||||
if (document.mime_type.equals("image/webp") && allowSticker) {
|
||||
BitmapFactory.Options bmOptions = new BitmapFactory.Options();
|
||||
try {
|
||||
bmOptions.inJustDecodeBounds = true;
|
||||
|
|
|
@ -14,8 +14,9 @@ import java.util.Locale;
|
|||
@SuppressWarnings("unchecked")
|
||||
public class TLRPC {
|
||||
|
||||
public static int MESSAGE_FLAG_UNREAD = 1;
|
||||
public static int MESSAGE_FLAG_OUT = 2;
|
||||
public static final int MESSAGE_FLAG_UNREAD = 1;
|
||||
public static final int MESSAGE_FLAG_OUT = 2;
|
||||
public static final int LAYER = 22;
|
||||
|
||||
public static class ChatPhoto extends TLObject {
|
||||
public FileLocation photo_small;
|
||||
|
@ -10831,7 +10832,7 @@ public class TLRPC {
|
|||
public static class invokeWithLayer extends TLObject {
|
||||
public static int constructor = 0xda9b0d0d;
|
||||
|
||||
public int layer = 22;
|
||||
public int layer = LAYER;
|
||||
public TLObject query;
|
||||
|
||||
public void serializeToStream(AbsSerializedData stream) {
|
||||
|
|
|
@ -210,15 +210,17 @@ public class StickersAdapter extends RecyclerView.Adapter implements Notificatio
|
|||
}
|
||||
final HashMap<String, ArrayList<TLRPC.Document>> result = new HashMap<>();
|
||||
for (TLRPC.TL_stickerPack stickerPack : res.packs) {
|
||||
ArrayList<TLRPC.Document> arrayList = result.get(stickerPack.emoticon);
|
||||
for (Long id : stickerPack.documents) {
|
||||
TLRPC.Document document = documents.get(id);
|
||||
if (document != null) {
|
||||
if (arrayList == null) {
|
||||
arrayList = new ArrayList<>();
|
||||
result.put(stickerPack.emoticon, arrayList);
|
||||
if (stickerPack != null && stickerPack.emoticon != null) {
|
||||
ArrayList<TLRPC.Document> arrayList = result.get(stickerPack.emoticon);
|
||||
for (Long id : stickerPack.documents) {
|
||||
TLRPC.Document document = documents.get(id);
|
||||
if (document != null) {
|
||||
if (arrayList == null) {
|
||||
arrayList = new ArrayList<>();
|
||||
result.put(stickerPack.emoticon, arrayList);
|
||||
}
|
||||
arrayList.add(document);
|
||||
}
|
||||
arrayList.add(document);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,6 +93,7 @@ import org.telegram.ui.Components.TimerDrawable;
|
|||
import org.telegram.ui.Components.TypingDotsDrawable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
@ -444,6 +445,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.didCreatedNewDeleteTask);
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.audioDidStarted);
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.updateMessageMedia);
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.replaceMessagesObjects);
|
||||
|
||||
super.onFragmentCreate();
|
||||
|
||||
|
@ -502,6 +504,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.didCreatedNewDeleteTask);
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.audioDidStarted);
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.updateMessageMedia);
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.replaceMessagesObjects);
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.openedChatChanged, dialog_id, true);
|
||||
}
|
||||
|
@ -1222,7 +1225,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
stickersAdapter.destroy();
|
||||
}
|
||||
|
||||
if (currentEncryptedChat == null) {
|
||||
if (currentEncryptedChat == null || currentEncryptedChat != null && AndroidUtilities.getPeerLayerVersion(currentEncryptedChat.layer) >= 23) {
|
||||
stickersListView.setPadding(AndroidUtilities.dp(18), 0, AndroidUtilities.dp(18), 0);
|
||||
stickersListView.setAdapter(stickersAdapter = new StickersAdapter(getParentActivity(), new StickersAdapter.StickersAdapterDelegate() {
|
||||
@Override
|
||||
|
@ -1269,6 +1272,36 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
public void onItemClick(View view, int position) {
|
||||
TLRPC.Document document = stickersAdapter.getItem(position);
|
||||
if (document instanceof TLRPC.TL_document) {
|
||||
if (currentEncryptedChat != null && document.thumb instanceof TLRPC.TL_photoSize) {
|
||||
File file = FileLoader.getPathToAttach(document.thumb, true);
|
||||
if (file.exists()) {
|
||||
try {
|
||||
int len = (int)file.length();
|
||||
byte[] arr = new byte[(int)file.length()];
|
||||
RandomAccessFile reader = new RandomAccessFile(file, "r");
|
||||
reader.readFully(arr);
|
||||
TLRPC.TL_document newDocument = new TLRPC.TL_document();
|
||||
newDocument.thumb = new TLRPC.TL_photoCachedSize();
|
||||
newDocument.thumb.location = document.thumb.location;
|
||||
newDocument.thumb.size = document.thumb.size;
|
||||
newDocument.thumb.w = document.thumb.w;
|
||||
newDocument.thumb.h = document.thumb.h;
|
||||
newDocument.thumb.type = document.thumb.type;
|
||||
newDocument.thumb.bytes = arr;
|
||||
|
||||
newDocument.id = document.id;
|
||||
newDocument.access_hash = document.access_hash;
|
||||
newDocument.date = document.date;
|
||||
newDocument.mime_type = document.mime_type;
|
||||
newDocument.size = document.size;
|
||||
newDocument.dc_id = document.dc_id;
|
||||
newDocument.attributes = document.attributes;
|
||||
document = newDocument;
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
SendMessagesHelper.getInstance().sendMessage((TLRPC.TL_document) document, null, null, dialog_id);
|
||||
}
|
||||
chatActivityEnterView.setFieldText("");
|
||||
|
@ -2661,6 +2694,25 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
existMessageObject.generateThumbs(false, 1);
|
||||
}
|
||||
updateVisibleRows();
|
||||
} else if (id == NotificationCenter.replaceMessagesObjects) {
|
||||
if (dialog_id == (long) args[0]) {
|
||||
boolean changed = false;
|
||||
ArrayList<MessageObject> messageObjects = (ArrayList<MessageObject>) args[1];
|
||||
for (MessageObject messageObject : messageObjects) {
|
||||
MessageObject old = messagesDict.get(messageObject.messageOwner.id);
|
||||
if (old != null) {
|
||||
messagesDict.put(old.messageOwner.id, messageObject);
|
||||
int idx = messages.indexOf(old);
|
||||
if (idx >= 0) {
|
||||
messages.set(idx, messageObject);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
chatAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3098,15 +3150,26 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
chatListView.setSelectionFromTop(messages.size() - 1, -100000 - chatListView.getPaddingTop());
|
||||
}
|
||||
} else if (option == 1) {
|
||||
ArrayList<Integer> ids = new ArrayList<>();
|
||||
ids.add(selectedObject.messageOwner.id);
|
||||
removeUnreadPlane(true);
|
||||
ArrayList<Long> random_ids = null;
|
||||
if (currentEncryptedChat != null && selectedObject.messageOwner.random_id != 0 && selectedObject.type != 10) {
|
||||
random_ids = new ArrayList<>();
|
||||
random_ids.add(selectedObject.messageOwner.random_id);
|
||||
}
|
||||
MessagesController.getInstance().deleteMessages(ids, random_ids, currentEncryptedChat);
|
||||
final MessageObject finalSelectedObject = selectedObject;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setMessage(LocaleController.formatString("AreYouSureDeleteMessages", R.string.AreYouSureDeleteMessages, LocaleController.formatPluralString("messages", 1)));
|
||||
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
ArrayList<Integer> ids = new ArrayList<>();
|
||||
ids.add(finalSelectedObject.messageOwner.id);
|
||||
removeUnreadPlane(true);
|
||||
ArrayList<Long> random_ids = null;
|
||||
if (currentEncryptedChat != null && finalSelectedObject.messageOwner.random_id != 0 && finalSelectedObject.type != 10) {
|
||||
random_ids = new ArrayList<>();
|
||||
random_ids.add(finalSelectedObject.messageOwner.random_id);
|
||||
}
|
||||
MessagesController.getInstance().deleteMessages(ids, random_ids, currentEncryptedChat);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
showAlertDialog(builder);
|
||||
} else if (option == 2) {
|
||||
forwaringMessage = selectedObject;
|
||||
Bundle args = new Bundle();
|
||||
|
|
|
@ -123,7 +123,7 @@
|
|||
<string name="NotificationMessageMap">%1$s قام بإرسال موقع لك</string>
|
||||
<string name="NotificationMessageDocument">%1$s قام بإرسال مستند لك</string>
|
||||
<string name="NotificationMessageAudio">%1$s قام بإرسال مقطع صوتي لك</string>
|
||||
<string name="NotificationMessageSticker">%1$s sent you an sticker</string>
|
||||
<string name="NotificationMessageSticker">%1$s قام بإرسال ملصق</string>
|
||||
<string name="NotificationMessageGroupText">%1$s @ %2$s: %3$s</string>
|
||||
<string name="NotificationMessageGroupNoText">%1$s قام بإرسال رسالة للمجموعة %2$s</string>
|
||||
<string name="NotificationMessageGroupPhoto">%1$s قام بإرسال صورة للمجموعة %2$s</string>
|
||||
|
@ -132,7 +132,7 @@
|
|||
<string name="NotificationMessageGroupMap">%1$s قام بإرسال موقع للمجموعة %2$s</string>
|
||||
<string name="NotificationMessageGroupDocument">%1$s قام بإرسال مستند للمجموعة %2$s</string>
|
||||
<string name="NotificationMessageGroupAudio">%1$s قام بإرسال مقطع صوتي للمجموعة %2$s</string>
|
||||
<string name="NotificationMessageGroupSticker">%1$s sent an sticker to the group %2$s</string>
|
||||
<string name="NotificationMessageGroupSticker">%1$s قام بإرسال ملصق للمجموعة %2$s</string>
|
||||
<string name="NotificationInvitedToGroup">%1$s قام بدعوتك للمجموعة %2$s</string>
|
||||
<string name="NotificationEditedGroupName">%1$s قام بتعديل اسم المجموعة %2$s</string>
|
||||
<string name="NotificationEditedGroupPhoto">%1$s قام بتغيير صورة المجموعة %2$s</string>
|
||||
|
@ -309,7 +309,7 @@
|
|||
<string name="NoPhotos">لا توجد صور حتى الآن</string>
|
||||
<string name="PleaseDownload">فضلًا، قم بتنزيل الوسائط أولًا</string>
|
||||
<string name="NoRecentPhotos">لا توجد صور حديثة</string>
|
||||
<string name="NoRecentGIFs">لا توجد صور حديثة</string>
|
||||
<string name="NoRecentGIFs">لا يوجد صور متحركة حديثة</string>
|
||||
<string name="SearchImages">البحث على الإنترنت</string>
|
||||
<string name="SearchGifs">البحث عن صور متحركة</string>
|
||||
<string name="SearchImagesTitle">البحث على الإنترنت</string>
|
||||
|
@ -419,7 +419,7 @@
|
|||
<string name="AttachLocation">موقع</string>
|
||||
<string name="AttachContact">جهة اتصال</string>
|
||||
<string name="AttachDocument">مستند</string>
|
||||
<string name="AttachSticker">Sticker</string>
|
||||
<string name="AttachSticker">ملصق</string>
|
||||
<string name="AttachAudio">مقطع صوتي</string>
|
||||
<string name="FromYou">أنت</string>
|
||||
<string name="ActionTakeScreenshootYou">أنت أخذت لقطة للشاشة !</string>
|
||||
|
|
|
@ -123,7 +123,7 @@
|
|||
<string name="NotificationMessageMap">%1$s sent you a location</string>
|
||||
<string name="NotificationMessageDocument">%1$s sent you a document</string>
|
||||
<string name="NotificationMessageAudio">%1$s sent you an audio</string>
|
||||
<string name="NotificationMessageSticker">%1$s sent you an sticker</string>
|
||||
<string name="NotificationMessageSticker">%1$s sent you a sticker</string>
|
||||
<string name="NotificationMessageGroupText">%1$s @ %2$s: %3$s</string>
|
||||
<string name="NotificationMessageGroupNoText">%1$s sent a message to the group %2$s</string>
|
||||
<string name="NotificationMessageGroupPhoto">%1$s sent a photo to the group %2$s</string>
|
||||
|
@ -132,7 +132,7 @@
|
|||
<string name="NotificationMessageGroupMap">%1$s sent a location to the group %2$s</string>
|
||||
<string name="NotificationMessageGroupDocument">%1$s sent a document to the group %2$s</string>
|
||||
<string name="NotificationMessageGroupAudio">%1$s sent an audio to the group %2$s</string>
|
||||
<string name="NotificationMessageGroupSticker">%1$s sent an sticker to the group %2$s</string>
|
||||
<string name="NotificationMessageGroupSticker">%1$s sent a sticker to the group %2$s</string>
|
||||
<string name="NotificationInvitedToGroup">%1$s invited you to the group %2$s</string>
|
||||
<string name="NotificationEditedGroupName">%1$s edited the group\'s %2$s name</string>
|
||||
<string name="NotificationEditedGroupPhoto">%1$s edited the group\'s %2$s photo</string>
|
||||
|
|
Loading…
Reference in a new issue