Added handling of meeting cancellation and edition

This commit is contained in:
Christophe Deschamps 2022-09-19 11:36:47 +02:00
parent 5e3906e578
commit 3c453119b3
8 changed files with 64 additions and 9 deletions

View file

@ -268,6 +268,8 @@
} else {
if (linphone_call_log_was_conference(callLog)) {
LinphoneConferenceInfo *confInfo = linphone_call_log_get_conference_info(callLog);
if (linphone_conference_info_get_state(confInfo) == LinphoneConferenceInfoStateCancelled)
return;
ConferenceWaitingRoomFragment *view = VIEW(ConferenceWaitingRoomFragment);
[view setDetailsWithSubject:[NSString stringWithUTF8String:linphone_conference_info_get_subject(confInfo)] url:[NSString stringWithUTF8String:linphone_address_as_string(linphone_conference_info_get_uri(confInfo))]];
[PhoneMainView.instance changeCurrentView:ConferenceWaitingRoomFragment.compositeViewDescription];

View file

@ -36,10 +36,13 @@ class ScheduledConferenceData {
let participantsShort = MutableLiveData<String>()
let participantsExpanded = MutableLiveData<String>()
let rawDate : Date
let isConferenceCancelled = MutableLiveData(false)
let canEdit = MutableLiveData(false)
let isFinished : Bool
init (conferenceInfo: ConferenceInfo) {
init (conferenceInfo: ConferenceInfo, isFinished: Bool = false) {
self.conferenceInfo = conferenceInfo
self.isFinished = isFinished
expanded.value = false
address.value = conferenceInfo.uri?.asStringUriOnly()
@ -59,6 +62,18 @@ class ScheduledConferenceData {
organizer.value = conferenceInfo.organizer?.addressBookEnhancedDisplayName()
computeParticipantsLists()
isConferenceCancelled.value = conferenceInfo.state == .Cancelled
if let organizerAddress = conferenceInfo.organizer {
let localAccount = Core.get().accountList.filter { account in
account.params?.identityAddress != nil && organizerAddress.weakEqual(address2: account.params!.identityAddress!)
}.first
canEdit.value = localAccount != nil
} else {
canEdit.value = false
Log.e("[Scheduled Conference] No organizer SIP URI found for: \(conferenceInfo.uri?.asStringUriOnly())")
}
}
func destroy() {

View file

@ -38,7 +38,7 @@ class ScheduledConferencesViewModel {
coreDelegate = CoreDelegateStub(
onConferenceInfoReceived: { (core, conferenceInfo) in
Log.i("[Scheduled Conferences] New conference info received")
self.conferences.value!.append(ScheduledConferenceData(conferenceInfo: conferenceInfo))
self.conferences.value!.append(ScheduledConferenceData(conferenceInfo: conferenceInfo,isFinished: false))
self.conferences.notifyValue()
}
@ -52,12 +52,12 @@ class ScheduledConferencesViewModel {
if (showTerminated.value == true) {
core.conferenceInformationList.filter{$0.duration != 0 && (TimeInterval($0.dateTime) + TimeInterval($0.duration) < now)}.forEach { conferenceInfo in
conferences.value!.append(ScheduledConferenceData(conferenceInfo: conferenceInfo))
conferences.value!.append(ScheduledConferenceData(conferenceInfo: conferenceInfo,isFinished: true))
}
} else {
let twoHoursAgo = now - 7200 // Show all conferences from 2 hour ago and forward
core.getConferenceInformationListAfterTime(time: time_t(twoHoursAgo)).filter{$0.duration != 0}.forEach { conferenceInfo in
conferences.value!.append(ScheduledConferenceData(conferenceInfo: conferenceInfo))
conferences.value!.append(ScheduledConferenceData(conferenceInfo: conferenceInfo,isFinished: false))
}
}

View file

@ -36,6 +36,9 @@ import EventKitUI
let join_share_width = 150.0
let inviteTitle = StyledLabel(VoipTheme.conference_invite_title_font, VoipTexts.conference_invite_title)
let inviteCancelled = StyledLabel(VoipTheme.conference_cancelled_title_font, VoipTexts.conference_cancel_title)
let inviteUpdated = StyledLabel(VoipTheme.conference_updated_title_font, VoipTexts.conference_update_title)
let subject = StyledLabel(VoipTheme.conference_invite_subject_font)
let participants = StyledLabel(VoipTheme.conference_invite_desc_font)
let date = StyledLabel(VoipTheme.conference_invite_desc_font)
@ -59,6 +62,10 @@ import EventKitUI
descriptionTitle.isHidden = data.description.value == nil || data.description.value!.count == 0
descriptionValue.isHidden = descriptionTitle.isHidden
descriptionValue.text = data.description.value
inviteTitle.isHidden = [.Cancelled,.Updated].contains(data.conferenceInfo.state)
inviteCancelled.isHidden = data.conferenceInfo.state != .Cancelled
inviteUpdated.isHidden = data.conferenceInfo.state != .Updated
join.isEnabled = data.isConferenceCancelled.value != true
}
}
}
@ -77,6 +84,8 @@ import EventKitUI
addSubview(rows)
rows.addArrangedSubview(inviteTitle)
rows.addArrangedSubview(inviteCancelled)
rows.addArrangedSubview(inviteUpdated)
rows.addArrangedSubview(subject)
rows.addArrangedSubview(participants)
rows.addArrangedSubview(date)

View file

@ -32,6 +32,7 @@ class ScheduledConferencesCell: UITableViewCell {
let timeDuration = StyledLabel(VoipTheme.conference_invite_desc_font)
let organiser = StyledLabel(VoipTheme.conference_invite_desc_font)
let subject = StyledLabel(VoipTheme.conference_invite_subject_font)
let cancelledLabel = StyledLabel(VoipTheme.conference_cancelled_title_font)
let participantsIcon = UIImageView(image: UIImage(named: "conference_schedule_participants_default"))
let participants = StyledLabel(VoipTheme.conference_invite_desc_font)
let infoConf = UIButton()
@ -54,9 +55,19 @@ class ScheduledConferencesCell: UITableViewCell {
timeDuration.text = "\(data.time.value)"+(data.duration.value != nil ? " ( \(data.duration.value) )" : "")
organiser.text = VoipTexts.conference_schedule_organizer+data.organizer.value!
subject.text = data.subject.value!
cancelledLabel.text = data.isConferenceCancelled.value == true ? ( data.canEdit.value == true ? VoipTexts.conference_scheduled_cancelled_by_me: VoipTexts.conference_scheduled_cancelled_by_organizer) : nil
cancelledLabel.isHidden = data.isConferenceCancelled.value != true
descriptionValue.text = data.description.value!
urlValue.text = data.address.value!
self.joinConf.isHidden = data.isConferenceCancelled.value == true
self.editConf.isHidden = data.canEdit.value != true || data.isConferenceCancelled.value == true
self.urlTitle.isHidden = data.isConferenceCancelled.value == true
self.urlValue.isHidden = data.isConferenceCancelled.value == true
self.copyLink.isHidden = data.isConferenceCancelled.value == true
data.expanded.readCurrentAndObserve { expanded in
self.contentView.backgroundColor =
data.conferenceInfo.state == .Cancelled ? VoipTheme.voip_conference_cancelled_bg_color :
data.isFinished ? VoipTheme.backgroundColor3.get() : VoipTheme.backgroundColor4.get()
self.contentView.layer.borderWidth = expanded == true ? 2.0 : 0.0
self.descriptionTitle.isHidden = expanded != true || self.descriptionValue.text?.count == 0
self.descriptionValue.isHidden = expanded != true || self.descriptionValue.text?.count == 0
@ -101,9 +112,15 @@ class ScheduledConferencesCell: UITableViewCell {
contentView.addSubview(organiser)
organiser.alignParentTop(withMargin: 15).toRightOf(timeDuration, withLeftMargin:10).alignParentRight(withMargin:10).alignHorizontalCenterWith(clockIcon).done()
contentView.addSubview(subject)
subject.alignUnder(view: timeDuration,withMargin: 15).alignParentLeft(withMargin: 10).done()
let subjectCancel = UIStackView()
subjectCancel.axis = .vertical
contentView.addSubview(subjectCancel)
subjectCancel.alignUnder(view: timeDuration,withMargin: 15).alignParentLeft(withMargin: 10).done()
subjectCancel.addArrangedSubview(cancelledLabel)
subjectCancel.addArrangedSubview(subject)
contentView.addSubview(participantsIcon)
participantsIcon.alignUnder(view: subject,withMargin: 15).square(15).alignParentLeft(withMargin: 10).done()

View file

@ -94,6 +94,8 @@ import UIKit
@objc static let conference_invite_join = NSLocalizedString("Join",comment:"")
@objc static let conference_invite_participants_count = NSLocalizedString("%d participants",comment:"")
@objc static let conference_invite_title = NSLocalizedString("Meeting invite:",comment:"")
@objc static let conference_update_title = NSLocalizedString("Meeting has been updated:",comment:"")
@objc static let conference_cancel_title = NSLocalizedString("Meeting has been cancelled:",comment:"")
@objc static let conference_last_user = NSLocalizedString("All other participants have left the group call",comment:"")
@objc static let conference_local_title = NSLocalizedString("Local group call",comment:"")
@objc static let conference_no_schedule = NSLocalizedString("No scheduled meeting yet.",comment:"")
@ -139,6 +141,8 @@ import UIKit
@objc static let conference_admin_unset = NSLocalizedString("%s is no longer admin",comment:"")
@objc static let conference_scheduled_terminated_filter = NSLocalizedString("Terminated",comment:"")
@objc static let conference_scheduled_future_filter = NSLocalizedString("Scheduled",comment:"")
@objc static let conference_scheduled_cancelled_by_me = NSLocalizedString("You have cancelled the conference",comment:"")
@objc static let conference_scheduled_cancelled_by_organizer = NSLocalizedString("Conference has been cancelled by organizer",comment:"")
// FROM ANDROID END

View file

@ -55,8 +55,13 @@ import UIKit
static let dark_grey_color = UIColor(hex:"#444444")
static let voip_conference_invite_out = UIColor(hex:"ffeee5")
static let voip_conference_invite_in = header_background_color
static let voip_conference_updated = UIColor(hex:"#EFAE00")
static let voip_conference_cancelled_bg_color = UIColor(hex:"#FFE6E6")
static let voip_dark_color5 = UIColor(hex:"#353B3F")
// Light / Dark variations
static let voipBackgroundColor = LightDarkColor(voip_gray_blue_color,voip_dark_color)
static let voipBackgroundBWColor = LightDarkColor(UIColor.white,voip_dark_color)
@ -72,11 +77,11 @@ import UIKit
static let voipFormDisabledFieldBackgroundColor = LightDarkColor(header_background_color,voip_dark_color4)
static let primarySubtextLightColor = LightDarkColor(light_grey_color,toolbar_color)
static let primaryTextColor = LightDarkColor(dark_grey_color,.white)
static let backgroundColor3 = LightDarkColor(voip_light_gray,voip_dark_color5)
static let backgroundColor4 = LightDarkColor(header_background_color,voip_dark_color5)
// Text styles
static let fontName = "Roboto"
static let call_header_title = TextStyle(fgColor: LightDarkColor(.white,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .center, font: fontName+"-Bold", size: 18.0)
@ -125,6 +130,9 @@ import UIKit
static let conference_invite_desc_title_font = TextStyle(fgColor: LightDarkColor(voip_dark_gray,voip_dark_gray), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 14.0)
static let conference_invite_subject_font = TextStyle(fgColor: LightDarkColor(voip_dark_gray,voip_dark_gray), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 14.0)
static let conference_invite_title_font = TextStyle(fgColor: LightDarkColor(dark_grey_color,dark_grey_color), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 16.0)
static let conference_cancelled_title_font = TextStyle(fgColor: LightDarkColor(.red,.red), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 16.0)
static let conference_updated_title_font = TextStyle(fgColor: LightDarkColor(voip_conference_updated,voip_conference_updated), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 16.0)
static let conference_preview_subject_font = TextStyle(fgColor: LightDarkColor(.white,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Regular", size: 24.0)
static let conference_waiting_room_no_video_font = TextStyle(fgColor: LightDarkColor(.white,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .center, font: fontName+"-Regular", size: 16.0)