mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-28 10:47:46 +00:00
Don't let outgoing messages trigger last seen divider
Closes #6306 // FREEBIE
This commit is contained in:
parent
1d3f1cc79e
commit
8f96cff104
@ -289,7 +289,7 @@ public class ConversationAdapter <V extends View & BindableConversationItem>
|
||||
Cursor cursor = getCursorAtPositionOrThrow(i);
|
||||
MessageRecord messageRecord = getMessageRecord(cursor);
|
||||
|
||||
if (messageRecord.getDateReceived() <= lastSeen) {
|
||||
if (messageRecord.isOutgoing() || messageRecord.getDateReceived() <= lastSeen) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@ -345,7 +345,8 @@ public class ConversationAdapter <V extends View & BindableConversationItem>
|
||||
Cursor cursor = getCursorAtPositionOrThrow(position);
|
||||
MessageRecord messageRecord = getMessageRecord(cursor);
|
||||
|
||||
return messageRecord.getDateReceived();
|
||||
if (messageRecord.isOutgoing()) return 0;
|
||||
else return messageRecord.getDateReceived();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -412,6 +412,7 @@ public class ConversationFragment extends Fragment
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
|
||||
Log.w(TAG, "onLoadFinished");
|
||||
ConversationLoader loader = (ConversationLoader)cursorLoader;
|
||||
|
||||
if (list.getAdapter() != null) {
|
||||
@ -427,10 +428,16 @@ public class ConversationFragment extends Fragment
|
||||
|
||||
getListAdapter().changeCursor(cursor);
|
||||
|
||||
int lastSeenPosition = getListAdapter().findLastSeenPosition(lastSeen);
|
||||
|
||||
if (firstLoad) {
|
||||
scrollToLastSeenPosition(lastSeen);
|
||||
scrollToLastSeenPosition(lastSeenPosition);
|
||||
firstLoad = false;
|
||||
}
|
||||
|
||||
if (lastSeenPosition <= 0) {
|
||||
setLastSeen(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -441,9 +448,7 @@ public class ConversationFragment extends Fragment
|
||||
}
|
||||
}
|
||||
|
||||
private void scrollToLastSeenPosition(long lastSeen) {
|
||||
final int lastSeenPosition = getListAdapter().findLastSeenPosition(lastSeen);
|
||||
|
||||
private void scrollToLastSeenPosition(final int lastSeenPosition) {
|
||||
if (lastSeenPosition > 0) {
|
||||
list.post(new Runnable() {
|
||||
@Override
|
||||
@ -451,8 +456,6 @@ public class ConversationFragment extends Fragment
|
||||
((LinearLayoutManager)list.getLayoutManager()).scrollToPositionWithOffset(lastSeenPosition, list.getHeight());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
setLastSeen(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -911,6 +911,7 @@ public class MmsDatabase extends MessagingDatabase {
|
||||
long messageId = insertMediaMessage(masterSecret, addresses, message.getBody(),
|
||||
message.getAttachments(), contentValues);
|
||||
|
||||
DatabaseFactory.getThreadDatabase(context).setLastSeen(threadId);
|
||||
jobManager.add(new TrimThreadJob(context, threadId));
|
||||
|
||||
return messageId;
|
||||
|
@ -614,6 +614,7 @@ public class SmsDatabase extends MessagingDatabase {
|
||||
long messageId = db.insert(TABLE_NAME, ADDRESS, contentValues);
|
||||
|
||||
DatabaseFactory.getThreadDatabase(context).update(threadId, true);
|
||||
DatabaseFactory.getThreadDatabase(context).setLastSeen(threadId);
|
||||
notifyConversationListeners(threadId);
|
||||
jobManager.add(new TrimThreadJob(context, threadId));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user