From 80c4b2e45e346f7d3e45bf681b59ba6127f3d3c3 Mon Sep 17 00:00:00 2001 From: Christophe Deschamps Date: Tue, 14 Jun 2022 12:05:57 +0200 Subject: [PATCH] Remote mute indication --- .../Views/Fragments/Conference/MicMuted.swift | 33 +++++++++++++++++++ .../VoipActiveSpeakerParticipantCell.swift | 13 +++++++- .../VoipAudioOnlyParticipantCell.swift | 10 ++---- .../Conference/VoipGridParticipantCell.swift | 10 ++++++ linphone.xcodeproj/project.pbxproj | 4 +++ 5 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 Classes/Swift/Voip/Views/Fragments/Conference/MicMuted.swift diff --git a/Classes/Swift/Voip/Views/Fragments/Conference/MicMuted.swift b/Classes/Swift/Voip/Views/Fragments/Conference/MicMuted.swift new file mode 100644 index 000000000..14227ea9a --- /dev/null +++ b/Classes/Swift/Voip/Views/Fragments/Conference/MicMuted.swift @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2010-2020 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 Foundation + +class MicMuted : UIImageView { + required init?(coder: NSCoder) { + super.init(coder: coder) + } + init (_ diameter: Int) { + super.init(image: UIImage(named: "voip_micro_off")?.tinted(with: .white)) + layer.cornerRadius = CGFloat(diameter/2) + clipsToBounds = true + backgroundColor = VoipTheme.voip_dark_gray + square(diameter).done() + } +} diff --git a/Classes/Swift/Voip/Views/Fragments/Conference/VoipActiveSpeakerParticipantCell.swift b/Classes/Swift/Voip/Views/Fragments/Conference/VoipActiveSpeakerParticipantCell.swift index 707a3baf1..c93552c02 100644 --- a/Classes/Swift/Voip/Views/Fragments/Conference/VoipActiveSpeakerParticipantCell.swift +++ b/Classes/Swift/Voip/Views/Fragments/Conference/VoipActiveSpeakerParticipantCell.swift @@ -30,6 +30,8 @@ class VoipActiveSpeakerParticipantCell: UICollectionViewCell { static let avatar_size = 80.0 let switch_camera_button_margins = 8.0 let switch_camera_button_size = 30 + static let mute_size = 25 + let mute_margin = 5 let videoView = UIView() @@ -38,6 +40,7 @@ class VoipActiveSpeakerParticipantCell: UICollectionViewCell { let switchCamera = UIImageView(image: UIImage(named:"voip_change_camera")?.tinted(with:.white)) let displayName = StyledLabel(VoipTheme.conference_participant_name_font_as) let pauseLabel = StyledLabel(VoipTheme.conference_participant_name_font_as,VoipTexts.conference_participant_paused) + let muted = MicMuted(VoipActiveSpeakerParticipantCell.mute_size) var participantData: ConferenceParticipantDeviceData? = nil { didSet { @@ -77,6 +80,10 @@ class VoipActiveSpeakerParticipantCell: UICollectionViewCell { self.layer.borderWidth = 0 } } + data.micMuted.clearObservers() + data.micMuted.readCurrentAndObserve { (muted) in + self.muted.isHidden = muted != true + } } } } @@ -124,12 +131,16 @@ class VoipActiveSpeakerParticipantCell: UICollectionViewCell { contentView.addSubview(displayName) displayName.matchParentSideBorders(insetedByDx:ActiveCallView.bottom_displayname_margin_left).alignParentBottom(withMargin:ActiveCallView.bottom_displayname_margin_bottom).done() - // Paused label commented out (Android 10.06.2022) + // Paused label commented out as in Android 10.06.2022 // contentView.addSubview(pauseLabel) //pauseLabel.toRightOf(displayName).alignParentBottom(withMargin:ActiveCallView.bottom_displayname_margin_bottom).done() + contentView.addSubview(muted) + muted.alignParentLeft(withMargin: mute_margin).alignParentTop(withMargin:mute_margin).done() + contentView.matchParentDimmensions().done() makeHeightMatchWidth().done() + } required init?(coder: NSCoder) { diff --git a/Classes/Swift/Voip/Views/Fragments/Conference/VoipAudioOnlyParticipantCell.swift b/Classes/Swift/Voip/Views/Fragments/Conference/VoipAudioOnlyParticipantCell.swift index 133a297f5..1334dd97f 100644 --- a/Classes/Swift/Voip/Views/Fragments/Conference/VoipAudioOnlyParticipantCell.swift +++ b/Classes/Swift/Voip/Views/Fragments/Conference/VoipAudioOnlyParticipantCell.swift @@ -28,14 +28,14 @@ class VoipAudioOnlyParticipantCell: UICollectionViewCell { // Layout Constants static let cell_height = 80.0 static let avatar_size = 40.0 - static let mute_size = 30.0 + static let mute_size = 30 let corner_radius = 6.7 let common_margin = 10.0 let avatar = Avatar(diameter:VoipCallCell.avatar_size,color:VoipTheme.voipBackgroundColor, textStyle: VoipTheme.call_generated_avatar_small) let paused = UIImageView(image: UIImage(named: "voip_pause")?.tinted(with: .white)) - let muted = UIImageView(image: UIImage(named: "voip_micro_off")?.tinted(with: .white)) + let muted = MicMuted(VoipAudioOnlyParticipantCell.mute_size) let displayName = StyledLabel(VoipTheme.conference_participant_name_font_as) @@ -97,11 +97,7 @@ class VoipAudioOnlyParticipantCell: UICollectionViewCell { displayName.numberOfLines = 3 contentView.addSubview(muted) - muted.layer.cornerRadius = VoipAudioOnlyParticipantCell.avatar_size/2 - muted.clipsToBounds = true - muted.backgroundColor = VoipTheme.voip_dark_gray - muted.size(w: VoipAudioOnlyParticipantCell.mute_size, h: VoipAudioOnlyParticipantCell.mute_size).alignParentRight(withMargin: common_margin).toRightOf(displayName,withLeftMargin: common_margin).centerY().done() - + muted.alignParentRight(withMargin: common_margin).toRightOf(displayName,withLeftMargin: common_margin).centerY().done() } required init?(coder: NSCoder) { diff --git a/Classes/Swift/Voip/Views/Fragments/Conference/VoipGridParticipantCell.swift b/Classes/Swift/Voip/Views/Fragments/Conference/VoipGridParticipantCell.swift index ffa83dd39..837163684 100644 --- a/Classes/Swift/Voip/Views/Fragments/Conference/VoipGridParticipantCell.swift +++ b/Classes/Swift/Voip/Views/Fragments/Conference/VoipGridParticipantCell.swift @@ -31,6 +31,8 @@ class VoipGridParticipantCell: UICollectionViewCell { let switch_camera_button_margins = 8.0 let switch_camera_button_size = 30 let pause_label_left_margin = 5 + static let mute_size = 25 + let mute_margin = 5 let videoView = UIView() @@ -39,6 +41,7 @@ class VoipGridParticipantCell: UICollectionViewCell { let switchCamera = UIImageView(image: UIImage(named:"voip_change_camera")?.tinted(with:.white)) let displayName = StyledLabel(VoipTheme.conference_participant_name_font_grid) let pauseLabel = StyledLabel(VoipTheme.conference_participant_name_font_grid,VoipTexts.conference_participant_paused) + let muted = MicMuted(VoipActiveSpeakerParticipantCell.mute_size) var participantData: ConferenceParticipantDeviceData? = nil { didSet { @@ -82,6 +85,10 @@ class VoipGridParticipantCell: UICollectionViewCell { self.layer.borderWidth = 0 } } + data.micMuted.clearObservers() + data.micMuted.readCurrentAndObserve { (muted) in + self.muted.isHidden = muted != true + } } } } @@ -132,6 +139,9 @@ class VoipGridParticipantCell: UICollectionViewCell { contentView.addSubview(pauseLabel) pauseLabel.toRightOf(displayName,withLeftMargin: pause_label_left_margin).alignParentBottom(withMargin:ActiveCallView.bottom_displayname_margin_bottom).done() + contentView.addSubview(muted) + muted.alignParentLeft(withMargin: mute_margin).alignParentTop(withMargin:mute_margin).done() + contentView.matchParentDimmensions().done() } diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 57a87656c..8ed5f7d5f 100644 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -674,6 +674,7 @@ C6277DA8274BF1CE00406FB9 /* voip_radio_on.png in Resources */ = {isa = PBXBuildFile; fileRef = C6277DA6274BF1CD00406FB9 /* voip_radio_on.png */; }; C6277DA9274BF1CE00406FB9 /* voip_radio_off.png in Resources */ = {isa = PBXBuildFile; fileRef = C6277DA7274BF1CD00406FB9 /* voip_radio_off.png */; }; C6278497273C21E1002FAA29 /* LocalVideoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6278496273C21E1002FAA29 /* LocalVideoView.swift */; }; + C63F70B52858927E0066163B /* MicMuted.swift in Sources */ = {isa = PBXBuildFile; fileRef = C63F70B42858927E0066163B /* MicMuted.swift */; }; C64A854E2667B67200252AD2 /* EphemeralSettingsView.m in Sources */ = {isa = PBXBuildFile; fileRef = C64A854D2667B67200252AD2 /* EphemeralSettingsView.m */; }; C64A85502667B67A00252AD2 /* EphemeralSettingsView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C64A854F2667B67A00252AD2 /* EphemeralSettingsView.xib */; }; C64A85522667B74100252AD2 /* ephemeral_messages_default.png in Resources */ = {isa = PBXBuildFile; fileRef = C64A85512667B74100252AD2 /* ephemeral_messages_default.png */; }; @@ -1847,6 +1848,7 @@ C6277DA6274BF1CD00406FB9 /* voip_radio_on.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = voip_radio_on.png; sourceTree = ""; }; C6277DA7274BF1CD00406FB9 /* voip_radio_off.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = voip_radio_off.png; sourceTree = ""; }; C6278496273C21E1002FAA29 /* LocalVideoView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocalVideoView.swift; sourceTree = ""; }; + C63F70B42858927E0066163B /* MicMuted.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MicMuted.swift; sourceTree = ""; }; C64A854C2667B66900252AD2 /* EphemeralSettingsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EphemeralSettingsView.h; sourceTree = ""; }; C64A854D2667B67200252AD2 /* EphemeralSettingsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EphemeralSettingsView.m; sourceTree = ""; }; C64A854F2667B67A00252AD2 /* EphemeralSettingsView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = EphemeralSettingsView.xib; sourceTree = ""; }; @@ -3558,6 +3560,7 @@ C6B04D66274BD61200F70559 /* VoipConferenceActiveSpeakerView.swift */, C6B04D68274BD6A100F70559 /* VoipActiveSpeakerParticipantCell.swift */, C67C97B0274FB4C10074A0D8 /* VoipConferenceDisplayModeSelectionView.swift */, + C63F70B42858927E0066163B /* MicMuted.swift */, ); path = Conference; sourceTree = ""; @@ -5010,6 +5013,7 @@ 63B81A0E1B57DA33009604A6 /* TPKeyboardAvoidingScrollView.m in Sources */, 633888451BFB2C49001D5E7B /* HPGrowingTextView.m in Sources */, 63F1DF441BCE618E00EDED90 /* UIAddressTextField.m in Sources */, + C63F70B52858927E0066163B /* MicMuted.swift in Sources */, D3EA540D1598528B0037DC6B /* ChatsListTableView.m in Sources */, D3EA5411159853750037DC6B /* UIChatCell.m in Sources */, D31B4B21159876C0002E6C72 /* UICompositeView.m in Sources */,