Go to the correct basic chat room if you have multiple with the same remote address but different local addresses
This commit is contained in:
parent
8b2a46922d
commit
1a42eb7802
14 changed files with 160 additions and 74 deletions
|
@ -701,7 +701,8 @@ public class LinphoneActivity extends LinphoneGenericActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayChat(
|
private void displayChat(
|
||||||
String sipUri,
|
String localSipUri,
|
||||||
|
String remoteSipUri,
|
||||||
String message,
|
String message,
|
||||||
String fileUri,
|
String fileUri,
|
||||||
String pictureUri,
|
String pictureUri,
|
||||||
|
@ -709,17 +710,18 @@ public class LinphoneActivity extends LinphoneGenericActivity
|
||||||
String displayName,
|
String displayName,
|
||||||
Address lAddress) {
|
Address lAddress) {
|
||||||
Bundle extras = new Bundle();
|
Bundle extras = new Bundle();
|
||||||
extras.putString("SipUri", sipUri);
|
extras.putString("LocalSipUri", localSipUri);
|
||||||
|
extras.putString("RemoteSipUri", remoteSipUri);
|
||||||
|
|
||||||
if (message != null) extras.putString("messageDraft", message);
|
if (message != null) extras.putString("messageDraft", message);
|
||||||
if (fileUri != null) extras.putString("fileSharedUri", fileUri);
|
if (fileUri != null) extras.putString("fileSharedUri", fileUri);
|
||||||
if (sipUri != null && lAddress.getDisplayName() != null) {
|
if (remoteSipUri != null && lAddress.getDisplayName() != null) {
|
||||||
extras.putString("DisplayName", displayName);
|
extras.putString("DisplayName", displayName);
|
||||||
extras.putString("PictureUri", pictureUri);
|
extras.putString("PictureUri", pictureUri);
|
||||||
extras.putString("ThumbnailUri", thumbnailUri);
|
extras.putString("ThumbnailUri", thumbnailUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sipUri == null) {
|
if (remoteSipUri == null) {
|
||||||
changeCurrentFragment(FragmentsAvailable.CREATE_CHAT, extras);
|
changeCurrentFragment(FragmentsAvailable.CREATE_CHAT, extras);
|
||||||
} else {
|
} else {
|
||||||
changeCurrentFragment(FragmentsAvailable.GROUP_CHAT, extras);
|
changeCurrentFragment(FragmentsAvailable.GROUP_CHAT, extras);
|
||||||
|
@ -755,9 +757,10 @@ public class LinphoneActivity extends LinphoneGenericActivity
|
||||||
changeCurrentFragment(FragmentsAvailable.CREATE_CHAT, extras);
|
changeCurrentFragment(FragmentsAvailable.CREATE_CHAT, extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void goToChat(String sipUri, Bundle shareInfos) {
|
public void goToChat(String localSipUri, String remoteSipUri, Bundle shareInfos) {
|
||||||
Bundle extras = new Bundle();
|
Bundle extras = new Bundle();
|
||||||
extras.putString("SipUri", sipUri);
|
extras.putString("LocalSipUri", localSipUri);
|
||||||
|
extras.putString("RemoteSipUri", remoteSipUri);
|
||||||
|
|
||||||
if (shareInfos != null) {
|
if (shareInfos != null) {
|
||||||
if (shareInfos.getString("fileSharedUri") != null)
|
if (shareInfos.getString("fileSharedUri") != null)
|
||||||
|
@ -773,7 +776,7 @@ public class LinphoneActivity extends LinphoneGenericActivity
|
||||||
&& mCurrentFragment == FragmentsAvailable.GROUP_CHAT
|
&& mCurrentFragment == FragmentsAvailable.GROUP_CHAT
|
||||||
&& !mEmptyFragment) {
|
&& !mEmptyFragment) {
|
||||||
ChatMessagesFragment chatFragment = (ChatMessagesFragment) fragment2;
|
ChatMessagesFragment chatFragment = (ChatMessagesFragment) fragment2;
|
||||||
chatFragment.changeDisplayedChat(sipUri);
|
chatFragment.changeDisplayedChat(localSipUri, remoteSipUri);
|
||||||
} else {
|
} else {
|
||||||
changeCurrentFragment(FragmentsAvailable.GROUP_CHAT, extras);
|
changeCurrentFragment(FragmentsAvailable.GROUP_CHAT, extras);
|
||||||
}
|
}
|
||||||
|
@ -781,7 +784,7 @@ public class LinphoneActivity extends LinphoneGenericActivity
|
||||||
changeCurrentFragment(FragmentsAvailable.GROUP_CHAT, extras);
|
changeCurrentFragment(FragmentsAvailable.GROUP_CHAT, extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
LinphoneManager.getInstance().updateUnreadCountForChatRoom(sipUri, 0);
|
LinphoneManager.getInstance().updateUnreadCountForChatRoom(localSipUri, remoteSipUri, 0);
|
||||||
displayMissedChats(LinphoneManager.getInstance().getUnreadMessageCount());
|
displayMissedChats(LinphoneManager.getInstance().getUnreadMessageCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -814,15 +817,18 @@ public class LinphoneActivity extends LinphoneGenericActivity
|
||||||
changeCurrentFragment(FragmentsAvailable.INFO_GROUP_CHAT, extras);
|
changeCurrentFragment(FragmentsAvailable.INFO_GROUP_CHAT, extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void goToContactDevicesInfos(String sipUri) {
|
public void goToContactDevicesInfos(String localSipUri, String remoteSipUri) {
|
||||||
Bundle extras = new Bundle();
|
Bundle extras = new Bundle();
|
||||||
extras.putSerializable("SipUri", sipUri);
|
extras.putSerializable("LocalSipUri", localSipUri);
|
||||||
|
extras.putSerializable("RemoteSipUri", remoteSipUri);
|
||||||
changeCurrentFragment(FragmentsAvailable.CONTACT_DEVICES, extras);
|
changeCurrentFragment(FragmentsAvailable.CONTACT_DEVICES, extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void goToChatMessageImdnInfos(String sipUri, String messageId) {
|
public void goToChatMessageImdnInfos(
|
||||||
|
String localSipUri, String remoteSipUri, String messageId) {
|
||||||
Bundle extras = new Bundle();
|
Bundle extras = new Bundle();
|
||||||
extras.putSerializable("SipUri", sipUri);
|
extras.putSerializable("LocalSipUri", localSipUri);
|
||||||
|
extras.putSerializable("RemoteSipUri", remoteSipUri);
|
||||||
extras.putString("MessageId", messageId);
|
extras.putString("MessageId", messageId);
|
||||||
changeCurrentFragment(FragmentsAvailable.MESSAGE_IMDN, extras);
|
changeCurrentFragment(FragmentsAvailable.MESSAGE_IMDN, extras);
|
||||||
}
|
}
|
||||||
|
@ -831,7 +837,8 @@ public class LinphoneActivity extends LinphoneGenericActivity
|
||||||
changeCurrentFragment(FragmentsAvailable.CHAT_LIST, null);
|
changeCurrentFragment(FragmentsAvailable.CHAT_LIST, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayChat(String sipUri, String message, String fileUri) {
|
public void displayChat(
|
||||||
|
String localSipUri, String remoteSipUri, String message, String fileUri) {
|
||||||
if (getResources().getBoolean(R.bool.disable_chat)) {
|
if (getResources().getBoolean(R.bool.disable_chat)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -841,8 +848,8 @@ public class LinphoneActivity extends LinphoneGenericActivity
|
||||||
String displayName = null;
|
String displayName = null;
|
||||||
|
|
||||||
Address lAddress = null;
|
Address lAddress = null;
|
||||||
if (sipUri != null) {
|
if (remoteSipUri != null) {
|
||||||
lAddress = LinphoneManager.getLc().interpretUrl(sipUri);
|
lAddress = LinphoneManager.getLc().interpretUrl(remoteSipUri);
|
||||||
if (lAddress == null) return;
|
if (lAddress == null) return;
|
||||||
LinphoneContact contact =
|
LinphoneContact contact =
|
||||||
ContactsManager.getInstance().findContactFromAddress(lAddress);
|
ContactsManager.getInstance().findContactFromAddress(lAddress);
|
||||||
|
@ -862,21 +869,35 @@ public class LinphoneActivity extends LinphoneGenericActivity
|
||||||
&& mCurrentFragment == FragmentsAvailable.GROUP_CHAT
|
&& mCurrentFragment == FragmentsAvailable.GROUP_CHAT
|
||||||
&& !mEmptyFragment) {
|
&& !mEmptyFragment) {
|
||||||
ChatMessagesFragment chatFragment = (ChatMessagesFragment) fragment2;
|
ChatMessagesFragment chatFragment = (ChatMessagesFragment) fragment2;
|
||||||
chatFragment.changeDisplayedChat(sipUri);
|
chatFragment.changeDisplayedChat(localSipUri, remoteSipUri);
|
||||||
} else {
|
} else {
|
||||||
displayChat(
|
displayChat(
|
||||||
sipUri, message, fileUri, pictureUri, thumbnailUri, displayName, lAddress);
|
localSipUri,
|
||||||
|
remoteSipUri,
|
||||||
|
message,
|
||||||
|
fileUri,
|
||||||
|
pictureUri,
|
||||||
|
thumbnailUri,
|
||||||
|
displayName,
|
||||||
|
lAddress);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isTablet()) {
|
if (isTablet()) {
|
||||||
changeCurrentFragment(FragmentsAvailable.CHAT_LIST, null);
|
changeCurrentFragment(FragmentsAvailable.CHAT_LIST, null);
|
||||||
} else {
|
} else {
|
||||||
displayChat(
|
displayChat(
|
||||||
sipUri, message, fileUri, pictureUri, thumbnailUri, displayName, lAddress);
|
localSipUri,
|
||||||
|
remoteSipUri,
|
||||||
|
message,
|
||||||
|
fileUri,
|
||||||
|
pictureUri,
|
||||||
|
thumbnailUri,
|
||||||
|
displayName,
|
||||||
|
lAddress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LinphoneManager.getInstance().updateUnreadCountForChatRoom(sipUri, 0);
|
LinphoneManager.getInstance().updateUnreadCountForChatRoom(localSipUri, remoteSipUri, 0);
|
||||||
displayMissedChats(LinphoneManager.getInstance().getUnreadMessageCount());
|
displayMissedChats(LinphoneManager.getInstance().getUnreadMessageCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1536,12 +1557,12 @@ public class LinphoneActivity extends LinphoneGenericActivity
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
|
|
||||||
if (intent.getStringExtra("msgShared") != null) {
|
if (intent.getStringExtra("msgShared") != null) {
|
||||||
displayChat(null, intent.getStringExtra("msgShared"), null);
|
displayChat(null, null, intent.getStringExtra("msgShared"), null);
|
||||||
intent.putExtra("msgShared", "");
|
intent.putExtra("msgShared", "");
|
||||||
}
|
}
|
||||||
if (intent.getStringExtra("fileShared") != null
|
if (intent.getStringExtra("fileShared") != null
|
||||||
&& !intent.getStringExtra("fileShared").equals("")) {
|
&& !intent.getStringExtra("fileShared").equals("")) {
|
||||||
displayChat(null, null, intent.getStringExtra("fileShared"));
|
displayChat(null, null, null, intent.getStringExtra("fileShared"));
|
||||||
intent.putExtra("fileShared", "");
|
intent.putExtra("fileShared", "");
|
||||||
}
|
}
|
||||||
mIsOnBackground = false;
|
mIsOnBackground = false;
|
||||||
|
@ -1592,12 +1613,13 @@ public class LinphoneActivity extends LinphoneGenericActivity
|
||||||
}
|
}
|
||||||
Bundle extras = intent.getExtras();
|
Bundle extras = intent.getExtras();
|
||||||
if (extras != null && extras.getBoolean("GoToChat", false)) {
|
if (extras != null && extras.getBoolean("GoToChat", false)) {
|
||||||
String sipUri = extras.getString("ChatContactSipUri");
|
String localSipUri = extras.getString("LocalSipUri");
|
||||||
|
String remoteSipUri = extras.getString("ChatContactSipUri");
|
||||||
intent.putExtra("DoNotGoToCallActivity", true);
|
intent.putExtra("DoNotGoToCallActivity", true);
|
||||||
if (sipUri == null) {
|
if (remoteSipUri == null) {
|
||||||
goToChatList();
|
goToChatList();
|
||||||
} else {
|
} else {
|
||||||
goToChat(sipUri, extras);
|
goToChat(localSipUri, remoteSipUri, extras);
|
||||||
}
|
}
|
||||||
} else if (extras != null && extras.getBoolean("GoToHistory", false)) {
|
} else if (extras != null && extras.getBoolean("GoToHistory", false)) {
|
||||||
intent.putExtra("DoNotGoToCallActivity", true);
|
intent.putExtra("DoNotGoToCallActivity", true);
|
||||||
|
|
|
@ -165,10 +165,10 @@ public class LinphoneLauncherActivity extends Activity {
|
||||||
&& (stringFileShared != null || fileUri != null)) {
|
&& (stringFileShared != null || fileUri != null)) {
|
||||||
if (stringFileShared != null) {
|
if (stringFileShared != null) {
|
||||||
LinphoneActivity.instance()
|
LinphoneActivity.instance()
|
||||||
.displayChat(null, stringFileShared, null);
|
.displayChat(null, null, stringFileShared, null);
|
||||||
} else if (fileUri != null) {
|
} else if (fileUri != null) {
|
||||||
LinphoneActivity.instance()
|
LinphoneActivity.instance()
|
||||||
.displayChat(null, null, stringUriFileShared);
|
.displayChat(null, null, null, stringUriFileShared);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1938,17 +1938,22 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateUnreadCountForChatRoom(String key, Integer value) {
|
public void updateUnreadCountForChatRoom(
|
||||||
|
String localSipUri, String remoteSipUri, Integer value) {
|
||||||
|
String key = localSipUri + "//" + remoteSipUri;
|
||||||
mUnreadChatsPerRoom.put(key, value);
|
mUnreadChatsPerRoom.put(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateUnreadCountForChatRoom(ChatRoom cr, Integer value) {
|
public void updateUnreadCountForChatRoom(ChatRoom cr, Integer value) {
|
||||||
String key = cr.getPeerAddress().asStringUriOnly();
|
String localSipUri = cr.getLocalAddress().asStringUriOnly();
|
||||||
updateUnreadCountForChatRoom(key, value);
|
String remoteSipUri = cr.getPeerAddress().asStringUriOnly();
|
||||||
|
updateUnreadCountForChatRoom(localSipUri, remoteSipUri, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void increaseUnreadCountForChatRoom(ChatRoom cr) {
|
private void increaseUnreadCountForChatRoom(ChatRoom cr) {
|
||||||
String key = cr.getPeerAddress().asStringUriOnly();
|
String localSipUri = cr.getLocalAddress().asStringUriOnly();
|
||||||
|
String remoteSipUri = cr.getPeerAddress().asStringUriOnly();
|
||||||
|
String key = localSipUri + "//" + remoteSipUri;
|
||||||
if (mUnreadChatsPerRoom.containsKey(key)) {
|
if (mUnreadChatsPerRoom.containsKey(key)) {
|
||||||
mUnreadChatsPerRoom.put(key, mUnreadChatsPerRoom.get(key) + 1);
|
mUnreadChatsPerRoom.put(key, mUnreadChatsPerRoom.get(key) + 1);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -113,8 +113,8 @@ public class ChatMessagesFragment extends Fragment
|
||||||
private Uri mImageToUploadUri;
|
private Uri mImageToUploadUri;
|
||||||
private ChatMessagesAdapter mEventsAdapter;
|
private ChatMessagesAdapter mEventsAdapter;
|
||||||
private ChatMessagesOldAdapter mOldEventsAdapter;
|
private ChatMessagesOldAdapter mOldEventsAdapter;
|
||||||
private String mRemoteSipUri;
|
private String mLocalSipUri, mRemoteSipUri;
|
||||||
private Address mRemoteSipAddress, mRemoteParticipantAddress;
|
private Address mLocalSipAddress, mRemoteSipAddress, mRemoteParticipantAddress;
|
||||||
private ChatRoom mChatRoom;
|
private ChatRoom mChatRoom;
|
||||||
private ArrayList<LinphoneContact> mParticipants;
|
private ArrayList<LinphoneContact> mParticipants;
|
||||||
private LinearLayoutManager layoutManager;
|
private LinearLayoutManager layoutManager;
|
||||||
|
@ -131,8 +131,12 @@ public class ChatMessagesFragment extends Fragment
|
||||||
setRetainInstance(true);
|
setRetainInstance(true);
|
||||||
|
|
||||||
if (getArguments() != null) {
|
if (getArguments() != null) {
|
||||||
if (getArguments().getString("SipUri") != null) {
|
if (getArguments().getString("LocalSipUri") != null) {
|
||||||
mRemoteSipUri = getArguments().getString("SipUri");
|
mLocalSipUri = getArguments().getString("LocalSipUri");
|
||||||
|
mLocalSipAddress = LinphoneManager.getLc().createAddress(mLocalSipUri);
|
||||||
|
}
|
||||||
|
if (getArguments().getString("RemoteSipUri") != null) {
|
||||||
|
mRemoteSipUri = getArguments().getString("RemoteSipUri");
|
||||||
mRemoteSipAddress = LinphoneManager.getLc().createAddress(mRemoteSipUri);
|
mRemoteSipAddress = LinphoneManager.getLc().createAddress(mRemoteSipUri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,7 +170,7 @@ public class ChatMessagesFragment extends Fragment
|
||||||
CallManager.getInstance().inviteAddress(device.getAddress());
|
CallManager.getInstance().inviteAddress(device.getAddress());
|
||||||
} else {
|
} else {
|
||||||
LinphoneActivity.instance()
|
LinphoneActivity.instance()
|
||||||
.goToContactDevicesInfos(getRemoteSipUri());
|
.goToContactDevicesInfos(mLocalSipUri, mRemoteSipUri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -368,8 +372,10 @@ public class ChatMessagesFragment extends Fragment
|
||||||
LinphoneManager.getInstance().setCurrentChatRoomAddress(mRemoteSipAddress);
|
LinphoneManager.getInstance().setCurrentChatRoomAddress(mRemoteSipAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeDisplayedChat(String sipUri) {
|
public void changeDisplayedChat(String localSipUri, String remoteSipUri) {
|
||||||
mRemoteSipUri = sipUri;
|
mLocalSipUri = localSipUri;
|
||||||
|
mLocalSipAddress = LinphoneManager.getLc().createAddress(mLocalSipUri);
|
||||||
|
mRemoteSipUri = remoteSipUri;
|
||||||
mRemoteSipAddress = LinphoneManager.getLc().createAddress(mRemoteSipUri);
|
mRemoteSipAddress = LinphoneManager.getLc().createAddress(mRemoteSipUri);
|
||||||
|
|
||||||
initChatRoom();
|
initChatRoom();
|
||||||
|
@ -539,7 +545,8 @@ public class ChatMessagesFragment extends Fragment
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (item.getItemId() == R.id.imdn_infos) {
|
if (item.getItemId() == R.id.imdn_infos) {
|
||||||
LinphoneActivity.instance().goToChatMessageImdnInfos(getRemoteSipUri(), messageId);
|
LinphoneActivity.instance()
|
||||||
|
.goToChatMessageImdnInfos(mLocalSipUri, mRemoteSipUri, messageId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (item.getItemId() == R.id.copy_text) {
|
if (item.getItemId() == R.id.copy_text) {
|
||||||
|
@ -708,7 +715,11 @@ public class ChatMessagesFragment extends Fragment
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mChatRoom = core.getChatRoomFromUri(mRemoteSipAddress.asStringUriOnly());
|
if (mLocalSipAddress != null) {
|
||||||
|
mChatRoom = core.getChatRoom(mRemoteSipAddress, mLocalSipAddress);
|
||||||
|
} else {
|
||||||
|
mChatRoom = core.getChatRoomFromUri(mRemoteSipAddress.asStringUriOnly());
|
||||||
|
}
|
||||||
mChatRoom.addListener(this);
|
mChatRoom.addListener(this);
|
||||||
mChatRoom.markAsRead();
|
mChatRoom.markAsRead();
|
||||||
LinphoneManager.getInstance().updateUnreadCountForChatRoom(mChatRoom, 0);
|
LinphoneManager.getInstance().updateUnreadCountForChatRoom(mChatRoom, 0);
|
||||||
|
@ -864,7 +875,8 @@ public class ChatMessagesFragment extends Fragment
|
||||||
mChatRoom.getParticipants()[0].getDevices()[0];
|
mChatRoom.getParticipants()[0].getDevices()[0];
|
||||||
CallManager.getInstance().inviteAddress(device.getAddress());
|
CallManager.getInstance().inviteAddress(device.getAddress());
|
||||||
} else {
|
} else {
|
||||||
LinphoneActivity.instance().goToContactDevicesInfos(getRemoteSipUri());
|
LinphoneActivity.instance()
|
||||||
|
.goToContactDevicesInfos(mLocalSipUri, mRemoteSipUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
|
@ -888,10 +900,6 @@ public class ChatMessagesFragment extends Fragment
|
||||||
mChatEventsList.getLayoutManager().scrollToPosition(0);
|
mChatEventsList.getLayoutManager().scrollToPosition(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getRemoteSipUri() {
|
|
||||||
return mRemoteSipUri;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemClicked(int position) {
|
public void onItemClicked(int position) {
|
||||||
if (mSelectionHelper.getAdapter().isEditionEnabled()) {
|
if (mSelectionHelper.getAdapter().isEditionEnabled()) {
|
||||||
|
|
|
@ -237,7 +237,10 @@ public class ChatRoomCreationFragment extends Fragment
|
||||||
if (newState == ChatRoom.State.Created) {
|
if (newState == ChatRoom.State.Created) {
|
||||||
mWaitLayout.setVisibility(View.GONE);
|
mWaitLayout.setVisibility(View.GONE);
|
||||||
LinphoneActivity.instance()
|
LinphoneActivity.instance()
|
||||||
.goToChat(cr.getPeerAddress().asStringUriOnly(), mShareInfos);
|
.goToChat(
|
||||||
|
cr.getLocalAddress().asStringUriOnly(),
|
||||||
|
cr.getPeerAddress().asStringUriOnly(),
|
||||||
|
mShareInfos);
|
||||||
} else if (newState == ChatRoom.State.CreationFailed) {
|
} else if (newState == ChatRoom.State.CreationFailed) {
|
||||||
mWaitLayout.setVisibility(View.GONE);
|
mWaitLayout.setVisibility(View.GONE);
|
||||||
LinphoneActivity.instance().displayChatRoomError();
|
LinphoneActivity.instance().displayChatRoomError();
|
||||||
|
@ -548,7 +551,10 @@ public class ChatRoomCreationFragment extends Fragment
|
||||||
mChatRoom = lc.findOneToOneChatRoom(lpc.getIdentityAddress(), address, true);
|
mChatRoom = lc.findOneToOneChatRoom(lpc.getIdentityAddress(), address, true);
|
||||||
if (mChatRoom != null) {
|
if (mChatRoom != null) {
|
||||||
LinphoneActivity.instance()
|
LinphoneActivity.instance()
|
||||||
.goToChat(mChatRoom.getPeerAddress().asStringUriOnly(), mShareInfos);
|
.goToChat(
|
||||||
|
mChatRoom.getLocalAddress().asStringUriOnly(),
|
||||||
|
mChatRoom.getPeerAddress().asStringUriOnly(),
|
||||||
|
mShareInfos);
|
||||||
} else {
|
} else {
|
||||||
mChatRoom =
|
mChatRoom =
|
||||||
lc.createClientGroupChatRoom(
|
lc.createClientGroupChatRoom(
|
||||||
|
@ -577,12 +583,17 @@ public class ChatRoomCreationFragment extends Fragment
|
||||||
} else {
|
} else {
|
||||||
LinphoneActivity.instance()
|
LinphoneActivity.instance()
|
||||||
.goToChat(
|
.goToChat(
|
||||||
mChatRoom.getPeerAddress().asStringUriOnly(), mShareInfos);
|
mChatRoom.getLocalAddress().asStringUriOnly(),
|
||||||
|
mChatRoom.getPeerAddress().asStringUriOnly(),
|
||||||
|
mShareInfos);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ChatRoom chatRoom = lc.getChatRoom(address);
|
ChatRoom chatRoom = lc.getChatRoom(address);
|
||||||
LinphoneActivity.instance()
|
LinphoneActivity.instance()
|
||||||
.goToChat(chatRoom.getPeerAddress().asStringUriOnly(), mShareInfos);
|
.goToChat(
|
||||||
|
chatRoom.getLocalAddress().asStringUriOnly(),
|
||||||
|
chatRoom.getPeerAddress().asStringUriOnly(),
|
||||||
|
mShareInfos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -182,7 +182,11 @@ public class ChatRoomsFragment extends Fragment
|
||||||
mChatRoomsAdapter.toggleSelection(position);
|
mChatRoomsAdapter.toggleSelection(position);
|
||||||
} else {
|
} else {
|
||||||
ChatRoom room = (ChatRoom) mChatRoomsAdapter.getItem(position);
|
ChatRoom room = (ChatRoom) mChatRoomsAdapter.getItem(position);
|
||||||
LinphoneActivity.instance().goToChat(room.getPeerAddress().asString(), null);
|
LinphoneActivity.instance()
|
||||||
|
.goToChat(
|
||||||
|
room.getLocalAddress().asStringUriOnly(),
|
||||||
|
room.getPeerAddress().asString(),
|
||||||
|
null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +209,11 @@ public class ChatRoomsFragment extends Fragment
|
||||||
ChatRoomsAdapter adapter = (ChatRoomsAdapter) mChatRoomsList.getAdapter();
|
ChatRoomsAdapter adapter = (ChatRoomsAdapter) mChatRoomsList.getAdapter();
|
||||||
if (adapter != null && adapter.getItemCount() > 0) {
|
if (adapter != null && adapter.getItemCount() > 0) {
|
||||||
ChatRoom room = (ChatRoom) adapter.getItem(0);
|
ChatRoom room = (ChatRoom) adapter.getItem(0);
|
||||||
LinphoneActivity.instance().goToChat(room.getPeerAddress().asStringUriOnly(), null);
|
LinphoneActivity.instance()
|
||||||
|
.goToChat(
|
||||||
|
room.getLocalAddress().asStringUriOnly(),
|
||||||
|
room.getPeerAddress().asStringUriOnly(),
|
||||||
|
null);
|
||||||
} else {
|
} else {
|
||||||
LinphoneActivity.instance().displayEmptyFragment();
|
LinphoneActivity.instance().displayEmptyFragment();
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,8 +50,8 @@ public class DevicesFragment extends Fragment {
|
||||||
private ExpandableListView mExpandableList;
|
private ExpandableListView mExpandableList;
|
||||||
private DevicesAdapter mAdapter;
|
private DevicesAdapter mAdapter;
|
||||||
|
|
||||||
private String mRoomUri;
|
private String mLocalSipUri, mRoomUri;
|
||||||
private Address mRoomAddr;
|
private Address mLocalSipAddr, mRoomAddr;
|
||||||
private ChatRoom mRoom;
|
private ChatRoom mRoom;
|
||||||
private boolean mOnlyDisplayChilds;
|
private boolean mOnlyDisplayChilds;
|
||||||
|
|
||||||
|
@ -62,7 +62,9 @@ public class DevicesFragment extends Fragment {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
if (getArguments() != null) {
|
if (getArguments() != null) {
|
||||||
mRoomUri = getArguments().getString("SipUri");
|
mLocalSipUri = getArguments().getString("LocalSipUri");
|
||||||
|
mLocalSipAddr = LinphoneManager.getLc().createAddress(mLocalSipUri);
|
||||||
|
mRoomUri = getArguments().getString("RemoteSipUri");
|
||||||
mRoomAddr = LinphoneManager.getLc().createAddress(mRoomUri);
|
mRoomAddr = LinphoneManager.getLc().createAddress(mRoomUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +119,7 @@ public class DevicesFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (LinphoneActivity.instance().isTablet()) {
|
if (LinphoneActivity.instance().isTablet()) {
|
||||||
LinphoneActivity.instance().goToChat(mRoomUri, null);
|
LinphoneActivity.instance().goToChat(mLocalSipUri, mRoomUri, null);
|
||||||
} else {
|
} else {
|
||||||
LinphoneActivity.instance().onBackPressed();
|
LinphoneActivity.instance().onBackPressed();
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,6 +159,7 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
|
||||||
if (LinphoneActivity.instance().isTablet()) {
|
if (LinphoneActivity.instance().isTablet()) {
|
||||||
LinphoneActivity.instance()
|
LinphoneActivity.instance()
|
||||||
.goToChat(
|
.goToChat(
|
||||||
|
null,
|
||||||
mGroupChatRoomAddress.asStringUriOnly(),
|
mGroupChatRoomAddress.asStringUriOnly(),
|
||||||
mShareInfos);
|
mShareInfos);
|
||||||
} else {
|
} else {
|
||||||
|
@ -200,7 +201,9 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
|
||||||
mChatRoom.leave();
|
mChatRoom.leave();
|
||||||
LinphoneActivity.instance()
|
LinphoneActivity.instance()
|
||||||
.goToChat(
|
.goToChat(
|
||||||
mGroupChatRoomAddress.asString(), null);
|
null,
|
||||||
|
mGroupChatRoomAddress.asString(),
|
||||||
|
null);
|
||||||
} else {
|
} else {
|
||||||
Log.e(
|
Log.e(
|
||||||
"Can't leave, chatRoom for address "
|
"Can't leave, chatRoom for address "
|
||||||
|
@ -297,7 +300,10 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
|
||||||
getFragmentManager().popBackStack();
|
getFragmentManager().popBackStack();
|
||||||
getFragmentManager().popBackStack();
|
getFragmentManager().popBackStack();
|
||||||
LinphoneActivity.instance()
|
LinphoneActivity.instance()
|
||||||
.goToChat(cr.getPeerAddress().asStringUriOnly(), mShareInfos);
|
.goToChat(
|
||||||
|
cr.getLocalAddress().asStringUriOnly(),
|
||||||
|
cr.getPeerAddress().asStringUriOnly(),
|
||||||
|
mShareInfos);
|
||||||
} else if (newState == ChatRoom.State.CreationFailed) {
|
} else if (newState == ChatRoom.State.CreationFailed) {
|
||||||
mWaitLayout.setVisibility(View.GONE);
|
mWaitLayout.setVisibility(View.GONE);
|
||||||
LinphoneActivity.instance().displayChatRoomError();
|
LinphoneActivity.instance().displayChatRoomError();
|
||||||
|
@ -378,7 +384,7 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
|
||||||
mChatRoom.addParticipants(participantsToAdd);
|
mChatRoom.addParticipants(participantsToAdd);
|
||||||
|
|
||||||
LinphoneActivity.instance()
|
LinphoneActivity.instance()
|
||||||
.goToChat(mGroupChatRoomAddress.asString(), null);
|
.goToChat(null, mGroupChatRoomAddress.asString(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -57,8 +57,8 @@ public class ImdnFragment extends Fragment {
|
||||||
private ChatMessageViewHolder mBubble;
|
private ChatMessageViewHolder mBubble;
|
||||||
private ViewGroup mContainer;
|
private ViewGroup mContainer;
|
||||||
|
|
||||||
private String mRoomUri, mMessageId;
|
private String mLocalSipuri, mRoomUri, mMessageId;
|
||||||
private Address mRoomAddr;
|
private Address mLocalSipAddr, mRoomAddr;
|
||||||
private ChatRoom mRoom;
|
private ChatRoom mRoom;
|
||||||
private ChatMessage mMessage;
|
private ChatMessage mMessage;
|
||||||
private ChatMessageListenerStub mListener;
|
private ChatMessageListenerStub mListener;
|
||||||
|
@ -70,13 +70,15 @@ public class ImdnFragment extends Fragment {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
if (getArguments() != null) {
|
if (getArguments() != null) {
|
||||||
mRoomUri = getArguments().getString("SipUri");
|
mLocalSipuri = getArguments().getString("LocalSipUri");
|
||||||
|
mLocalSipAddr = LinphoneManager.getLc().createAddress(mLocalSipuri);
|
||||||
|
mRoomUri = getArguments().getString("RemoteSipUri");
|
||||||
mRoomAddr = LinphoneManager.getLc().createAddress(mRoomUri);
|
mRoomAddr = LinphoneManager.getLc().createAddress(mRoomUri);
|
||||||
mMessageId = getArguments().getString("MessageId");
|
mMessageId = getArguments().getString("MessageId");
|
||||||
}
|
}
|
||||||
|
|
||||||
Core core = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
Core core = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
mRoom = core.getChatRoomFromUri(mRoomAddr.asStringUriOnly());
|
mRoom = core.getChatRoom(mRoomAddr, mLocalSipAddr);
|
||||||
|
|
||||||
mInflater = inflater;
|
mInflater = inflater;
|
||||||
mContainer = container;
|
mContainer = container;
|
||||||
|
@ -88,7 +90,7 @@ public class ImdnFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (LinphoneActivity.instance().isTablet()) {
|
if (LinphoneActivity.instance().isTablet()) {
|
||||||
LinphoneActivity.instance().goToChat(mRoomUri, null);
|
LinphoneActivity.instance().goToChat(mLocalSipuri, mRoomUri, null);
|
||||||
} else {
|
} else {
|
||||||
LinphoneActivity.instance().onBackPressed();
|
LinphoneActivity.instance().onBackPressed();
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,8 +62,8 @@ public class ImdnOldFragment extends Fragment {
|
||||||
private ChatMessageOldViewHolder mBubble;
|
private ChatMessageOldViewHolder mBubble;
|
||||||
private ViewGroup mContainer;
|
private ViewGroup mContainer;
|
||||||
|
|
||||||
private String mRoomUri, mMessageId;
|
private String mLocalSipUri, mRoomUri, mMessageId;
|
||||||
private Address mRoomAddr;
|
private Address mLocalAddr, mRoomAddr;
|
||||||
private ChatRoom mRoom;
|
private ChatRoom mRoom;
|
||||||
private ChatMessage mMessage;
|
private ChatMessage mMessage;
|
||||||
private ChatMessageListenerStub mListener;
|
private ChatMessageListenerStub mListener;
|
||||||
|
@ -75,13 +75,15 @@ public class ImdnOldFragment extends Fragment {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
if (getArguments() != null) {
|
if (getArguments() != null) {
|
||||||
mRoomUri = getArguments().getString("SipUri");
|
mLocalSipUri = getArguments().getString("LocalSipUri");
|
||||||
|
mLocalAddr = LinphoneManager.getLc().createAddress(mLocalSipUri);
|
||||||
|
mRoomUri = getArguments().getString("RemoteSipUri");
|
||||||
mRoomAddr = LinphoneManager.getLc().createAddress(mRoomUri);
|
mRoomAddr = LinphoneManager.getLc().createAddress(mRoomUri);
|
||||||
mMessageId = getArguments().getString("MessageId");
|
mMessageId = getArguments().getString("MessageId");
|
||||||
}
|
}
|
||||||
|
|
||||||
Core core = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
Core core = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
mRoom = core.getChatRoomFromUri(mRoomAddr.asStringUriOnly());
|
mRoom = core.getChatRoom(mRoomAddr, mLocalAddr);
|
||||||
|
|
||||||
mInflater = inflater;
|
mInflater = inflater;
|
||||||
mContainer = container;
|
mContainer = container;
|
||||||
|
@ -93,7 +95,7 @@ public class ImdnOldFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (LinphoneActivity.instance().isTablet()) {
|
if (LinphoneActivity.instance().isTablet()) {
|
||||||
LinphoneActivity.instance().goToChat(mRoomUri, null);
|
LinphoneActivity.instance().goToChat(mLocalSipUri, mRoomUri, null);
|
||||||
} else {
|
} else {
|
||||||
LinphoneActivity.instance().onBackPressed();
|
LinphoneActivity.instance().onBackPressed();
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,10 @@ public class ContactDetailsFragment extends Fragment
|
||||||
isSecured);
|
isSecured);
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
LinphoneActivity.instance()
|
LinphoneActivity.instance()
|
||||||
.goToChat(room.getPeerAddress().asStringUriOnly(), null);
|
.goToChat(
|
||||||
|
room.getLocalAddress().asStringUriOnly(),
|
||||||
|
room.getPeerAddress().asStringUriOnly(),
|
||||||
|
null);
|
||||||
} else {
|
} else {
|
||||||
if (defaultProxyConfig.getConferenceFactoryUri() != null
|
if (defaultProxyConfig.getConferenceFactoryUri() != null
|
||||||
&& (isSecured
|
&& (isSecured
|
||||||
|
@ -115,7 +118,9 @@ public class ContactDetailsFragment extends Fragment
|
||||||
room = lc.getChatRoom(participant);
|
room = lc.getChatRoom(participant);
|
||||||
LinphoneActivity.instance()
|
LinphoneActivity.instance()
|
||||||
.goToChat(
|
.goToChat(
|
||||||
room.getPeerAddress().asStringUriOnly(), null);
|
room.getLocalAddress().asStringUriOnly(),
|
||||||
|
room.getPeerAddress().asStringUriOnly(),
|
||||||
|
null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,7 +171,10 @@ public class ContactDetailsFragment extends Fragment
|
||||||
if (newState == ChatRoom.State.Created) {
|
if (newState == ChatRoom.State.Created) {
|
||||||
mWaitLayout.setVisibility(View.GONE);
|
mWaitLayout.setVisibility(View.GONE);
|
||||||
LinphoneActivity.instance()
|
LinphoneActivity.instance()
|
||||||
.goToChat(cr.getPeerAddress().asStringUriOnly(), null);
|
.goToChat(
|
||||||
|
cr.getLocalAddress().asStringUriOnly(),
|
||||||
|
cr.getPeerAddress().asStringUriOnly(),
|
||||||
|
null);
|
||||||
} else if (newState == ChatRoom.State.CreationFailed) {
|
} else if (newState == ChatRoom.State.CreationFailed) {
|
||||||
mWaitLayout.setVisibility(View.GONE);
|
mWaitLayout.setVisibility(View.GONE);
|
||||||
LinphoneActivity.instance().displayChatRoomError();
|
LinphoneActivity.instance().displayChatRoomError();
|
||||||
|
|
|
@ -110,7 +110,10 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
||||||
if (newState == ChatRoom.State.Created) {
|
if (newState == ChatRoom.State.Created) {
|
||||||
mWaitLayout.setVisibility(View.GONE);
|
mWaitLayout.setVisibility(View.GONE);
|
||||||
LinphoneActivity.instance()
|
LinphoneActivity.instance()
|
||||||
.goToChat(cr.getPeerAddress().asStringUriOnly(), null);
|
.goToChat(
|
||||||
|
cr.getLocalAddress().asStringUriOnly(),
|
||||||
|
cr.getPeerAddress().asStringUriOnly(),
|
||||||
|
null);
|
||||||
} else if (newState == ChatRoom.State.CreationFailed) {
|
} else if (newState == ChatRoom.State.CreationFailed) {
|
||||||
mWaitLayout.setVisibility(View.GONE);
|
mWaitLayout.setVisibility(View.GONE);
|
||||||
LinphoneActivity.instance().displayChatRoomError();
|
LinphoneActivity.instance().displayChatRoomError();
|
||||||
|
@ -217,7 +220,11 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
||||||
lc.findOneToOneChatRoom(
|
lc.findOneToOneChatRoom(
|
||||||
lc.getDefaultProxyConfig().getContact(), participant, false);
|
lc.getDefaultProxyConfig().getContact(), participant, false);
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
LinphoneActivity.instance().goToChat(room.getPeerAddress().asStringUriOnly(), null);
|
LinphoneActivity.instance()
|
||||||
|
.goToChat(
|
||||||
|
room.getLocalAddress().asStringUriOnly(),
|
||||||
|
room.getPeerAddress().asStringUriOnly(),
|
||||||
|
null);
|
||||||
} else {
|
} else {
|
||||||
ProxyConfig lpc = lc.getDefaultProxyConfig();
|
ProxyConfig lpc = lc.getDefaultProxyConfig();
|
||||||
if (lpc != null
|
if (lpc != null
|
||||||
|
@ -232,7 +239,10 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
||||||
} else {
|
} else {
|
||||||
room = lc.getChatRoom(participant);
|
room = lc.getChatRoom(participant);
|
||||||
LinphoneActivity.instance()
|
LinphoneActivity.instance()
|
||||||
.goToChat(room.getPeerAddress().asStringUriOnly(), null);
|
.goToChat(
|
||||||
|
room.getLocalAddress().asStringUriOnly(),
|
||||||
|
room.getPeerAddress().asStringUriOnly(),
|
||||||
|
null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (id == R.id.add_contact) {
|
} else if (id == R.id.add_contact) {
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class NotificationBroadcastReceiver extends BroadcastReceiver {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatRoom room = core.findChatRoom(remoteAddr, localAddr);
|
ChatRoom room = core.getChatRoom(remoteAddr, localAddr);
|
||||||
if (room == null) {
|
if (room == null) {
|
||||||
Log.e(
|
Log.e(
|
||||||
"[Notification Broadcast Receiver] Couldn't find chat room for remote address "
|
"[Notification Broadcast Receiver] Couldn't find chat room for remote address "
|
||||||
|
|
|
@ -154,6 +154,7 @@ public class NotificationsManager {
|
||||||
Intent notifIntent = new Intent(mContext, LinphoneActivity.class);
|
Intent notifIntent = new Intent(mContext, LinphoneActivity.class);
|
||||||
notifIntent.putExtra("GoToChat", true);
|
notifIntent.putExtra("GoToChat", true);
|
||||||
notifIntent.putExtra("ChatContactSipUri", conferenceAddress);
|
notifIntent.putExtra("ChatContactSipUri", conferenceAddress);
|
||||||
|
notifIntent.putExtra("LocalSipUri", localIdentity.asStringUriOnly());
|
||||||
PendingIntent pendingIntent =
|
PendingIntent pendingIntent =
|
||||||
PendingIntent.getActivity(
|
PendingIntent.getActivity(
|
||||||
mContext, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
mContext, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
@ -200,6 +201,7 @@ public class NotificationsManager {
|
||||||
Intent notifIntent = new Intent(mContext, LinphoneActivity.class);
|
Intent notifIntent = new Intent(mContext, LinphoneActivity.class);
|
||||||
notifIntent.putExtra("GoToChat", true);
|
notifIntent.putExtra("GoToChat", true);
|
||||||
notifIntent.putExtra("ChatContactSipUri", fromSipUri);
|
notifIntent.putExtra("ChatContactSipUri", fromSipUri);
|
||||||
|
notifIntent.putExtra("LocalSipUri", localIdentity.asStringUriOnly());
|
||||||
PendingIntent pendingIntent =
|
PendingIntent pendingIntent =
|
||||||
PendingIntent.getActivity(
|
PendingIntent.getActivity(
|
||||||
mContext, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
mContext, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
|
Loading…
Reference in a new issue