Fixed meeting schedule using 'all day' toggle

This commit is contained in:
Sylvain Berfini 2024-08-21 10:01:10 +02:00
parent 9ed2415d1b
commit 2821d4b72f

View file

@ -404,10 +404,39 @@ class ScheduleMeetingViewModel @UiThread constructor() : GenericViewModel() {
conferenceInfo.subject = subject.value
conferenceInfo.description = description.value
val startTime = startTimestamp / 1000 // Linphone expects timestamp in seconds
conferenceInfo.dateTime = startTime
val duration = (((endTimestamp - startTimestamp) / 1000) / 60).toInt() // Linphone expects duration in minutes
conferenceInfo.duration = duration
if (allDayMeeting.value == true) {
val cal = Calendar.getInstance(
TimeZone.getTimeZone(selectedTimeZone.value?.id ?: TimeZone.getDefault().id)
)
cal.timeInMillis = startTimestamp
cal.set(Calendar.HOUR_OF_DAY, 0)
cal.set(Calendar.MINUTE, 0)
cal.set(Calendar.SECOND, 0)
val startTime = cal.timeInMillis / 1000 // Linphone expects timestamp in seconds
cal.timeInMillis = endTimestamp
cal.set(Calendar.HOUR_OF_DAY, 0)
cal.set(Calendar.MINUTE, 0)
cal.set(Calendar.SECOND, 0)
cal.add(Calendar.HOUR, 24)
val endTime = cal.timeInMillis / 1000 // Linphone expects timestamp in seconds
val duration = ((endTime - startTime) / 60).toInt() // Linphone expects duration in minutes
Log.i(
"$TAG Scheduling meeting using start day [$startTime] and duration [$duration] (minutes)"
)
conferenceInfo.dateTime = startTime
conferenceInfo.duration = duration
} else {
val startTime = startTimestamp / 1000 // Linphone expects timestamp in seconds
val duration =
(((endTimestamp - startTimestamp) / 1000) / 60).toInt() // Linphone expects duration in minutes
Log.i(
"$TAG Scheduling meeting using start hour [$startTime] and duration [$duration] (minutes)"
)
conferenceInfo.dateTime = startTime
conferenceInfo.duration = duration
}
val participantsList = participants.value.orEmpty()
val participantsInfoList = arrayListOf<ParticipantInfo>()