Fixed chat room button in contact's details
This commit is contained in:
parent
83584a43c4
commit
b4dcaef771
5 changed files with 34 additions and 8 deletions
|
@ -1083,9 +1083,9 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
} else {
|
||||
String subject = cr.getSubject();
|
||||
if (contact != null) {
|
||||
LinphoneService.instance().displayGroupChatMessageNotification(subject, cr.getConferenceAddress().asString(), contact.getFullName(), contact.getThumbnailUri(), textMessage);
|
||||
LinphoneService.instance().displayGroupChatMessageNotification(subject, cr.getPeerAddress().asString(), contact.getFullName(), contact.getThumbnailUri(), textMessage);
|
||||
} else {
|
||||
LinphoneService.instance().displayGroupChatMessageNotification(subject, cr.getConferenceAddress().asString(), from.getUsername(), null, textMessage);
|
||||
LinphoneService.instance().displayGroupChatMessageNotification(subject, cr.getPeerAddress().asString(), from.getUsername(), null, textMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -315,11 +315,11 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
|
|||
public void onStateChanged(ChatRoom cr, ChatRoom.State newState) {
|
||||
if (newState == ChatRoom.State.Created) {
|
||||
mWaitLayout.setVisibility(View.GONE);
|
||||
LinphoneActivity.instance().goToChat(cr.getConferenceAddress().asStringUriOnly());
|
||||
LinphoneActivity.instance().goToChat(cr.getPeerAddress().asStringUriOnly());
|
||||
} else if (newState == ChatRoom.State.CreationFailed) {
|
||||
mWaitLayout.setVisibility(View.GONE);
|
||||
displayChatRoomError();
|
||||
Log.e("Group chat room for address " + cr.getConferenceAddress() + " has failed !");
|
||||
Log.e("Group chat room for address " + cr.getPeerAddress() + " has failed !");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -178,11 +178,11 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
|
|||
public void onStateChanged(ChatRoom cr, ChatRoom.State newState) {
|
||||
if (newState == ChatRoom.State.Created) {
|
||||
mWaitLayout.setVisibility(View.GONE);
|
||||
LinphoneActivity.instance().goToChat(cr.getConferenceAddress().asStringUriOnly());
|
||||
LinphoneActivity.instance().goToChat(cr.getPeerAddress().asStringUriOnly());
|
||||
} else if (newState == ChatRoom.State.CreationFailed) {
|
||||
mWaitLayout.setVisibility(View.GONE);
|
||||
displayChatRoomError();
|
||||
Log.e("Group chat room for address " + cr.getConferenceAddress() + " has failed !");
|
||||
Log.e("Group chat room for address " + cr.getPeerAddress() + " has failed !");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -23,8 +23,14 @@ import org.linphone.LinphoneManager;
|
|||
import org.linphone.LinphoneUtils;
|
||||
import org.linphone.R;
|
||||
import org.linphone.activities.LinphoneActivity;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.ChatRoom;
|
||||
import org.linphone.core.ChatRoomListenerStub;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
import org.linphone.fragments.FragmentsAvailable;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
|
@ -62,7 +68,27 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
public void onClick(View v) {
|
||||
if (LinphoneActivity.isInstanciated()) {
|
||||
String tag = (String)v.getTag();
|
||||
LinphoneActivity.instance().displayChat(tag, null, null);
|
||||
Core lc = LinphoneManager.getLc();
|
||||
Address participant = Factory.instance().createAddress(tag);
|
||||
ChatRoom room = lc.findOneToOneChatRoom(lc.getDefaultProxyConfig().getContact(), participant);
|
||||
if (room != null) {
|
||||
LinphoneActivity.instance().goToChat(room.getPeerAddress().asStringUriOnly());
|
||||
} else {
|
||||
//TODO wait layout
|
||||
ChatRoom chatRoom = LinphoneManager.getLc().createClientGroupChatRoom(getString(R.string.dummy_group_chat_subject));
|
||||
chatRoom.setListener(new ChatRoomListenerStub() {
|
||||
@Override
|
||||
public void onStateChanged(ChatRoom cr, ChatRoom.State newState) {
|
||||
if (newState == ChatRoom.State.Created) {
|
||||
LinphoneActivity.instance().goToChat(cr.getPeerAddress().asStringUriOnly());
|
||||
} else if (newState == ChatRoom.State.CreationFailed) {
|
||||
//TODO error
|
||||
Log.e("Group chat room for address " + cr.getPeerAddress() + " has failed !");
|
||||
}
|
||||
}
|
||||
});
|
||||
chatRoom.addParticipant(participant);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 89ed9caeebc3e371bdb92ddf3328978da18ba9eb
|
||||
Subproject commit e5e123ea96b22b84ac8272ea174ca9effb689ddf
|
Loading…
Reference in a new issue