/* * Copyright (c) 2010-2024 Belledonne Communications SARL. * * This file is part of linphone-iphone * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ import SwiftUI import Foundation import linphonesw struct AddParticipantsFragment: View { @Environment(\.dismiss) var dismiss private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom } @State private var orientation = UIDevice.current.orientation @ObservedObject var contactsManager = ContactsManager.shared @ObservedObject var magicSearch = MagicSearchSingleton.shared @ObservedObject var addParticipantsViewModel: AddParticipantsViewModel var confirmAddParticipantsFunc: ([SelectedAddressModel]) -> Void @FocusState var isSearchFieldFocused: Bool var body: some View { ZStack(alignment: .bottomTrailing) { VStack(spacing: 16) { if #available(iOS 16.0, *) { Rectangle() .foregroundColor(Color.orangeMain500) .edgesIgnoringSafeArea(.top) .frame(height: 0) } else if idiom != .pad && !(orientation == .landscapeLeft || orientation == .landscapeRight || UIScreen.main.bounds.size.width > UIScreen.main.bounds.size.height) { Rectangle() .foregroundColor(Color.orangeMain500) .edgesIgnoringSafeArea(.top) .frame(height: 1) } HStack { Image("caret-left") .renderingMode(.template) .resizable() .foregroundStyle(Color.orangeMain500) .frame(width: 25, height: 25, alignment: .leading) .padding(.all, 10) .padding(.top, 2) .padding(.leading, -10) .onTapGesture { addParticipantsViewModel.reset() dismiss() } VStack(alignment: .leading, spacing: 3) { Text("conversation_add_participants_title") .multilineTextAlignment(.leading) .default_text_style_orange_800(styleSize: 16) .padding(.top, 20) Text(String(format: String(localized: "selected_participants_count"), $addParticipantsViewModel.participantsToAdd.count)) .default_text_style_300(styleSize: 12) } Spacer() } .frame(maxWidth: .infinity) .frame(height: 50) .padding(.horizontal) .padding(.bottom, 4) .background(.white) ScrollView(.horizontal) { HStack { ForEach(0..