mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 19:38:08 +00:00
Added missing cancel dialog when deleting a meeting for which we are the organizer from the meetings list + updated strings
This commit is contained in:
parent
f3eb821946
commit
54ee456f8e
5 changed files with 66 additions and 10 deletions
|
|
@ -36,9 +36,12 @@ import org.linphone.R
|
|||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.MeetingsListFragmentBinding
|
||||
import org.linphone.ui.main.fragment.AbstractMainFragment
|
||||
import org.linphone.ui.main.history.model.ConfirmationDialogModel
|
||||
import org.linphone.ui.main.meetings.adapter.MeetingsListAdapter
|
||||
import org.linphone.ui.main.meetings.model.MeetingModel
|
||||
import org.linphone.ui.main.meetings.viewmodel.MeetingsListViewModel
|
||||
import org.linphone.utils.AppUtils
|
||||
import org.linphone.utils.DialogUtils
|
||||
import org.linphone.utils.Event
|
||||
import org.linphone.utils.RecyclerViewHeaderDecoration
|
||||
|
||||
|
|
@ -153,9 +156,13 @@ class MeetingsListFragment : AbstractMainFragment() {
|
|||
adapter.resetSelection()
|
||||
},
|
||||
{ // onDelete
|
||||
Log.i("$TAG Deleting meeting [${model.id}]")
|
||||
model.delete()
|
||||
listViewModel.applyFilter()
|
||||
if (model.isOrganizer()) {
|
||||
showCancelMeetingDialog(model)
|
||||
} else {
|
||||
Log.i("$TAG Deleting meeting [${model.id}]")
|
||||
model.delete()
|
||||
listViewModel.applyFilter()
|
||||
}
|
||||
}
|
||||
)
|
||||
modalBottomSheet.show(parentFragmentManager, MeetingsMenuDialogFragment.TAG)
|
||||
|
|
@ -246,4 +253,38 @@ class MeetingsListFragment : AbstractMainFragment() {
|
|||
AppUtils.getDimension(R.dimen.meeting_list_decoration_height).toInt()
|
||||
)
|
||||
}
|
||||
|
||||
private fun showCancelMeetingDialog(meetingModel: MeetingModel) {
|
||||
Log.i("$TAG Meeting is editable, asking whether to cancel it or not before deleting it")
|
||||
|
||||
val model = ConfirmationDialogModel()
|
||||
val dialog = DialogUtils.getCancelMeetingDialog(requireContext(), model)
|
||||
|
||||
model.dismissEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
model.cancelEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
Log.i("$TAG Deleting meeting [${meetingModel.id}]")
|
||||
meetingModel.delete()
|
||||
listViewModel.applyFilter()
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
model.confirmEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
Log.i("$TAG Cancelling meeting [${meetingModel.id}]")
|
||||
listViewModel.cancelMeeting(meetingModel.conferenceInfo)
|
||||
meetingModel.delete()
|
||||
listViewModel.applyFilter()
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
dialog.show()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,4 +84,12 @@ class MeetingModel @WorkerThread constructor(val conferenceInfo: ConferenceInfo)
|
|||
core.deleteConferenceInformation(conferenceInfo)
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
fun isOrganizer(): Boolean {
|
||||
return coreContext.core.accountList.find { account ->
|
||||
val address = account.params.identityAddress
|
||||
address != null && conferenceInfo.organizer?.weakEqual(address) == true
|
||||
} != null
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,15 @@ class MeetingsListViewModel @UiThread constructor() : AbstractMainViewModel() {
|
|||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun cancelMeeting(conferenceInfo: ConferenceInfo) {
|
||||
coreContext.postOnCoreThread { core ->
|
||||
Log.w("$TAG Cancelling conference info [${conferenceInfo.uri?.asStringUriOnly()}]")
|
||||
val conferenceScheduler = core.createConferenceScheduler()
|
||||
conferenceScheduler.cancelConference(conferenceInfo)
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private fun computeMeetingsList(filter: String) {
|
||||
if (meetings.value.orEmpty().isEmpty()) {
|
||||
|
|
@ -133,8 +142,8 @@ class MeetingsListViewModel @UiThread constructor() : AbstractMainViewModel() {
|
|||
System.currentTimeMillis(),
|
||||
false
|
||||
)
|
||||
val firstMeetingOfTheWeek = previousModelWeekLabel != todayWeekLabel
|
||||
list.add(MeetingListItemModel(null, firstMeetingOfTheWeek))
|
||||
val first = previousModelWeekLabel != todayWeekLabel
|
||||
list.add(MeetingListItemModel(null, first))
|
||||
meetingForTodayFound = true
|
||||
previousModelWeekLabel = todayWeekLabel
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -530,7 +530,7 @@
|
|||
<string name="meeting_schedule_description_title">Description</string>
|
||||
<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_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>
|
||||
|
|
@ -592,7 +592,7 @@
|
|||
<string name="call_dialog_zrtp_validate_trust_local_code_label">Votre code :</string>
|
||||
<string name="call_dialog_zrtp_validate_trust_remote_code_label">Code correspondant : </string>
|
||||
<string name="call_dialog_zrtp_validate_trust_letters_do_not_match">Aucune correspondance</string>
|
||||
<string name="call_dialog_zrtp_security_alert_title">Security alert</string>
|
||||
<string name="call_dialog_zrtp_security_alert_title">Alerte de sécurité</string>
|
||||
<string name="call_dialog_zrtp_security_alert_try_again">Réessayer</string>
|
||||
<string name="call_dialog_zrtp_security_alert_message">La confidentialité de votre appel peut être compromise !</string>
|
||||
|
||||
|
|
@ -620,8 +620,7 @@
|
|||
<string name="call_stats_zrtp_sas_algo">Algorithme SAS : %s</string>
|
||||
|
||||
<string name="call_history_deleted_toast">L\'historique des appels a été supprimé</string>
|
||||
<string name="call_can_be_trusted_toast">Appareil vérifié</string>
|
||||
<string name="call_can_not_be_trusted_alert_toast">Problème de sécurité !</string>
|
||||
<string name="call_can_be_trusted_toast">Appareil authentifié</string>
|
||||
<string name="call_transfer_in_progress_toast">Appel en cours de transfert</string>
|
||||
<string name="call_transfer_successful_toast">L\'appel a été transferré</string>
|
||||
<string name="call_transfer_failed_toast">Le transfert a échoué !</string>
|
||||
|
|
|
|||
|
|
@ -658,7 +658,6 @@
|
|||
|
||||
<string name="call_history_deleted_toast">History has been deleted</string>
|
||||
<string name="call_can_be_trusted_toast">Device validated</string>
|
||||
<string name="call_can_not_be_trusted_alert_toast">Security alert !</string>
|
||||
<string name="call_transfer_in_progress_toast">Call is being transferred</string>
|
||||
<string name="call_transfer_successful_toast">Call has been successfully transferred</string>
|
||||
<string name="call_transfer_failed_toast">Call transfer failed!</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue