Remove unneeded SecretChatHelper; this will be done completely in the backend.

This commit is contained in:
B. Petersen
2016-10-20 18:40:51 +02:00
parent e4368041a4
commit c55adf3383
7 changed files with 31 additions and 1908 deletions
@@ -664,7 +664,7 @@ public class AndroidUtilities {
encryptedChat.ttl = 60 * 60 * 24 * 7;
}
if (oldValue != encryptedChat.ttl) {
SecretChatHelper.getInstance().sendTTLMessage(encryptedChat, null);
//SecretChatHelper.getInstance().sendTTLMessage(encryptedChat, null);
MessagesStorage.getInstance().updateEncryptedChatTTL(encryptedChat);
}
}
@@ -1185,7 +1185,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
}
}
if (send) {
SecretChatHelper.getInstance().sendScreenshotMessage(lastSecretChat, lastSecretChatVisibleMessages, null);
//SecretChatHelper.getInstance().sendScreenshotMessage(lastSecretChat, lastSecretChatVisibleMessages, null);
}
}
@@ -515,7 +515,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
MediaController.getInstance().cleanup();
NotificationsController.getInstance().cleanup();
SendMessagesHelper.getInstance().cleanup();
SecretChatHelper.getInstance().cleanup();
//SecretChatHelper.getInstance().cleanup();
StickersQuery.cleanup();
SearchQuery.cleanup();
DraftQuery.cleanup();
@@ -1785,7 +1785,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
});
} else {
if (randoms != null && encryptedChat != null && !randoms.isEmpty()) {
SecretChatHelper.getInstance().sendMessagesDeleteMessage(encryptedChat, randoms, null);
//SecretChatHelper.getInstance().sendMessagesDeleteMessage(encryptedChat, randoms, null);
}
TLRPC.TL_messages_deleteMessages req = new TLRPC.TL_messages_deleteMessages();
req.id = toSend;
@@ -1969,9 +1969,9 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}, ConnectionsManager.RequestFlagInvokeAfter);
} else {
if (onlyHistory == 1) {
SecretChatHelper.getInstance().sendClearHistoryMessage(getEncryptedChat(high_id), null);
//SecretChatHelper.getInstance().sendClearHistoryMessage(getEncryptedChat(high_id), null);
} else {
SecretChatHelper.getInstance().declineSecretChat(high_id);
//SecretChatHelper.getInstance().declineSecretChat(high_id);
}
}
}
@@ -3094,9 +3094,11 @@ public class MessagesController implements NotificationCenter.NotificationCenter
if (encChats != null) {
for (int a = 0; a < encChats.size(); a++) {
TLRPC.EncryptedChat encryptedChat = encChats.get(a);
/*
if (encryptedChat instanceof TLRPC.TL_encryptedChat && AndroidUtilities.getMyLayerVersion(encryptedChat.layer) < SecretChatHelper.CURRENT_SECRET_CHAT_LAYER) {
SecretChatHelper.getInstance().sendNotifyLayerMessage(encryptedChat, null);
}
*/
putEncryptedChat(encryptedChat, true);
}
}
@@ -3618,7 +3620,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
ArrayList<Long> random_ids = new ArrayList<>();
random_ids.add(random_id);
SecretChatHelper.getInstance().sendMessagesReadMessage(chat, random_ids, null);
//SecretChatHelper.getInstance().sendMessagesReadMessage(chat, random_ids, null);
if (ttl > 0) {
int time = ConnectionsManager.getInstance().getCurrentTime();
MessagesStorage.getInstance().createTaskForSecretChat(chat.id, time, time, 0, random_ids);
@@ -5172,6 +5174,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
public void run() {
if (!res.new_messages.isEmpty() || !res.new_encrypted_messages.isEmpty()) {
final HashMap<Long, ArrayList<MessageObject>> messages = new HashMap<>();
/*
for (TLRPC.EncryptedMessage encryptedMessage : res.new_encrypted_messages) {
ArrayList<TLRPC.Message> decryptedMessages = SecretChatHelper.getInstance().decryptMessage(encryptedMessage);
if (decryptedMessages != null && !decryptedMessages.isEmpty()) {
@@ -5180,6 +5183,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
}
}
*/
ImageLoader.saveMessagesThumbs(res.new_messages);
@@ -5258,7 +5262,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
});
SecretChatHelper.getInstance().processPendingEncMessages();
//SecretChatHelper.getInstance().processPendingEncMessages();
}
if (!res.other_updates.isEmpty()) {
@@ -5901,7 +5905,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
MessagesStorage.lastPtsValue = updates.pts;
}
}
SecretChatHelper.getInstance().processPendingEncMessages();
//SecretChatHelper.getInstance().processPendingEncMessages();
if (!fromQueue) {
ArrayList<Integer> keys = new ArrayList<>(updatesQueueChannels.keySet());
for (int a = 0; a < keys.size(); a++) {
@@ -6323,6 +6327,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
} else if (update instanceof TLRPC.TL_updateNewGeoChatMessage) {
//DEPRECATED
} else if (update instanceof TLRPC.TL_updateNewEncryptedMessage) {
/*
ArrayList<TLRPC.Message> decryptedMessages = SecretChatHelper.getInstance().decryptMessage(((TLRPC.TL_updateNewEncryptedMessage) update).message);
if (decryptedMessages != null && !decryptedMessages.isEmpty()) {
int cid = ((TLRPC.TL_updateNewEncryptedMessage) update).message.chat_id;
@@ -6341,6 +6346,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
pushMessages.add(obj);
}
}
*/
} else if (update instanceof TLRPC.TL_updateEncryptedChatTyping) {
TLRPC.EncryptedChat encryptedChat = getEncryptedChatDB(update.chat_id);
if (encryptedChat != null) {
@@ -6380,7 +6386,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
} else if (update instanceof TLRPC.TL_updateDcOptions) {
ConnectionsManager.getInstance().updateDcSettings();
} else if (update instanceof TLRPC.TL_updateEncryption) {
SecretChatHelper.getInstance().processUpdateEncryption((TLRPC.TL_updateEncryption) update, usersDict);
//SecretChatHelper.getInstance().processUpdateEncryption((TLRPC.TL_updateEncryption) update, usersDict);
} else if (update instanceof TLRPC.TL_updateUserBlocked) {
final TLRPC.TL_updateUserBlocked finalUpdate = (TLRPC.TL_updateUserBlocked) update;
if (finalUpdate.blocked) {
File diff suppressed because it is too large Load Diff
@@ -305,7 +305,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
}
message.sendEncryptedRequest.media.key = (byte[]) args[3];
message.sendEncryptedRequest.media.iv = (byte[]) args[4];
SecretChatHelper.getInstance().performSendEncryptedRequest(message.sendEncryptedRequest, message.obj.messageOwner, message.encryptedChat, encryptedFile, message.originalPath, message.obj);
//SecretChatHelper.getInstance().performSendEncryptedRequest(message.sendEncryptedRequest, message.obj.messageOwner, message.encryptedChat, encryptedFile, message.originalPath, message.obj);
arr.remove(a);
a--;
}
@@ -555,6 +555,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
if (messageObject.messageOwner.random_id == 0) {
messageObject.messageOwner.random_id = getNextRandomId();
}
/*
if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionSetMessageTTL) {
SecretChatHelper.getInstance().sendTTLMessage(encryptedChat, messageObject.messageOwner);
} else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionDeleteMessages) {
@@ -582,6 +583,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
} else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionNoop) {
SecretChatHelper.getInstance().sendNoopMessage(encryptedChat, messageObject.messageOwner);
}
*/
return true;
}
if (unsent) {
@@ -1528,7 +1530,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
} else {
reqSend.media = new TLRPC.TL_decryptedMessageMediaEmpty();
}
SecretChatHelper.getInstance().performSendEncryptedRequest(reqSend, newMsgObj.messageOwner, encryptedChat, null, null, newMsgObj);
//SecretChatHelper.getInstance().performSendEncryptedRequest(reqSend, newMsgObj.messageOwner, encryptedChat, null, null, newMsgObj);
if (retryMessageObject == null) {
DraftQuery.cleanDraft(peer, false);
}
@@ -1759,7 +1761,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
}
reqSend.media.lat = location.geo.lat;
reqSend.media._long = location.geo._long;
SecretChatHelper.getInstance().performSendEncryptedRequest(reqSend, newMsgObj.messageOwner, encryptedChat, null, null, newMsgObj);
//SecretChatHelper.getInstance().performSendEncryptedRequest(reqSend, newMsgObj.messageOwner, encryptedChat, null, null, newMsgObj);
} else if (type == 2 || type == 9 && photo != null) {
TLRPC.PhotoSize small = photo.sizes.get(0);
TLRPC.PhotoSize big = photo.sizes.get(photo.sizes.size() - 1);
@@ -1804,7 +1806,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
encryptedFile.access_hash = big.location.secret;
reqSend.media.key = big.location.key;
reqSend.media.iv = big.location.iv;
SecretChatHelper.getInstance().performSendEncryptedRequest(reqSend, newMsgObj.messageOwner, encryptedChat, encryptedFile, null, newMsgObj);
//SecretChatHelper.getInstance().performSendEncryptedRequest(reqSend, newMsgObj.messageOwner, encryptedChat, encryptedFile, null, newMsgObj);
}
} else if (type == 3) {
ImageLoader.fillPhotoSizeWithBytes(document.thumb);
@@ -1860,7 +1862,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
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, newMsgObj);
//SecretChatHelper.getInstance().performSendEncryptedRequest(reqSend, newMsgObj.messageOwner, encryptedChat, encryptedFile, null, newMsgObj);
}
} else if (type == 6) {
reqSend.media = new TLRPC.TL_decryptedMessageMediaContact();
@@ -1868,7 +1870,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
reqSend.media.first_name = user.first_name;
reqSend.media.last_name = user.last_name;
reqSend.media.user_id = user.id;
SecretChatHelper.getInstance().performSendEncryptedRequest(reqSend, newMsgObj.messageOwner, encryptedChat, null, null, newMsgObj);
//SecretChatHelper.getInstance().performSendEncryptedRequest(reqSend, newMsgObj.messageOwner, encryptedChat, null, null, newMsgObj);
} else if (type == 7 || type == 9 && document != null) {
if (MessageObject.isStickerDocument(document)) {
reqSend.media = new TLRPC.TL_decryptedMessageMediaExternalDocument();
@@ -1885,7 +1887,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
} else {
((TLRPC.TL_decryptedMessageMediaExternalDocument) reqSend.media).thumb = document.thumb;
}
SecretChatHelper.getInstance().performSendEncryptedRequest(reqSend, newMsgObj.messageOwner, encryptedChat, null, null, newMsgObj);
//SecretChatHelper.getInstance().performSendEncryptedRequest(reqSend, newMsgObj.messageOwner, encryptedChat, null, null, newMsgObj);
} else {
ImageLoader.fillPhotoSizeWithBytes(document.thumb);
if (AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 46) {
@@ -1935,7 +1937,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
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, newMsgObj);
//SecretChatHelper.getInstance().performSendEncryptedRequest(reqSend, newMsgObj.messageOwner, encryptedChat, encryptedFile, null, newMsgObj);
}
}
} else if (type == 8) {
@@ -38,7 +38,7 @@ import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessagesStorage;
import org.telegram.messenger.SecretChatHelper;
//import org.telegram.messenger.SecretChatHelper;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.UserObject;
import org.telegram.tgnet.TLRPC;
@@ -287,7 +287,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
return;
}
creatingChat = true;
SecretChatHelper.getInstance().startSecretChat(getParentActivity(), user);
//SecretChatHelper.getInstance().startSecretChat(getParentActivity(), user);
} else {
Bundle args = new Bundle();
args.putInt("user_id", user.id);
@@ -361,7 +361,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
} else {
if (createSecretChat) {
creatingChat = true;
SecretChatHelper.getInstance().startSecretChat(getParentActivity(), user);
//SecretChatHelper.getInstance().startSecretChat(getParentActivity(), user);
} else {
Bundle args = new Bundle();
args.putInt("user_id", user.id);
@@ -46,7 +46,7 @@ import org.telegram.messenger.AnimatorListenerAdapterProxy;
import org.telegram.messenger.ChatObject;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessagesStorage;
import org.telegram.messenger.SecretChatHelper;
//import org.telegram.messenger.SecretChatHelper;
import org.telegram.messenger.SendMessagesHelper;
import org.telegram.messenger.UserObject;
//import org.telegram.messenger.query.BotQuery; -- EDIT BY MR
@@ -622,7 +622,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
@Override
public void onClick(DialogInterface dialogInterface, int i) {
creatingChat = true;
SecretChatHelper.getInstance().startSecretChat(getParentActivity(), MessagesController.getInstance().getUser(user_id));
//SecretChatHelper.getInstance().startSecretChat(getParentActivity(), MessagesController.getInstance().getUser(user_id));
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);