Hide AddParticipantsFragment on check click

This commit is contained in:
Benoit Martins 2025-07-24 11:54:14 +02:00
parent 24501f3ce2
commit 9d861a7b81
6 changed files with 26 additions and 28 deletions

View file

@ -83,7 +83,7 @@ struct ParticipantsListFragment: View {
if callViewModel.myParticipantModel != nil && callViewModel.myParticipantModel!.isAdmin {
NavigationLink(destination: {
AddParticipantsFragment(addParticipantsViewModel: addParticipantsViewModel, confirmAddParticipantsFunc: callViewModel.addParticipants)
AddParticipantsFragment(addParticipantsViewModel: addParticipantsViewModel, confirmAddParticipantsFunc: callViewModel.addParticipants, dismissOnCheckClick: true)
.onAppear {
addParticipantsViewModel.participantsToAdd = []
}

View file

@ -456,7 +456,7 @@ struct ConversationInfoFragment: View {
if conversationViewModel.isUserAdmin {
NavigationLink(destination: {
AddParticipantsFragment(addParticipantsViewModel: addParticipantsViewModel, confirmAddParticipantsFunc: conversationViewModel.addParticipants)
AddParticipantsFragment(addParticipantsViewModel: addParticipantsViewModel, confirmAddParticipantsFunc: conversationViewModel.addParticipants, dismissOnCheckClick: true)
.onAppear {
conversationViewModel.getParticipants()
addParticipantsViewModel.participantsToAdd = conversationViewModel.participants

View file

@ -32,7 +32,7 @@ struct StartGroupConversationFragment: View {
var body: some View {
ZStack {
AddParticipantsFragment(addParticipantsViewModel: addParticipantsViewModel, confirmAddParticipantsFunc: startConversationViewModel.addParticipants)
AddParticipantsFragment(addParticipantsViewModel: addParticipantsViewModel, confirmAddParticipantsFunc: startConversationViewModel.addParticipants, dismissOnCheckClick: false)
.onAppear {
addParticipantsViewModel.participantsToAdd = startConversationViewModel.participants
}

View file

@ -30,7 +30,7 @@ struct StartGroupCallFragment: View {
var body: some View {
ZStack {
AddParticipantsFragment(addParticipantsViewModel: addParticipantsViewModel, confirmAddParticipantsFunc: startCallViewModel.addParticipants)
AddParticipantsFragment(addParticipantsViewModel: addParticipantsViewModel, confirmAddParticipantsFunc: startCallViewModel.addParticipants, dismissOnCheckClick: false)
.onAppear {
addParticipantsViewModel.participantsToAdd = startCallViewModel.participants
}

View file

@ -35,6 +35,8 @@ struct AddParticipantsFragment: View {
@FocusState var isSearchFieldFocused: Bool
var dismissOnCheckClick: Bool
var body: some View {
ZStack(alignment: .bottomTrailing) {
VStack(spacing: 16) {
@ -253,7 +255,7 @@ struct AddParticipantsFragment: View {
withAnimation {
confirmAddParticipantsFunc(addParticipantsViewModel.participantsToAdd)
if SharedMainViewModel.shared.indexView == 3 {
if dismissOnCheckClick {
dismiss()
}
@ -337,7 +339,3 @@ struct AddParticipantsFragment: View {
}
}
}
#Preview {
AddParticipantsFragment(addParticipantsViewModel: AddParticipantsViewModel(), confirmAddParticipantsFunc: { _ in })
}

View file

@ -252,7 +252,7 @@ struct ScheduleMeetingFragment: View {
VStack {
NavigationLink(destination: {
AddParticipantsFragment(addParticipantsViewModel: addParticipantsViewModel, confirmAddParticipantsFunc: meetingViewModel.addParticipants)
AddParticipantsFragment(addParticipantsViewModel: addParticipantsViewModel, confirmAddParticipantsFunc: meetingViewModel.addParticipants, dismissOnCheckClick: true)
.onAppear {
addParticipantsViewModel.participantsToAdd = meetingViewModel.participants
}
@ -300,24 +300,24 @@ struct ScheduleMeetingFragment: View {
}.frame(maxHeight: .infinity)
}
}
if !CorePreferences.disableChatFeature {
Rectangle()
.foregroundStyle(.clear)
.frame(height: 1)
.background(Color.gray200)
HStack(spacing: 10) {
Toggle("", isOn: $meetingViewModel.sendInvitations)
.padding(.leading, 16)
.labelsHidden()
.tint(Color.orangeMain300)
Text("meeting_schedule_send_invitations_title")
.default_text_style_500(styleSize: 14)
Spacer()
}
}
if !CorePreferences.disableChatFeature {
Rectangle()
.foregroundStyle(.clear)
.frame(height: 1)
.background(Color.gray200)
HStack(spacing: 10) {
Toggle("", isOn: $meetingViewModel.sendInvitations)
.padding(.leading, 16)
.labelsHidden()
.tint(Color.orangeMain300)
Text("meeting_schedule_send_invitations_title")
.default_text_style_500(styleSize: 14)
Spacer()
}
}
Spacer()
}
.background(.white)