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; split = true;
// Allow the last image to be sent with text if image and text at the same time OK // 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; split = false;
} }
} }

View file

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