|
|
|
@ -4,6 +4,7 @@ final class ThreadPickerVC : UIViewController, UITableViewDataSource, UITableVie
|
|
|
|
|
private var threads: YapDatabaseViewMappings!
|
|
|
|
|
private var threadViewModelCache: [String:ThreadViewModel] = [:] // Thread ID to ThreadViewModel
|
|
|
|
|
private var selectedThread: TSThread?
|
|
|
|
|
var shareVC: ShareVC?
|
|
|
|
|
|
|
|
|
|
private var threadCount: UInt {
|
|
|
|
|
threads.numberOfItems(inGroup: TSInboxGroup)
|
|
|
|
@ -99,6 +100,7 @@ final class ThreadPickerVC : UIViewController, UITableViewDataSource, UITableVie
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func attachmentApproval(_ attachmentApproval: AttachmentApprovalViewController, didApproveAttachments attachments: [SignalAttachment], messageText: String?) {
|
|
|
|
|
shareVC?.showLoader()
|
|
|
|
|
let message = VisibleMessage()
|
|
|
|
|
message.sentTimestamp = NSDate.millisecondTimestamp()
|
|
|
|
|
message.text = messageText
|
|
|
|
@ -107,16 +109,24 @@ final class ThreadPickerVC : UIViewController, UITableViewDataSource, UITableVie
|
|
|
|
|
tsMessage.save(with: transaction)
|
|
|
|
|
}
|
|
|
|
|
Storage.write { transaction in
|
|
|
|
|
MessageSender.sendNonDurably(message, with: attachments, in: self.selectedThread!, using: transaction).retainUntilComplete()
|
|
|
|
|
MessageSender.sendNonDurably(message, with: attachments, in: self.selectedThread!, using: transaction).done { [weak self] _ in
|
|
|
|
|
guard let self = self else { return }
|
|
|
|
|
self.shareVC?.hideLoader()
|
|
|
|
|
self.shareVC?.shareViewWasCompleted()
|
|
|
|
|
}.catch { [weak self] error in
|
|
|
|
|
guard let self = self else { return }
|
|
|
|
|
self.shareVC?.hideLoader()
|
|
|
|
|
self.shareVC?.shareViewFailed(error: error)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func attachmentApprovalDidCancel(_ attachmentApproval: AttachmentApprovalViewController) {
|
|
|
|
|
|
|
|
|
|
// Do nothing
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func attachmentApproval(_ attachmentApproval: AttachmentApprovalViewController, didChangeMessageText newMessageText: String?) {
|
|
|
|
|
|
|
|
|
|
// Do nothing
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: Convenience
|
|
|
|
|