Update ConversationFragement.java with the change of server. Use List instead of Array. Delete the converting codes.

This commit is contained in:
ryanzhao 2019-11-15 09:27:14 +11:00
parent 4837c520e3
commit 9ed5ebab6d

View File

@ -539,18 +539,13 @@ public class ConversationFragment extends Fragment
ignoredMessages.add(messageRecord.getId()); ignoredMessages.add(messageRecord.getId());
} }
} }
long[] serverIDsArray = new long[serverIDs.size()];
for (int i=0; i < serverIDs.size(); i++) {
serverIDsArray[i] = serverIDs.get(i);
}
if (publicChat != null && publicChatAPI != null) { if (publicChat != null && publicChatAPI != null) {
publicChatAPI publicChatAPI
.deleteMessages(serverIDsArray, publicChat.getChannel(), publicChat.getServer(), isSentByUser) .deleteMessages(serverIDs, publicChat.getChannel(), publicChat.getServer(), isSentByUser)
.success(l -> { .success(l -> {
List<Long> longList = Longs.asList(l);
for (MessageRecord messageRecord : messageRecords) { for (MessageRecord messageRecord : messageRecords) {
Long serverID = DatabaseFactory.getLokiMessageDatabase(getContext()).getServerID(messageRecord.id); Long serverID = DatabaseFactory.getLokiMessageDatabase(getContext()).getServerID(messageRecord.id);
if (longList.contains(serverID)) { if (l.contains(serverID)) {
if (messageRecord.isMms()) { if (messageRecord.isMms()) {
DatabaseFactory.getMmsDatabase(getActivity()).delete(messageRecord.getId()); DatabaseFactory.getMmsDatabase(getActivity()).delete(messageRecord.getId());
} else { } else {