mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Invite the DM recipient to a new room (#5588)
* handle the details to invite users flow. * implemented the room creation in the invite screen, and its dismissal + navigaton to the newly created room * updated preview and unit tests * pr suggestions
This commit is contained in:
@@ -26,6 +26,7 @@ enum RoomDetailsScreenCoordinatorAction {
|
||||
case presentRoomDetailsEditScreen
|
||||
case presentNotificationSettingsScreen
|
||||
case presentInviteUsersScreen
|
||||
case presentInviteToNewRoom(invitee: UserProfileProxy)
|
||||
case presentPollsHistory
|
||||
case presentRolesAndPermissionsScreen
|
||||
case presentCall(isVoiceCall: Bool)
|
||||
@@ -71,6 +72,8 @@ final class RoomDetailsScreenCoordinator: CoordinatorProtocol {
|
||||
actionsSubject.send(.presentRoomMembersList)
|
||||
case .requestInvitePeoplePresentation:
|
||||
actionsSubject.send(.presentInviteUsersScreen)
|
||||
case .requestInviteToNewRoomPresentation(let invitee):
|
||||
actionsSubject.send(.presentInviteToNewRoom(invitee: invitee))
|
||||
case .leftRoom:
|
||||
actionsSubject.send(.leftRoom)
|
||||
case .requestEditDetailsPresentation:
|
||||
|
||||
@@ -18,6 +18,7 @@ enum RoomDetailsScreenViewModelAction: Equatable {
|
||||
case requestMemberDetailsPresentation
|
||||
case requestRecipientDetailsPresentation(userID: String)
|
||||
case requestInvitePeoplePresentation
|
||||
case requestInviteToNewRoomPresentation(selectedInvitee: UserProfileProxy)
|
||||
case leftRoom
|
||||
case requestEditDetailsPresentation
|
||||
case requestPollsHistoryPresentation
|
||||
@@ -98,6 +99,7 @@ struct RoomDetailsScreenViewState: BindableState {
|
||||
}
|
||||
shortcuts.append(.videoCall)
|
||||
}
|
||||
// The invite flow is different for DMs
|
||||
if dmRecipientInfo == nil, canInviteUsers {
|
||||
shortcuts.append(.invite)
|
||||
}
|
||||
|
||||
@@ -110,7 +110,11 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
|
||||
case .processTapPeople:
|
||||
actionsSubject.send(.requestMemberDetailsPresentation)
|
||||
case .processTapInvite:
|
||||
actionsSubject.send(.requestInvitePeoplePresentation)
|
||||
if let dmRecipient = state.dmRecipientInfo {
|
||||
actionsSubject.send(.requestInviteToNewRoomPresentation(selectedInvitee: .init(member: dmRecipient.member)))
|
||||
} else {
|
||||
actionsSubject.send(.requestInvitePeoplePresentation)
|
||||
}
|
||||
case .processTapLeave:
|
||||
processTapToLeave()
|
||||
case .confirmLeave:
|
||||
|
||||
@@ -22,6 +22,11 @@ struct RoomDetailsScreen: View {
|
||||
|
||||
aboutSection
|
||||
|
||||
// The invitation flow is different for DMs
|
||||
if context.viewState.dmRecipientInfo != nil {
|
||||
inviteToNewRoomSection
|
||||
}
|
||||
|
||||
configurationSection
|
||||
|
||||
if context.viewState.dmRecipientInfo == nil {
|
||||
@@ -165,6 +170,13 @@ struct RoomDetailsScreen: View {
|
||||
}
|
||||
}
|
||||
|
||||
private var inviteToNewRoomSection: some View {
|
||||
ListRow(label: .default(title: L10n.actionInvite, icon: \.userAdd),
|
||||
kind: .navigationLink {
|
||||
context.send(viewAction: .processTapInvite)
|
||||
})
|
||||
}
|
||||
|
||||
private var configurationSection: some View {
|
||||
Section {
|
||||
ListRow(label: .default(title: L10n.screenRoomDetailsNotificationTitle, icon: \.notifications),
|
||||
|
||||
Reference in New Issue
Block a user