Skip to content

Commit

Permalink
Merge pull request #560 from WideChat/pjl-remove-composer-delay
Browse files Browse the repository at this point in the history
clear composer and enable send button before sending messages
  • Loading branch information
bizzbyster authored Aug 2, 2019
2 parents b6c3992 + 843bf21 commit 2f3ff34
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ class ChatRoomPresenter @Inject constructor(
RoomUiModel(roles = chatRoles, isBroadcast = chatIsBroadcast)
), false
)
clearDraftMessage()
view.enableSendMessageButton()
client.sendMessage(id, chatRoomId, text)
messagesRepository.save(newMessage.copy(synced = true))
analyticsManager.logMessageSent(newMessage.type.toString(), currentServer)
Expand All @@ -432,15 +434,16 @@ class ChatRoomPresenter @Inject constructor(
}
}
} else {
clearDraftMessage()
view.enableSendMessageButton()
client.updateMessage(chatRoomId, messageId, text)
}
clearDraftMessage()
} catch (ex: Exception) {
Timber.e(ex, "Error sending message...")
view.enableSendMessageButton()
jobSchedulerInteractor.scheduleSendingMessages()
} finally {
view.clearMessageComposition(true)
view.enableSendMessageButton()
//view.enableSendMessageButton()
}
}
}
Expand Down Expand Up @@ -1363,6 +1366,7 @@ class ChatRoomPresenter @Inject constructor(
}

fun clearDraftMessage() {
view.clearMessageComposition(true)
localRepository.clear(draftKey)
}
/**
Expand Down

0 comments on commit 2f3ff34

Please sign in to comment.