Report room and decline & block screens tweaks (#4044)

* report rom and decline and block screens tweaks

- Use the copies: "Leave room" and "Report room" everywhere, also in DMs
- Report reason in report room is now mandatory.
- Report reason in decline and block is now mandatory if the report action is set to on.
- Generic alert for failure of main API in both report room and decline and block has been added

* report room and decline and block screen previews
This commit is contained in:
Mauro
2025-04-22 11:44:20 +02:00
committed by GitHub
parent cffcb5c7b9
commit 7183b0fe19
19 changed files with 64 additions and 36 deletions
@@ -38,7 +38,7 @@ class ReportRoomScreenViewModel: ReportRoomScreenViewModelType, ReportRoomScreen
private func report() async {
showLoadingIndicator()
let result = await roomProxy.reportRoom(reason: state.bindings.reason.isBlank ? nil : state.bindings.reason)
let result = await roomProxy.reportRoom(reason: state.bindings.reason.isEmpty ? nil : state.bindings.reason)
switch result {
case .success:
@@ -51,7 +51,11 @@ class ReportRoomScreenViewModel: ReportRoomScreenViewModelType, ReportRoomScreen
}
case .failure:
hideLoadingIndicator()
userIndicatorController.submitIndicator(.init(title: L10n.errorUnknown))
state.bindings.alert = .init(id: .reportRoomFailed,
title: L10n.commonSomethingWentWrong,
message: L10n.commonSomethingWentWrongMessage,
primaryButton: .init(title: L10n.actionDismiss, role: .cancel, action: nil),
secondaryButton: .init(title: L10n.actionTryAgain) { [weak self] in Task { await self?.report() } })
}
}
@@ -72,7 +76,7 @@ class ReportRoomScreenViewModel: ReportRoomScreenViewModelType, ReportRoomScreen
title: L10n.screenReportRoomLeaveFailedAlertTitle,
message: L10n.screenReportRoomLeaveFailedAlertMessage,
primaryButton: .init(title: L10n.actionDismiss, role: .cancel) { [weak self] in self?.actionsSubject.send(.dismiss(shouldLeaveRoom: false)) },
secondaryButton: .init(title: L10n.actionRetry) { [weak self] in Task { await self?.leaveRoom(showLoading: true) } })
secondaryButton: .init(title: L10n.actionTryAgain) { [weak self] in Task { await self?.leaveRoom(showLoading: true) } })
}
}