Updated liblinphone + use existing chatroom if possible, else create it (destroy no more needed)
This commit is contained in:
parent
bc8c5a5b74
commit
e1153f938f
3 changed files with 10 additions and 16 deletions
|
@ -178,7 +178,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
progressBar.setProgress(0);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
chatRoom = lc.getOrCreateChatRoom(sipUri);
|
||||
}
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
messagesFilterLimit = savedInstanceState.getInt("messagesFilterLimit");
|
||||
}
|
||||
|
@ -487,9 +492,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
|
||||
@Override
|
||||
public void onPause() {
|
||||
if (chatRoom != null) {
|
||||
chatRoom.destroy();
|
||||
}
|
||||
latestImageMessages = null;
|
||||
message.removeTextChangedListener(textWatcher);
|
||||
removeVirtualKeyboardVisiblityListener();
|
||||
|
@ -513,11 +515,6 @@ 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();
|
||||
|
|
|
@ -280,7 +280,7 @@ public class ChatStorage {
|
|||
}
|
||||
c.close();
|
||||
} else {
|
||||
LinphoneChatRoom room = LinphoneManager.getLc().createChatRoom(correspondent);
|
||||
LinphoneChatRoom room = LinphoneManager.getLc().getOrCreateChatRoom(correspondent);
|
||||
LinphoneChatMessage[] history = room.getHistory();
|
||||
for (int i = 0; i < history.length; i++) {
|
||||
LinphoneChatMessage message = history[i];
|
||||
|
@ -290,7 +290,6 @@ public class ChatStorage {
|
|||
chatMessage.setUrl(message.getExternalBodyUrl());
|
||||
chatMessages.add(chatMessage);
|
||||
}
|
||||
room.destroy();
|
||||
}
|
||||
|
||||
return chatMessages;
|
||||
|
@ -319,9 +318,8 @@ public class ChatStorage {
|
|||
|
||||
public void removeDiscussion(String correspondent) {
|
||||
if (useNativeAPI) {
|
||||
LinphoneChatRoom chatroom = LinphoneManager.getLc().createChatRoom(correspondent);
|
||||
LinphoneChatRoom chatroom = LinphoneManager.getLc().getOrCreateChatRoom(correspondent);
|
||||
chatroom.deleteHistory();
|
||||
chatroom.destroy();
|
||||
} else {
|
||||
db.delete(TABLE_NAME, "remoteContact LIKE \"" + correspondent + "\"", null);
|
||||
}
|
||||
|
@ -393,9 +391,8 @@ public class ChatStorage {
|
|||
count = c.getCount();
|
||||
c.close();
|
||||
} else {
|
||||
LinphoneChatRoom chatroom = LinphoneManager.getLc().createChatRoom(contact);
|
||||
LinphoneChatRoom chatroom = LinphoneManager.getLc().getOrCreateChatRoom(contact);
|
||||
count = chatroom.getUnreadMessagesCount();
|
||||
chatroom.destroy();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 8fbe7ee1d47c7957f35ca9268c4072df7921cec1
|
||||
Subproject commit 55b640b0d733ea88885d438c7888cf021269510e
|
Loading…
Reference in a new issue