From 71260856381dca1c36752579cc9cfcd09e83e714 Mon Sep 17 00:00:00 2001 From: Christophe Deschamps Date: Fri, 14 Oct 2022 16:55:53 +0200 Subject: [PATCH] Bulk bug fixes conference --- .../Data/ScheduledConferenceData.swift | 4 ++ .../Views/ScheduledConferencesCell.swift | 39 ++++++++++--------- .../Views/ScheduledConferencesView.swift | 7 +--- Classes/Swift/Voip/VoipDialog.swift | 4 +- 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/Classes/Swift/Conference/Data/ScheduledConferenceData.swift b/Classes/Swift/Conference/Data/ScheduledConferenceData.swift index 5a5c9a89b..86934f720 100644 --- a/Classes/Swift/Conference/Data/ScheduledConferenceData.swift +++ b/Classes/Swift/Conference/Data/ScheduledConferenceData.swift @@ -91,6 +91,10 @@ class ScheduledConferenceData { String(describing: participant.addressBookEnhancedDisplayName()) }.joined(separator: ", ") + if (participantsShort.value?.count == 0) { + participantsShort.value = " " + } + participantsExpanded.value = conferenceInfo.participants.map {(participant) in String(describing: participant.addressBookEnhancedDisplayName())+" ("+String(describing: participant.asStringUriOnly())+")" }.joined(separator: "\n") diff --git a/Classes/Swift/Conference/Views/ScheduledConferencesCell.swift b/Classes/Swift/Conference/Views/ScheduledConferencesCell.swift index 408900867..a1ffe5e6d 100644 --- a/Classes/Swift/Conference/Views/ScheduledConferencesCell.swift +++ b/Classes/Swift/Conference/Views/ScheduledConferencesCell.swift @@ -50,6 +50,7 @@ class ScheduledConferencesCell: UITableViewCell { let joinEditDelete = UIStackView() let expandedRows = UIStackView() let selectionCheckBox = StyledCheckBox() + let myContentView = UIView() var conferenceData: ScheduledConferenceData? = nil { didSet { @@ -67,10 +68,10 @@ class ScheduledConferencesCell: UITableViewCell { self.urlValue.isHidden = data.isConferenceCancelled.value == true self.copyLink.isHidden = data.isConferenceCancelled.value == true data.expanded.readCurrentAndObserve { expanded in - self.contentView.backgroundColor = + self.myContentView.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.myContentView.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 self.infoConf.isSelected = expanded == true @@ -79,7 +80,7 @@ class ScheduledConferencesCell: UITableViewCell { self.expandedRows.isHidden = expanded != true self.joinEditDelete.isHidden = expanded != true if let myAddress = Core.get().defaultAccount?.params?.identityAddress { - self.editConf.isHidden = expanded != true || data.conferenceInfo.organizer?.weakEqual(address2: myAddress) != true + self.editConf.isHidden = expanded != true || data.conferenceInfo.organizer?.weakEqual(address2: myAddress) != true || data.conferenceInfo.state == .Cancelled } else { self.editConf.isHidden = true } @@ -99,31 +100,33 @@ class ScheduledConferencesCell: UITableViewCell { override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) - contentView.layer.cornerRadius = corner_radius - contentView.clipsToBounds = true - contentView.backgroundColor = VoipTheme.header_background_color - contentView.layer.borderColor = VoipTheme.primary_color.cgColor + contentView.addSubview(myContentView) + + myContentView.layer.cornerRadius = corner_radius + myContentView.clipsToBounds = true + myContentView.backgroundColor = VoipTheme.header_background_color + myContentView.layer.borderColor = VoipTheme.primary_color.cgColor + myContentView.matchParentDimmensions(insetedBy: UIEdgeInsets(top: 5,left: 0,bottom: 5,right: 0)).done() - - contentView.addSubview(clockIcon) + myContentView.addSubview(clockIcon) clockIcon.alignParentTop(withMargin: 15).square(15).alignParentLeft(withMargin: 10).done() - contentView.addSubview(timeDuration) + myContentView.addSubview(timeDuration) timeDuration.alignParentTop(withMargin: 15).toRightOf(clockIcon,withLeftMargin:10).alignHorizontalCenterWith(clockIcon).done() - contentView.addSubview(organiser) + myContentView.addSubview(organiser) organiser.alignParentTop(withMargin: 15).toRightOf(timeDuration, withLeftMargin:10).alignParentRight(withMargin:10).alignHorizontalCenterWith(clockIcon).done() let subjectCancel = UIStackView() subjectCancel.axis = .vertical - contentView.addSubview(subjectCancel) + myContentView.addSubview(subjectCancel) subjectCancel.alignUnder(view: timeDuration,withMargin: 15).alignParentLeft(withMargin: 10).done() subjectCancel.addArrangedSubview(cancelledLabel) subjectCancel.addArrangedSubview(subject) - contentView.addSubview(participantsIcon) + myContentView.addSubview(participantsIcon) participantsIcon.alignUnder(view: subject,withMargin: 15).square(15).alignParentLeft(withMargin: 10).done() //infoConf.onClick { @@ -131,18 +134,18 @@ class ScheduledConferencesCell: UITableViewCell { self.conferenceData?.toggleExpand() self.owningTableView?.reloadData() } - contentView.addSubview(infoConf) + myContentView.addSubview(infoConf) infoConf.imageView?.contentMode = .scaleAspectFit infoConf.alignUnder(view: subject,withMargin: 15).square(30).alignParentRight(withMargin: 10).alignHorizontalCenterWith(participantsIcon).done() infoConf.applyTintedIcons(tintedIcons: VoipTheme.conference_info_button) - contentView.addSubview(participants) + myContentView.addSubview(participants) participants.alignUnder(view: subject,withMargin: 15).toRightOf(participantsIcon,withLeftMargin:10).toRightOf(participantsIcon,withLeftMargin:10).toLeftOf(infoConf,withRightMargin: 15).done() expandedRows.axis = .vertical expandedRows.spacing = 10 - contentView.addSubview(expandedRows) + myContentView.addSubview(expandedRows) expandedRows.alignUnder(view: participants,withMargin: 15).matchParentSideBorders(insetedByDx:10).done() expandedRows.addArrangedSubview(descriptionTitle) @@ -166,7 +169,7 @@ class ScheduledConferencesCell: UITableViewCell { joinEditDelete.spacing = 10 joinEditDelete.distribution = .equalSpacing - contentView.addSubview(joinEditDelete) + myContentView.addSubview(joinEditDelete) joinEditDelete.alignUnder(view: expandedRows,withMargin: 15).alignParentRight(withMargin: 10).done() @@ -206,7 +209,7 @@ class ScheduledConferencesCell: UITableViewCell { deleteConf.onClick { self.askConfirmationTodeleteEntry() } - contentView.addSubview(selectionCheckBox) + myContentView.addSubview(selectionCheckBox) selectionCheckBox.alignParentRight(withMargin: delete_checkbox_margin).alignUnder(view:organiser, withMargin: delete_checkbox_margin).done() ScheduledConferencesViewModel.shared.editionEnabled.readCurrentAndObserve { editing in self.selectionCheckBox.isHidden = editing != true diff --git a/Classes/Swift/Conference/Views/ScheduledConferencesView.swift b/Classes/Swift/Conference/Views/ScheduledConferencesView.swift index 807cebf75..d7a3ec13b 100644 --- a/Classes/Swift/Conference/Views/ScheduledConferencesView.swift +++ b/Classes/Swift/Conference/Views/ScheduledConferencesView.swift @@ -182,12 +182,7 @@ import linphonesw } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - let daysArray = Array(ScheduledConferencesViewModel.shared.daySplitted.keys.sorted().reversed()) - let day = daysArray[indexPath.section] - guard let data = ScheduledConferencesViewModel.shared.daySplitted[day]?[indexPath.row] else { - return UITableView.automaticDimension - } - return data.expanded.value! ? UITableView.automaticDimension : 100 + return UITableView.automaticDimension } diff --git a/Classes/Swift/Voip/VoipDialog.swift b/Classes/Swift/Voip/VoipDialog.swift index 84231fc65..c9d11f3eb 100644 --- a/Classes/Swift/Voip/VoipDialog.swift +++ b/Classes/Swift/Voip/VoipDialog.swift @@ -105,8 +105,10 @@ class VoipDialog : UIView{ toastQueue.append(message) return } + let rooVc = rootVC() let alert = UIAlertController(title: nil, message: message, preferredStyle: .actionSheet) - rootVC()?.present(alert, animated: true) + alert.popoverPresentationController?.sourceView = PhoneMainView.instance().mainViewController.tabBarView + rooVc?.present(alert, animated: true) DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + timeout) { alert.dismiss(animated: true) if (toastQueue.count > 0) {