Commit 4dcd88b9 authored by Utkarsh Barsaiyan's avatar Utkarsh Barsaiyan

Fix null username being shown while sending mssgs without internet

parent cf7ffd51
...@@ -320,12 +320,13 @@ class ChatRoomPresenter @Inject constructor( ...@@ -320,12 +320,13 @@ class ChatRoomPresenter @Inject constructor(
if (messageId == null) { if (messageId == null) {
val id = UUID.randomUUID().toString() val id = UUID.randomUUID().toString()
val username = userHelper.username() val username = userHelper.username()
val user = userHelper.user()
val newMessage = Message( val newMessage = Message(
id = id, id = id,
roomId = chatRoomId, roomId = chatRoomId,
message = text, message = text,
timestamp = Instant.now().toEpochMilli(), timestamp = Instant.now().toEpochMilli(),
sender = SimpleUser(null, username, username), sender = SimpleUser(user?.id, user?.username ?: username, user?.name),
attachments = null, attachments = null,
avatar = currentServer.avatarUrl(username ?: ""), avatar = currentServer.avatarUrl(username ?: ""),
channels = null, channels = null,
...@@ -345,6 +346,7 @@ class ChatRoomPresenter @Inject constructor( ...@@ -345,6 +346,7 @@ class ChatRoomPresenter @Inject constructor(
unread = true unread = true
) )
try { try {
Timber.d("#### $newMessage")
messagesRepository.save(newMessage) messagesRepository.save(newMessage)
view.showNewMessage( view.showNewMessage(
mapper.map( mapper.map(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment