feat: change leave room info (MESSENGER-6526)

This commit is contained in:
JanNiklas Grabowski
2024-09-27 11:00:03 +02:00
parent 384bebc921
commit 617d658d99
7 changed files with 24 additions and 3 deletions

View File

@@ -179,6 +179,7 @@
"room_participants_leave_prompt_title_for_dm" = "Verlassen";
"room_participants_leave_prompt_msg_for_dm" = "Bist du sicher, dass du die Konversation verlassen möchtest?";
"room_participants_cant_leave_prompt_message" = "Du kannst den Raum nicht verlassen, da es keine weiteren Admins im Raum gibt.";
"room_participants_leave_and_delete_prompt_msg" = "Raum wirklich verlassen und endgültig löschen?";
"room_participants_invite_prompt_to_msg" = "Bist du sicher, dass du %@ zu %@ einladen möchtest";
"room_participants_filter_room_members" = "Filtere Raum-Mitglieder";
"room_participants_filter_room_members_for_dm" = "Mitglieder filtern";

View File

@@ -157,6 +157,7 @@
// MARK: - Room Participants
"room_participants_cant_leave_prompt_message" = "You cannot leave the room because there are no other admins in the room.";
"room_participants_leave_and_delete_prompt_msg" = "Leave room and delete it?";
"room_participants_action_permalink" = "Share user link";
"room_event_action_permalink" = "Share message link";
"bwi_room_participants_section_admin" = "Admin";

View File

@@ -1487,6 +1487,10 @@ public class BWIL10n: NSObject {
public static func roomParticipantsInvitePromptToMsg(_ p1: String, _ p2: String) -> String {
return BWIL10n.tr("Bwi", "room_participants_invite_prompt_to_msg", p1, p2)
}
/// Raum wirklich verlassen und endgültig löschen?
public static var roomParticipantsLeaveAndDeletePromptMsg: String {
return BWIL10n.tr("Bwi", "room_participants_leave_and_delete_prompt_msg")
}
/// Bist du sicher, dass du die Konversation verlassen möchtest?
public static var roomParticipantsLeavePromptMsgForDm: String {
return BWIL10n.tr("Bwi", "room_participants_leave_prompt_msg_for_dm")

View File

@@ -204,9 +204,14 @@ class RoomContextActionService: NSObject, RoomContextActionServiceProtocol {
}()
private func getLeaveAlertController() -> UIAlertController {
if LeaveRoomHelper.canLeaveRoom(self.session, self.room) {
if LeaveRoomHelper.canLeaveRoom(self.session, self.room) {
var message = ""
if LeaveRoomHelper.isOnlyMember(self.room) {
message = BWIL10n.roomParticipantsLeaveAndDeletePromptMsg
} else {
message = self.isRoomDirect ? VectorL10n.roomParticipantsLeavePromptMsgForDm : VectorL10n.roomParticipantsLeavePromptMsg
}
let title = self.isRoomDirect ? VectorL10n.roomParticipantsLeavePromptTitleForDm : VectorL10n.roomParticipantsLeavePromptTitle
let message = self.isRoomDirect ? VectorL10n.roomParticipantsLeavePromptMsgForDm : VectorL10n.roomParticipantsLeavePromptMsg
let controller = UIAlertController(title: title, message: message, preferredStyle: .alert)

View File

@@ -79,8 +79,13 @@ final class RoomInfoListViewController: UIViewController {
private func getLeaveAlertController() -> UIAlertController {
if self.viewModel.canLeaveRoom() {
var message = ""
if viewModel.isOnlyMember() {
message = BWIL10n.roomParticipantsLeaveAndDeletePromptMsg
} else {
message = self.isRoomDirect ? VectorL10n.roomParticipantsLeavePromptMsgForDm : VectorL10n.roomParticipantsLeavePromptMsg
}
let title = self.isRoomDirect ? VectorL10n.roomParticipantsLeavePromptTitleForDm : VectorL10n.roomParticipantsLeavePromptTitle
let message = self.isRoomDirect ? VectorL10n.roomParticipantsLeavePromptMsgForDm : VectorL10n.roomParticipantsLeavePromptMsg
let controller = UIAlertController(title: title, message: message, preferredStyle: .alert)

View File

@@ -127,6 +127,10 @@ final class RoomInfoListViewModel: NSObject, RoomInfoListViewModelType {
return LeaveRoomHelper.canLeaveRoom(self.session, self.room)
}
func isOnlyMember() -> Bool {
return LeaveRoomHelper.isOnlyMember(self.room)
}
func isDirectRoom() -> Bool {
return room.isDirect
}

View File

@@ -38,6 +38,7 @@ protocol RoomInfoListViewModelType {
func process(viewAction: RoomInfoListViewAction)
func canLeaveRoom() -> Bool
func isOnlyMember() -> Bool
func isDirectRoom() -> Bool
func isPersonalNotesRoom() -> Bool
func isInviteOnlyRoom() -> Bool