Updated conference invitation chat message layout to add label/icon when meeting is updated/cancelled

This commit is contained in:
Sylvain Berfini 2024-03-20 10:53:35 +01:00
parent b41bc3bb7d
commit a871fb971b
8 changed files with 90 additions and 8 deletions

View file

@ -45,6 +45,7 @@ import org.linphone.core.ChatMessage
import org.linphone.core.ChatMessageListenerStub
import org.linphone.core.ChatMessageReaction
import org.linphone.core.ChatRoom
import org.linphone.core.ConferenceInfo
import org.linphone.core.Content
import org.linphone.core.Factory
import org.linphone.core.Player
@ -120,6 +121,10 @@ class MessageModel @WorkerThread constructor(
// Below are for conferences info
val meetingFound = MutableLiveData<Boolean>()
val meetingUpdated = MutableLiveData<Boolean>()
val meetingCancelled = MutableLiveData<Boolean>()
val meetingDay = MutableLiveData<String>()
val meetingDayNumber = MutableLiveData<String>()
@ -581,6 +586,9 @@ class MessageModel @WorkerThread constructor(
meetingSubject.postValue(conferenceInfo.subject)
meetingDescription.postValue(conferenceInfo.description)
meetingUpdated.postValue(conferenceInfo.state == ConferenceInfo.State.Updated)
meetingCancelled.postValue(conferenceInfo.state == ConferenceInfo.State.Cancelled)
val timestamp = conferenceInfo.dateTime
val duration = conferenceInfo.duration
val date = TimestampUtils.toString(

View file

@ -36,6 +36,7 @@ import com.google.android.material.timepicker.TimeFormat
import org.linphone.R
import org.linphone.core.tools.Log
import org.linphone.databinding.MeetingEditFragmentBinding
import org.linphone.ui.main.MainActivity
import org.linphone.ui.main.fragment.SlidingPaneChildFragment
import org.linphone.ui.main.meetings.viewmodel.ScheduleMeetingViewModel
import org.linphone.utils.Event
@ -167,6 +168,10 @@ class EditMeetingFragment : SlidingPaneChildFragment() {
viewModel.conferenceCreatedEvent.observe(viewLifecycleOwner) {
it.consume {
Log.i("$TAG Conference was scheduled, leaving fragment and ask list to refresh")
(requireActivity() as MainActivity).showGreenToast(
getString(R.string.meeting_info_updated_toast),
R.drawable.check
)
sharedViewModel.forceRefreshMeetingsListEvent.value = Event(true)
goBack()
}

View file

@ -159,6 +159,10 @@ class MeetingFragment : SlidingPaneChildFragment() {
viewModel.conferenceCancelledEvent.observe(viewLifecycleOwner) {
it.consume {
Log.i("$TAG Meeting has been cancelled successfully, deleting it")
(requireActivity() as MainActivity).showGreenToast(
getString(R.string.meeting_info_cancelled_toast),
R.drawable.trash_simple
)
viewModel.delete()
}
}

View file

@ -36,6 +36,7 @@ import com.google.android.material.timepicker.TimeFormat
import org.linphone.R
import org.linphone.core.tools.Log
import org.linphone.databinding.MeetingScheduleFragmentBinding
import org.linphone.ui.main.MainActivity
import org.linphone.ui.main.fragment.GenericFragment
import org.linphone.ui.main.meetings.viewmodel.ScheduleMeetingViewModel
import org.linphone.utils.Event
@ -169,6 +170,10 @@ class ScheduleMeetingFragment : GenericFragment() {
viewModel.conferenceCreatedEvent.observe(viewLifecycleOwner) {
it.consume {
Log.i("$TAG Conference was scheduled, leaving fragment and ask list to refresh")
(requireActivity() as MainActivity).showGreenToast(
getString(R.string.meeting_info_created_toast),
R.drawable.check
)
sharedViewModel.forceRefreshMeetingsListEvent.value = Event(true)
goBack()
}

View file

@ -96,9 +96,8 @@ class MeetingViewModel @UiThread constructor() : ViewModel() {
chatRoomParams.isEncryptionEnabled = true
chatRoomParams.subject = "Meeting cancelled" // Won't be used
conferenceScheduler.sendInvitations(chatRoomParams) // Send cancel ICS
} else if (state == ConferenceScheduler.State.Error) {
operationInProgress.postValue(false)
conferenceCancelledEvent.postValue(Event(true))
}
}
@ -118,6 +117,9 @@ class MeetingViewModel @UiThread constructor() : ViewModel() {
)
}
conferenceScheduler.removeListener(this)
operationInProgress.postValue(false)
conferenceCancelledEvent.postValue(Event(true))
}
}

View file

@ -34,6 +34,48 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="@id/day_background"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:id="@+id/meeting_updated_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="@string/conversation_message_meeting_updated_label"
android:textColor="@color/warning_600"
android:textSize="12sp"
android:maxLines="1"
android:ellipsize="end"
android:gravity="center_vertical"
android:drawablePadding="8dp"
android:drawableStart="@drawable/warning_circle"
android:drawableTint="@color/warning_600"
android:visibility="@{model.meetingUpdated ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintTop_toTopOf="@id/header_background"
app:layout_constraintStart_toStartOf="@id/header_background"
app:layout_constraintEnd_toEndOf="@id/header_background"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:id="@+id/meeting_cancelled_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="@string/conversation_message_meeting_cancelled_label"
android:textColor="@color/danger_500"
android:textSize="12sp"
android:maxLines="1"
android:ellipsize="end"
android:gravity="center_vertical"
android:drawablePadding="8dp"
android:drawableStart="@drawable/x"
android:drawableTint="@color/danger_500"
android:visibility="@{model.meetingCancelled ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintTop_toBottomOf="@id/meeting_updated_title"
app:layout_constraintStart_toStartOf="@id/header_background"
app:layout_constraintEnd_toEndOf="@id/header_background"/>
<View
android:id="@+id/day_background"
android:layout_width="0dp"
@ -42,7 +84,7 @@
android:layout_marginTop="16dp"
android:layout_marginBottom="-4dp"
android:background="@drawable/shape_squircle_white_r10_background"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintTop_toBottomOf="@id/meeting_cancelled_title"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="@id/header_day"
app:layout_constraintBottom_toBottomOf="@id/header_day_number"/>
@ -101,7 +143,7 @@
app:drawableTint="?attr/color_main2_600"
app:layout_constraintStart_toEndOf="@id/day_background"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
app:layout_constraintTop_toBottomOf="@id/meeting_cancelled_title"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_300"
@ -174,6 +216,7 @@
android:textColor="?attr/color_main2_800"
android:maxLines="1"
android:ellipsize="end"
android:visibility="@{model.meetingCancelled ? View.GONE : View.VISIBLE, default=gone}"
android:drawableStart="@drawable/users"
android:drawablePadding="4dp"
app:drawableTint="?attr/color_main2_600"
@ -200,6 +243,7 @@
android:text="@string/meeting_waiting_room_join"
android:maxLines="1"
android:ellipsize="end"
android:visibility="@{model.meetingCancelled ? View.GONE : View.VISIBLE, default=gone}"
app:layout_constraintStart_toEndOf="@id/participants"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/description"

View file

@ -479,6 +479,9 @@
<string name="meeting_schedule_edit_title">Modifier la réunion</string>
<string name="meeting_schedule_cancel_dialog_title">Annuler la réunion?</string>
<string name="meeting_schedule_cancel_dialog_message">Voulez-vous annuler la réunion et envoyer une notification aux participants?</string>
<string name="meeting_info_created_toast">La réunion a été créée</string>
<string name="meeting_info_updated_toast">La réunion a été mise à jour</string>
<string name="meeting_info_cancelled_toast">La réunion a été annulée</string>
<string name="meeting_waiting_room_join">Rejoindre</string>
@ -577,17 +580,21 @@
<string name="network_not_reachable">Vous n\'êtes pas connecté à internet</string>
<string name="operation_in_progress_overlay">Opération en cours, merci de patienter…</string>
<!-- Keep <u></u> in following strings translations! -->
<!-- Keep <u></u> in the following strings translations! -->
<string name="welcome_carousel_skip"><u>Passer</u></string>
<string name="assistant_forgotten_password"><u>Mot de passe oublié ?</u></string>
<string name="call_zrtp_sas_validation_skip"><u>Passer</u></string>
<!-- Keep <i></i> in following strings translations! -->
<!-- Keep <i></i> in the following strings translations! -->
<string name="message_meeting_invitation_content_description"><i>invitation à une réunion : </i>%s</string>
<string name="message_meeting_invitation_updated_content_description"><i>réunion mise à jour : </i>%s</string>
<string name="message_meeting_invitation_cancelled_content_description"><i>réunion annulée : </i>%s</string>
<string name="message_voice_message_content_description"><i>message vocal</i></string>
<!-- Keep <b></b> in the following strings translations! -->
<string name="conversation_message_meeting_updated_label"><b>La réunion a été mise à jour</b></string>
<string name="conversation_message_meeting_cancelled_label"><b>La réunion a été annulée</b></string>
<string name="content_description_trusted_contact_icon">Contact is trusted</string>
<string name="content_description_not_trusted_contact_icon">Contact is not trusted!</string>
<string name="content_description_contact_online">Contact is online</string>

View file

@ -528,6 +528,9 @@
<string name="meeting_schedule_edit_title">Edit meeting</string>
<string name="meeting_schedule_cancel_dialog_title">Cancel the meeting?</string>
<string name="meeting_schedule_cancel_dialog_message">Do you want to cancel the meeting and send a notification to all participants?</string>
<string name="meeting_info_created_toast">Meeting has been created</string>
<string name="meeting_info_updated_toast">Meeting has been updated</string>
<string name="meeting_info_cancelled_toast">Meeting has been cancelled</string>
<string name="meeting_waiting_room_join">Join</string>
@ -631,17 +634,21 @@
<string name="network_not_reachable">You aren\'t connected to internet</string>
<string name="operation_in_progress_overlay">Operation in progress, please wait</string>
<!-- Keep <u></u> in following strings translations! -->
<!-- Keep <u></u> in the following strings translations! -->
<string name="welcome_carousel_skip"><u>Skip</u></string>
<string name="assistant_forgotten_password"><u>Forgotten password?</u></string>
<string name="call_zrtp_sas_validation_skip"><u>Skip</u></string>
<!-- Keep <i></i> in following strings translations! -->
<!-- Keep <i></i> in the following strings translations! -->
<string name="message_meeting_invitation_content_description"><i>meeting invite: </i>%s</string>
<string name="message_meeting_invitation_updated_content_description"><i>meeting updated: </i>%s</string>
<string name="message_meeting_invitation_cancelled_content_description"><i>meeting cancelled: </i>%s</string>
<string name="message_voice_message_content_description"><i>voice message</i></string>
<!-- Keep <b></b> in the following strings translations! -->
<string name="conversation_message_meeting_updated_label"><b>Meeting has been updated</b></string>
<string name="conversation_message_meeting_cancelled_label"><b>Meeting has been cancelled!</b></string>
<!-- Content description for accessibility -->
<string name="content_description_trusted_contact_icon">Contact is trusted</string>
<string name="content_description_not_trusted_contact_icon">Contact is not trusted!</string>