diff --git a/app/src/main/java/org/linphone/notifications/NotificationBroadcastReceiver.kt b/app/src/main/java/org/linphone/notifications/NotificationBroadcastReceiver.kt index 91d232f34..e2661351e 100644 --- a/app/src/main/java/org/linphone/notifications/NotificationBroadcastReceiver.kt +++ b/app/src/main/java/org/linphone/notifications/NotificationBroadcastReceiver.kt @@ -113,7 +113,7 @@ class NotificationBroadcastReceiver : BroadcastReceiver() { val room = core.searchChatRoom(null, localAddress, remoteAddress, arrayOfNulls(0)) if (room == null) { Log.e( - "$TAG Couldn't find chat room for remote address $remoteSipAddress and local address $localIdentity" + "$TAG Couldn't find conversation for remote address $remoteSipAddress and local address $localIdentity" ) return@postOnCoreThread } diff --git a/app/src/main/java/org/linphone/notifications/NotificationsManager.kt b/app/src/main/java/org/linphone/notifications/NotificationsManager.kt index 1697ed1d2..279e15f9e 100644 --- a/app/src/main/java/org/linphone/notifications/NotificationsManager.kt +++ b/app/src/main/java/org/linphone/notifications/NotificationsManager.kt @@ -155,22 +155,22 @@ class NotificationsManager @MainThread constructor(private val context: Context) val id = LinphoneUtils.getChatRoomId(chatRoom.localAddress, chatRoom.peerAddress) if (id == currentlyDisplayedChatRoomId) { Log.i( - "$TAG Do not notify received messages for currently displayed chat room [$id]" + "$TAG Do not notify received messages for currently displayed conversation [$id]" ) return } if (chatRoom.muted) { - Log.i("$TAG Chat room $id has been muted") + Log.i("$TAG Conversation $id has been muted") return } if (ShortcutUtils.isShortcutToChatRoomAlreadyCreated(context, chatRoom)) { - Log.i("$TAG Chat room shortcut already exists") + Log.i("$TAG Conversation shortcut already exists") showChatRoomNotification(chatRoom, messages) } else { Log.i( - "$TAG Ensure chat room shortcut exists for 'conversation' notification" + "$TAG Ensure conversation shortcut exists for notification" ) scope.launch { val shortcuts = async { @@ -202,13 +202,13 @@ class NotificationsManager @MainThread constructor(private val context: Context) val id = LinphoneUtils.getChatRoomId(chatRoom.localAddress, chatRoom.peerAddress) if (id == currentlyDisplayedChatRoomId) { Log.i( - "$TAG Do not notify received reaction for currently displayed chat room [$id]" + "$TAG Do not notify received reaction for currently displayed conversation [$id]" ) return } if (chatRoom.muted) { - Log.i("$TAG Chat room $id has been muted") + Log.i("$TAG Conversation $id has been muted") return } if (coreContext.isAddressMyself(address)) { @@ -235,14 +235,14 @@ class NotificationsManager @MainThread constructor(private val context: Context) if (chatRoom.muted) { val id = LinphoneUtils.getChatRoomId(chatRoom.localAddress, chatRoom.peerAddress) - Log.i("$TAG Chat room $id has been muted") + Log.i("$TAG Conversation $id has been muted") return } val chatRoomPeerAddress = chatRoom.peerAddress.asStringUriOnly() val notifiable: Notifiable? = chatNotificationsMap[chatRoomPeerAddress] if (notifiable == null) { - Log.i("$TAG No notification for chat room [$chatRoomPeerAddress], nothing to do") + Log.i("$TAG No notification for conversation [$chatRoomPeerAddress], nothing to do") return } @@ -280,7 +280,7 @@ class NotificationsManager @MainThread constructor(private val context: Context) @WorkerThread override fun onChatRoomRead(core: Core, chatRoom: ChatRoom) { Log.i( - "$TAG Chat room [$chatRoom] has been marked as read, removing notification if any" + "$TAG Conversation [$chatRoom] has been marked as read, removing notification if any" ) dismissChatNotification(chatRoom) } @@ -307,7 +307,7 @@ class NotificationsManager @MainThread constructor(private val context: Context) } displayReplyMessageNotification(message, notifiable) } else { - Log.e("$TAG Couldn't find notification for chat room $address") + Log.e("$TAG Couldn't find notification for conversation $address") cancelNotification(id, CHAT_TAG) } } else if (state == ChatMessage.State.NotDelivered) { @@ -924,7 +924,7 @@ class NotificationsManager @MainThread constructor(private val context: Context) val notifiable: Notifiable? = chatNotificationsMap[address] if (notifiable != null) { Log.i( - "$TAG Dismissing notification for chat room $chatRoom with id ${notifiable.notificationId}" + "$TAG Dismissing notification for conversation $chatRoom with id ${notifiable.notificationId}" ) notifiable.messages.clear() cancelNotification(notifiable.notificationId, CHAT_TAG) diff --git a/app/src/main/java/org/linphone/ui/main/chat/fragment/ConversationFragment.kt b/app/src/main/java/org/linphone/ui/main/chat/fragment/ConversationFragment.kt index c900b3353..19cddae08 100644 --- a/app/src/main/java/org/linphone/ui/main/chat/fragment/ConversationFragment.kt +++ b/app/src/main/java/org/linphone/ui/main/chat/fragment/ConversationFragment.kt @@ -270,7 +270,7 @@ class ConversationFragment : GenericFragment() { it.consume { found -> if (!found) { (view.parent as? ViewGroup)?.doOnPreDraw { - Log.e("$TAG Failed to find chat room, going back") + Log.e("$TAG Failed to find conversation, going back") goBack() val message = getString(R.string.toast_cant_find_conversation_to_display) (requireActivity() as MainActivity).showRedToast(message, R.drawable.x) @@ -518,7 +518,9 @@ class ConversationFragment : GenericFragment() { super.onResume() val id = LinphoneUtils.getChatRoomId(args.localSipUri, args.remoteSipUri) - Log.i("$TAG Asking notifications manager not to notify chat messages for chat room [$id]") + Log.i( + "$TAG Asking notifications manager not to notify chat messages for conversation [$id]" + ) coreContext.notificationsManager.setCurrentlyDisplayedChatRoomId(id) if (viewModel.scrollingPosition != SCROLLING_POSITION_NOT_SET) { diff --git a/app/src/main/java/org/linphone/ui/main/chat/fragment/ConversationInfoFragment.kt b/app/src/main/java/org/linphone/ui/main/chat/fragment/ConversationInfoFragment.kt index 0078263d4..4e1ed0ee5 100644 --- a/app/src/main/java/org/linphone/ui/main/chat/fragment/ConversationInfoFragment.kt +++ b/app/src/main/java/org/linphone/ui/main/chat/fragment/ConversationInfoFragment.kt @@ -105,14 +105,14 @@ class ConversationInfoFragment : GenericFragment() { it.consume { found -> if (found) { Log.i( - "$TAG Found matching chat room for local SIP URI [$localSipUri] and remote SIP URI [$remoteSipUri]" + "$TAG Found matching conversation for local SIP URI [$localSipUri] and remote SIP URI [$remoteSipUri]" ) (view.parent as? ViewGroup)?.doOnPreDraw { startPostponedEnterTransition() } } else { (view.parent as? ViewGroup)?.doOnPreDraw { - Log.e("$TAG Failed to find chat room, going back") + Log.e("$TAG Failed to find conversation, going back") goBack() val message = getString(R.string.toast_cant_find_conversation_to_display) (requireActivity() as MainActivity).showRedToast(message, R.drawable.x) diff --git a/app/src/main/java/org/linphone/ui/main/chat/fragment/StartConversationFragment.kt b/app/src/main/java/org/linphone/ui/main/chat/fragment/StartConversationFragment.kt index 7c53c7901..35d99843b 100644 --- a/app/src/main/java/org/linphone/ui/main/chat/fragment/StartConversationFragment.kt +++ b/app/src/main/java/org/linphone/ui/main/chat/fragment/StartConversationFragment.kt @@ -88,7 +88,7 @@ class StartConversationFragment : GenericAddressPickerFragment() { viewModel.chatRoomCreatedEvent.observe(viewLifecycleOwner) { it.consume { pair -> Log.i( - "$TAG Chat room [${pair.second}] for local address [${pair.first}] has been created, navigating to it" + "$TAG Conversation [${pair.second}] for local address [${pair.first}] has been created, navigating to it" ) sharedViewModel.showConversationEvent.value = Event(pair) goBack() @@ -97,7 +97,7 @@ class StartConversationFragment : GenericAddressPickerFragment() { viewModel.chatRoomCreationErrorEvent.observe(viewLifecycleOwner) { it.consume { error -> - Log.i("$TAG Chat room creation error, showing red toast") + Log.i("$TAG Conversation creation error, showing red toast") (requireActivity() as MainActivity).showRedToast(error, R.drawable.warning_circle) } } diff --git a/app/src/main/java/org/linphone/ui/main/chat/model/ConversationModel.kt b/app/src/main/java/org/linphone/ui/main/chat/model/ConversationModel.kt index 509d08d2e..85e2530f7 100644 --- a/app/src/main/java/org/linphone/ui/main/chat/model/ConversationModel.kt +++ b/app/src/main/java/org/linphone/ui/main/chat/model/ConversationModel.kt @@ -85,13 +85,23 @@ class ConversationModel @WorkerThread constructor(val chatRoom: ChatRoom) { private val chatRoomListener = object : ChatRoomListenerStub() { @WorkerThread override fun onStateChanged(chatRoom: ChatRoom, newState: ChatRoom.State?) { - Log.i("$TAG Chat room state changed [${chatRoom.state}]") + Log.i("$TAG Conversation state changed [${chatRoom.state}]") if (chatRoom.state == ChatRoom.State.Created) { subject.postValue(chatRoom.subject) computeParticipants() + } else if (chatRoom.state == ChatRoom.State.Deleted) { + Log.i("$TAG Conversation [$id] has been deleted") + isBeingDeleted.postValue(false) } } + override fun onConferenceJoined(chatRoom: ChatRoom, eventLog: EventLog) { + // This is required as a Created chat room may not have the participants list yet + Log.i("$TAG Conversation has been joined") + subject.postValue(chatRoom.subject) + computeParticipants() + } + @WorkerThread override fun onIsComposingReceived( chatRoom: ChatRoom, @@ -121,7 +131,7 @@ class ConversationModel @WorkerThread constructor(val chatRoom: ChatRoom) { @WorkerThread override fun onSubjectChanged(chatRoom: ChatRoom, eventLog: EventLog) { - Log.i("$TAG Chat room subject changed [${chatRoom.subject}]") + Log.i("$TAG Conversation subject changed [${chatRoom.subject}]") subject.postValue(chatRoom.subject) updateLastUpdatedTime() } @@ -210,10 +220,13 @@ class ConversationModel @WorkerThread constructor(val chatRoom: ChatRoom) { coreContext.postOnCoreThread { core -> Log.i("$TAG Deleting conversation [$id]") isBeingDeleted.postValue(true) + val basic = chatRoom.hasCapability(Capabilities.Basic.toInt()) ShortcutUtils.removeShortcutToChatRoom(chatRoom) core.deleteChatRoom(chatRoom) - Log.i("$TAG Conversation [$id] has been deleted") - isBeingDeleted.postValue(false) + if (basic) { + Log.i("$TAG Conversation [$id] has been deleted") + isBeingDeleted.postValue(false) + } } } @@ -263,7 +276,7 @@ class ConversationModel @WorkerThread constructor(val chatRoom: ChatRoom) { lastMessage = message } } else { - Log.w("$TAG No last message to display for chat room [$id]") + Log.w("$TAG No last message to display for conversation [$id]") } } @@ -289,12 +302,14 @@ class ConversationModel @WorkerThread constructor(val chatRoom: ChatRoom) { private fun computeParticipants() { val friends = arrayListOf() val address = if (chatRoom.hasCapability(Capabilities.Basic.toInt())) { - Log.i("$TAG Chat room [$id] is 'Basic'") + Log.i("$TAG Conversation [$id] is 'Basic'") chatRoom.peerAddress } else { val firstParticipant = chatRoom.participants.firstOrNull() if (isGroup) { - Log.i("$TAG Group chat room [$id] has [${chatRoom.nbParticipants}] participant(s)") + Log.i( + "$TAG Group conversation [$id] has [${chatRoom.nbParticipants}] participant(s)" + ) for (participant in chatRoom.participants) { val friend = coreContext.contactsManager.findContactByAddress( participant.address @@ -305,7 +320,7 @@ class ConversationModel @WorkerThread constructor(val chatRoom: ChatRoom) { } } else { Log.i( - "$TAG Chat room [$id] is with participant [${firstParticipant?.address?.asStringUriOnly()}]" + "$TAG Conversation [$id] is with participant [${firstParticipant?.address?.asStringUriOnly()}]" ) } firstParticipant?.address ?: chatRoom.peerAddress diff --git a/app/src/main/java/org/linphone/ui/main/chat/viewmodel/ConversationInfoViewModel.kt b/app/src/main/java/org/linphone/ui/main/chat/viewmodel/ConversationInfoViewModel.kt index 8a1cbe172..d934d4413 100644 --- a/app/src/main/java/org/linphone/ui/main/chat/viewmodel/ConversationInfoViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/chat/viewmodel/ConversationInfoViewModel.kt @@ -146,7 +146,7 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() { @WorkerThread override fun onSubjectChanged(chatRoom: ChatRoom, eventLog: EventLog) { Log.i( - "$TAG Chat room [${LinphoneUtils.getChatRoomId(chatRoom)}] has a new subject [${chatRoom.subject}]" + "$TAG Conversation [${LinphoneUtils.getChatRoomId(chatRoom)}] has a new subject [${chatRoom.subject}]" ) val message = AppUtils.getString( R.string.toast_conversation_subject_changed @@ -199,10 +199,10 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() { fun findChatRoom(room: ChatRoom?, localSipUri: String, remoteSipUri: String) { coreContext.postOnCoreThread { core -> Log.i( - "$TAG Looking for chat room with local SIP URI [$localSipUri] and remote SIP URI [$remoteSipUri]" + "$TAG Looking for conversation with local SIP URI [$localSipUri] and remote SIP URI [$remoteSipUri]" ) if (room != null && ::chatRoom.isInitialized && chatRoom == room) { - Log.i("$TAG Chat room object already in memory, skipping") + Log.i("$TAG Conversation object already in memory, skipping") chatRoomFoundEvent.postValue(Event(true)) return@postOnCoreThread } @@ -215,7 +215,7 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() { room.peerAddress ) == true ) { - Log.i("$TAG Chat room object available in sharedViewModel, using it") + Log.i("$TAG Conversation object available in sharedViewModel, using it") chatRoom = room chatRoom.addListener(chatRoomListener) configureChatRoom() @@ -225,7 +225,7 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() { } if (localAddress != null && remoteAddress != null) { - Log.i("$TAG Searching for chat room in Core using local & peer SIP addresses") + Log.i("$TAG Searching for conversation in Core using local & peer SIP addresses") val found = core.searchChatRoom( null, localAddress, @@ -241,7 +241,7 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() { configureChatRoom() chatRoomFoundEvent.postValue(Event(true)) } else { - Log.e("$TAG Failed to find chat room given local & remote addresses!") + Log.e("$TAG Failed to find conversation given local & remote addresses!") chatRoomFoundEvent.postValue(Event(false)) } } else { @@ -255,7 +255,7 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() { fun leaveGroup() { coreContext.postOnCoreThread { if (::chatRoom.isInitialized) { - Log.i("$TAG Leaving chat room [${LinphoneUtils.getChatRoomId(chatRoom)}]") + Log.i("$TAG Leaving conversation [${LinphoneUtils.getChatRoomId(chatRoom)}]") chatRoom.leave() } groupLeftEvent.postValue(Event(true)) @@ -267,7 +267,9 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() { coreContext.postOnCoreThread { // TODO: confirmation dialog ? if (::chatRoom.isInitialized) { - Log.i("$TAG Cleaning chat room [${LinphoneUtils.getChatRoomId(chatRoom)}] history") + Log.i( + "$TAG Cleaning conversation [${LinphoneUtils.getChatRoomId(chatRoom)}] history" + ) chatRoom.deleteHistory() } historyDeletedEvent.postValue(Event(true)) @@ -396,7 +398,7 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() { coreContext.postOnCoreThread { if (::chatRoom.isInitialized) { if (!LinphoneUtils.isChatRoomAGroup(chatRoom)) { - Log.e("$TAG Can't add participants to a chat room that's not a group!") + Log.e("$TAG Can't add participants to a conversation that's not a group!") return@postOnCoreThread } @@ -412,7 +414,7 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() { val participantsToAdd = arrayOfNulls
(list.size) list.toArray(participantsToAdd) - Log.i("$TAG Adding [${participantsToAdd.size}] new participants to chat room") + Log.i("$TAG Adding [${participantsToAdd.size}] new participants to conversation") val ok = chatRoom.addParticipants(participantsToAdd) if (!ok) { Log.w("$TAG Failed to add some/all participants to the group!") @@ -429,7 +431,7 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() { fun updateSubject(newSubject: String) { coreContext.postOnCoreThread { if (::chatRoom.isInitialized) { - Log.i("$TAG Updating chat room subject to [$newSubject]") + Log.i("$TAG Updating conversation subject to [$newSubject]") chatRoom.subject = newSubject } } @@ -476,7 +478,7 @@ class ConversationInfoViewModel @UiThread constructor() : ViewModel() { val readOnly = chatRoom.isReadOnly || empty isReadOnly.postValue(readOnly) if (readOnly) { - Log.w("$TAG Chat room with subject [${chatRoom.subject}] is read only!") + Log.w("$TAG Conversation with subject [${chatRoom.subject}] is read only!") } subject.postValue(chatRoom.subject) diff --git a/app/src/main/java/org/linphone/ui/main/chat/viewmodel/ConversationViewModel.kt b/app/src/main/java/org/linphone/ui/main/chat/viewmodel/ConversationViewModel.kt index f59388e26..e1690b565 100644 --- a/app/src/main/java/org/linphone/ui/main/chat/viewmodel/ConversationViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/chat/viewmodel/ConversationViewModel.kt @@ -90,7 +90,7 @@ class ConversationViewModel @UiThread constructor() : ViewModel() { private val chatRoomListener = object : ChatRoomListenerStub() { @WorkerThread override fun onStateChanged(chatRoom: ChatRoom, newState: ChatRoom.State?) { - Log.i("$TAG Chat room state changed [${chatRoom.state}]") + Log.i("$TAG Conversation state changed [${chatRoom.state}]") if (chatRoom.state == ChatRoom.State.Created) { computeConversationInfo() } @@ -254,10 +254,10 @@ class ConversationViewModel @UiThread constructor() : ViewModel() { fun findChatRoom(room: ChatRoom?, localSipUri: String, remoteSipUri: String) { coreContext.postOnCoreThread { core -> Log.i( - "$TAG Looking for chat room with local SIP URI [$localSipUri] and remote SIP URI [$remoteSipUri]" + "$TAG Looking for conversation with local SIP URI [$localSipUri] and remote SIP URI [$remoteSipUri]" ) if (room != null && ::chatRoom.isInitialized && chatRoom == room) { - Log.i("$TAG Chat room object already in memory, skipping") + Log.i("$TAG Conversation object already in memory, skipping") chatRoomFoundEvent.postValue(Event(true)) return@postOnCoreThread } @@ -270,7 +270,7 @@ class ConversationViewModel @UiThread constructor() : ViewModel() { room.peerAddress ) == true ) { - Log.i("$TAG Chat room object available in sharedViewModel, using it") + Log.i("$TAG Conversation object available in sharedViewModel, using it") chatRoom = room chatRoom.addListener(chatRoomListener) configureChatRoom() @@ -280,7 +280,7 @@ class ConversationViewModel @UiThread constructor() : ViewModel() { } if (localAddress != null && remoteAddress != null) { - Log.i("$TAG Searching for chat room in Core using local & peer SIP addresses") + Log.i("$TAG Searching for conversation in Core using local & peer SIP addresses") val found = core.searchChatRoom( null, localAddress, @@ -296,7 +296,7 @@ class ConversationViewModel @UiThread constructor() : ViewModel() { configureChatRoom() chatRoomFoundEvent.postValue(Event(true)) } else { - Log.e("$TAG Failed to find chat room given local & remote addresses!") + Log.e("$TAG Failed to find conversation given local & remote addresses!") chatRoomFoundEvent.postValue(Event(false)) } } else { @@ -349,7 +349,7 @@ class ConversationViewModel @UiThread constructor() : ViewModel() { val readOnly = chatRoom.isReadOnly || empty isReadOnly.postValue(readOnly) if (readOnly) { - Log.w("$TAG Chat room with subject [${chatRoom.subject}] is read only!") + Log.w("$TAG Conversation with subject [${chatRoom.subject}] is read only!") } computeConversationInfo() diff --git a/app/src/main/java/org/linphone/ui/main/chat/viewmodel/ConversationsListViewModel.kt b/app/src/main/java/org/linphone/ui/main/chat/viewmodel/ConversationsListViewModel.kt index 6a3451232..1c9985bdd 100644 --- a/app/src/main/java/org/linphone/ui/main/chat/viewmodel/ConversationsListViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/chat/viewmodel/ConversationsListViewModel.kt @@ -59,7 +59,7 @@ class ConversationsListViewModel @UiThread constructor() : AbstractTopBarViewMod state: ChatRoom.State? ) { Log.i( - "$TAG Chat room [${LinphoneUtils.getChatRoomId(chatRoom)}] state changed [$state]" + "$TAG Conversation [${LinphoneUtils.getChatRoomId(chatRoom)}] state changed [$state]" ) when (state) { @@ -146,7 +146,7 @@ class ConversationsListViewModel @UiThread constructor() : AbstractTopBarViewMod if (account?.isInSecureMode() == true) { if (!chatRoom.hasCapability(Capabilities.Encrypted.toInt()) && chatRoom.unreadMessagesCount == 0) { // TODO: remove message count check later Log.w( - "$TAG Skipping chat room [${LinphoneUtils.getChatRoomId(chatRoom)}] as it is not E2E encrypted and default account requires it" + "$TAG Skipping conversation [${LinphoneUtils.getChatRoomId(chatRoom)}] as it is not E2E encrypted and default account requires it" ) continue } @@ -178,7 +178,7 @@ class ConversationsListViewModel @UiThread constructor() : AbstractTopBarViewMod @WorkerThread private fun reorderChatRooms() { - Log.i("$TAG Re-ordering chat rooms") + Log.i("$TAG Re-ordering conversations") val sortedList = arrayListOf() sortedList.addAll(conversations.value.orEmpty()) sortedList.sortByDescending { diff --git a/app/src/main/java/org/linphone/ui/main/chat/viewmodel/StartConversationViewModel.kt b/app/src/main/java/org/linphone/ui/main/chat/viewmodel/StartConversationViewModel.kt index 96f4204d6..ee9df826b 100644 --- a/app/src/main/java/org/linphone/ui/main/chat/viewmodel/StartConversationViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/chat/viewmodel/StartConversationViewModel.kt @@ -63,10 +63,10 @@ class StartConversationViewModel @UiThread constructor() : AddressSelectionViewM override fun onStateChanged(chatRoom: ChatRoom, newState: ChatRoom.State?) { val state = chatRoom.state val id = LinphoneUtils.getChatRoomId(chatRoom) - Log.i("$TAG Chat room [$id] (${chatRoom.subject}) state changed: [$state]") + Log.i("$TAG Conversation [$id] (${chatRoom.subject}) state changed: [$state]") if (state == ChatRoom.State.Created) { - Log.i("$TAG Chat room [$id] successfully created") + Log.i("$TAG Conversation [$id] successfully created") chatRoom.removeListener(this) operationInProgress.postValue(false) chatRoomCreatedEvent.postValue( @@ -78,7 +78,7 @@ class StartConversationViewModel @UiThread constructor() : AddressSelectionViewM ) ) } else if (state == ChatRoom.State.CreationFailed) { - Log.e("$TAG Chat room [$id] creation has failed!") + Log.e("$TAG Conversation [$id] creation has failed!") chatRoom.removeListener(this) operationInProgress.postValue(false) chatRoomCreationErrorEvent.postValue(Event("Error!")) // TODO FIXME: use translated string @@ -138,7 +138,9 @@ class StartConversationViewModel @UiThread constructor() : AddressSelectionViewM if (params.backend == ChatRoom.Backend.FlexisipChat) { if (chatRoom.state == ChatRoom.State.Created) { val id = LinphoneUtils.getChatRoomId(chatRoom) - Log.i("$TAG Group chat room [$id] ($groupChatRoomSubject) has been created") + Log.i( + "$TAG Group conversation [$id] ($groupChatRoomSubject) has been created" + ) operationInProgress.postValue(false) chatRoomCreatedEvent.postValue( Event( @@ -150,13 +152,13 @@ class StartConversationViewModel @UiThread constructor() : AddressSelectionViewM ) } else { Log.i( - "$TAG Chat room [$groupChatRoomSubject] isn't in Created state yet, wait for it" + "$TAG Conversation [$groupChatRoomSubject] isn't in Created state yet, wait for it" ) chatRoom.addListener(chatRoomListener) } } else { val id = LinphoneUtils.getChatRoomId(chatRoom) - Log.i("$TAG Chat room successfully created [$id] ($groupChatRoomSubject)") + Log.i("$TAG Conversation successfully created [$id] ($groupChatRoomSubject)") operationInProgress.postValue(false) chatRoomCreatedEvent.postValue( Event( @@ -168,7 +170,7 @@ class StartConversationViewModel @UiThread constructor() : AddressSelectionViewM ) } } else { - Log.e("$TAG Failed to create group chat room [$groupChatRoomSubject]!") + Log.e("$TAG Failed to create group conversation [$groupChatRoomSubject]!") operationInProgress.postValue(false) chatRoomCreationErrorEvent.postValue(Event("Error!")) // TODO FIXME: use translated string } @@ -195,19 +197,19 @@ class StartConversationViewModel @UiThread constructor() : AddressSelectionViewM val sameDomain = remote.domain == corePreferences.defaultDomain && remote.domain == account.params.domain if (account.isInSecureMode() && sameDomain) { - Log.i("$TAG Account is in secure mode & domain matches, creating a E2E chat room") + Log.i("$TAG Account is in secure mode & domain matches, creating a E2E conversation") params.backend = ChatRoom.Backend.FlexisipChat params.isEncryptionEnabled = true } else if (!account.isInSecureMode()) { if (LinphoneUtils.isEndToEndEncryptedChatAvailable(core)) { Log.i( - "$TAG Account is in interop mode but LIME is available, creating a E2E chat room" + "$TAG Account is in interop mode but LIME is available, creating a E2E conversation" ) params.backend = ChatRoom.Backend.FlexisipChat params.isEncryptionEnabled = true } else { Log.i( - "$TAG Account is in interop mode but LIME isn't available, creating a SIP simple chat room" + "$TAG Account is in interop mode but LIME isn't available, creating a SIP simple conversation" ) params.backend = ChatRoom.Backend.Basic params.isEncryptionEnabled = false @@ -226,14 +228,14 @@ class StartConversationViewModel @UiThread constructor() : AddressSelectionViewM val existingChatRoom = core.searchChatRoom(params, localAddress, null, participants) if (existingChatRoom == null) { Log.i( - "$TAG No existing 1-1 chat room between local account [${localAddress?.asStringUriOnly()}] and remote [${remote.asStringUriOnly()}] was found for given parameters, let's create it" + "$TAG No existing 1-1 conversation between local account [${localAddress?.asStringUriOnly()}] and remote [${remote.asStringUriOnly()}] was found for given parameters, let's create it" ) val chatRoom = core.createChatRoom(params, localAddress, participants) if (chatRoom != null) { if (params.backend == ChatRoom.Backend.FlexisipChat) { if (chatRoom.state == ChatRoom.State.Created) { val id = LinphoneUtils.getChatRoomId(chatRoom) - Log.i("$TAG 1-1 chat room [$id] has been created") + Log.i("$TAG 1-1 conversation [$id] has been created") operationInProgress.postValue(false) chatRoomCreatedEvent.postValue( Event( @@ -244,12 +246,12 @@ class StartConversationViewModel @UiThread constructor() : AddressSelectionViewM ) ) } else { - Log.i("$TAG Chat room isn't in Created state yet, wait for it") + Log.i("$TAG Conversation isn't in Created state yet, wait for it") chatRoom.addListener(chatRoomListener) } } else { val id = LinphoneUtils.getChatRoomId(chatRoom) - Log.i("$TAG Chat room successfully created [$id]") + Log.i("$TAG Conversation successfully created [$id]") operationInProgress.postValue(false) chatRoomCreatedEvent.postValue( Event( @@ -261,13 +263,13 @@ class StartConversationViewModel @UiThread constructor() : AddressSelectionViewM ) } } else { - Log.e("$TAG Failed to create 1-1 chat room with [${remote.asStringUriOnly()}]!") + Log.e("$TAG Failed to create 1-1 conversation with [${remote.asStringUriOnly()}]!") operationInProgress.postValue(false) chatRoomCreationErrorEvent.postValue(Event("Error!")) // TODO FIXME: use translated string } } else { Log.w( - "$TAG A 1-1 chat room between local account [${localAddress?.asStringUriOnly()}] and remote [${remote.asStringUriOnly()}] for given parameters already exists!" + "$TAG A 1-1 conversation between local account [${localAddress?.asStringUriOnly()}] and remote [${remote.asStringUriOnly()}] for given parameters already exists!" ) operationInProgress.postValue(false) chatRoomCreatedEvent.postValue( diff --git a/app/src/main/java/org/linphone/ui/main/contacts/viewmodel/ContactViewModel.kt b/app/src/main/java/org/linphone/ui/main/contacts/viewmodel/ContactViewModel.kt index face95e15..c12bee6c0 100644 --- a/app/src/main/java/org/linphone/ui/main/contacts/viewmodel/ContactViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/contacts/viewmodel/ContactViewModel.kt @@ -184,10 +184,10 @@ class ContactViewModel @UiThread constructor() : ViewModel() { override fun onStateChanged(chatRoom: ChatRoom, newState: ChatRoom.State?) { val state = chatRoom.state val id = LinphoneUtils.getChatRoomId(chatRoom) - Log.i("$TAG Chat room [$id] (${chatRoom.subject}) state changed: [$state]") + Log.i("$TAG Conversation [$id] (${chatRoom.subject}) state changed: [$state]") if (state == ChatRoom.State.Created) { - Log.i("$TAG Chat room [$id] successfully created") + Log.i("$TAG Conversation [$id] successfully created") chatRoom.removeListener(this) operationInProgress.postValue(false) goToConversationEvent.postValue( @@ -199,7 +199,7 @@ class ContactViewModel @UiThread constructor() : ViewModel() { ) ) } else if (state == ChatRoom.State.CreationFailed) { - Log.e("$TAG Chat room [$id] creation has failed!") + Log.e("$TAG Conversation [$id] creation has failed!") chatRoom.removeListener(this) operationInProgress.postValue(false) chatRoomCreationErrorEvent.postValue(Event("Error!")) // TODO FIXME: use translated string @@ -499,7 +499,9 @@ class ContactViewModel @UiThread constructor() : ViewModel() { val localSipUri = account?.params?.identityAddress?.asStringUriOnly() if (!localSipUri.isNullOrEmpty()) { val remoteSipUri = remote.asStringUriOnly() - Log.i("$TAG Looking for existing chat room between [$localSipUri] and [$remoteSipUri]") + Log.i( + "$TAG Looking for existing conversation between [$localSipUri] and [$remoteSipUri]" + ) val params: ChatRoomParams = coreContext.core.createDefaultChatRoomParams() params.isGroupEnabled = false @@ -508,19 +510,21 @@ class ContactViewModel @UiThread constructor() : ViewModel() { val sameDomain = remote.domain == corePreferences.defaultDomain && remote.domain == account.params.domain if (account.isInSecureMode() && sameDomain) { - Log.i("$TAG Account is in secure mode & domain matches, creating a E2E chat room") + Log.i( + "$TAG Account is in secure mode & domain matches, creating a E2E conversation" + ) params.backend = ChatRoom.Backend.FlexisipChat params.isEncryptionEnabled = true } else if (!account.isInSecureMode()) { if (LinphoneUtils.isEndToEndEncryptedChatAvailable(core)) { Log.i( - "$TAG Account is in interop mode but LIME is available, creating a E2E chat room" + "$TAG Account is in interop mode but LIME is available, creating a E2E conversation" ) params.backend = ChatRoom.Backend.FlexisipChat params.isEncryptionEnabled = true } else { Log.i( - "$TAG Account is in interop mode but LIME isn't available, creating a SIP simple chat room" + "$TAG Account is in interop mode but LIME isn't available, creating a SIP simple conversation" ) params.backend = ChatRoom.Backend.Basic params.isEncryptionEnabled = false @@ -537,14 +541,16 @@ class ContactViewModel @UiThread constructor() : ViewModel() { val existingChatRoom = core.searchChatRoom(params, localAddress, null, participants) if (existingChatRoom != null) { Log.i( - "$TAG Found existing chat room [${LinphoneUtils.getChatRoomId(existingChatRoom)}], going to it" + "$TAG Found existing conversation [${LinphoneUtils.getChatRoomId( + existingChatRoom + )}], going to it" ) goToConversationEvent.postValue( Event(Pair(localSipUri, existingChatRoom.peerAddress.asStringUriOnly())) ) } else { Log.i( - "$TAG No existing chat room between [$localSipUri] and [$remoteSipUri] was found, let's create it" + "$TAG No existing conversation between [$localSipUri] and [$remoteSipUri] was found, let's create it" ) operationInProgress.postValue(true) val chatRoom = core.createChatRoom(params, localAddress, participants) @@ -552,7 +558,7 @@ class ContactViewModel @UiThread constructor() : ViewModel() { if (params.backend == ChatRoom.Backend.FlexisipChat) { if (chatRoom.state == ChatRoom.State.Created) { val id = LinphoneUtils.getChatRoomId(chatRoom) - Log.i("$TAG 1-1 chat room [$id] has been created") + Log.i("$TAG 1-1 conversation [$id] has been created") operationInProgress.postValue(false) goToConversationEvent.postValue( Event( @@ -563,12 +569,12 @@ class ContactViewModel @UiThread constructor() : ViewModel() { ) ) } else { - Log.i("$TAG Chat room isn't in Created state yet, wait for it") + Log.i("$TAG Conversation isn't in Created state yet, wait for it") chatRoom.addListener(chatRoomListener) } } else { val id = LinphoneUtils.getChatRoomId(chatRoom) - Log.i("$TAG Chat room successfully created [$id]") + Log.i("$TAG Conversation successfully created [$id]") operationInProgress.postValue(false) goToConversationEvent.postValue( Event( @@ -580,7 +586,9 @@ class ContactViewModel @UiThread constructor() : ViewModel() { ) } } else { - Log.e("$TAG Failed to create 1-1 chat room with [${remote.asStringUriOnly()}]!") + Log.e( + "$TAG Failed to create 1-1 conversation with [${remote.asStringUriOnly()}]!" + ) operationInProgress.postValue(false) chatRoomCreationErrorEvent.postValue(Event("Error!")) // TODO FIXME: use translated string } diff --git a/app/src/main/java/org/linphone/ui/main/history/viewmodel/ContactHistoryViewModel.kt b/app/src/main/java/org/linphone/ui/main/history/viewmodel/ContactHistoryViewModel.kt index fa48b3efc..0acf0eb01 100644 --- a/app/src/main/java/org/linphone/ui/main/history/viewmodel/ContactHistoryViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/history/viewmodel/ContactHistoryViewModel.kt @@ -64,10 +64,10 @@ class ContactHistoryViewModel @UiThread constructor() : ViewModel() { override fun onStateChanged(chatRoom: ChatRoom, newState: ChatRoom.State?) { val state = chatRoom.state val id = LinphoneUtils.getChatRoomId(chatRoom) - Log.i("$TAG Chat room [$id] (${chatRoom.subject}) state changed: [$state]") + Log.i("$TAG Conversation [$id] (${chatRoom.subject}) state changed: [$state]") if (state == ChatRoom.State.Created) { - Log.i("$TAG Chat room [$id] successfully created") + Log.i("$TAG Conversation [$id] successfully created") chatRoom.removeListener(this) operationInProgress.postValue(false) goToConversationEvent.postValue( @@ -79,7 +79,7 @@ class ContactHistoryViewModel @UiThread constructor() : ViewModel() { ) ) } else if (state == ChatRoom.State.CreationFailed) { - Log.e("$TAG Chat room [$id] creation has failed!") + Log.e("$TAG Conversation [$id] creation has failed!") chatRoom.removeListener(this) operationInProgress.postValue(false) chatRoomCreationErrorEvent.postValue(Event("Error!")) // TODO FIXME: use translated string @@ -164,7 +164,7 @@ class ContactHistoryViewModel @UiThread constructor() : ViewModel() { val remote = address val remoteSipUri = remote.asStringUriOnly() Log.i( - "$TAG Looking for existing chat room between [$localSipUri] and [$remoteSipUri]" + "$TAG Looking for existing conversation between [$localSipUri] and [$remoteSipUri]" ) val params: ChatRoomParams = coreContext.core.createDefaultChatRoomParams() @@ -175,20 +175,20 @@ class ContactHistoryViewModel @UiThread constructor() : ViewModel() { val sameDomain = remote.domain == corePreferences.defaultDomain && remote.domain == account.params.domain if (account.isInSecureMode() && sameDomain) { Log.i( - "$TAG Account is in secure mode & domain matches, creating a E2E chat room" + "$TAG Account is in secure mode & domain matches, creating a E2E conversation" ) params.backend = ChatRoom.Backend.FlexisipChat params.isEncryptionEnabled = true } else if (!account.isInSecureMode()) { if (LinphoneUtils.isEndToEndEncryptedChatAvailable(core)) { Log.i( - "$TAG Account is in interop mode but LIME is available, creating a E2E chat room" + "$TAG Account is in interop mode but LIME is available, creating a E2E conversation" ) params.backend = ChatRoom.Backend.FlexisipChat params.isEncryptionEnabled = true } else { Log.i( - "$TAG Account is in interop mode but LIME isn't available, creating a SIP simple chat room" + "$TAG Account is in interop mode but LIME isn't available, creating a SIP simple conversation" ) params.backend = ChatRoom.Backend.Basic params.isEncryptionEnabled = false @@ -205,7 +205,7 @@ class ContactHistoryViewModel @UiThread constructor() : ViewModel() { val existingChatRoom = core.searchChatRoom(params, localAddress, null, participants) if (existingChatRoom != null) { Log.i( - "$TAG Found existing chat room [${LinphoneUtils.getChatRoomId( + "$TAG Found existing conversation [${LinphoneUtils.getChatRoomId( existingChatRoom )}], going to it" ) @@ -214,7 +214,7 @@ class ContactHistoryViewModel @UiThread constructor() : ViewModel() { ) } else { Log.i( - "$TAG No existing chat room between [$localSipUri] and [$remoteSipUri] was found, let's create it" + "$TAG No existing conversation between [$localSipUri] and [$remoteSipUri] was found, let's create it" ) operationInProgress.postValue(true) val chatRoom = core.createChatRoom(params, localAddress, participants) @@ -222,7 +222,7 @@ class ContactHistoryViewModel @UiThread constructor() : ViewModel() { if (params.backend == ChatRoom.Backend.FlexisipChat) { if (chatRoom.state == ChatRoom.State.Created) { val id = LinphoneUtils.getChatRoomId(chatRoom) - Log.i("$TAG 1-1 chat room [$id] has been created") + Log.i("$TAG 1-1 conversation [$id] has been created") operationInProgress.postValue(false) goToConversationEvent.postValue( Event( @@ -233,12 +233,12 @@ class ContactHistoryViewModel @UiThread constructor() : ViewModel() { ) ) } else { - Log.i("$TAG Chat room isn't in Created state yet, wait for it") + Log.i("$TAG Conversation isn't in Created state yet, wait for it") chatRoom.addListener(chatRoomListener) } } else { val id = LinphoneUtils.getChatRoomId(chatRoom) - Log.i("$TAG Chat room successfully created [$id]") + Log.i("$TAG Conversation successfully created [$id]") operationInProgress.postValue(false) goToConversationEvent.postValue( Event( @@ -251,7 +251,7 @@ class ContactHistoryViewModel @UiThread constructor() : ViewModel() { } } else { Log.e( - "$TAG Failed to create 1-1 chat room with [${remote.asStringUriOnly()}]!" + "$TAG Failed to create 1-1 conversation with [${remote.asStringUriOnly()}]!" ) operationInProgress.postValue(false) chatRoomCreationErrorEvent.postValue(Event("Error!")) // TODO FIXME: use translated string diff --git a/app/src/main/java/org/linphone/utils/LinphoneUtils.kt b/app/src/main/java/org/linphone/utils/LinphoneUtils.kt index 9fc83865f..86d6c68ed 100644 --- a/app/src/main/java/org/linphone/utils/LinphoneUtils.kt +++ b/app/src/main/java/org/linphone/utils/LinphoneUtils.kt @@ -250,11 +250,11 @@ class LinphoneUtils { val localAddress = split[0] val peerAddress = split[1] Log.i( - "$TAG Got local [$localAddress] and peer [$peerAddress] SIP URIs from chat room id [$id]" + "$TAG Got local [$localAddress] and peer [$peerAddress] SIP URIs from conversation id [$id]" ) return Pair(localAddress, peerAddress) } else { - Log.e("$TAG Failed to parse chat room id [$id]") + Log.e("$TAG Failed to parse conversation id [$id]") } return null } diff --git a/app/src/main/java/org/linphone/utils/ShortcutUtils.kt b/app/src/main/java/org/linphone/utils/ShortcutUtils.kt index b7817bee1..fe887ef95 100644 --- a/app/src/main/java/org/linphone/utils/ShortcutUtils.kt +++ b/app/src/main/java/org/linphone/utils/ShortcutUtils.kt @@ -46,7 +46,7 @@ class ShortcutUtils { @WorkerThread fun removeShortcutToChatRoom(chatRoom: ChatRoom) { val id = LinphoneUtils.getChatRoomId(chatRoom) - Log.i("$TAG Removing shortcut to chat room [$id]") + Log.i("$TAG Removing shortcut to conversation [$id]") ShortcutManagerCompat.removeLongLivedShortcuts(coreContext.context, arrayListOf(id)) } @@ -56,7 +56,7 @@ class ShortcutUtils { Log.e("$TAG Rate limiting is active, aborting") return } - Log.i("$TAG Creating launcher shortcuts for chat rooms") + Log.i("$TAG Creating launcher shortcuts for conversations") var count = 0 for (room in coreContext.core.chatRooms) { val shortcut: ShortcutInfoCompat? = createChatRoomShortcut(context, room)