Closed pixlwave closed 6 years ago
Oh, should mention: Please test with a failed message before merging as I wasn't sure how to do this.
A better approach that is less impacting might be something like this in MainViewRoomController.swift
line 203:
let messageSendErrorHandler = { (roomId, eventId, userId) in
if roomId == nil || eventId == nil {
return
}
if (MatrixServices.inst.eventCache[roomId!]?.contains(where: { $0.eventId == eventId && $0.sentState == MXEventSentStateFailed }))! {
let sheet = self.storyboard?.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier("MessageSendFailedSheet")) as! MainViewSendErrorController
sheet.roomId = roomId!
sheet.eventId = eventId!
self.presentViewControllerAsSheet(sheet)
}
} as (_: String?, _: String?, _: String?) -> ()
Sure I can update. I was wondering though if it makes sense to be setting this handler for all messages even if they didn't fail sending?
Indeed it doesn’t make sense - please feel free to improve upon!
Well that commit is very much more impacting, but I think that's how I'd do it. No offence if you'd rather not do that though 🙃
Thinking about it, creating the protocol might be a tad ott. I'd skip that part and just make the delegate type the controller.
Fixes a crash that occurred when clicking the padlock icon.