Workaround to allow client group chat with 1 participant without being one to one

This commit is contained in:
Sylvain Berfini 2019-02-14 11:40:15 +01:00
parent ac2ddf83b4
commit b96ef0ecc6
2 changed files with 13 additions and 7 deletions

View file

@ -1083,7 +1083,7 @@ public class ChatMessagesFragment extends Fragment
split = true;
// Allow the last image to be sent with text if image and text at the same time OK
if (hasText && !sendImageAndTextAsDifferentMessages && i == filesCount - 1) {
if (hasText && i == filesCount - 1) {
split = false;
}
}

View file

@ -329,13 +329,19 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
mIsEncryptionEnabled);
mTempChatRoom.addListener(mChatRoomCreationListener);
int i = 0;
Address[] participantsToAdd = new Address[mParticipants.size()];
for (ContactAddress ca : mParticipants) {
participantsToAdd[i] = ca.getAddress();
i++;
if (mParticipants.size() == 1) {
// Ugly hack until new client chat group API so we can have a group
// chat room with 1 participant without being one to one
mTempChatRoom.addParticipant(mParticipants.get(0).getAddress());
} else {
int i = 0;
Address[] participantsToAdd = new Address[mParticipants.size()];
for (ContactAddress ca : mParticipants) {
participantsToAdd[i] = ca.getAddress();
i++;
}
mTempChatRoom.addParticipants(participantsToAdd);
}
mTempChatRoom.addParticipants(participantsToAdd);
} else {
// Subject
String newSubject = mSubjectField.getText().toString();