mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 00:49:44 +00:00
Change Leave Room to Leave Conversation for DMs (#2354)
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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) })
|
||||
|
||||
Reference in New Issue
Block a user