/* * Copyright (c) 2010-2023 Belledonne Communications SARL. * * This file is part of Linphone * * 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 Foundation import linphonesw class ParticipantModel: ObservableObject { static let TAG = "[Participant Model]" let address: Address @Published var sipUri: String @Published var name: String @Published var avatarModel: ContactAvatarModel @Published var isJoining: Bool @Published var onPause: Bool @Published var isMuted: Bool @Published var isAdmin: Bool @Published var isSpeaking: Bool init(address: Address, isJoining: Bool = false, onPause: Bool = false, isMuted: Bool = false, isAdmin: Bool = false, isSpeaking: Bool = false) { self.address = address self.sipUri = address.asStringUriOnly() if let addressFriend = ContactsManager.shared.getFriendWithAddress(address: self.address) { self.name = addressFriend.name! } else { self.name = address.displayName != nil ? address.displayName! : address.username! } self.avatarModel = ContactAvatarModel.getAvatarModelFromAddress(address: self.address) self.isJoining = isJoining self.onPause = onPause self.isMuted = isMuted self.isAdmin = isAdmin self.isSpeaking = isSpeaking } }