forked from mirrors/linphone-iphone
Swipe to delete on conferences view
This commit is contained in:
parent
726a4afdd1
commit
cfb71d14c4
5 changed files with 33 additions and 12 deletions
|
|
@ -202,16 +202,23 @@ class ScheduledConferencesCell: UITableViewCell {
|
|||
|
||||
joinEditDelete.addArrangedSubview(deleteConf)
|
||||
deleteConf.onClick {
|
||||
let delete = ButtonAttributes(text:VoipTexts.conference_info_confirm_removal_delete, action: {
|
||||
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()
|
||||
self.askConfirmationTodeleteEntry()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func askConfirmationTodeleteEntry() {
|
||||
let delete = ButtonAttributes(text:VoipTexts.conference_info_confirm_removal_delete, action: {
|
||||
self.deleteEntry()
|
||||
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()
|
||||
}
|
||||
|
||||
func deleteEntry() {
|
||||
Core.get().deleteConferenceInformation(conferenceInfo: self.conferenceData!.conferenceInfo)
|
||||
ScheduledConferencesViewModel.shared.computeConferenceInfoList()
|
||||
self.owningTableView?.reloadData()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
|
|
|
|||
|
|
@ -167,4 +167,12 @@ import linphonesw
|
|||
}
|
||||
|
||||
|
||||
|
||||
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
|
||||
if editingStyle == .delete {
|
||||
let cell = tableView.cellForRow(at: indexPath) as! ScheduledConferencesCell
|
||||
cell.askConfirmationTodeleteEntry()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,4 +29,10 @@ extension UILabel {
|
|||
let labelSize = myText.boundingRect(with: rect, options: .usesLineFragmentOrigin, attributes: [NSAttributedString.Key.font: myFont], context: nil)
|
||||
return ceil(labelSize.width)
|
||||
}
|
||||
|
||||
func addSidePadding(p:CGFloat = 5.0) {
|
||||
if let w = textWidth {
|
||||
width(w+2*p).done()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@ class VoipDialog : UIView{
|
|||
// Layout constants
|
||||
let center_corner_radius = 7.0
|
||||
let title_margin_top = 20
|
||||
let title_margin_sides = 10.0
|
||||
let button_margin = 20.0
|
||||
let button_width = 135.0
|
||||
let button_height = 40.0
|
||||
let button_radius = 3.0
|
||||
let button_spacing = 15.0
|
||||
|
||||
let center_view_sides_margin = 13.0
|
||||
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ class VoipDialog : UIView{
|
|||
|
||||
title.numberOfLines = 0
|
||||
centerView.addSubview(title)
|
||||
title.alignParentTop(withMargin:title_margin_top).matchParentSideBorders().done()
|
||||
title.alignParentTop(withMargin:title_margin_top).matchParentSideBorders(insetedByDx: title_margin_sides).done()
|
||||
title.text = message
|
||||
|
||||
let buttonsView = UIStackView()
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ hiddenKeys = _hiddenKeys;
|
|||
for (NSArray *specifiers in _dataSource) {
|
||||
for (id sp in specifiers) {
|
||||
if ([sp isKindOfClass:[IASKSpecifier class]]) {
|
||||
if ([[sp key] isEqualToString:key]) {
|
||||
if ([[(IASKSpecifier*)sp key] isEqualToString:key]) {
|
||||
return sp;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue