mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-04-22 14:08:30 +00:00
Renamed chat message to simply message
This commit is contained in:
parent
45ca7aa348
commit
ff2d04351f
21 changed files with 99 additions and 99 deletions
|
|
@ -195,7 +195,7 @@ class NotificationsManager @MainThread constructor(private val context: Context)
|
||||||
if (defaultAccountAddress != null && defaultAccountAddress.weakEqual(address)) return
|
if (defaultAccountAddress != null && defaultAccountAddress.weakEqual(address)) return
|
||||||
|
|
||||||
Log.i(
|
Log.i(
|
||||||
"$TAG Reaction received [${reaction.body}] from [${address.asStringUriOnly()}] for chat message [$message]"
|
"$TAG Reaction received [${reaction.body}] from [${address.asStringUriOnly()}] for message [$message]"
|
||||||
)
|
)
|
||||||
if (corePreferences.disableChat) return
|
if (corePreferences.disableChat) return
|
||||||
|
|
||||||
|
|
@ -229,7 +229,7 @@ class NotificationsManager @MainThread constructor(private val context: Context)
|
||||||
address: Address
|
address: Address
|
||||||
) {
|
) {
|
||||||
Log.i(
|
Log.i(
|
||||||
"$TAG [${address.asStringUriOnly()}] removed it's previously sent reaction for chat message [$message]"
|
"$TAG [${address.asStringUriOnly()}] removed it's previously sent reaction for message [$message]"
|
||||||
)
|
)
|
||||||
if (corePreferences.disableChat) return
|
if (corePreferences.disableChat) return
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,9 @@ import org.linphone.R
|
||||||
import org.linphone.databinding.ChatBubbleIncomingBinding
|
import org.linphone.databinding.ChatBubbleIncomingBinding
|
||||||
import org.linphone.databinding.ChatBubbleOutgoingBinding
|
import org.linphone.databinding.ChatBubbleOutgoingBinding
|
||||||
import org.linphone.databinding.ChatEventBinding
|
import org.linphone.databinding.ChatEventBinding
|
||||||
import org.linphone.ui.main.chat.model.ChatMessageModel
|
|
||||||
import org.linphone.ui.main.chat.model.EventLogModel
|
import org.linphone.ui.main.chat.model.EventLogModel
|
||||||
import org.linphone.ui.main.chat.model.EventModel
|
import org.linphone.ui.main.chat.model.EventModel
|
||||||
|
import org.linphone.ui.main.chat.model.MessageModel
|
||||||
import org.linphone.utils.Event
|
import org.linphone.utils.Event
|
||||||
import org.linphone.utils.startAnimatedDrawable
|
import org.linphone.utils.startAnimatedDrawable
|
||||||
|
|
||||||
|
|
@ -46,16 +46,16 @@ class ConversationEventAdapter : ListAdapter<EventLogModel, RecyclerView.ViewHol
|
||||||
const val EVENT = 3
|
const val EVENT = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
val chatMessageLongPressEvent = MutableLiveData<Event<ChatMessageModel>>()
|
val chatMessageLongPressEvent = MutableLiveData<Event<MessageModel>>()
|
||||||
|
|
||||||
val showDeliveryForChatMessageModelEvent: MutableLiveData<Event<ChatMessageModel>> by lazy {
|
val showDeliveryForChatMessageModelEvent: MutableLiveData<Event<MessageModel>> by lazy {
|
||||||
MutableLiveData<Event<ChatMessageModel>>()
|
MutableLiveData<Event<MessageModel>>()
|
||||||
}
|
}
|
||||||
val showReactionForChatMessageModelEvent: MutableLiveData<Event<ChatMessageModel>> by lazy {
|
val showReactionForChatMessageModelEvent: MutableLiveData<Event<MessageModel>> by lazy {
|
||||||
MutableLiveData<Event<ChatMessageModel>>()
|
MutableLiveData<Event<MessageModel>>()
|
||||||
}
|
}
|
||||||
val scrollToRepliedMessageEvent: MutableLiveData<Event<ChatMessageModel>> by lazy {
|
val scrollToRepliedMessageEvent: MutableLiveData<Event<MessageModel>> by lazy {
|
||||||
MutableLiveData<Event<ChatMessageModel>>()
|
MutableLiveData<Event<MessageModel>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||||
|
|
@ -70,7 +70,7 @@ class ConversationEventAdapter : ListAdapter<EventLogModel, RecyclerView.ViewHol
|
||||||
val data = getItem(position)
|
val data = getItem(position)
|
||||||
if (data.isEvent) return EVENT
|
if (data.isEvent) return EVENT
|
||||||
|
|
||||||
if ((data.model as ChatMessageModel).isOutgoing) {
|
if ((data.model as MessageModel).isOutgoing) {
|
||||||
return OUTGOING_CHAT_MESSAGE
|
return OUTGOING_CHAT_MESSAGE
|
||||||
}
|
}
|
||||||
return INCOMING_CHAT_MESSAGE
|
return INCOMING_CHAT_MESSAGE
|
||||||
|
|
@ -148,8 +148,8 @@ class ConversationEventAdapter : ListAdapter<EventLogModel, RecyclerView.ViewHol
|
||||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||||
val eventLog = getItem(position)
|
val eventLog = getItem(position)
|
||||||
when (holder) {
|
when (holder) {
|
||||||
is IncomingBubbleViewHolder -> holder.bind(eventLog.model as ChatMessageModel)
|
is IncomingBubbleViewHolder -> holder.bind(eventLog.model as MessageModel)
|
||||||
is OutgoingBubbleViewHolder -> holder.bind(eventLog.model as ChatMessageModel)
|
is OutgoingBubbleViewHolder -> holder.bind(eventLog.model as MessageModel)
|
||||||
is EventViewHolder -> holder.bind(eventLog.model as EventModel)
|
is EventViewHolder -> holder.bind(eventLog.model as EventModel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -157,7 +157,7 @@ class ConversationEventAdapter : ListAdapter<EventLogModel, RecyclerView.ViewHol
|
||||||
inner class IncomingBubbleViewHolder(
|
inner class IncomingBubbleViewHolder(
|
||||||
val binding: ChatBubbleIncomingBinding
|
val binding: ChatBubbleIncomingBinding
|
||||||
) : RecyclerView.ViewHolder(binding.root) {
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
fun bind(message: ChatMessageModel) {
|
fun bind(message: MessageModel) {
|
||||||
with(binding) {
|
with(binding) {
|
||||||
model = message
|
model = message
|
||||||
executePendingBindings()
|
executePendingBindings()
|
||||||
|
|
@ -170,7 +170,7 @@ class ConversationEventAdapter : ListAdapter<EventLogModel, RecyclerView.ViewHol
|
||||||
inner class OutgoingBubbleViewHolder(
|
inner class OutgoingBubbleViewHolder(
|
||||||
val binding: ChatBubbleOutgoingBinding
|
val binding: ChatBubbleOutgoingBinding
|
||||||
) : RecyclerView.ViewHolder(binding.root) {
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
fun bind(message: ChatMessageModel) {
|
fun bind(message: MessageModel) {
|
||||||
with(binding) {
|
with(binding) {
|
||||||
model = message
|
model = message
|
||||||
executePendingBindings()
|
executePendingBindings()
|
||||||
|
|
@ -193,8 +193,8 @@ class ConversationEventAdapter : ListAdapter<EventLogModel, RecyclerView.ViewHol
|
||||||
private class EventLogDiffCallback : DiffUtil.ItemCallback<EventLogModel>() {
|
private class EventLogDiffCallback : DiffUtil.ItemCallback<EventLogModel>() {
|
||||||
override fun areItemsTheSame(oldItem: EventLogModel, newItem: EventLogModel): Boolean {
|
override fun areItemsTheSame(oldItem: EventLogModel, newItem: EventLogModel): Boolean {
|
||||||
return if (!oldItem.isEvent && !newItem.isEvent) {
|
return if (!oldItem.isEvent && !newItem.isEvent) {
|
||||||
val oldData = (oldItem.model as ChatMessageModel)
|
val oldData = (oldItem.model as MessageModel)
|
||||||
val newData = (newItem.model as ChatMessageModel)
|
val newData = (newItem.model as MessageModel)
|
||||||
oldData.id == newData.id &&
|
oldData.id == newData.id &&
|
||||||
oldData.timestamp == newData.timestamp &&
|
oldData.timestamp == newData.timestamp &&
|
||||||
oldData.isOutgoing == newData.isOutgoing
|
oldData.isOutgoing == newData.isOutgoing
|
||||||
|
|
@ -207,8 +207,8 @@ class ConversationEventAdapter : ListAdapter<EventLogModel, RecyclerView.ViewHol
|
||||||
return if (oldItem.isEvent && newItem.isEvent) {
|
return if (oldItem.isEvent && newItem.isEvent) {
|
||||||
true
|
true
|
||||||
} else if (!oldItem.isEvent && !newItem.isEvent) {
|
} else if (!oldItem.isEvent && !newItem.isEvent) {
|
||||||
val oldModel = (oldItem.model as ChatMessageModel)
|
val oldModel = (oldItem.model as MessageModel)
|
||||||
val newModel = (newItem.model as ChatMessageModel)
|
val newModel = (newItem.model as MessageModel)
|
||||||
oldModel.statusIcon.value == newModel.statusIcon.value
|
oldModel.statusIcon.value == newModel.statusIcon.value
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@ import androidx.recyclerview.widget.ListAdapter
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import org.linphone.R
|
import org.linphone.R
|
||||||
import org.linphone.databinding.ChatMessageBottomSheetListCellBinding
|
import org.linphone.databinding.ChatMessageBottomSheetListCellBinding
|
||||||
import org.linphone.ui.main.chat.model.ChatMessageBottomSheetParticipantModel
|
import org.linphone.ui.main.chat.model.MessageBottomSheetParticipantModel
|
||||||
|
|
||||||
class ChatMessageBottomSheetAdapter : ListAdapter<ChatMessageBottomSheetParticipantModel, RecyclerView.ViewHolder>(
|
class MessageBottomSheetAdapter : ListAdapter<MessageBottomSheetParticipantModel, RecyclerView.ViewHolder>(
|
||||||
ParticipantDiffCallback()
|
ParticipantDiffCallback()
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|
@ -35,7 +35,7 @@ class ChatMessageBottomSheetAdapter : ListAdapter<ChatMessageBottomSheetParticip
|
||||||
val binding: ChatMessageBottomSheetListCellBinding
|
val binding: ChatMessageBottomSheetListCellBinding
|
||||||
) : RecyclerView.ViewHolder(binding.root) {
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
@UiThread
|
@UiThread
|
||||||
fun bind(bottomSheetModel: ChatMessageBottomSheetParticipantModel) {
|
fun bind(bottomSheetModel: MessageBottomSheetParticipantModel) {
|
||||||
with(binding) {
|
with(binding) {
|
||||||
model = bottomSheetModel
|
model = bottomSheetModel
|
||||||
executePendingBindings()
|
executePendingBindings()
|
||||||
|
|
@ -43,17 +43,17 @@ class ChatMessageBottomSheetAdapter : ListAdapter<ChatMessageBottomSheetParticip
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ParticipantDiffCallback : DiffUtil.ItemCallback<ChatMessageBottomSheetParticipantModel>() {
|
private class ParticipantDiffCallback : DiffUtil.ItemCallback<MessageBottomSheetParticipantModel>() {
|
||||||
override fun areItemsTheSame(
|
override fun areItemsTheSame(
|
||||||
oldItem: ChatMessageBottomSheetParticipantModel,
|
oldItem: MessageBottomSheetParticipantModel,
|
||||||
newItem: ChatMessageBottomSheetParticipantModel
|
newItem: MessageBottomSheetParticipantModel
|
||||||
): Boolean {
|
): Boolean {
|
||||||
return oldItem.sipUri == newItem.sipUri && oldItem.value == newItem.value
|
return oldItem.sipUri == newItem.sipUri && oldItem.value == newItem.value
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun areContentsTheSame(
|
override fun areContentsTheSame(
|
||||||
oldItem: ChatMessageBottomSheetParticipantModel,
|
oldItem: MessageBottomSheetParticipantModel,
|
||||||
newItem: ChatMessageBottomSheetParticipantModel
|
newItem: MessageBottomSheetParticipantModel
|
||||||
): Boolean {
|
): Boolean {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
@ -63,11 +63,11 @@ import org.linphone.core.tools.Log
|
||||||
import org.linphone.databinding.ChatBubbleLongPressMenuBinding
|
import org.linphone.databinding.ChatBubbleLongPressMenuBinding
|
||||||
import org.linphone.databinding.ChatConversationFragmentBinding
|
import org.linphone.databinding.ChatConversationFragmentBinding
|
||||||
import org.linphone.ui.main.MainActivity
|
import org.linphone.ui.main.MainActivity
|
||||||
import org.linphone.ui.main.chat.adapter.ChatMessageBottomSheetAdapter
|
|
||||||
import org.linphone.ui.main.chat.adapter.ConversationEventAdapter
|
import org.linphone.ui.main.chat.adapter.ConversationEventAdapter
|
||||||
import org.linphone.ui.main.chat.model.ChatMessageDeliveryModel
|
import org.linphone.ui.main.chat.adapter.MessageBottomSheetAdapter
|
||||||
import org.linphone.ui.main.chat.model.ChatMessageModel
|
import org.linphone.ui.main.chat.model.MessageDeliveryModel
|
||||||
import org.linphone.ui.main.chat.model.ChatMessageReactionsModel
|
import org.linphone.ui.main.chat.model.MessageModel
|
||||||
|
import org.linphone.ui.main.chat.model.MessageReactionsModel
|
||||||
import org.linphone.ui.main.chat.view.RichEditText
|
import org.linphone.ui.main.chat.view.RichEditText
|
||||||
import org.linphone.ui.main.chat.viewmodel.ConversationViewModel
|
import org.linphone.ui.main.chat.viewmodel.ConversationViewModel
|
||||||
import org.linphone.ui.main.chat.viewmodel.ConversationViewModel.Companion.SCROLLING_POSITION_NOT_SET
|
import org.linphone.ui.main.chat.viewmodel.ConversationViewModel.Companion.SCROLLING_POSITION_NOT_SET
|
||||||
|
|
@ -98,7 +98,7 @@ class ConversationFragment : GenericFragment() {
|
||||||
|
|
||||||
private lateinit var adapter: ConversationEventAdapter
|
private lateinit var adapter: ConversationEventAdapter
|
||||||
|
|
||||||
private lateinit var bottomSheetAdapter: ChatMessageBottomSheetAdapter
|
private lateinit var bottomSheetAdapter: MessageBottomSheetAdapter
|
||||||
|
|
||||||
private val args: ConversationFragmentArgs by navArgs()
|
private val args: ConversationFragmentArgs by navArgs()
|
||||||
|
|
||||||
|
|
@ -157,7 +157,7 @@ class ConversationFragment : GenericFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var currentChatMessageModelForBottomSheet: ChatMessageModel? = null
|
private var currentChatMessageModelForBottomSheet: MessageModel? = null
|
||||||
private val bottomSheetCallback = object : BottomSheetCallback() {
|
private val bottomSheetCallback = object : BottomSheetCallback() {
|
||||||
override fun onStateChanged(bottomSheet: View, newState: Int) {
|
override fun onStateChanged(bottomSheet: View, newState: Int) {
|
||||||
Log.i("$TAG Bottom sheet state is [$newState]")
|
Log.i("$TAG Bottom sheet state is [$newState]")
|
||||||
|
|
@ -180,15 +180,15 @@ class ConversationFragment : GenericFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var bottomSheetDeliveryModel: ChatMessageDeliveryModel? = null
|
private var bottomSheetDeliveryModel: MessageDeliveryModel? = null
|
||||||
|
|
||||||
private var bottomSheetReactionsModel: ChatMessageReactionsModel? = null
|
private var bottomSheetReactionsModel: MessageReactionsModel? = null
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
adapter = ConversationEventAdapter()
|
adapter = ConversationEventAdapter()
|
||||||
bottomSheetAdapter = ChatMessageBottomSheetAdapter()
|
bottomSheetAdapter = MessageBottomSheetAdapter()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
|
|
@ -244,7 +244,7 @@ class ConversationFragment : GenericFragment() {
|
||||||
adapter.notifyItemChanged(index)
|
adapter.notifyItemChanged(index)
|
||||||
|
|
||||||
val chatMessageEventLog = adapter.currentList[index]
|
val chatMessageEventLog = adapter.currentList[index]
|
||||||
val chatMessageModel = (chatMessageEventLog.model as? ChatMessageModel)
|
val chatMessageModel = (chatMessageEventLog.model as? MessageModel)
|
||||||
if (chatMessageModel != null) {
|
if (chatMessageModel != null) {
|
||||||
sendMessageViewModel.replyToMessage(chatMessageModel)
|
sendMessageViewModel.replyToMessage(chatMessageModel)
|
||||||
// Open keyboard & focus edit text
|
// Open keyboard & focus edit text
|
||||||
|
|
@ -324,10 +324,10 @@ class ConversationFragment : GenericFragment() {
|
||||||
it.consume { model ->
|
it.consume { model ->
|
||||||
val repliedMessageId = model.replyToMessageId
|
val repliedMessageId = model.replyToMessageId
|
||||||
if (repliedMessageId.isNullOrEmpty()) {
|
if (repliedMessageId.isNullOrEmpty()) {
|
||||||
Log.w("$TAG Chat message [${model.id}] doesn't have a reply to ID!")
|
Log.w("$TAG Message [${model.id}] doesn't have a reply to ID!")
|
||||||
} else {
|
} else {
|
||||||
val originalMessage = adapter.currentList.find { eventLog ->
|
val originalMessage = adapter.currentList.find { eventLog ->
|
||||||
!eventLog.isEvent && (eventLog.model as ChatMessageModel).id == repliedMessageId
|
!eventLog.isEvent && (eventLog.model as MessageModel).id == repliedMessageId
|
||||||
}
|
}
|
||||||
if (originalMessage != null) {
|
if (originalMessage != null) {
|
||||||
val position = adapter.currentList.indexOf(originalMessage)
|
val position = adapter.currentList.indexOf(originalMessage)
|
||||||
|
|
@ -417,7 +417,7 @@ class ConversationFragment : GenericFragment() {
|
||||||
|
|
||||||
viewModel.isGroup.observe(viewLifecycleOwner) { group ->
|
viewModel.isGroup.observe(viewLifecycleOwner) { group ->
|
||||||
if (group) {
|
if (group) {
|
||||||
Log.i("$TAG Adding text observer to chat message sending area")
|
Log.i("$TAG Adding text observer to message sending area")
|
||||||
binding.sendArea.messageToSend.addTextChangedListener(textObserver)
|
binding.sendArea.messageToSend.addTextChangedListener(textObserver)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -491,7 +491,7 @@ class ConversationFragment : GenericFragment() {
|
||||||
|
|
||||||
sharedViewModel.forceRefreshConversationEvents.observe(viewLifecycleOwner) {
|
sharedViewModel.forceRefreshConversationEvents.observe(viewLifecycleOwner) {
|
||||||
it.consume {
|
it.consume {
|
||||||
Log.i("$TAG Force refreshing chat messages list")
|
Log.i("$TAG Force refreshing messages list")
|
||||||
viewModel.applyFilter("")
|
viewModel.applyFilter("")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -519,7 +519,7 @@ class ConversationFragment : GenericFragment() {
|
||||||
|
|
||||||
val id = LinphoneUtils.getChatRoomId(args.localSipUri, args.remoteSipUri)
|
val id = LinphoneUtils.getChatRoomId(args.localSipUri, args.remoteSipUri)
|
||||||
Log.i(
|
Log.i(
|
||||||
"$TAG Asking notifications manager not to notify chat messages for conversation [$id]"
|
"$TAG Asking notifications manager not to notify messages for conversation [$id]"
|
||||||
)
|
)
|
||||||
coreContext.notificationsManager.setCurrentlyDisplayedChatRoomId(id)
|
coreContext.notificationsManager.setCurrentlyDisplayedChatRoomId(id)
|
||||||
|
|
||||||
|
|
@ -566,7 +566,7 @@ class ConversationFragment : GenericFragment() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showChatMessageLongPressMenu(chatMessageModel: ChatMessageModel) {
|
private fun showChatMessageLongPressMenu(chatMessageModel: MessageModel) {
|
||||||
Compatibility.setBlurRenderEffect(binding.root)
|
Compatibility.setBlurRenderEffect(binding.root)
|
||||||
|
|
||||||
val dialog = Dialog(requireContext(), R.style.Theme_LinphoneDialog)
|
val dialog = Dialog(requireContext(), R.style.Theme_LinphoneDialog)
|
||||||
|
|
@ -606,7 +606,7 @@ class ConversationFragment : GenericFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
layout.setResendClickListener {
|
layout.setResendClickListener {
|
||||||
Log.i("$TAG Re-sending chat message in error state")
|
Log.i("$TAG Re-sending message in error state")
|
||||||
chatMessageModel.resend()
|
chatMessageModel.resend()
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
}
|
}
|
||||||
|
|
@ -645,7 +645,7 @@ class ConversationFragment : GenericFragment() {
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
private fun showBottomSheetDialog(
|
private fun showBottomSheetDialog(
|
||||||
chatMessageModel: ChatMessageModel,
|
chatMessageModel: MessageModel,
|
||||||
showDelivery: Boolean = false,
|
showDelivery: Boolean = false,
|
||||||
showReactions: Boolean = false
|
showReactions: Boolean = false
|
||||||
) {
|
) {
|
||||||
|
|
@ -683,11 +683,11 @@ class ConversationFragment : GenericFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
private fun prepareBottomSheetForDeliveryStatus(chatMessageModel: ChatMessageModel) {
|
private fun prepareBottomSheetForDeliveryStatus(chatMessageModel: MessageModel) {
|
||||||
coreContext.postOnCoreThread {
|
coreContext.postOnCoreThread {
|
||||||
bottomSheetDeliveryModel?.destroy()
|
bottomSheetDeliveryModel?.destroy()
|
||||||
|
|
||||||
val model = ChatMessageDeliveryModel(chatMessageModel.chatMessage) { deliveryModel ->
|
val model = MessageDeliveryModel(chatMessageModel.chatMessage) { deliveryModel ->
|
||||||
coreContext.postOnMainThread {
|
coreContext.postOnMainThread {
|
||||||
displayDeliveryStatuses(deliveryModel)
|
displayDeliveryStatuses(deliveryModel)
|
||||||
}
|
}
|
||||||
|
|
@ -697,11 +697,11 @@ class ConversationFragment : GenericFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
private fun prepareBottomSheetForReactions(chatMessageModel: ChatMessageModel) {
|
private fun prepareBottomSheetForReactions(chatMessageModel: MessageModel) {
|
||||||
coreContext.postOnCoreThread {
|
coreContext.postOnCoreThread {
|
||||||
bottomSheetReactionsModel?.destroy()
|
bottomSheetReactionsModel?.destroy()
|
||||||
|
|
||||||
val model = ChatMessageReactionsModel(chatMessageModel.chatMessage) { reactionsModel ->
|
val model = MessageReactionsModel(chatMessageModel.chatMessage) { reactionsModel ->
|
||||||
coreContext.postOnMainThread {
|
coreContext.postOnMainThread {
|
||||||
if (reactionsModel.allReactions.isEmpty()) {
|
if (reactionsModel.allReactions.isEmpty()) {
|
||||||
Log.i("$TAG No reaction to display, closing bottom sheet")
|
Log.i("$TAG No reaction to display, closing bottom sheet")
|
||||||
|
|
@ -719,7 +719,7 @@ class ConversationFragment : GenericFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
private fun displayDeliveryStatuses(model: ChatMessageDeliveryModel) {
|
private fun displayDeliveryStatuses(model: MessageDeliveryModel) {
|
||||||
val tabs = binding.messageBottomSheet.tabs
|
val tabs = binding.messageBottomSheet.tabs
|
||||||
tabs.removeAllTabs()
|
tabs.removeAllTabs()
|
||||||
tabs.addTab(
|
tabs.addTab(
|
||||||
|
|
@ -768,7 +768,7 @@ class ConversationFragment : GenericFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
private fun displayReactions(model: ChatMessageReactionsModel) {
|
private fun displayReactions(model: MessageReactionsModel) {
|
||||||
val totalCount = model.allReactions.size
|
val totalCount = model.allReactions.size
|
||||||
val label = getString(R.string.message_reactions_info_all_title, totalCount.toString())
|
val label = getString(R.string.message_reactions_info_all_title, totalCount.toString())
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ class ConversationInfoFragment : GenericFragment() {
|
||||||
sharedViewModel.newChatMessageEphemeralLifetimeToSet.observe(viewLifecycleOwner) {
|
sharedViewModel.newChatMessageEphemeralLifetimeToSet.observe(viewLifecycleOwner) {
|
||||||
it.consume { ephemeralLifetime ->
|
it.consume { ephemeralLifetime ->
|
||||||
Log.i(
|
Log.i(
|
||||||
"$TAG Setting [$ephemeralLifetime] as new ephemeral lifetime for chat messages"
|
"$TAG Setting [$ephemeralLifetime] as new ephemeral lifetime for messages"
|
||||||
)
|
)
|
||||||
viewModel.updateEphemeralLifetime(ephemeralLifetime)
|
viewModel.updateEphemeralLifetime(ephemeralLifetime)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ class ConversationModel @WorkerThread constructor(val chatRoom: ChatRoom) {
|
||||||
isMuted.postValue(chatRoom.muted)
|
isMuted.postValue(chatRoom.muted)
|
||||||
isEphemeral.postValue(chatRoom.isEphemeralEnabled)
|
isEphemeral.postValue(chatRoom.isEphemeralEnabled)
|
||||||
Log.i(
|
Log.i(
|
||||||
"$TAG Ephemeral chat messages are [${if (chatRoom.isEphemeralEnabled) "enabled" else "disabled"}], lifetime is [${chatRoom.ephemeralLifetime}]"
|
"$TAG Ephemeral messages are [${if (chatRoom.isEphemeralEnabled) "enabled" else "disabled"}], lifetime is [${chatRoom.ephemeralLifetime}]"
|
||||||
)
|
)
|
||||||
|
|
||||||
updateLastMessage()
|
updateLastMessage()
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ class EventLogModel @WorkerThread constructor(
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatMessageModel(
|
MessageModel(
|
||||||
chatMessage,
|
chatMessage,
|
||||||
avatarModel,
|
avatarModel,
|
||||||
isFromGroup,
|
isFromGroup,
|
||||||
|
|
@ -90,6 +90,6 @@ class EventLogModel @WorkerThread constructor(
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
fun destroy() {
|
fun destroy() {
|
||||||
(model as? ChatMessageModel)?.destroy()
|
(model as? MessageModel)?.destroy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import androidx.annotation.WorkerThread
|
||||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||||
import org.linphone.core.Address
|
import org.linphone.core.Address
|
||||||
|
|
||||||
class ChatMessageBottomSheetParticipantModel @WorkerThread constructor(
|
class MessageBottomSheetParticipantModel @WorkerThread constructor(
|
||||||
address: Address,
|
address: Address,
|
||||||
val value: String,
|
val value: String,
|
||||||
val isOurOwnReaction: Boolean = false,
|
val isOurOwnReaction: Boolean = false,
|
||||||
|
|
@ -12,12 +12,12 @@ import org.linphone.core.tools.Log
|
||||||
import org.linphone.utils.AppUtils
|
import org.linphone.utils.AppUtils
|
||||||
import org.linphone.utils.TimestampUtils
|
import org.linphone.utils.TimestampUtils
|
||||||
|
|
||||||
class ChatMessageDeliveryModel @WorkerThread constructor(
|
class MessageDeliveryModel @WorkerThread constructor(
|
||||||
private val chatMessage: ChatMessage,
|
private val chatMessage: ChatMessage,
|
||||||
private val onDeliveryUpdated: ((model: ChatMessageDeliveryModel) -> Unit)? = null
|
private val onDeliveryUpdated: ((model: MessageDeliveryModel) -> Unit)? = null
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "[Chat Message Delivery Model]"
|
private const val TAG = "[Message Delivery Model]"
|
||||||
}
|
}
|
||||||
|
|
||||||
val readLabel = MutableLiveData<String>()
|
val readLabel = MutableLiveData<String>()
|
||||||
|
|
@ -28,13 +28,13 @@ class ChatMessageDeliveryModel @WorkerThread constructor(
|
||||||
|
|
||||||
val errorLabel = MutableLiveData<String>()
|
val errorLabel = MutableLiveData<String>()
|
||||||
|
|
||||||
val displayedModels = arrayListOf<ChatMessageBottomSheetParticipantModel>()
|
val displayedModels = arrayListOf<MessageBottomSheetParticipantModel>()
|
||||||
|
|
||||||
private val deliveredModels = arrayListOf<ChatMessageBottomSheetParticipantModel>()
|
private val deliveredModels = arrayListOf<MessageBottomSheetParticipantModel>()
|
||||||
|
|
||||||
private val sentModels = arrayListOf<ChatMessageBottomSheetParticipantModel>()
|
private val sentModels = arrayListOf<MessageBottomSheetParticipantModel>()
|
||||||
|
|
||||||
private val errorModels = arrayListOf<ChatMessageBottomSheetParticipantModel>()
|
private val errorModels = arrayListOf<MessageBottomSheetParticipantModel>()
|
||||||
|
|
||||||
private val chatMessageListener = object : ChatMessageListenerStub() {
|
private val chatMessageListener = object : ChatMessageListenerStub() {
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
|
|
@ -57,7 +57,7 @@ class ChatMessageDeliveryModel @WorkerThread constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
fun computeListForState(state: State): ArrayList<ChatMessageBottomSheetParticipantModel> {
|
fun computeListForState(state: State): ArrayList<MessageBottomSheetParticipantModel> {
|
||||||
return when (state) {
|
return when (state) {
|
||||||
State.DeliveredToUser -> {
|
State.DeliveredToUser -> {
|
||||||
deliveredModels
|
deliveredModels
|
||||||
|
|
@ -83,7 +83,7 @@ class ChatMessageDeliveryModel @WorkerThread constructor(
|
||||||
|
|
||||||
for (participant in chatMessage.getParticipantsByImdnState(State.Displayed)) {
|
for (participant in chatMessage.getParticipantsByImdnState(State.Displayed)) {
|
||||||
displayedModels.add(
|
displayedModels.add(
|
||||||
ChatMessageBottomSheetParticipantModel(
|
MessageBottomSheetParticipantModel(
|
||||||
participant.participant.address,
|
participant.participant.address,
|
||||||
TimestampUtils.toString(participant.stateChangeTime)
|
TimestampUtils.toString(participant.stateChangeTime)
|
||||||
)
|
)
|
||||||
|
|
@ -92,7 +92,7 @@ class ChatMessageDeliveryModel @WorkerThread constructor(
|
||||||
if (!chatMessage.isOutgoing) {
|
if (!chatMessage.isOutgoing) {
|
||||||
// Always add ourselves to prevent empty list
|
// Always add ourselves to prevent empty list
|
||||||
displayedModels.add(
|
displayedModels.add(
|
||||||
ChatMessageBottomSheetParticipantModel(
|
MessageBottomSheetParticipantModel(
|
||||||
chatMessage.localAddress,
|
chatMessage.localAddress,
|
||||||
TimestampUtils.toString(chatMessage.time)
|
TimestampUtils.toString(chatMessage.time)
|
||||||
)
|
)
|
||||||
|
|
@ -108,7 +108,7 @@ class ChatMessageDeliveryModel @WorkerThread constructor(
|
||||||
|
|
||||||
for (participant in chatMessage.getParticipantsByImdnState(State.DeliveredToUser)) {
|
for (participant in chatMessage.getParticipantsByImdnState(State.DeliveredToUser)) {
|
||||||
deliveredModels.add(
|
deliveredModels.add(
|
||||||
ChatMessageBottomSheetParticipantModel(
|
MessageBottomSheetParticipantModel(
|
||||||
participant.participant.address,
|
participant.participant.address,
|
||||||
TimestampUtils.toString(participant.stateChangeTime)
|
TimestampUtils.toString(participant.stateChangeTime)
|
||||||
)
|
)
|
||||||
|
|
@ -124,7 +124,7 @@ class ChatMessageDeliveryModel @WorkerThread constructor(
|
||||||
|
|
||||||
for (participant in chatMessage.getParticipantsByImdnState(State.Delivered)) {
|
for (participant in chatMessage.getParticipantsByImdnState(State.Delivered)) {
|
||||||
sentModels.add(
|
sentModels.add(
|
||||||
ChatMessageBottomSheetParticipantModel(
|
MessageBottomSheetParticipantModel(
|
||||||
participant.participant.address,
|
participant.participant.address,
|
||||||
TimestampUtils.toString(participant.stateChangeTime)
|
TimestampUtils.toString(participant.stateChangeTime)
|
||||||
)
|
)
|
||||||
|
|
@ -140,7 +140,7 @@ class ChatMessageDeliveryModel @WorkerThread constructor(
|
||||||
|
|
||||||
for (participant in chatMessage.getParticipantsByImdnState(State.NotDelivered)) {
|
for (participant in chatMessage.getParticipantsByImdnState(State.NotDelivered)) {
|
||||||
errorModels.add(
|
errorModels.add(
|
||||||
ChatMessageBottomSheetParticipantModel(
|
MessageBottomSheetParticipantModel(
|
||||||
participant.participant.address,
|
participant.participant.address,
|
||||||
TimestampUtils.toString(participant.stateChangeTime)
|
TimestampUtils.toString(participant.stateChangeTime)
|
||||||
)
|
)
|
||||||
|
|
@ -58,7 +58,7 @@ import org.linphone.utils.PatternClickableSpan
|
||||||
import org.linphone.utils.SpannableClickedListener
|
import org.linphone.utils.SpannableClickedListener
|
||||||
import org.linphone.utils.TimestampUtils
|
import org.linphone.utils.TimestampUtils
|
||||||
|
|
||||||
class ChatMessageModel @WorkerThread constructor(
|
class MessageModel @WorkerThread constructor(
|
||||||
val chatMessage: ChatMessage,
|
val chatMessage: ChatMessage,
|
||||||
val avatarModel: ContactAvatarModel,
|
val avatarModel: ContactAvatarModel,
|
||||||
val isFromGroup: Boolean,
|
val isFromGroup: Boolean,
|
||||||
|
|
@ -73,7 +73,7 @@ class ChatMessageModel @WorkerThread constructor(
|
||||||
private val onWebUrlClicked: ((url: String) -> Unit)? = null
|
private val onWebUrlClicked: ((url: String) -> Unit)? = null
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "[Chat Message Model]"
|
private const val TAG = "[Message Model]"
|
||||||
|
|
||||||
private const val SIP_URI_REGEXP = "(?:<?sips?:)[a-zA-Z0-9+_.\\-]+(?:@([a-zA-Z0-9+_.\\-;=~]+))+(>)?"
|
private const val SIP_URI_REGEXP = "(?:<?sips?:)[a-zA-Z0-9+_.\\-]+(?:@([a-zA-Z0-9+_.\\-;=~]+))+(>)?"
|
||||||
private const val HTTP_LINK_REGEXP = "https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)"
|
private const val HTTP_LINK_REGEXP = "https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)"
|
||||||
|
|
@ -171,14 +171,14 @@ class ChatMessageModel @WorkerThread constructor(
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
override fun onNewMessageReaction(message: ChatMessage, reaction: ChatMessageReaction) {
|
override fun onNewMessageReaction(message: ChatMessage, reaction: ChatMessageReaction) {
|
||||||
Log.i(
|
Log.i(
|
||||||
"$TAG New reaction [${reaction.body}] from [${reaction.fromAddress.asStringUriOnly()}] for chat message with ID [$id]"
|
"$TAG New reaction [${reaction.body}] from [${reaction.fromAddress.asStringUriOnly()}] for message with ID [$id]"
|
||||||
)
|
)
|
||||||
updateReactionsList()
|
updateReactionsList()
|
||||||
}
|
}
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
override fun onReactionRemoved(message: ChatMessage, address: Address) {
|
override fun onReactionRemoved(message: ChatMessage, address: Address) {
|
||||||
Log.i("$TAG A reaction was removed for chat message with ID [$id]")
|
Log.i("$TAG A reaction was removed for message with ID [$id]")
|
||||||
updateReactionsList()
|
updateReactionsList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -235,7 +235,7 @@ class ChatMessageModel @WorkerThread constructor(
|
||||||
@UiThread
|
@UiThread
|
||||||
fun sendReaction(emoji: String) {
|
fun sendReaction(emoji: String) {
|
||||||
coreContext.postOnCoreThread {
|
coreContext.postOnCoreThread {
|
||||||
Log.i("$TAG Sending reaction [$emoji] to chat message with ID [$id]")
|
Log.i("$TAG Sending reaction [$emoji] to message with ID [$id]")
|
||||||
val reaction = chatMessage.createReaction(emoji)
|
val reaction = chatMessage.createReaction(emoji)
|
||||||
reaction.send()
|
reaction.send()
|
||||||
dismissLongPressMenuEvent.postValue(Event(true))
|
dismissLongPressMenuEvent.postValue(Event(true))
|
||||||
|
|
@ -275,7 +275,7 @@ class ChatMessageModel @WorkerThread constructor(
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
private fun computeContentsList() {
|
private fun computeContentsList() {
|
||||||
Log.d("$TAG Computing chat message contents list")
|
Log.d("$TAG Computing message contents list")
|
||||||
var displayableContentFound = false
|
var displayableContentFound = false
|
||||||
var filesContentCount = 0
|
var filesContentCount = 0
|
||||||
val filesPath = arrayListOf<FileModel>()
|
val filesPath = arrayListOf<FileModel>()
|
||||||
|
|
@ -9,15 +9,15 @@ import org.linphone.core.ChatMessageListenerStub
|
||||||
import org.linphone.core.ChatMessageReaction
|
import org.linphone.core.ChatMessageReaction
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
|
|
||||||
class ChatMessageReactionsModel @WorkerThread constructor(
|
class MessageReactionsModel @WorkerThread constructor(
|
||||||
private val chatMessage: ChatMessage,
|
private val chatMessage: ChatMessage,
|
||||||
private val onReactionsUpdated: ((model: ChatMessageReactionsModel) -> Unit)? = null
|
private val onReactionsUpdated: ((model: MessageReactionsModel) -> Unit)? = null
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "[Chat Message Reactions Model]"
|
private const val TAG = "[Message Reactions Model]"
|
||||||
}
|
}
|
||||||
|
|
||||||
val allReactions = arrayListOf<ChatMessageBottomSheetParticipantModel>()
|
val allReactions = arrayListOf<MessageBottomSheetParticipantModel>()
|
||||||
|
|
||||||
val differentReactions = MutableLiveData<ArrayList<String>>()
|
val differentReactions = MutableLiveData<ArrayList<String>>()
|
||||||
|
|
||||||
|
|
@ -47,8 +47,8 @@ class ChatMessageReactionsModel @WorkerThread constructor(
|
||||||
chatMessage.removeListener(chatMessageListener)
|
chatMessage.removeListener(chatMessageListener)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun filterReactions(emoji: String): ArrayList<ChatMessageBottomSheetParticipantModel> {
|
fun filterReactions(emoji: String): ArrayList<MessageBottomSheetParticipantModel> {
|
||||||
val filteredList = arrayListOf<ChatMessageBottomSheetParticipantModel>()
|
val filteredList = arrayListOf<MessageBottomSheetParticipantModel>()
|
||||||
|
|
||||||
for (reaction in allReactions) {
|
for (reaction in allReactions) {
|
||||||
if (reaction.value == emoji) {
|
if (reaction.value == emoji) {
|
||||||
|
|
@ -72,7 +72,7 @@ class ChatMessageReactionsModel @WorkerThread constructor(
|
||||||
|
|
||||||
val isOurOwn = reaction.fromAddress.weakEqual(chatMessage.chatRoom.localAddress)
|
val isOurOwn = reaction.fromAddress.weakEqual(chatMessage.chatRoom.localAddress)
|
||||||
allReactions.add(
|
allReactions.add(
|
||||||
ChatMessageBottomSheetParticipantModel(
|
MessageBottomSheetParticipantModel(
|
||||||
reaction.fromAddress,
|
reaction.fromAddress,
|
||||||
body,
|
body,
|
||||||
isOurOwn
|
isOurOwn
|
||||||
|
|
@ -80,7 +80,7 @@ class ChatMessageReactionsModel @WorkerThread constructor(
|
||||||
if (isOurOwn) {
|
if (isOurOwn) {
|
||||||
coreContext.postOnCoreThread {
|
coreContext.postOnCoreThread {
|
||||||
Log.i(
|
Log.i(
|
||||||
"$TAG Removing our own reaction for chat message [${chatMessage.messageId}]"
|
"$TAG Removing our own reaction for message [${chatMessage.messageId}]"
|
||||||
)
|
)
|
||||||
val removeReaction = chatMessage.createReaction("")
|
val removeReaction = chatMessage.createReaction("")
|
||||||
removeReaction.send()
|
removeReaction.send()
|
||||||
|
|
@ -460,7 +460,7 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() {
|
||||||
if (!chatRoom.isEphemeralEnabled) 0L else chatRoom.ephemeralLifetime
|
if (!chatRoom.isEphemeralEnabled) 0L else chatRoom.ephemeralLifetime
|
||||||
)
|
)
|
||||||
Log.i(
|
Log.i(
|
||||||
"$TAG Ephemeral chat messages are [${if (chatRoom.isEphemeralEnabled) "enabled" else "disabled"}], lifetime is [${chatRoom.ephemeralLifetime}]"
|
"$TAG Ephemeral messages are [${if (chatRoom.isEphemeralEnabled) "enabled" else "disabled"}], lifetime is [${chatRoom.ephemeralLifetime}]"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@ import org.linphone.core.EventLog
|
||||||
import org.linphone.core.Factory
|
import org.linphone.core.Factory
|
||||||
import org.linphone.core.Friend
|
import org.linphone.core.Friend
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
import org.linphone.ui.main.chat.model.ChatMessageModel
|
|
||||||
import org.linphone.ui.main.chat.model.EventLogModel
|
import org.linphone.ui.main.chat.model.EventLogModel
|
||||||
|
import org.linphone.ui.main.chat.model.MessageModel
|
||||||
import org.linphone.ui.main.contacts.model.ContactAvatarModel
|
import org.linphone.ui.main.contacts.model.ContactAvatarModel
|
||||||
import org.linphone.utils.AppUtils
|
import org.linphone.utils.AppUtils
|
||||||
import org.linphone.utils.Event
|
import org.linphone.utils.Event
|
||||||
|
|
@ -99,7 +99,7 @@ class ConversationViewModel @UiThread constructor() : ViewModel() {
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
override fun onChatMessageSending(chatRoom: ChatRoom, eventLog: EventLog) {
|
override fun onChatMessageSending(chatRoom: ChatRoom, eventLog: EventLog) {
|
||||||
val message = eventLog.chatMessage
|
val message = eventLog.chatMessage
|
||||||
Log.i("$TAG Chat message [$message] is being sent")
|
Log.i("$TAG Message [$message] is being sent")
|
||||||
|
|
||||||
val list = arrayListOf<EventLogModel>()
|
val list = arrayListOf<EventLogModel>()
|
||||||
list.addAll(events.value.orEmpty())
|
list.addAll(events.value.orEmpty())
|
||||||
|
|
@ -130,7 +130,7 @@ class ConversationViewModel @UiThread constructor() : ViewModel() {
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
override fun onChatMessageSent(chatRoom: ChatRoom, eventLog: EventLog) {
|
override fun onChatMessageSent(chatRoom: ChatRoom, eventLog: EventLog) {
|
||||||
val message = eventLog.chatMessage
|
val message = eventLog.chatMessage
|
||||||
Log.i("$TAG Chat message [$message] has been sent")
|
Log.i("$TAG Message [$message] has been sent")
|
||||||
}
|
}
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
|
|
@ -203,7 +203,7 @@ class ConversationViewModel @UiThread constructor() : ViewModel() {
|
||||||
Log.i("$TAG Message [${message?.messageId}] ephemeral lifetime has expired")
|
Log.i("$TAG Message [${message?.messageId}] ephemeral lifetime has expired")
|
||||||
|
|
||||||
val found = eventsLogs.find {
|
val found = eventsLogs.find {
|
||||||
(it.model as? ChatMessageModel)?.chatMessage == message
|
(it.model as? MessageModel)?.chatMessage == message
|
||||||
}
|
}
|
||||||
if (found != null) {
|
if (found != null) {
|
||||||
val list = arrayListOf<EventLogModel>()
|
val list = arrayListOf<EventLogModel>()
|
||||||
|
|
@ -322,7 +322,7 @@ class ConversationViewModel @UiThread constructor() : ViewModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
fun deleteChatMessage(chatMessageModel: ChatMessageModel) {
|
fun deleteChatMessage(chatMessageModel: MessageModel) {
|
||||||
coreContext.postOnCoreThread {
|
coreContext.postOnCoreThread {
|
||||||
val eventsLogs = events.value.orEmpty()
|
val eventsLogs = events.value.orEmpty()
|
||||||
val found = eventsLogs.find {
|
val found = eventsLogs.find {
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,8 @@ import org.linphone.core.Player
|
||||||
import org.linphone.core.PlayerListener
|
import org.linphone.core.PlayerListener
|
||||||
import org.linphone.core.Recorder
|
import org.linphone.core.Recorder
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
import org.linphone.ui.main.chat.model.ChatMessageModel
|
|
||||||
import org.linphone.ui.main.chat.model.FileModel
|
import org.linphone.ui.main.chat.model.FileModel
|
||||||
|
import org.linphone.ui.main.chat.model.MessageModel
|
||||||
import org.linphone.ui.main.chat.model.ParticipantModel
|
import org.linphone.ui.main.chat.model.ParticipantModel
|
||||||
import org.linphone.utils.AppUtils
|
import org.linphone.utils.AppUtils
|
||||||
import org.linphone.utils.AudioUtils
|
import org.linphone.utils.AudioUtils
|
||||||
|
|
@ -193,10 +193,10 @@ class SendMessageInConversationViewModel @UiThread constructor() : ViewModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
fun replyToMessage(model: ChatMessageModel) {
|
fun replyToMessage(model: MessageModel) {
|
||||||
coreContext.postOnCoreThread {
|
coreContext.postOnCoreThread {
|
||||||
val message = model.chatMessage
|
val message = model.chatMessage
|
||||||
Log.i("$TAG Pending reply to chat message [${message.messageId}]")
|
Log.i("$TAG Pending reply to message [${message.messageId}]")
|
||||||
chatMessageToReplyTo = message
|
chatMessageToReplyTo = message
|
||||||
isReplyingTo.postValue(model.avatarModel.friend.name)
|
isReplyingTo.postValue(model.avatarModel.friend.name)
|
||||||
isReplyingToMessage.postValue(LinphoneUtils.getTextDescribingMessage(message))
|
isReplyingToMessage.postValue(LinphoneUtils.getTextDescribingMessage(message))
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
<import type="android.view.View" />
|
<import type="android.view.View" />
|
||||||
<variable
|
<variable
|
||||||
name="model"
|
name="model"
|
||||||
type="org.linphone.ui.main.chat.model.ChatMessageModel" />
|
type="org.linphone.ui.main.chat.model.MessageModel" />
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
type="View.OnClickListener" />
|
type="View.OnClickListener" />
|
||||||
<variable
|
<variable
|
||||||
name="model"
|
name="model"
|
||||||
type="org.linphone.ui.main.chat.model.ChatMessageModel" />
|
type="org.linphone.ui.main.chat.model.MessageModel" />
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
type="View.OnClickListener" />
|
type="View.OnClickListener" />
|
||||||
<variable
|
<variable
|
||||||
name="model"
|
name="model"
|
||||||
type="org.linphone.ui.main.chat.model.ChatMessageModel" />
|
type="org.linphone.ui.main.chat.model.MessageModel" />
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
<import type="android.view.View" />
|
<import type="android.view.View" />
|
||||||
<variable
|
<variable
|
||||||
name="model"
|
name="model"
|
||||||
type="org.linphone.ui.main.chat.model.ChatMessageModel" />
|
type="org.linphone.ui.main.chat.model.MessageModel" />
|
||||||
<variable
|
<variable
|
||||||
name="inflatedVisibility"
|
name="inflatedVisibility"
|
||||||
type="Integer" />
|
type="Integer" />
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
type="View.OnClickListener" />
|
type="View.OnClickListener" />
|
||||||
<variable
|
<variable
|
||||||
name="model"
|
name="model"
|
||||||
type="org.linphone.ui.main.chat.model.ChatMessageModel" />
|
type="org.linphone.ui.main.chat.model.MessageModel" />
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
<import type="android.view.View" />
|
<import type="android.view.View" />
|
||||||
<variable
|
<variable
|
||||||
name="model"
|
name="model"
|
||||||
type="org.linphone.ui.main.chat.model.ChatMessageModel" />
|
type="org.linphone.ui.main.chat.model.MessageModel" />
|
||||||
<variable
|
<variable
|
||||||
name="inflatedVisibility"
|
name="inflatedVisibility"
|
||||||
type="Integer" />
|
type="Integer" />
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
|
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
|
||||||
<variable
|
<variable
|
||||||
name="model"
|
name="model"
|
||||||
type="org.linphone.ui.main.chat.model.ChatMessageBottomSheetParticipantModel" />
|
type="org.linphone.ui.main.chat.model.MessageBottomSheetParticipantModel" />
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue