Replaced createClientGroupChatRoom method that is now deprecated by new one
This commit is contained in:
parent
9865ad9078
commit
0168b90b20
4 changed files with 89 additions and 42 deletions
|
@ -52,6 +52,7 @@ import org.linphone.contacts.SearchContactsAdapter;
|
|||
import org.linphone.core.Address;
|
||||
import org.linphone.core.ChatRoom;
|
||||
import org.linphone.core.ChatRoomListenerStub;
|
||||
import org.linphone.core.ChatRoomParams;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.FriendCapability;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
|
@ -565,15 +566,23 @@ public class ChatRoomCreationFragment extends Fragment
|
|||
mChatRoom.getPeerAddress().asStringUriOnly(),
|
||||
mShareInfos);
|
||||
} else {
|
||||
mChatRoom =
|
||||
lc.createClientGroupChatRoom(
|
||||
getString(R.string.dummy_group_chat_subject),
|
||||
!createEncryptedChatRoom,
|
||||
createEncryptedChatRoom);
|
||||
mChatRoom.addListener(mChatRoomCreationListener);
|
||||
ChatRoomParams params = lc.createDefaultChatRoomParams();
|
||||
params.enableEncryption(true);
|
||||
params.enableGroup(true);
|
||||
|
||||
Address participants[] = new Address[1];
|
||||
participants[0] = address;
|
||||
mChatRoom.addParticipants(participants);
|
||||
|
||||
mChatRoom =
|
||||
lc.createChatRoom(
|
||||
params,
|
||||
getString(R.string.dummy_group_chat_subject),
|
||||
participants);
|
||||
if (mChatRoom != null) {
|
||||
mChatRoom.addListener(mChatRoomCreationListener);
|
||||
} else {
|
||||
Log.w("[Chat Room Creation Fragment] createChatRoom returned null...");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (lpc != null
|
||||
|
@ -582,13 +591,24 @@ public class ChatRoomCreationFragment extends Fragment
|
|||
mChatRoom = lc.findOneToOneChatRoom(lpc.getIdentityAddress(), address, false);
|
||||
if (mChatRoom == null) {
|
||||
mWaitLayout.setVisibility(View.VISIBLE);
|
||||
mChatRoom =
|
||||
lc.createClientGroupChatRoom(
|
||||
getString(R.string.dummy_group_chat_subject), true);
|
||||
mChatRoom.addListener(mChatRoomCreationListener);
|
||||
|
||||
ChatRoomParams params = lc.createDefaultChatRoomParams();
|
||||
params.enableEncryption(false);
|
||||
params.enableGroup(true);
|
||||
|
||||
Address participants[] = new Address[1];
|
||||
participants[0] = address;
|
||||
mChatRoom.addParticipants(participants);
|
||||
|
||||
mChatRoom =
|
||||
lc.createChatRoom(
|
||||
params,
|
||||
getString(R.string.dummy_group_chat_subject),
|
||||
participants);
|
||||
if (mChatRoom != null) {
|
||||
mChatRoom.addListener(mChatRoomCreationListener);
|
||||
} else {
|
||||
Log.w("[Chat Room Creation Fragment] createChatRoom returned null...");
|
||||
}
|
||||
} else {
|
||||
LinphoneActivity.instance()
|
||||
.goToChat(
|
||||
|
|
|
@ -51,6 +51,8 @@ import org.linphone.core.ChatMessage;
|
|||
import org.linphone.core.ChatRoom;
|
||||
import org.linphone.core.ChatRoomListener;
|
||||
import org.linphone.core.ChatRoomListenerStub;
|
||||
import org.linphone.core.ChatRoomParams;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.EventLog;
|
||||
import org.linphone.core.Participant;
|
||||
import org.linphone.core.tools.Log;
|
||||
|
@ -326,26 +328,28 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
|
|||
public void onClick(View view) {
|
||||
if (!mIsAlreadyCreatedGroup) {
|
||||
mWaitLayout.setVisibility(View.VISIBLE);
|
||||
mTempChatRoom =
|
||||
LinphoneManager.getLc()
|
||||
.createClientGroupChatRoom(
|
||||
mSubjectField.getText().toString(),
|
||||
false,
|
||||
mIsEncryptionEnabled);
|
||||
mTempChatRoom.addListener(mChatRoomCreationListener);
|
||||
Core core = LinphoneManager.getLc();
|
||||
|
||||
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()];
|
||||
Address[] participants = new Address[mParticipants.size()];
|
||||
for (ContactAddress ca : mParticipants) {
|
||||
participantsToAdd[i] = ca.getAddress();
|
||||
participants[i] = ca.getAddress();
|
||||
i++;
|
||||
}
|
||||
mTempChatRoom.addParticipants(participantsToAdd);
|
||||
|
||||
ChatRoomParams params = core.createDefaultChatRoomParams();
|
||||
params.enableEncryption(mIsEncryptionEnabled);
|
||||
params.enableGroup(true);
|
||||
|
||||
mTempChatRoom =
|
||||
core.createChatRoom(
|
||||
params,
|
||||
mSubjectField.getText().toString(),
|
||||
participants);
|
||||
if (mTempChatRoom != null) {
|
||||
mTempChatRoom.addListener(mChatRoomCreationListener);
|
||||
} else {
|
||||
Log.w("[Group Info Fragment] createChatRoom returned null...");
|
||||
}
|
||||
} else {
|
||||
// Subject
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.linphone.R;
|
|||
import org.linphone.core.Address;
|
||||
import org.linphone.core.ChatRoom;
|
||||
import org.linphone.core.ChatRoomListenerStub;
|
||||
import org.linphone.core.ChatRoomParams;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.FriendCapability;
|
||||
|
@ -105,15 +106,25 @@ public class ContactDetailsFragment extends Fragment
|
|||
|| !LinphonePreferences.instance()
|
||||
.useBasicChatRoomFor1To1())) {
|
||||
mWaitLayout.setVisibility(View.VISIBLE);
|
||||
mChatRoom =
|
||||
lc.createClientGroupChatRoom(
|
||||
getString(R.string.dummy_group_chat_subject),
|
||||
!isSecured,
|
||||
isSecured);
|
||||
mChatRoom.addListener(mChatRoomCreationListener);
|
||||
|
||||
ChatRoomParams params = lc.createDefaultChatRoomParams();
|
||||
params.enableEncryption(isSecured);
|
||||
params.enableGroup(true);
|
||||
|
||||
Address participants[] = new Address[1];
|
||||
participants[0] = participant;
|
||||
mChatRoom.addParticipants(participants);
|
||||
|
||||
mChatRoom =
|
||||
lc.createChatRoom(
|
||||
params,
|
||||
getString(R.string.dummy_group_chat_subject),
|
||||
participants);
|
||||
if (mChatRoom != null) {
|
||||
mChatRoom.addListener(mChatRoomCreationListener);
|
||||
} else {
|
||||
Log.w(
|
||||
"[Contact Details Fragment] createChatRoom returned null...");
|
||||
}
|
||||
} else {
|
||||
room = lc.getChatRoom(participant);
|
||||
LinphoneActivity.instance()
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.linphone.contacts.LinphoneContact;
|
|||
import org.linphone.core.Address;
|
||||
import org.linphone.core.ChatRoom;
|
||||
import org.linphone.core.ChatRoomListenerStub;
|
||||
import org.linphone.core.ChatRoomParams;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
|
@ -228,13 +229,24 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
&& lpc.getConferenceFactoryUri() != null
|
||||
&& !LinphonePreferences.instance().useBasicChatRoomFor1To1()) {
|
||||
mWaitLayout.setVisibility(View.VISIBLE);
|
||||
mChatRoom =
|
||||
lc.createClientGroupChatRoom(
|
||||
getString(R.string.dummy_group_chat_subject), true);
|
||||
mChatRoom.addListener(mChatRoomCreationListener);
|
||||
|
||||
ChatRoomParams params = lc.createDefaultChatRoomParams();
|
||||
params.enableEncryption(false);
|
||||
params.enableGroup(true);
|
||||
|
||||
Address participants[] = new Address[1];
|
||||
participants[0] = participant;
|
||||
mChatRoom.addParticipants(participants);
|
||||
|
||||
mChatRoom =
|
||||
lc.createChatRoom(
|
||||
params,
|
||||
getString(R.string.dummy_group_chat_subject),
|
||||
participants);
|
||||
if (mChatRoom != null) {
|
||||
mChatRoom.addListener(mChatRoomCreationListener);
|
||||
} else {
|
||||
Log.w("[History Detail Fragment] createChatRoom returned null...");
|
||||
}
|
||||
} else {
|
||||
room = lc.getChatRoom(participant);
|
||||
LinphoneActivity.instance()
|
||||
|
|
Loading…
Reference in a new issue