From 9d861a7b815494b2805efc65fd84442c369d5f22 Mon Sep 17 00:00:00 2001 From: Benoit Martins Date: Thu, 24 Jul 2025 11:54:14 +0200 Subject: [PATCH] Hide AddParticipantsFragment on check click --- .../Fragments/ParticipantsListFragment.swift | 2 +- .../Fragments/ConversationInfoFragment.swift | 2 +- .../StartGroupConversationFragment.swift | 2 +- .../Fragments/StartGroupCallFragment.swift | 2 +- .../Fragments/AddParticipantsFragment.swift | 8 ++-- .../Fragments/ScheduleMeetingFragment.swift | 38 +++++++++---------- 6 files changed, 26 insertions(+), 28 deletions(-) diff --git a/Linphone/UI/Call/Fragments/ParticipantsListFragment.swift b/Linphone/UI/Call/Fragments/ParticipantsListFragment.swift index 6877c10da..930e1b381 100644 --- a/Linphone/UI/Call/Fragments/ParticipantsListFragment.swift +++ b/Linphone/UI/Call/Fragments/ParticipantsListFragment.swift @@ -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 = [] } diff --git a/Linphone/UI/Main/Conversations/Fragments/ConversationInfoFragment.swift b/Linphone/UI/Main/Conversations/Fragments/ConversationInfoFragment.swift index 5ee3c53a0..13091c494 100644 --- a/Linphone/UI/Main/Conversations/Fragments/ConversationInfoFragment.swift +++ b/Linphone/UI/Main/Conversations/Fragments/ConversationInfoFragment.swift @@ -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 diff --git a/Linphone/UI/Main/Conversations/Fragments/StartGroupConversationFragment.swift b/Linphone/UI/Main/Conversations/Fragments/StartGroupConversationFragment.swift index 03860bd39..1edbaf478 100644 --- a/Linphone/UI/Main/Conversations/Fragments/StartGroupConversationFragment.swift +++ b/Linphone/UI/Main/Conversations/Fragments/StartGroupConversationFragment.swift @@ -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 } diff --git a/Linphone/UI/Main/History/Fragments/StartGroupCallFragment.swift b/Linphone/UI/Main/History/Fragments/StartGroupCallFragment.swift index c0f7c8664..fd95af5e5 100644 --- a/Linphone/UI/Main/History/Fragments/StartGroupCallFragment.swift +++ b/Linphone/UI/Main/History/Fragments/StartGroupCallFragment.swift @@ -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 } diff --git a/Linphone/UI/Main/Meetings/Fragments/AddParticipantsFragment.swift b/Linphone/UI/Main/Meetings/Fragments/AddParticipantsFragment.swift index 20fde9ca6..f8ce7c616 100644 --- a/Linphone/UI/Main/Meetings/Fragments/AddParticipantsFragment.swift +++ b/Linphone/UI/Main/Meetings/Fragments/AddParticipantsFragment.swift @@ -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 }) -} diff --git a/Linphone/UI/Main/Meetings/Fragments/ScheduleMeetingFragment.swift b/Linphone/UI/Main/Meetings/Fragments/ScheduleMeetingFragment.swift index a2d6bd330..f5c9d53f8 100644 --- a/Linphone/UI/Main/Meetings/Fragments/ScheduleMeetingFragment.swift +++ b/Linphone/UI/Main/Meetings/Fragments/ScheduleMeetingFragment.swift @@ -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)