diff --git a/ElementX/Resources/Localizations/en.lproj/Localizable.strings b/ElementX/Resources/Localizations/en.lproj/Localizable.strings index 97b37d901..dd2d37df3 100644 --- a/ElementX/Resources/Localizations/en.lproj/Localizable.strings +++ b/ElementX/Resources/Localizations/en.lproj/Localizable.strings @@ -56,6 +56,7 @@ "action_join" = "Join"; "action_learn_more" = "Learn more"; "action_leave" = "Leave"; +"action_leave_conversation" = "Leave conversation"; "action_leave_room" = "Leave room"; "action_manage_account" = "Manage account"; "action_manage_devices" = "Manage devices"; @@ -228,6 +229,7 @@ "error_unknown" = "Sorry, an error occurred"; "invite_friends_rich_title" = "🔐️ Join me on %1$@"; "invite_friends_text" = "Hey, talk to me on %1$@: %2$@"; +"leave_conversation_alert_subtitle" = "Are you sure that you want to leave this conversation? This conversation is not public and you won't be able to rejoin without an invite."; "leave_room_alert_empty_subtitle" = "Are you sure that you want to leave this room? You're the only person here. If you leave, no one will be able to join in the future, including you."; "leave_room_alert_private_subtitle" = "Are you sure that you want to leave this room? This room is not public and you won't be able to rejoin without an invite."; "leave_room_alert_subtitle" = "Are you sure that you want to leave the room?"; @@ -679,6 +681,7 @@ "screen_dm_details_unblock_user" = "Unblock user"; "screen_login_subtitle" = "Matrix is an open network for secure, decentralised communication."; "screen_report_content_block_user" = "Block user"; +"screen_room_details_leave_conversation_title" = "Leave conversation"; "screen_room_details_leave_room_title" = "Leave room"; "screen_room_details_security_title" = "Security"; "screen_room_details_topic_title" = "Topic"; diff --git a/ElementX/Sources/Generated/Strings.swift b/ElementX/Sources/Generated/Strings.swift index 315e48fa9..47b793a93 100644 --- a/ElementX/Sources/Generated/Strings.swift +++ b/ElementX/Sources/Generated/Strings.swift @@ -146,6 +146,8 @@ public enum L10n { public static var actionLearnMore: String { return L10n.tr("Localizable", "action_learn_more") } /// Leave public static var actionLeave: String { return L10n.tr("Localizable", "action_leave") } + /// Leave conversation + public static var actionLeaveConversation: String { return L10n.tr("Localizable", "action_leave_conversation") } /// Leave room public static var actionLeaveRoom: String { return L10n.tr("Localizable", "action_leave_room") } /// Manage account @@ -524,6 +526,8 @@ public enum L10n { public static func inviteFriendsText(_ p1: Any, _ p2: Any) -> String { return L10n.tr("Localizable", "invite_friends_text", String(describing: p1), String(describing: p2)) } + /// Are you sure that you want to leave this conversation? This conversation is not public and you won't be able to rejoin without an invite. + public static var leaveConversationAlertSubtitle: String { return L10n.tr("Localizable", "leave_conversation_alert_subtitle") } /// Are you sure that you want to leave this room? You're the only person here. If you leave, no one will be able to join in the future, including you. public static var leaveRoomAlertEmptySubtitle: String { return L10n.tr("Localizable", "leave_room_alert_empty_subtitle") } /// Are you sure that you want to leave this room? This room is not public and you won't be able to rejoin without an invite. @@ -1188,6 +1192,8 @@ public enum L10n { public static var screenRoomDetailsErrorUnmuting: String { return L10n.tr("Localizable", "screen_room_details_error_unmuting") } /// Invite people public static var screenRoomDetailsInvitePeopleTitle: String { return L10n.tr("Localizable", "screen_room_details_invite_people_title") } + /// Leave conversation + public static var screenRoomDetailsLeaveConversationTitle: String { return L10n.tr("Localizable", "screen_room_details_leave_conversation_title") } /// Leave room public static var screenRoomDetailsLeaveRoomTitle: String { return L10n.tr("Localizable", "screen_room_details_leave_room_title") } /// Custom diff --git a/ElementX/Sources/Screens/HomeScreen/HomeScreenViewModel.swift b/ElementX/Sources/Screens/HomeScreen/HomeScreenViewModel.swift index effa07d5e..61b2ffe3b 100644 --- a/ElementX/Sources/Screens/HomeScreen/HomeScreenViewModel.swift +++ b/ElementX/Sources/Screens/HomeScreen/HomeScreenViewModel.swift @@ -331,9 +331,9 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol } if room.isPublic { - state.bindings.leaveRoomAlertItem = LeaveRoomAlertItem(roomId: roomId, state: .public) + state.bindings.leaveRoomAlertItem = LeaveRoomAlertItem(roomId: roomId, isDM: room.isEncryptedOneToOneRoom, state: .public) } else { - state.bindings.leaveRoomAlertItem = room.joinedMembersCount > 1 ? LeaveRoomAlertItem(roomId: roomId, state: .private) : LeaveRoomAlertItem(roomId: roomId, state: .empty) + state.bindings.leaveRoomAlertItem = room.joinedMembersCount > 1 ? LeaveRoomAlertItem(roomId: roomId, isDM: room.isEncryptedOneToOneRoom, state: .private) : LeaveRoomAlertItem(roomId: roomId, isDM: room.isEncryptedOneToOneRoom, state: .empty) } } } diff --git a/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenModels.swift b/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenModels.swift index 030a2ecde..878e14c97 100644 --- a/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenModels.swift +++ b/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenModels.swift @@ -147,15 +147,19 @@ struct LeaveRoomAlertItem: AlertProtocol { } let roomId: String + let isDM: Bool let state: RoomState - let title = L10n.actionLeaveRoom let confirmationTitle = L10n.actionLeave let cancelTitle = L10n.actionCancel + + var title: String { + isDM ? L10n.actionLeaveConversation : L10n.actionLeaveRoom + } var subtitle: String { switch state { case .empty: return L10n.leaveRoomAlertEmptySubtitle - case .private: return L10n.leaveRoomAlertPrivateSubtitle + case .private: return isDM ? L10n.leaveConversationAlertSubtitle : L10n.leaveRoomAlertPrivateSubtitle case .public: return L10n.leaveRoomAlertSubtitle } } diff --git a/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenViewModel.swift b/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenViewModel.swift index 8d4847aa0..3b73c13ba 100644 --- a/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenViewModel.swift +++ b/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenViewModel.swift @@ -90,10 +90,10 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr actionsSubject.send(.requestInvitePeoplePresentation) case .processTapLeave: guard state.joinedMembersCount > 1 else { - state.bindings.leaveRoomAlertItem = LeaveRoomAlertItem(roomId: roomProxy.id, state: .empty) + state.bindings.leaveRoomAlertItem = LeaveRoomAlertItem(roomId: roomProxy.id, isDM: roomProxy.isEncryptedOneToOneRoom, state: .empty) return } - state.bindings.leaveRoomAlertItem = LeaveRoomAlertItem(roomId: roomProxy.id, state: roomProxy.isPublic ? .public : .private) + state.bindings.leaveRoomAlertItem = LeaveRoomAlertItem(roomId: roomProxy.id, isDM: roomProxy.isEncryptedOneToOneRoom, state: roomProxy.isPublic ? .public : .private) case .confirmLeave: Task { await leaveRoom() } case .processTapIgnore: diff --git a/ElementX/Sources/Screens/RoomDetailsScreen/View/RoomDetailsScreen.swift b/ElementX/Sources/Screens/RoomDetailsScreen/View/RoomDetailsScreen.swift index f73f50bf0..b14783707 100644 --- a/ElementX/Sources/Screens/RoomDetailsScreen/View/RoomDetailsScreen.swift +++ b/ElementX/Sources/Screens/RoomDetailsScreen/View/RoomDetailsScreen.swift @@ -220,10 +220,14 @@ struct RoomDetailsScreen: View { } } } + + private var leaveRoomTitle: String { + context.viewState.dmRecipient == nil ? L10n.screenRoomDetailsLeaveRoomTitle : L10n.screenRoomDetailsLeaveConversationTitle + } private var leaveRoomSection: some View { Section { - ListRow(label: .action(title: L10n.actionLeaveRoom, + ListRow(label: .action(title: leaveRoomTitle, icon: \.leave, role: .destructive), kind: .button { context.send(viewAction: .processTapLeave) }) diff --git a/changelog.d/2330.change b/changelog.d/2330.change new file mode 100644 index 000000000..1c24af835 --- /dev/null +++ b/changelog.d/2330.change @@ -0,0 +1 @@ +Change Leave Room to Leave Conversation for DMs \ No newline at end of file