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
@@ -290,7 +290,7 @@
"crypto_identity_change_pin_violation_new" = "%1$@’s %2$@ identity was reset. %3$@";
"crypto_identity_change_pin_violation_new_user_id" = "(%1$@)";
"crypto_identity_change_profile_pin_violation" = "%1$@’s identity was reset.";
"crypto_identity_change_verification_violation_new" = "%1$@’s %2$@ identity was reset. %3$@";
"crypto_identity_change_verification_violation_new" = "%1$@’s %2$@ identity was reset. %3$@";
"crypto_identity_change_withdraw_verification_action" = "Withdraw verification";
"dialog_confirm_link_message" = "The link %1$@ is taking you to another site %2$@\n\nAre you sure you want to continue?";
"dialog_confirm_link_title" = "Double-check this link";
@@ -429,6 +429,7 @@
"screen_decline_and_block_block_user_option_description" = "You will not see any messages or room invites from this user";
"screen_decline_and_block_block_user_option_title" = "Block user";
"screen_decline_and_block_report_user_option_description" = "Report this room to your account provider.";
"screen_decline_and_block_report_user_reason_placeholder" = "Describe the reason to report…";
"screen_decline_and_block_title" = "Decline and block";
"screen_edit_room_address_room_address_section_footer" = "You’ll need a room address in order to make it visible in the directory.";
"screen_edit_room_address_title" = "Room address";
@@ -480,6 +481,7 @@
"screen_media_upload_preview_error_failed_sending" = "Failed uploading media, please try again.";
"screen_pinned_timeline_empty_state_description" = "Press on a message and choose “%1$@” to include here.";
"screen_pinned_timeline_empty_state_headline" = "Pin important messages so that they can be easily discovered";
"screen_push_history_title" = "Push history";
"screen_report_room_leave_failed_alert_message" = "Your report was submitted successfully, but we encountered an issue while trying to leave the room. Please try again.";
"screen_report_room_leave_failed_alert_title" = "Unable to Leave Room";
"screen_report_room_reason_footer" = "Report this room to your admin. If the messages are encrypted, your admin will not be able to read them.";
@@ -1124,6 +1126,7 @@
"timeline_decryption_failure_historical_event_user_not_joined" = "You don't have access to this message";
"timeline_decryption_failure_unable_to_decrypt" = "Unable to decrypt message";
"timeline_decryption_failure_withheld_unverified" = "This message was blocked either because you did not verify your device or because the sender needs to verify your identity.";
"troubleshoot_notifications_entry_point_push_history_title" = "Push history";
"troubleshoot_notifications_entry_point_section" = "Troubleshoot";
"troubleshoot_notifications_screen_action" = "Run tests";
"troubleshoot_notifications_screen_action_again" = "Run tests again";
@@ -290,7 +290,7 @@
"crypto_identity_change_pin_violation_new" = "%1$@’s %2$@ identity was reset. %3$@";
"crypto_identity_change_pin_violation_new_user_id" = "(%1$@)";
"crypto_identity_change_profile_pin_violation" = "%1$@’s identity was reset.";
"crypto_identity_change_verification_violation_new" = "%1$@’s %2$@ identity was reset. %3$@";
"crypto_identity_change_verification_violation_new" = "%1$@’s %2$@ identity was reset. %3$@";
"crypto_identity_change_withdraw_verification_action" = "Withdraw verification";
"dialog_confirm_link_message" = "The link %1$@ is taking you to another site %2$@\n\nAre you sure you want to continue?";
"dialog_confirm_link_title" = "Double-check this link";
@@ -429,6 +429,7 @@
"screen_decline_and_block_block_user_option_description" = "You will not see any messages or room invites from this user";
"screen_decline_and_block_block_user_option_title" = "Block user";
"screen_decline_and_block_report_user_option_description" = "Report this room to your account provider.";
"screen_decline_and_block_report_user_reason_placeholder" = "Describe the reason to report…";
"screen_decline_and_block_title" = "Decline and block";
"screen_edit_room_address_room_address_section_footer" = "You’ll need a room address in order to make it visible in the directory.";
"screen_edit_room_address_title" = "Room address";
@@ -480,6 +481,7 @@
"screen_media_upload_preview_error_failed_sending" = "Failed uploading media, please try again.";
"screen_pinned_timeline_empty_state_description" = "Press on a message and choose “%1$@” to include here.";
"screen_pinned_timeline_empty_state_headline" = "Pin important messages so that they can be easily discovered";
"screen_push_history_title" = "Push history";
"screen_report_room_leave_failed_alert_message" = "Your report was submitted successfully, but we encountered an issue while trying to leave the room. Please try again.";
"screen_report_room_leave_failed_alert_title" = "Unable to Leave Room";
"screen_report_room_reason_footer" = "Report this room to your admin. If the messages are encrypted, your admin will not be able to read them.";
@@ -1124,6 +1126,7 @@
"timeline_decryption_failure_historical_event_user_not_joined" = "You don't have access to this message";
"timeline_decryption_failure_unable_to_decrypt" = "Unable to decrypt message";
"timeline_decryption_failure_withheld_unverified" = "This message was blocked either because you did not verify your device or because the sender needs to verify your identity.";
"troubleshoot_notifications_entry_point_push_history_title" = "Push history";
"troubleshoot_notifications_entry_point_section" = "Troubleshoot";
"troubleshoot_notifications_screen_action" = "Run tests";
"troubleshoot_notifications_screen_action_again" = "Run tests again";
+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)
}
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:331907bdf035f86c3d347dee7b9ed185ed5017166ed9e8b461350a3b42568d96
size 99116
oid sha256:50deca012b287d8b87ac14a747f9e67f495d54af46e1b831e7108c8a2a83817f
size 114279
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1a7a6b83541d8118cb2f6ef72ede4ad7da26e143f3fff128162f8a86cc79d1f4
size 101990
oid sha256:1c586e0bd1cd29f360e5279e58af24da103d81957c05d0acca6f6e14fc551f78
size 124636
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7afb522b666d6ee0053565805eeecfa2de03931c84e0fa3a8881d987c3289873
size 50827
oid sha256:2b42cc41e5589b9a765bc1ec3332cff981267bb6949f46661bc29b736873135c
size 64675
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0ecf718f65e63626ece27b13bfaf90eb1a4a66aefcaebf38bd9290f6e9bda3fa
size 52405
oid sha256:1b9d37c4275549091542cc691ce9c52576abaa17d965ccd26000b6bc70f89363
size 78011
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:60c89d39f8c797146967f6419b4b778daf1a23e96887135f94bd05b748d5f5b8
size 99560
oid sha256:75f8f6719667c51e24b0e81fc0087e3dc89c78455eb4c5034ff390c1a6dedcc3
size 123998
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3bb8474771644359632424dabb6f9b2062044bcb9f4d6c1721d01267cb28cecb
size 102525
oid sha256:97a51bbcea7e4196cc8be8c7a1a7e09ec9ad8fa0c45c544e2ce401aedd339d74
size 136178
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6f4043f23a826059c0e5c8ab412e302d3316ea01bc2ea0f6821240c214d1479a
size 52656
oid sha256:f0d04d5a3973060cc4ce7c26ce8cf1c68a0e86d69151bbdb2224e61a7f59a2fb
size 75080
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:05925f7f9857ea05c41cf73e085a9f9cc14cf99a86bfbbb190c394a9ab01cb4b
size 54307
oid sha256:667e0255a2c429f3424a7106ffd4153b68796ea28bce4b60e759256bd54bfd5d
size 93890
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:148107fd3a1f3ac3870de2a5e412809682aae45ae5c193bd7c6ad95e9ef8a9a0
size 159001
oid sha256:80fcc3ff5fdf0ef8620b1a7778922d77b276729e989b286d74d8709c00170301
size 158452
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:23091f2e8cebcd97be02c8f0c1d6a7bc46153127114ee34d67f017335287e485
size 170755
oid sha256:f5cd23bd239f4e125a9a5f3e1d1be35340d6b1f04dd00a447e41e66bd734a6c8
size 171300
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ca5ba42465ba82ffb54b2c23bf0cad04a247d69a0d0c479ee8163b56d14d3f70
size 77669
oid sha256:02a02dcb61bf5d79bd97acd9697aac30b953d8542e3286a2920c328f947e1fde
size 77779
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c77fbd3355f3951ff1f007a9f935b9b2179cc845e5bdde5e4ae30f40564f9b1a
size 100639
oid sha256:3d897f9d56229822129b6197b60e67275e20559e2981e84eaf4be66cc5f0df26
size 101071
@@ -12,8 +12,61 @@ import XCTest
@MainActor
class DeclineAndBlockScreenViewModelTests: XCTestCase {
var viewModel: DeclineAndBlockScreenViewModelProtocol!
var clientProxy: ClientProxyMock!
var context: DeclineAndBlockScreenViewModelType.Context {
viewModel.context
}
override func setUp() {
clientProxy = ClientProxyMock(.init())
viewModel = DeclineAndBlockScreenViewModel(userID: "@alice:matrix.org",
roomID: "!room:matrix.org",
clientProxy: clientProxy,
userIndicatorController: UserIndicatorControllerMock())
}
func testInitialState() {
XCTAssertFalse(context.viewState.isDeclineDisabled)
XCTAssertFalse(context.shouldReport)
XCTAssertTrue(context.shouldBlockUser)
}
func testDeclineDisabled() {
context.shouldBlockUser = false
XCTAssertTrue(context.viewState.isDeclineDisabled)
XCTAssertFalse(context.shouldReport)
XCTAssertFalse(context.shouldBlockUser)
}
func testDeclineBlockAndReport() async throws {
let reason = "Test reason"
clientProxy.roomForIdentifierClosure = { id in
XCTAssertEqual(id, "!room:matrix.org")
let roomProxyMock = InvitedRoomProxyMock(.init(id: id))
roomProxyMock.rejectInvitationReturnValue = .success(())
return .invited(InvitedRoomProxyMock(.init(id: id)))
}
clientProxy.reportRoomForIdentifierReasonClosure = { id, reasonValue in
XCTAssertEqual(id, "!room:matrix.org")
XCTAssertEqual(reasonValue, reason)
return .success(())
}
clientProxy.ignoreUserClosure = { userId in
XCTAssertEqual(userId, "@alice:matrix.org")
return .success(())
}
context.shouldReport = true
context.reportReason = reason
let deferredAction = deferFulfillment(viewModel.actionsPublisher) { action in
action == .dismiss(hasDeclined: true)
}
context.send(viewAction: .decline)
try await deferredAction.fulfill()
XCTAssertTrue(clientProxy.roomForIdentifierCalled)
XCTAssertTrue(clientProxy.reportRoomForIdentifierReasonCalled)
XCTAssertTrue(clientProxy.ignoreUserCalled)
}
}