change: decline and block design tweaks

This commit is contained in:
Mauro Romito
2025-04-10 17:56:00 +02:00
committed by Mauro
parent 88397792cf
commit b2c647b1af
19 changed files with 116 additions and 41 deletions
+7 -1
View File
@@ -638,7 +638,7 @@ internal enum L10n {
internal static func cryptoIdentityChangeProfilePinViolation(_ p1: Any) -> String {
return L10n.tr("Localizable", "crypto_identity_change_profile_pin_violation", String(describing: p1))
}
/// %1$@’s %2$@ identity was reset. %3$@
/// %1$@’s %2$@ identity was reset. %3$@
internal static func cryptoIdentityChangeVerificationViolationNew(_ p1: Any, _ p2: Any, _ p3: Any) -> String {
return L10n.tr("Localizable", "crypto_identity_change_verification_violation_new", String(describing: p1), String(describing: p2), String(describing: p3))
}
@@ -1324,6 +1324,8 @@ internal enum L10n {
internal static var screenDeclineAndBlockBlockUserOptionTitle: String { return L10n.tr("Localizable", "screen_decline_and_block_block_user_option_title") }
/// Report this room to your account provider.
internal static var screenDeclineAndBlockReportUserOptionDescription: String { return L10n.tr("Localizable", "screen_decline_and_block_report_user_option_description") }
/// Describe the reason to report…
internal static var screenDeclineAndBlockReportUserReasonPlaceholder: String { return L10n.tr("Localizable", "screen_decline_and_block_report_user_reason_placeholder") }
/// Decline and block
internal static var screenDeclineAndBlockTitle: String { return L10n.tr("Localizable", "screen_decline_and_block_title") }
/// Block
@@ -1710,6 +1712,8 @@ internal enum L10n {
internal static var screenPollsHistoryFilterPast: String { return L10n.tr("Localizable", "screen_polls_history_filter_past") }
/// Polls
internal static var screenPollsHistoryTitle: String { return L10n.tr("Localizable", "screen_polls_history_title") }
/// Push history
internal static var screenPushHistoryTitle: String { return L10n.tr("Localizable", "screen_push_history_title") }
/// Establishing a secure connection
internal static var screenQrCodeLoginConnectingSubtitle: String { return L10n.tr("Localizable", "screen_qr_code_login_connecting_subtitle") }
/// A secure connection could not be made to the new device. Your existing devices are still safe and you don't need to worry about them.
@@ -2836,6 +2840,8 @@ internal enum L10n {
internal static var timelineDecryptionFailureUnableToDecrypt: String { return L10n.tr("Localizable", "timeline_decryption_failure_unable_to_decrypt") }
/// This message was blocked either because you did not verify your device or because the sender needs to verify your identity.
internal static var timelineDecryptionFailureWithheldUnverified: String { return L10n.tr("Localizable", "timeline_decryption_failure_withheld_unverified") }
/// Push history
internal static var troubleshootNotificationsEntryPointPushHistoryTitle: String { return L10n.tr("Localizable", "troubleshoot_notifications_entry_point_push_history_title") }
/// Troubleshoot
internal static var troubleshootNotificationsEntryPointSection: String { return L10n.tr("Localizable", "troubleshoot_notifications_entry_point_section") }
/// Troubleshoot notifications
@@ -7,7 +7,7 @@
import Foundation
enum DeclineAndBlockScreenViewModelAction {
enum DeclineAndBlockScreenViewModelAction: Equatable {
case dismiss(hasDeclined: Bool)
}
@@ -54,27 +54,27 @@ class DeclineAndBlockScreenViewModel: DeclineAndBlockScreenViewModelType, Declin
return
}
let result = await roomProxy.rejectInvitation()
hideLoadingIndicator()
// TODO: Check with design how to handle the error cases and what message to present for success and error
switch result {
switch await roomProxy.rejectInvitation() {
case .success:
var shouldShowFailure = false
if state.bindings.shouldReport {
Task {
await clientProxy.reportRoomForIdentifier(roomID, reason: state.bindings.reportReason.isBlank ? nil : state.bindings.reportReason)
}
shouldShowFailure = await clientProxy.reportRoomForIdentifier(roomID, reason: state.bindings.reportReason.isBlank ? nil : state.bindings.reportReason).isFailure
}
if state.bindings.shouldBlockUser {
Task {
await clientProxy.ignoreUser(userID)
}
shouldShowFailure = await clientProxy.ignoreUser(userID).isFailure
}
hideLoadingIndicator()
if shouldShowFailure {
showError()
} else {
showSuccess()
}
actionsSubject.send(.dismiss(hasDeclined: true))
case .failure:
userIndicatorController.submitIndicator(.init(title: L10n.errorUnknown))
hideLoadingIndicator()
showError()
}
}
@@ -96,4 +96,8 @@ class DeclineAndBlockScreenViewModel: DeclineAndBlockScreenViewModelType, Declin
private func showError() {
userIndicatorController.submitIndicator(.init(title: L10n.errorUnknown))
}
private func showSuccess() {
userIndicatorController.submitIndicator(.init(title: L10n.commonSuccess, iconName: "checkmark"))
}
}
@@ -30,6 +30,9 @@ struct DeclineAndBlockScreen: View {
Section {
ListRow(label: .plain(title: L10n.screenDeclineAndBlockBlockUserOptionTitle),
kind: .toggle($context.shouldBlockUser))
} footer: {
Text(L10n.screenDeclineAndBlockBlockUserOptionDescription)
.compoundListSectionFooter()
}
}
@@ -37,12 +40,15 @@ struct DeclineAndBlockScreen: View {
Section {
ListRow(label: .plain(title: L10n.actionReportRoom),
kind: .toggle($context.shouldReport))
} footer: {
Text(L10n.screenDeclineAndBlockReportUserOptionDescription)
.compoundListSectionFooter()
}
}
private var reportReasonSection: some View {
Section {
ListRow(label: .plain(title: ""),
ListRow(label: .plain(title: L10n.screenDeclineAndBlockReportUserReasonPlaceholder),
kind: .textField(text: $context.reportReason, axis: .vertical))
.lineLimit(4, reservesSpace: true)
}