private fun getNewMessageState(lastMessage: Message?, lastLoadedMessage: Message?): NewMessageState? { val currentUser = user.value  return if (lastMessage != null && lastLoadedMessage != null && lastMessage.id != lastLoadedMessage.id) { if (lastMessage.user.id == currentUser?.id) { MyOwn } else { Other } } else { null } }
Builds the [NewMessageState] for the UI, whenever the message state changes. This is used to allow us to show the user a floating button giving them the option to scroll to the bottom when needed.