Allow group chat room with 1 participant
This commit is contained in:
parent
7f7ba181f5
commit
69ef2a8ee4
2 changed files with 6 additions and 26 deletions
|
@ -447,29 +447,8 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
|
||||||
}
|
}
|
||||||
} else if (id == R.id.next) {
|
} else if (id == R.id.next) {
|
||||||
if (mChatRoomAddress == null && mChatRoomSubject == null) {
|
if (mChatRoomAddress == null && mChatRoomSubject == null) {
|
||||||
if (mContactsSelected.size() == 1) {
|
|
||||||
mContactsSelectedLayout.removeAllViews();
|
|
||||||
mWaitLayout.setVisibility(View.VISIBLE);
|
|
||||||
Core lc = LinphoneManager.getLc();
|
|
||||||
Address participant = mContactsSelected.get(0).getAddress();
|
|
||||||
ChatRoom chatRoom = lc.findOneToOneChatRoom(lc.getDefaultProxyConfig().getContact(), participant);
|
|
||||||
if (chatRoom == null) {
|
|
||||||
ProxyConfig lpc = lc.getDefaultProxyConfig();
|
|
||||||
if (lpc != null && lpc.getConferenceFactoryUri() != null && !LinphonePreferences.instance().useBasicChatRoomFor1To1()) {
|
|
||||||
mChatRoom = lc.createClientGroupChatRoom(getString(R.string.dummy_group_chat_subject), !mSecurityToggle.isChecked(), mSecurityToggle.isChecked());
|
|
||||||
mChatRoom.addListener(mChatRoomCreationListener);
|
|
||||||
mChatRoom.addParticipant(participant);
|
|
||||||
} else {
|
|
||||||
chatRoom = lc.getChatRoom(participant);
|
|
||||||
LinphoneActivity.instance().goToChat(chatRoom.getPeerAddress().asStringUriOnly(), mShareInfos, participant.asString());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LinphoneActivity.instance().goToChat(chatRoom.getPeerAddress().asStringUriOnly(), mShareInfos, participant.asString());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mContactsSelectedLayout.removeAllViews();
|
mContactsSelectedLayout.removeAllViews();
|
||||||
LinphoneActivity.instance().goToChatGroupInfos(null, mContactsSelected, null, true, false, mShareInfos, mSecurityToggle.isChecked());
|
LinphoneActivity.instance().goToChatGroupInfos(null, mContactsSelected, null, true, false, mShareInfos, mSecurityToggle.isChecked());
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
LinphoneActivity.instance().goToChatGroupInfos(mChatRoomAddress, mContactsSelected, mChatRoomSubject, true, true, mShareInfos, mSecurityToggle.isChecked());
|
LinphoneActivity.instance().goToChatGroupInfos(mChatRoomAddress, mContactsSelected, mChatRoomSubject, true, true, mShareInfos, mSecurityToggle.isChecked());
|
||||||
}
|
}
|
||||||
|
@ -487,9 +466,10 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
|
||||||
ContactAddress ca = mSearchAdapter.getContacts().get(position);
|
ContactAddress ca = mSearchAdapter.getContacts().get(position);
|
||||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
ProxyConfig lpc = lc.getDefaultProxyConfig();
|
ProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||||
|
boolean createEncryptedChatRoom = mSecurityToggle.isChecked();
|
||||||
if (lpc == null || lpc.getConferenceFactoryUri() == null || mCreateGroupChatRoom == false) {
|
if (lpc == null || lpc.getConferenceFactoryUri() == null || mCreateGroupChatRoom == false) {
|
||||||
if (mSecurityToggle.isChecked() && lpc != null && lpc.getConferenceFactoryUri() != null) {
|
if (createEncryptedChatRoom && lpc != null && lpc.getConferenceFactoryUri() != null) {
|
||||||
mChatRoom = lc.createClientGroupChatRoom(getString(R.string.dummy_group_chat_subject), !mSecurityToggle.isChecked(), mSecurityToggle.isChecked());
|
mChatRoom = lc.createClientGroupChatRoom(getString(R.string.dummy_group_chat_subject), !createEncryptedChatRoom, createEncryptedChatRoom);
|
||||||
mChatRoom.addListener(mChatRoomCreationListener);
|
mChatRoom.addListener(mChatRoomCreationListener);
|
||||||
Address participants[] = new Address[1];
|
Address participants[] = new Address[1];
|
||||||
participants[0] = ca.getAddress();
|
participants[0] = ca.getAddress();
|
||||||
|
|
|
@ -261,7 +261,7 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (!mIsAlreadyCreatedGroup) {
|
if (!mIsAlreadyCreatedGroup) {
|
||||||
mWaitLayout.setVisibility(View.VISIBLE);
|
mWaitLayout.setVisibility(View.VISIBLE);
|
||||||
mTempChatRoom = LinphoneManager.getLc().createClientGroupChatRoom(mSubjectField.getText().toString(), mParticipants.size() == 1 && !mIsEncryptionEnabled, mIsEncryptionEnabled);
|
mTempChatRoom = LinphoneManager.getLc().createClientGroupChatRoom(mSubjectField.getText().toString(), false, mIsEncryptionEnabled);
|
||||||
mTempChatRoom.addListener(mChatRoomCreationListener);
|
mTempChatRoom.addListener(mChatRoomCreationListener);
|
||||||
|
|
||||||
Address addresses[] = new Address[mParticipants.size()];
|
Address addresses[] = new Address[mParticipants.size()];
|
||||||
|
|
Loading…
Reference in a new issue