mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Conference edition
This commit is contained in:
parent
df6834beae
commit
0dfb387fb6
7 changed files with 75 additions and 45 deletions
|
|
@ -25,28 +25,27 @@ import linphonesw
|
|||
class ScheduledConferenceData {
|
||||
|
||||
let conferenceInfo: ConferenceInfo
|
||||
let expanded = MutableLiveData<Bool>()
|
||||
|
||||
let address = MutableLiveData<String>()
|
||||
let subject = MutableLiveData<String>()
|
||||
let description = MutableLiveData<String>()
|
||||
let time = MutableLiveData<String>()
|
||||
let date = MutableLiveData<String>()
|
||||
let duration = MutableLiveData<String>()
|
||||
let organizer = MutableLiveData<String>()
|
||||
let participantsShort = MutableLiveData<String>()
|
||||
let participantsExpanded = MutableLiveData<String>()
|
||||
let rawDate : Date
|
||||
let expanded = MutableLiveData<Bool>()
|
||||
let address = MutableLiveData<String>()
|
||||
let subject = MutableLiveData<String>()
|
||||
let description = MutableLiveData<String>()
|
||||
let time = MutableLiveData<String>()
|
||||
let date = MutableLiveData<String>()
|
||||
let duration = MutableLiveData<String>()
|
||||
let organizer = MutableLiveData<String>()
|
||||
let participantsShort = MutableLiveData<String>()
|
||||
let participantsExpanded = MutableLiveData<String>()
|
||||
let rawDate : Date
|
||||
|
||||
|
||||
init (conferenceInfo: ConferenceInfo) {
|
||||
|
||||
init (conferenceInfo: ConferenceInfo) {
|
||||
self.conferenceInfo = conferenceInfo
|
||||
expanded.value = false
|
||||
|
||||
address.value = conferenceInfo.uri?.asStringUriOnly()
|
||||
subject.value = conferenceInfo.subject
|
||||
description.value = conferenceInfo.description
|
||||
|
||||
expanded.value = false
|
||||
|
||||
address.value = conferenceInfo.uri?.asStringUriOnly()
|
||||
subject.value = conferenceInfo.subject
|
||||
description.value = conferenceInfo.description
|
||||
|
||||
time.value = TimestampUtils.timeToString(unixTimestamp: Double(conferenceInfo.dateTime))
|
||||
date.value = TimestampUtils.toString(unixTimestamp:Double(conferenceInfo.dateTime), onlyDate:true, shortDate:false)
|
||||
rawDate = Date(timeIntervalSince1970:TimeInterval(conferenceInfo.dateTime))
|
||||
|
|
@ -59,17 +58,17 @@ class ScheduledConferenceData {
|
|||
|
||||
organizer.value = conferenceInfo.organizer?.addressBookEnhancedDisplayName()
|
||||
|
||||
computeParticipantsLists()
|
||||
}
|
||||
|
||||
func destroy() {
|
||||
}
|
||||
|
||||
func toggleExpand() {
|
||||
expanded.value = expanded.value == false
|
||||
}
|
||||
|
||||
private func computeParticipantsLists() {
|
||||
computeParticipantsLists()
|
||||
}
|
||||
|
||||
func destroy() {
|
||||
}
|
||||
|
||||
func toggleExpand() {
|
||||
expanded.value = expanded.value == false
|
||||
}
|
||||
|
||||
private func computeParticipantsLists() {
|
||||
participantsShort.value = conferenceInfo.participants.map {(participant) in
|
||||
String(describing: participant.addressBookEnhancedDisplayName())
|
||||
}.joined(separator: ", ")
|
||||
|
|
@ -77,7 +76,7 @@ class ScheduledConferenceData {
|
|||
participantsExpanded.value = conferenceInfo.participants.map {(participant) in
|
||||
String(describing: participant.addressBookEnhancedDisplayName())+" ("+String(describing: participant.asStringUriOnly())+")"
|
||||
}.joined(separator: "\n")
|
||||
}
|
||||
}
|
||||
|
||||
func gotoAssociatedChat() {
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ class ConferenceSchedulingViewModel {
|
|||
private var chatRooomDelegate : ChatRoomDelegate? = nil
|
||||
private var conferenceSchedulerDelegate : ConferenceSchedulerDelegateStub? = nil
|
||||
|
||||
var existingConfInfo:ConferenceInfo? = nil
|
||||
|
||||
init () {
|
||||
|
||||
|
|
@ -161,10 +162,10 @@ class ConferenceSchedulingViewModel {
|
|||
scheduledDuration.value = ConferenceSchedulingViewModel.durationList.indices.filter {
|
||||
ConferenceSchedulingViewModel.durationList[$0].value == 60
|
||||
}.first
|
||||
|
||||
continueEnabled.value = false
|
||||
|
||||
selectedAddresses.value = []
|
||||
existingConfInfo = nil
|
||||
description.value = ""
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -196,7 +197,10 @@ class ConferenceSchedulingViewModel {
|
|||
conferenceScheduler = try? Core.get().createConferenceScheduler()
|
||||
conferenceScheduler?.addDelegate(delegate: conferenceSchedulerDelegate!)
|
||||
|
||||
let conferenceInfo = try Factory.Instance.createConferenceInfo()
|
||||
guard let conferenceInfo = existingConfInfo != nil ? existingConfInfo : try Factory.Instance.createConferenceInfo() else {
|
||||
Log.e("[Conference Creation/Update] Failed, unable to get conf info.")
|
||||
return
|
||||
}
|
||||
conferenceInfo.organizer = localAddress
|
||||
subject.value.map { conferenceInfo.subject = $0}
|
||||
description.value.map { conferenceInfo.description = $0}
|
||||
|
|
@ -208,6 +212,7 @@ class ConferenceSchedulingViewModel {
|
|||
}
|
||||
conferenceScheduler?.account = localAccount
|
||||
conferenceScheduler?.info = conferenceInfo // Will trigger the conference creation automatically
|
||||
existingConfInfo = conferenceInfo
|
||||
|
||||
} catch {
|
||||
Log.e("[Conference Creation] Failed \(error)")
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import SVProgressHUD
|
|||
let durationValue = StyledValuePicker(liveIndex: ConferenceSchedulingViewModel.shared.scheduledDuration,options: ConferenceSchedulingViewModel.durationList.map({ (duration: Duration) -> String in duration.display}), readOnly:true)
|
||||
let timePicker = StyledDatePicker(liveValue: ConferenceSchedulingViewModel.shared.scheduledTime,pickerMode: .time, readOnly:true)
|
||||
let descriptionInput = StyledTextView(VoipTheme.conference_scheduling_font, placeHolder:VoipTexts.conference_schedule_description_hint,liveValue: ConferenceSchedulingViewModel.shared.description, readOnly:true)
|
||||
let createButton = FormButton(backgroundStateColors: VoipTheme.primary_colors_background)
|
||||
|
||||
|
||||
static let compositeDescription = UICompositeViewDescription(ConferenceSchedulingSummaryView.self, statusBar: StatusBarView.self, tabBar: nil, sideMenu: SideMenuView.self, fullscreen: false, isLeftFragment: false,fragmentWith: nil)
|
||||
|
|
@ -170,11 +171,10 @@ import SVProgressHUD
|
|||
}
|
||||
|
||||
// Create / Schedule
|
||||
let createButton = FormButton(backgroundStateColors: VoipTheme.primary_colors_background)
|
||||
contentView.addSubview(createButton)
|
||||
ConferenceSchedulingViewModel.shared.scheduleForLater.readCurrentAndObserve { _ in
|
||||
createButton.title = ConferenceSchedulingViewModel.shared.scheduleForLater.value == true ? VoipTexts.conference_schedule_start.uppercased() : VoipTexts.conference_group_call_create.uppercased()
|
||||
createButton.addSidePadding()
|
||||
self.createButton.title = ConferenceSchedulingViewModel.shared.scheduleForLater.value == true ? VoipTexts.conference_schedule_start.uppercased() : VoipTexts.conference_group_call_create.uppercased()
|
||||
self.createButton.addSidePadding()
|
||||
}
|
||||
|
||||
ConferenceSchedulingViewModel.shared.conferenceCreationInProgress.observe { progress in
|
||||
|
|
@ -191,6 +191,8 @@ import SVProgressHUD
|
|||
enableCreationTimeOut = false
|
||||
if (ConferenceSchedulingViewModel.shared.scheduleForLater.value == true) {
|
||||
PhoneMainView.instance().pop(toView:ScheduledConferencesView.compositeDescription)
|
||||
VoipDialog.toast(message: VoipTexts.conference_schedule_info_created)
|
||||
|
||||
}
|
||||
}
|
||||
ConferenceSchedulingViewModel.shared.onErrorEvent.observe { error in
|
||||
|
|
@ -208,9 +210,9 @@ import SVProgressHUD
|
|||
}
|
||||
}
|
||||
ConferenceSchedulingViewModel.shared.scheduleForLater.readCurrentAndObserve { (later) in
|
||||
createButton.title = ConferenceSchedulingViewModel.shared.scheduleForLater.value == true ? VoipTexts.conference_schedule_start.uppercased() : VoipTexts.conference_group_call_create.uppercased()
|
||||
self.createButton.title = ConferenceSchedulingViewModel.shared.scheduleForLater.value == true ? VoipTexts.conference_schedule_start.uppercased() : VoipTexts.conference_group_call_create.uppercased()
|
||||
viaChatLabel.isHidden = later != true || ConferenceSchedulingViewModel.shared.sendInviteViaChat.value != true
|
||||
createButton.addSidePadding()
|
||||
self.createButton.addSidePadding()
|
||||
}
|
||||
|
||||
createButton.centerX().alignParentBottom(withMargin: 3*self.form_margin).alignUnder(view: participantsListTableView,withMargin: 3*self.form_margin).done()
|
||||
|
|
@ -223,6 +225,7 @@ import SVProgressHUD
|
|||
durationValue.setIndex(index: ConferenceSchedulingViewModel.shared.scheduledDuration.value!)
|
||||
timePicker.liveValue = ConferenceSchedulingViewModel.shared.scheduledTime
|
||||
descriptionInput.text = ConferenceSchedulingViewModel.shared.description.value
|
||||
createButton.addSidePadding()
|
||||
super.viewWillAppear(animated)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -161,8 +161,27 @@ class ScheduledConferencesCell: UITableViewCell {
|
|||
|
||||
joinEditDelete.addArrangedSubview(editConf)
|
||||
editConf.onClick {
|
||||
// TODO
|
||||
VoipDialog.toast(message: "not available yet")
|
||||
guard let confData = self.conferenceData else {
|
||||
Log.e("Invalid conference date, unable to edit")
|
||||
VoipDialog.toast(message: VoipTexts.conference_edit_error)
|
||||
return
|
||||
}
|
||||
let infoDate = Date(timeIntervalSince1970: Double(confData.conferenceInfo.dateTime))
|
||||
ConferenceSchedulingViewModel.shared.reset()
|
||||
ConferenceSchedulingViewModel.shared.scheduledDate.value = infoDate
|
||||
ConferenceSchedulingViewModel.shared.scheduledTime.value = Date(timeIntervalSince1970: infoDate.timeIntervalSince1970 - Calendar.current.startOfDay(for: infoDate).timeIntervalSince1970)
|
||||
ConferenceSchedulingViewModel.shared.description.value = confData.description.value
|
||||
ConferenceSchedulingViewModel.shared.subject.value = confData.subject.value
|
||||
ConferenceSchedulingViewModel.shared.scheduledDuration.value = ConferenceSchedulingViewModel.durationList.firstIndex(where: {$0.value == confData.conferenceInfo.duration})
|
||||
ConferenceSchedulingViewModel.shared.scheduleForLater.value = true
|
||||
ConferenceSchedulingViewModel.shared.selectedAddresses.value = []
|
||||
confData.conferenceInfo.participants.forEach {
|
||||
ConferenceSchedulingViewModel.shared.selectedAddresses.value?.append($0)
|
||||
}
|
||||
ConferenceSchedulingViewModel.shared.existingConfInfo = confData.conferenceInfo
|
||||
// TOODO TimeZone (as Android 14.6.2022) ConferenceSchedulingViewModel.shared.scheduledTimeZone.value = self.conferenceData?.timezone
|
||||
let view : ConferenceSchedulingView = self.VIEW(ConferenceSchedulingView.compositeViewDescription())
|
||||
PhoneMainView.instance().changeCurrentView(view.compositeViewDescription())
|
||||
}
|
||||
|
||||
joinEditDelete.addArrangedSubview(deleteConf)
|
||||
|
|
@ -171,12 +190,12 @@ class ScheduledConferencesCell: UITableViewCell {
|
|||
Core.get().deleteConferenceInformation(conferenceInfo: self.conferenceData!.conferenceInfo)
|
||||
ScheduledConferencesViewModel.shared.computeConferenceInfoList()
|
||||
self.owningTableView?.reloadData()
|
||||
VoipDialog.toast(message: VoipTexts.conference_info_removed)
|
||||
}, isDestructive:false)
|
||||
let cancel = ButtonAttributes(text:VoipTexts.cancel, action: {}, isDestructive:true)
|
||||
VoipDialog(message:VoipTexts.conference_info_confirm_removal, givenButtons: [cancel,delete]).show()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ import linphonesw
|
|||
conferenceListView.allowsFocus = false
|
||||
}
|
||||
conferenceListView.separatorStyle = .singleLine
|
||||
conferenceListView.separatorColor = VoipTheme.light_grey_color
|
||||
conferenceListView.separatorColor = .white
|
||||
|
||||
view.addSubview(noConference)
|
||||
noConference.center().done()
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import UIKit
|
|||
extension UIButton {
|
||||
func addSidePadding(p:CGFloat = 10) {
|
||||
if let w = titleLabel?.textWidth {
|
||||
width(w+p).done()
|
||||
width(w+2*p).done()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,6 +115,10 @@ import UIKit
|
|||
static let conference_participants_title = NSLocalizedString("%d participants",comment:"")
|
||||
@objc static let conference_start_group_call_dialog_message = NSLocalizedString("Do you want to start a group call?\nEveryone in this group will receive a call to join the meeting.",comment:"")
|
||||
@objc static let conference_start_group_call_dialog_ok_button = NSLocalizedString("START",comment:"")
|
||||
static let conference_edit_error = NSLocalizedString("Unable to edit conference this time, date is invalid",comment:"")
|
||||
static let conference_schedule_info_created = NSLocalizedString("Meeting has been scheduled",comment:"")
|
||||
static let conference_info_removed = NSLocalizedString("Meeting info has been deleted",comment:"")
|
||||
|
||||
|
||||
|
||||
// Call Stats
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue