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(
if (messageId == null) {
val id = UUID.randomUUID().toString()
val username = userHelper.username()
val user = userHelper.user()
val newMessage = Message(
id = id,
roomId = chatRoomId,
message = text,
timestamp = Instant.now().toEpochMilli(),
sender = SimpleUser(null, username, username),
sender = SimpleUser(user?.id, user?.username ?: username, user?.name),
attachments = null,
avatar = currentServer.avatarUrl(username ?: ""),
channels = null,
......@@ -345,6 +346,7 @@ class ChatRoomPresenter @Inject constructor(
unread = true
)
try {
Timber.d("#### $newMessage")
messagesRepository.save(newMessage)
view.showNewMessage(
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