forked from mirrors/linphone-iphone
Filter for terminated/scheduled conferences
This commit is contained in:
parent
f25423445f
commit
6a29d1d0e2
5 changed files with 74 additions and 16 deletions
|
|
@ -31,6 +31,7 @@ class ScheduledConferencesViewModel {
|
|||
var conferences : MutableLiveData<[ScheduledConferenceData]> = MutableLiveData([])
|
||||
var daySplitted : [Date : [ScheduledConferenceData]] = [:]
|
||||
var coreDelegate: CoreDelegateStub?
|
||||
var showTerminated = MutableLiveData(false)
|
||||
|
||||
init () {
|
||||
|
||||
|
|
@ -48,11 +49,20 @@ class ScheduledConferencesViewModel {
|
|||
func computeConferenceInfoList() {
|
||||
conferences.value!.removeAll()
|
||||
let now = Date().timeIntervalSince1970 // Linphone uses time_t in seconds
|
||||
let oneHourAgo = now - 3600 // Show all conferences from 1 hour ago and forward
|
||||
core.getConferenceInformationListAfterTime(time: time_t(oneHourAgo)).filter{$0.duration != 0}.forEach { conferenceInfo in
|
||||
conferences.value!.append(ScheduledConferenceData(conferenceInfo: conferenceInfo))
|
||||
|
||||
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))
|
||||
}
|
||||
} 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))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
daySplitted = [:]
|
||||
conferences.value!.forEach { (conferenceInfo) in
|
||||
let startDateDay = dateAtBeginningOfDay(for: conferenceInfo.rawDate)
|
||||
|
|
|
|||
|
|
@ -23,9 +23,10 @@ import Foundation
|
|||
import linphonesw
|
||||
|
||||
@objc class ScheduledConferencesView: BackNextNavigationView, UICompositeViewDelegate, UITableViewDataSource, UITableViewDelegate {
|
||||
|
||||
|
||||
let conferenceListView = UITableView()
|
||||
let noConference = StyledLabel(VoipTheme.empty_list_font,VoipTexts.conference_no_schedule)
|
||||
let filters = UIStackView()
|
||||
|
||||
static let compositeDescription = UICompositeViewDescription(ScheduledConferencesView.self, statusBar: StatusBarView.self, tabBar: nil, sideMenu: SideMenuView.self, fullscreen: false, isLeftFragment: false,fragmentWith: nil)
|
||||
static func compositeViewDescription() -> UICompositeViewDescription! { return compositeDescription }
|
||||
|
|
@ -44,8 +45,39 @@ import linphonesw
|
|||
title:VoipTexts.conference_scheduled)
|
||||
|
||||
super.nextButton.applyTintedIcons(tintedIcons: VoipTheme.conference_create_button)
|
||||
|
||||
|
||||
// Filter buttons
|
||||
let showTerminated = getFilterButton(title: VoipTexts.conference_scheduled_terminated_filter)
|
||||
showTerminated.onClick {
|
||||
ScheduledConferencesViewModel.shared.showTerminated.value = true
|
||||
}
|
||||
filters.addArrangedSubview(showTerminated)
|
||||
|
||||
let showScheduled = getFilterButton(title: VoipTexts.conference_scheduled_future_filter)
|
||||
showScheduled.onClick {
|
||||
ScheduledConferencesViewModel.shared.showTerminated.value = false
|
||||
|
||||
}
|
||||
filters.addArrangedSubview(showScheduled)
|
||||
|
||||
ScheduledConferencesViewModel.shared.showTerminated.readCurrentAndObserve { it in
|
||||
showTerminated.isSelected = it == true
|
||||
showScheduled.isSelected = it != true
|
||||
self.noConference.text = it != true ? VoipTexts.conference_no_schedule : VoipTexts.conference_no_terminated_schedule
|
||||
ScheduledConferencesViewModel.shared.computeConferenceInfoList()
|
||||
self.conferenceListView.reloadData()
|
||||
self.noConference.isHidden = !ScheduledConferencesViewModel.shared.daySplitted.isEmpty
|
||||
}
|
||||
|
||||
self.view.addSubview(filters)
|
||||
filters.spacing = 10
|
||||
filters.alignParentLeft(withMargin: 10).alignUnder(view: super.topBar,withMargin: self.form_margin).done()
|
||||
|
||||
|
||||
// Conference list
|
||||
|
||||
self.view.addSubview(conferenceListView)
|
||||
conferenceListView.alignUnder(view: filters).done()
|
||||
conferenceListView.isScrollEnabled = true
|
||||
conferenceListView.dataSource = self
|
||||
conferenceListView.delegate = self
|
||||
|
|
@ -62,6 +94,20 @@ import linphonesw
|
|||
noConference.center().done()
|
||||
|
||||
}
|
||||
|
||||
func getFilterButton(title:String) -> UIButton {
|
||||
let filter_button_height = 35.0
|
||||
let button = ButtonWithStateBackgrounds(backgroundStateColors: VoipTheme.button_conference_list_filter)
|
||||
button.setTitle(title, for: .normal)
|
||||
button.setTitleColor(.black, for: .normal)
|
||||
button.setTitleColor(VoipTheme.primary_color, for: .selected)
|
||||
button.height(filter_button_height).done()
|
||||
button.layer.cornerRadius = filter_button_height / 2
|
||||
button.clipsToBounds = true
|
||||
button.applyTitleStyle(VoipTheme.conf_list_filter_button_font)
|
||||
button.addSidePadding()
|
||||
return button
|
||||
}
|
||||
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
|
|
@ -69,7 +115,7 @@ import linphonesw
|
|||
super.viewWillAppear(animated)
|
||||
self.conferenceListView.reloadData()
|
||||
self.conferenceListView.removeConstraints().done()
|
||||
self.conferenceListView.matchParentSideBorders(insetedByDx: 10).alignUnder(view: super.topBar,withMargin: self.form_margin).alignParentBottom().done()
|
||||
self.conferenceListView.matchParentSideBorders(insetedByDx: 10).alignUnder(view: filters,withMargin: self.form_margin).alignParentBottom().done()
|
||||
noConference.isHidden = !ScheduledConferencesViewModel.shared.daySplitted.isEmpty
|
||||
super.nextButton.isEnabled = Core.get().defaultAccount != nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ import UIKit
|
|||
@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:"")
|
||||
@objc static let conference_no_terminated_schedule = NSLocalizedString("No terminated meeting yet.",comment:"")
|
||||
@objc static let conference_participant_paused = NSLocalizedString("(paused)",comment:"")
|
||||
@objc static let conference_participants_title = NSLocalizedString("Participants (%d)",comment:"")
|
||||
@objc static let conference_paused_subtitle = NSLocalizedString("Click on play button to join it back.",comment:"")
|
||||
|
|
@ -136,8 +137,9 @@ import UIKit
|
|||
@objc static let conference_empty = NSLocalizedString("You are currently alone in this group call",comment:"")
|
||||
@objc static let conference_admin_set = NSLocalizedString("%s is now admin",comment:"")
|
||||
@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:"")
|
||||
|
||||
// FROM ANDROID END
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -128,15 +128,9 @@ import UIKit
|
|||
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)
|
||||
|
||||
static let empty_list_font = TextStyle(fgColor: primaryTextColor, bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .center, font: fontName+"-Regular", size: 18.0)
|
||||
static let conf_list_filter_button_font = TextStyle(fgColor: LightDarkColor(.black,.black), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .center, font: fontName+"-Regular", size: 14.0)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Buttons Background (State colors)
|
||||
|
||||
static let button_background = [
|
||||
|
|
@ -204,6 +198,11 @@ import UIKit
|
|||
UIButton.State.highlighted.rawValue : LightDarkColor(primary_color,primary_color),
|
||||
]
|
||||
|
||||
static let button_conference_list_filter = [
|
||||
UIButton.State.normal.rawValue : LightDarkColor(light_grey_color,light_grey_color),
|
||||
UIButton.State.selected.rawValue : LightDarkColor(primary_color.withAlphaComponent(0.24),primary_color.withAlphaComponent(0.24)),
|
||||
]
|
||||
|
||||
// Buttons Icons (State colors) + Background colors
|
||||
|
||||
static let call_terminate = ButtonTheme(
|
||||
|
|
@ -274,7 +273,8 @@ import UIKit
|
|||
tintableStateIcons:[:],
|
||||
backgroundStateColors: button_toggle_background_reverse)
|
||||
|
||||
// AUdio routes
|
||||
// AUuio routes
|
||||
|
||||
static let route_bluetooth = ButtonTheme(
|
||||
tintableStateIcons:[
|
||||
UIButton.State.normal.rawValue : TintableIcon(name: "voip_bluetooth",tintColor: LightDarkColor(.white,.white)),
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Reference in a new issue