mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 14:27:24 +00:00
fix to mark federated rooms as read
As lastMessageId is not available for federatedRooms, the API on server side now allows the messageID to be optional. This is done by this commit: messageId is null when it's a federated room. Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
4150d8e4eb
commit
d15d8d29e6
@ -552,7 +552,7 @@ public interface NcApi {
|
||||
@POST
|
||||
Observable<GenericOverall> setChatReadMarker(@Header("Authorization") String authorization,
|
||||
@Url String url,
|
||||
@Field("lastReadMessage") int lastReadMessage);
|
||||
@Nullable @Field("lastReadMessage") Integer lastReadMessage);
|
||||
|
||||
// Url is: /api/{apiVersion}/chat/{token}/read
|
||||
@DELETE
|
||||
|
@ -308,6 +308,12 @@ class ConversationsListBottomDialog(
|
||||
}
|
||||
|
||||
private fun markConversationAsRead() {
|
||||
val messageId = if (conversation.remoteServer.isNullOrEmpty()) {
|
||||
conversation.lastMessage!!.jsonMessageId
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
ncApi.setChatReadMarker(
|
||||
credentials,
|
||||
ApiUtils.getUrlForChatReadMarker(
|
||||
@ -315,7 +321,7 @@ class ConversationsListBottomDialog(
|
||||
currentUser.baseUrl!!,
|
||||
conversation.token!!
|
||||
),
|
||||
conversation.lastMessage!!.jsonMessageId
|
||||
messageId
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -360,6 +366,7 @@ class ConversationsListBottomDialog(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun leaveConversation() {
|
||||
val dataBuilder = Data.Builder()
|
||||
dataBuilder.putString(KEY_ROOM_TOKEN, conversation.token)
|
||||
|
Loading…
Reference in New Issue
Block a user