Fix multiple appearances of the same chat in chat list + added destroy method to linphonechatroom
This commit is contained in:
parent
b2e7abc5a2
commit
ffcb91cee7
3 changed files with 10 additions and 6 deletions
|
@ -183,11 +183,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
messagesFilterLimit = savedInstanceState.getInt("messagesFilterLimit");
|
||||
}
|
||||
displayChat(displayName, pictureUri);
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
chatRoom = lc.createChatRoom(sipUri);
|
||||
}
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(LinphoneActivity.instance());
|
||||
uploadServerUri = prefs.getString(getString(R.string.pref_image_sharing_server_key), getString(R.string.pref_image_sharing_server_default));
|
||||
|
@ -492,6 +487,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
|
||||
@Override
|
||||
public void onPause() {
|
||||
if (chatRoom != null) {
|
||||
chatRoom.destroy();
|
||||
}
|
||||
latestImageMessages = null;
|
||||
message.removeTextChangedListener(textWatcher);
|
||||
removeVirtualKeyboardVisiblityListener();
|
||||
|
@ -515,6 +513,11 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
@SuppressLint("UseSparseArrays")
|
||||
@Override
|
||||
public void onResume() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
chatRoom = lc.createChatRoom(sipUri);
|
||||
}
|
||||
|
||||
latestImageMessages = new HashMap<Integer, String>();
|
||||
message.addTextChangedListener(textWatcher);
|
||||
addVirtualKeyboardVisiblityListener();
|
||||
|
|
|
@ -290,6 +290,7 @@ public class ChatStorage {
|
|||
chatMessage.setUrl(message.getExternalBodyUrl());
|
||||
chatMessages.add(chatMessage);
|
||||
}
|
||||
room.destroy();
|
||||
}
|
||||
|
||||
return chatMessages;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 2db0e99c547779ffd34c08fa61e64f0a967ef6d6
|
||||
Subproject commit 3e2f306e361fce90b05da1cfc7d6c16bc592df69
|
Loading…
Reference in a new issue