mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
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:
@@ -30,6 +30,8 @@ struct RoomScreen: View {
|
||||
.toolbarBackground(.visible, for: .navigationBar) // Fix the toolbar's background.
|
||||
.overlay { loadingIndicator }
|
||||
.alert(item: $context.alertInfo) { $0.alert }
|
||||
.alert(item: $context.report,
|
||||
actions: { reportAlertActions($0) })
|
||||
.sheet(item: $context.debugInfo) { TimelineItemDebugView(info: $0) }
|
||||
.task(id: context.viewState.roomId) {
|
||||
// Give a couple of seconds for items to load and to see them.
|
||||
@@ -39,6 +41,15 @@ struct RoomScreen: View {
|
||||
context.send(viewAction: .markRoomAsRead)
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
func reportAlertActions(_ report: ReportAlertItem) -> some View {
|
||||
TextField("", text: report.reasonBinding)
|
||||
Button(ElementL10n.actionSend, action: {
|
||||
context.send(viewAction: .report(itemID: report.itemID, reason: report.reason))
|
||||
})
|
||||
Button(ElementL10n.actionCancel, role: .cancel, action: { })
|
||||
}
|
||||
|
||||
var timeline: some View {
|
||||
TimelineView()
|
||||
|
||||
@@ -40,6 +40,7 @@ enum TimelineItemContextMenuAction: Identifiable, Hashable {
|
||||
case reply
|
||||
case viewSource
|
||||
case retryDecryption(sessionID: String)
|
||||
case report
|
||||
|
||||
var id: Self { self }
|
||||
|
||||
@@ -107,6 +108,10 @@ public struct TimelineItemContextMenu: View {
|
||||
Button { send(action) } label: {
|
||||
Label(ElementL10n.roomTimelineContextMenuRetryDecryption, systemImage: "arrow.down.message")
|
||||
}
|
||||
case .report:
|
||||
Button(role: .destructive) { send(action) } label: {
|
||||
Label(ElementL10n.reportContent, systemImage: "exclamationmark.bubble")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user