Add support for last read message & fix pinned magic

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2019-09-05 15:52:41 +02:00
parent 8ad09d3395
commit 67e9405040
3 changed files with 20 additions and 13 deletions

View File

@ -992,13 +992,20 @@ public class ChatController extends BaseController implements MessagesListAdapte
return; return;
} }
Map<String, Integer> fieldMap = new HashMap<>();
fieldMap.put("includeLastKnown", 0);
if (lookIntoFuture > 0) { if (lookIntoFuture > 0) {
lookingIntoFuture = true; lookingIntoFuture = true;
} else if (isFirstMessagesProcessing) {
globalLastKnownFutureMessageId = currentConversation.getLastReadMessage();
globalLastKnownPastMessageId = currentConversation.getLastReadMessage();
fieldMap.put("includeLastKnown", 1);
} }
Map<String, Integer> fieldMap = new HashMap<>();
fieldMap.put("lookIntoFuture", lookIntoFuture); fieldMap.put("lookIntoFuture", lookIntoFuture);
fieldMap.put("limit", 25); fieldMap.put("limit", 10);
fieldMap.put("setReadMarker", 1);
int lastKnown; int lastKnown;
if (lookIntoFuture > 0) { if (lookIntoFuture > 0) {
@ -1007,9 +1014,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
lastKnown = globalLastKnownPastMessageId; lastKnown = globalLastKnownPastMessageId;
} }
if (lastKnown != -1) { fieldMap.put("lastKnownMessageId", lastKnown);
fieldMap.put("lastKnownMessageId", lastKnown);
}
if (!wasDetached) { if (!wasDetached) {
if (lookIntoFuture > 0) { if (lookIntoFuture > 0) {

View File

@ -92,7 +92,8 @@ public class Conversation {
public LobbyState lobbyState; public LobbyState lobbyState;
@JsonField(name = "lobbyTimer") @JsonField(name = "lobbyTimer")
public Long lobbyTimer; public Long lobbyTimer;
@JsonField(name = "lastReadMessage")
public int lastReadMessage;
public boolean isPublic() { public boolean isPublic() {
return (ConversationType.ROOM_PUBLIC_CALL.equals(type)); return (ConversationType.ROOM_PUBLIC_CALL.equals(type));

View File

@ -41,6 +41,14 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/margin_between_elements"> android:layout_marginEnd="@dimen/margin_between_elements">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@id/dialogAvatar"
android:layout_width="@dimen/small_item_height"
android:layout_height="@dimen/small_item_height"
android:contentDescription="@null"
app:roundAsCircle="true"
tools:src="@drawable/ic_call_black_24dp" />
<ImageView <ImageView
android:id="@+id/passwordProtectedRoomImageView" android:id="@+id/passwordProtectedRoomImageView"
android:layout_width="@dimen/margin_between_elements" android:layout_width="@dimen/margin_between_elements"
@ -55,13 +63,6 @@
android:layout_gravity="top|end" android:layout_gravity="top|end"
android:background="@drawable/shape_favorite_bubble" /> android:background="@drawable/shape_favorite_bubble" />
<com.facebook.drawee.view.SimpleDraweeView
android:id="@id/dialogAvatar"
android:layout_width="@dimen/small_item_height"
android:layout_height="@dimen/small_item_height"
android:contentDescription="@null"
app:roundAsCircle="true"
tools:src="@drawable/ic_call_black_24dp" />
</FrameLayout> </FrameLayout>
<RelativeLayout <RelativeLayout