Report Content (#587)

* ui for reporting content has been implemented

* implementation done, will only work withe a mx rust sdk that supports report content

* fix

* code improvements

* code improvement

* fix typo

Co-authored-by: Stefan Ceriu <stefanc@matrix.org>

* removing unneeded task

* code improvement

* changelog

---------

Co-authored-by: Stefan Ceriu <stefanc@matrix.org>
This commit is contained in:
Mauro
2023-02-22 18:14:43 +01:00
committed by GitHub
parent 455a7105ef
commit e48676e4eb
12 changed files with 127 additions and 1 deletions
@@ -64,6 +64,8 @@ class MockRoomTimelineController: RoomTimelineControllerProtocol {
func editMessage(_ newMessage: String, original itemID: String) async { }
func redact(_ itemID: String) async { }
func reportContent(_ itemID: String, reason: String?) async { }
func debugDescription(for itemID: String) -> String {
"Mock debug description"
@@ -187,6 +187,16 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
MXLog.error("Failed redacting message with error: \(error)")
}
}
func reportContent(_ itemID: String, reason: String?) async {
MXLog.info("Send report content in \(roomID)")
switch await roomProxy.reportContent(itemID, reason: reason) {
case .success:
MXLog.info("Finished reporting content")
case .failure(let error):
MXLog.error("Failed reporting content with error: \(error)")
}
}
// Handle this parallel to the timeline items so we're not forced
// to bundle the Rust side objects within them
@@ -59,6 +59,8 @@ protocol RoomTimelineControllerProtocol {
func sendReaction(_ reaction: String, to itemID: String) async
func redact(_ itemID: String) async
func reportContent(_ itemID: String, reason: String?) async
func debugDescription(for itemID: String) -> String