From 3c453119b3a7e0e0aab93ee336d45e506c5af138 Mon Sep 17 00:00:00 2001 From: Christophe Deschamps Date: Mon, 19 Sep 2022 11:36:47 +0200 Subject: [PATCH] Added handling of meeting cancellation and edition --- Classes/HistoryListTableView.m | 2 ++ .../Data/ScheduledConferenceData.swift | 19 ++++++++++++++-- .../ScheduledConferencesViewModel.swift | 6 ++--- .../Conference/Views/ICSBubbleView.swift | 9 ++++++++ .../Views/ScheduledConferencesCell.swift | 21 ++++++++++++++++-- Classes/Swift/Voip/Theme/VoipTexts.swift | 4 ++++ Classes/Swift/Voip/Theme/VoipTheme.swift | 12 ++++++++-- Resources/fr.lproj/Localizable.strings | Bin 71426 -> 71972 bytes 8 files changed, 64 insertions(+), 9 deletions(-) diff --git a/Classes/HistoryListTableView.m b/Classes/HistoryListTableView.m index 9ce13bdd4..8bf3ce518 100644 --- a/Classes/HistoryListTableView.m +++ b/Classes/HistoryListTableView.m @@ -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]; diff --git a/Classes/Swift/Conference/Data/ScheduledConferenceData.swift b/Classes/Swift/Conference/Data/ScheduledConferenceData.swift index 22439ee5e..9e5157343 100644 --- a/Classes/Swift/Conference/Data/ScheduledConferenceData.swift +++ b/Classes/Swift/Conference/Data/ScheduledConferenceData.swift @@ -36,10 +36,13 @@ class ScheduledConferenceData { let participantsShort = MutableLiveData() let participantsExpanded = MutableLiveData() 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() { diff --git a/Classes/Swift/Conference/ViewModels/ScheduledConferencesViewModel.swift b/Classes/Swift/Conference/ViewModels/ScheduledConferencesViewModel.swift index 6c5b2a048..b9f4a032c 100644 --- a/Classes/Swift/Conference/ViewModels/ScheduledConferencesViewModel.swift +++ b/Classes/Swift/Conference/ViewModels/ScheduledConferencesViewModel.swift @@ -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)) } } diff --git a/Classes/Swift/Conference/Views/ICSBubbleView.swift b/Classes/Swift/Conference/Views/ICSBubbleView.swift index a8397a368..e622537d8 100644 --- a/Classes/Swift/Conference/Views/ICSBubbleView.swift +++ b/Classes/Swift/Conference/Views/ICSBubbleView.swift @@ -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) diff --git a/Classes/Swift/Conference/Views/ScheduledConferencesCell.swift b/Classes/Swift/Conference/Views/ScheduledConferencesCell.swift index ba3bad096..81746eb14 100644 --- a/Classes/Swift/Conference/Views/ScheduledConferencesCell.swift +++ b/Classes/Swift/Conference/Views/ScheduledConferencesCell.swift @@ -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() diff --git a/Classes/Swift/Voip/Theme/VoipTexts.swift b/Classes/Swift/Voip/Theme/VoipTexts.swift index ec5a53d78..253f14b29 100644 --- a/Classes/Swift/Voip/Theme/VoipTexts.swift +++ b/Classes/Swift/Voip/Theme/VoipTexts.swift @@ -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 diff --git a/Classes/Swift/Voip/Theme/VoipTheme.swift b/Classes/Swift/Voip/Theme/VoipTheme.swift index f4498b9b1..f6fc4c05a 100644 --- a/Classes/Swift/Voip/Theme/VoipTheme.swift +++ b/Classes/Swift/Voip/Theme/VoipTheme.swift @@ -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) diff --git a/Resources/fr.lproj/Localizable.strings b/Resources/fr.lproj/Localizable.strings index 7c593bb6c7a6351688fcf5bf0099335c40ce98b5..e193859789fda441859ccd374c3f686904f0a02d 100644 GIT binary patch delta 291 zcmZo#$FgJ-OT!jMCh^H-+eBoO84?-t7?K%M8FGLyl_7;efuV#U1ISWfNS++8AUZka ziIi|2P)#XN{v}W}2dD!iSF51Royt%IR0-BUS@DLbIX2Uh7%GA4^MNYU!FFXbQ~~uA zF(@(E0