Mark messages as read if using liblinphone storage
This commit is contained in:
parent
679c89b2ea
commit
d18ba33e44
3 changed files with 15 additions and 7 deletions
|
@ -182,6 +182,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
chatRoom = lc.getOrCreateChatRoom(sipUri);
|
||||
//Only works if using liblinphone storage
|
||||
LinphoneActivity.instance().getChatStorage().markConversationAsRead(chatRoom);
|
||||
}
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
|
@ -293,7 +295,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
messagesFilterLimit += MESSAGES_STEP;
|
||||
else
|
||||
messagesFilterLimit = messagesList.size();
|
||||
}
|
||||
}
|
||||
invalidate(messagesFilterLimit);
|
||||
}
|
||||
|
||||
|
@ -315,11 +317,13 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
displayImageMessage(msg.getId(), msg.getImage(), msg.getTimestamp(), msg.isIncoming(), msg.getStatus(), messagesLayout, msg.getUrl());
|
||||
}
|
||||
|
||||
if (!msg.isRead())
|
||||
if (!msg.isRead()) {
|
||||
// Only works if not using liblinphone storage
|
||||
chatStorage.markMessageAsRead(msg.getId());
|
||||
}
|
||||
}
|
||||
LinphoneActivity.instance().updateMissedChatCount();
|
||||
|
||||
|
||||
if (limit < messagesList.size()) {
|
||||
messagesScrollView.setScrollViewListener(new ScrollViewListener() {
|
||||
@Override
|
||||
|
|
|
@ -359,15 +359,19 @@ public class ChatStorage {
|
|||
}
|
||||
|
||||
public void markMessageAsRead(int id) {
|
||||
if (useNativeAPI) {
|
||||
//TODO
|
||||
} else {
|
||||
if (!useNativeAPI) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("read", READ);
|
||||
db.update(TABLE_NAME, values, "id LIKE " + id, null);
|
||||
}
|
||||
}
|
||||
|
||||
public void markConversationAsRead(LinphoneChatRoom chatroom) {
|
||||
if (useNativeAPI) {
|
||||
chatroom.markAsRead();
|
||||
}
|
||||
}
|
||||
|
||||
public int getUnreadMessageCount() {
|
||||
int count;
|
||||
if (!useNativeAPI) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 55b640b0d733ea88885d438c7888cf021269510e
|
||||
Subproject commit 679624223898212549d46757e52646a95b9ab8b8
|
Loading…
Reference in a new issue