Closed jddeep closed 3 years ago
@TatankaConCube please look into this
@jddeep please provide the log with uploading the avatar and with getting the dialogs. I have checked it right now and it works correctly on the app from the master
branch. For which type of dialog do you change the photo?
@TatankaConCube Private Chat dialogs. Here is the code I am using for fetching the chats from server.
fun loadChats(): LiveData<ApiResponse<List<Chat>>> {
val requestBuilder = RequestGetBuilder()
.sortDesc(Consts.DIALOG_LAST_MESSAGE_DATE_SENT_FIELD_NAME)
.`in`(Consts.DIALOG_TYPE, 2, 3)
return InjectorUtils.provideConnectycubeServiceForType<ArrayList<ConnectycubeChatDialog>, List<Chat>>()
.perform(
ConnectycubeRestChatService.getChatDialogs(null, requestBuilder),
object : Converter<List<Chat>, ArrayList<ConnectycubeChatDialog>>() {
override fun convertTo(response: ArrayList<ConnectycubeChatDialog>): List<Chat> {
Log.e("FetchedChats: ", response.toString())
return convertToChats(response)
}
})
}
Here is the log:
FetchedChats:: [ConnectycubeChatDialog{id=607c0316ca8bf45f38f711ff, created_at=2021-18-04 15:29:50, updated_at=2021-19-04 19:28:55, last_msg_user_id=4010576, occupants_ids=[4010576, 4035232], occupants_count=null, admins_ids=[], pinned_messages_ids=[], last_message=Done, last_message_date_sent=1618840733, type=PRIVATE, name=TinguBoy, room_jid=null, user_id=4010576, photo=null, unread_message_count=0, customData=null, description=null}, ConnectycubeChatDialog{id=607bdd15ca8bf44136f7d00f, created_at=2021-18-04 12:47:41, updated_at=2021-18-04 15:22:04, last_msg_user_id=4010576, occupants_ids=[4010576, 4039232], occupants_count=null, admins_ids=[], pinned_messages_ids=[], last_message=brooooo, last_message_date_sent=1618739523, type=PRIVATE, name=Clinton, room_jid=null, user_id=4010576, photo=null, unread_message_count=0, customData=null, description=null}, ConnectycubeChatDialog{id=607bf347ca8bf47941f87100, created_at=2021-18-04 14:22:23, updated_at=2021-18-04 14:38:52, last_msg_user_id=4038853, occupants_ids=[4010576, 4038853], occupants_count=null, admins_ids=[], pinned_messages_ids=[], last_message=Ha bhai, last_message_date_sent=1618736931, type=PRIVATE, name=Ruben Sir, room_jid=null, user_id=4010576, photo=null, unread_message_count=0, customData=null, description=null}, ConnectycubeChatDialog{id=607bf10fca8bf43c50f6b942, created_at=2021-18-04 14:12:55, updated_at=2021-18-04 14:13:43, last_msg_user_id=4010576, occupants_ids=[4010576, 4035209], occupants_count=null, admins_ids=[], pinned_messages_ids=[], last_message=vro, last_message_date_sent=1618735421, type=PRIVATE, name=Gary V, room_jid=null, user_id=4010576, photo=null, unread_message_count=0, customData=null, description=null}, ConnectycubeChatDialog{id=607acd6fca8bf44136f6c86a, created_at=2021-17-04 17:28:39, updated_at=2021-18-04 08:47:28, last_msg_user_id=4010576, occupants_ids=[4010563, 4010576], occupants_count=null, admins_ids=[], pinned_messages_ids=[], last_message=Okayy, last_message_date_sent=1618715846, type=PRIVATE, name=Debayan, room_jid=null, user_id=4010576, photo=null, unread_message_count=0, customData=null, description=null}, ConnectycubeChatDialog{id=607ad099ca8bf41dc9f6a0f4, created_at=2021-17-04 05:42:09, updated_at=2021-17-04 05:42:27, last_msg_user_id=4010576, occupants_ids=[4010564, 4010576], occupants_count=null, admins_ids=[], pinned_messages_ids=[], last_message=Nsksnsnss, last_message_date_sent=1618661546, type=PRIVATE, name=Jaideep, room_jid=null, user_id=4010576, photo=null, unread_message_count=0, customData=null, description=null}, ConnectycubeChatDialog{id=60794172ca8bf41563f7b74b, created_at=2021-16-04 13:19:06, updated_at=2021-17-04 12:39:44, last_msg_user_id=4010572, occupants_ids=[4010572, 4010576], occupants_count=null, admins_ids=[], pinned_messages_ids=[], last_message=Vro, last_message_date_sent=1618643382, type=PRIVATE, name=Robert DeNiro, room_jid=null, user_id=4010576, photo=null, unread_message_count=0, customData=null, description=null}]
@TatankaConCube I checked on the admin dashboard of the chat dialogs, the photo urls are there. Which means the uploading is correct.
Please provide the logs which contain both requests, update and get dialogs without any filters.
For which type of dialog do you change the photo?
?
@TatankaConCube ConnectycubeDialogType.PRIVATE
You provided part only with private dialogs. I think the server fills this field dynamically by setting the opponent's photo there, but I'm not sure, need to consult with the backend team. I will back later.
Let me know if that's the case. Cause while signing up a user we are not providing a photo at that time.
Yes, I was right, server gets data from field 'avatar' of opponent and sets it as a 'photo' for private dialog.
@TatankaConCube okay. Then you are suggesting adding the avatar while signing up the user/opponent? In that way the chat dialog will have the photo?
@TatankaConCube By the way, this is how we are creating the chat dialog:
val array = arrayOfNulls<ConnectycubeUser>(liveSelectedUsers.value!!.size)
liveSelectedUsers.value?.toArray(array)
val chatDialog: ConnectycubeChatDialog = DialogUtils.buildDialog(*array)
name?.let { chatDialog.name = name }
avatar?.let { chatDialog.photo = avatar }
return Transformations.map(
chatRepo.createChatDialog(
convertToChat(chatDialog).apply {
this.name = chatDialog.name ?: (array[0]?.fullName ?: "")
this.photo = chatDialog.photo ?: (array[0]?.avatar ?: "")
}
)
)
And the avatar
here is a valid image url and it is getting stored in the photo
field of the dialog as can been seen in the admin dashboard. Wonder still why its dynamically changed to null
while fetching
No, you have to set the 'avatar' for user, not for dialog. In this way server will return photo.
Okay let us try that. Will let you know
@TatankaConCube Apparently its working! Thanks for the help.
ConnectycubeRestChatService.getChatDialogs() returns chats with photo as null even if photo is there. I checked on dashboard with the chat id. Everything is matching except the photo. There is a photo url in the dashboard but am receiving photo=null