Conference Waiting room view model + outgoing phase for call conference to remain on waiting room

This commit is contained in:
Christophe Deschamps 2022-03-22 17:24:43 +01:00
parent ce93af2566
commit 64d08445b6
3 changed files with 71 additions and 6 deletions

View file

@ -0,0 +1,40 @@
/*
* Copyright (c) 2010-2021 Belledonne Communications SARL.
*
* This file is part of linphone-android
* (see https://www.linphone.org).
*
* 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
* aDouble with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import Foundation
import linphonesw
class ConferenceWaitingRoomViewModel {
var core : Core { get { Core.get() } }
static let shared = ConferenceWaitingRoomViewModel()
let joinWithVideo = MutableLiveData<Bool>()
let layout = MutableLiveData<ConferenceLayout>()
let joinInProgress = MutableLiveData<Bool>(false)
init () {
}
}

View file

@ -41,7 +41,8 @@ import linphonesw
let buttonsView = UIStackView()
let cancel = FormButton(title: VoipTexts.cancel.uppercased(), backgroundStateColors: VoipTheme.primary_colors_background_gray, bold:false)
let start = FormButton(title: VoipTexts.conference_waiting_room_start_call.uppercased(), backgroundStateColors: VoipTheme.primary_colors_background)
let conferenceJoinSpinner = RotatingSpinner()
var conferenceUrl : String? = nil
let conferenceSubject = MutableLiveData<String>()
@ -80,13 +81,33 @@ import linphonesw
buttonsView.addArrangedSubview(start)
cancel.onClick {
Core.get().calls.forEach { call in
if ([Call.State.OutgoingInit, Call.State.OutgoingRinging, Call.State.OutgoingProgress].contains(call.state)) {
CallManager.instance().terminateCall(call: call.getCobject)
}
}
ConferenceWaitingRoomViewModel.shared.joinInProgress.value = false
PhoneMainView.instance().popView(self.compositeViewDescription())
}
start.onClick {
ConferenceWaitingRoomViewModel.shared.joinInProgress.value = true
self.conferenceUrl.map{ CallManager.instance().startCall(addr: $0, isSas: false, isVideo: true, isConference: true) }
}
ConferenceWaitingRoomViewModel.shared.joinInProgress.readCurrentAndObserve { joining in
self.start.isEnabled = joining != true
self.localVideo.isHidden = joining == true
if (joining == true) {
self.view.addSubview(self.conferenceJoinSpinner)
self.conferenceJoinSpinner.square(IncomingOutgoingCommonView.spinner_size).center().done()
self.conferenceJoinSpinner.startRotation()
} else {
self.conferenceJoinSpinner.stopRotation()
self.conferenceJoinSpinner.removeFromSuperview()
}
}
// localVideo view
localVideo.layer.cornerRadius = center_view_corner_radius

View file

@ -609,7 +609,7 @@
63E27A321C4FECD000D332AE /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 63E27A311C4FECD000D332AE /* LaunchScreen.xib */; };
63E27A521C50EDB000D332AE /* hold.mkv in Resources */ = {isa = PBXBuildFile; fileRef = 63E27A511C50EB2700D332AE /* hold.mkv */; };
63E59A3F1ADE70D900646FB3 /* InAppProductsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E59A3E1ADE70D900646FB3 /* InAppProductsManager.m */; };
63E802DB1C625AEF000D5509 /* BuildFile in Resources */ = {isa = PBXBuildFile; };
63E802DB1C625AEF000D5509 /* (null) in Resources */ = {isa = PBXBuildFile; };
63EC8D391D7438660066547B /* AssistantLinkView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 63EC8D3B1D7438660066547B /* AssistantLinkView.xib */; };
63F1DF441BCE618E00EDED90 /* UIAddressTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 63F1DF431BCE618E00EDED90 /* UIAddressTextField.m */; };
63FB30351A680E73008CA393 /* UIRoundedImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 63FB30341A680E73008CA393 /* UIRoundedImageView.m */; };
@ -683,6 +683,7 @@
C65A5D3B27216CC0005BA038 /* MutableLiveData.swift in Sources */ = {isa = PBXBuildFile; fileRef = C65A5D3727216CC0005BA038 /* MutableLiveData.swift */; };
C65A5D3F27216E3A005BA038 /* CallData.swift in Sources */ = {isa = PBXBuildFile; fileRef = C65A5D3E27216E3A005BA038 /* CallData.swift */; };
C65A5D45272196AE005BA038 /* OptionalExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C65A5D44272196AE005BA038 /* OptionalExtensions.swift */; };
C662D0A927EA2C5F00C02D4A /* ConferenceWaitingRoomViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C662D0A827EA2C5F00C02D4A /* ConferenceWaitingRoomViewModel.swift */; };
C666756F264C925800A0273C /* VFSUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6DA657B261C950C0020CB43 /* VFSUtil.swift */; };
C6667571264C925B00A0273C /* VFSUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6DA657B261C950C0020CB43 /* VFSUtil.swift */; };
C66B03BB26E8EB1A009B5EDC /* UIChatReplyBubbleView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C66B03BD26E8EB1A009B5EDC /* UIChatReplyBubbleView.xib */; };
@ -1852,6 +1853,7 @@
C65A5D3727216CC0005BA038 /* MutableLiveData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutableLiveData.swift; sourceTree = "<group>"; };
C65A5D3E27216E3A005BA038 /* CallData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallData.swift; sourceTree = "<group>"; };
C65A5D44272196AE005BA038 /* OptionalExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OptionalExtensions.swift; sourceTree = "<group>"; };
C662D0A827EA2C5F00C02D4A /* ConferenceWaitingRoomViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConferenceWaitingRoomViewModel.swift; sourceTree = "<group>"; };
C66B03BC26E8EB1A009B5EDC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/UIChatReplyBubbleView.xib; sourceTree = "<group>"; };
C66B03C126E8EB82009B5EDC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/UIChatReplyBubbleView.strings; sourceTree = "<group>"; };
C66B03C326E8EB87009B5EDC /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/UIChatReplyBubbleView.strings; sourceTree = "<group>"; };
@ -2524,7 +2526,7 @@
path = LinphoneUI;
sourceTree = "<group>";
};
29B97314FDCFA39411CA2CEA = {
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
isa = PBXGroup;
children = (
8C23BCB71D82AAC3005F19BB /* linphone.entitlements */,
@ -3587,6 +3589,7 @@
isa = PBXGroup;
children = (
C6EA2F662754DC45008E60F8 /* ConferenceSchedulingViewModel.swift */,
C662D0A827EA2C5F00C02D4A /* ConferenceWaitingRoomViewModel.swift */,
C6AF9217275E13790087ACDE /* ScheduledConferencesViewModel.swift */,
);
path = models;
@ -3933,7 +3936,7 @@
fr,
hu,
);
mainGroup = 29B97314FDCFA39411CA2CEA;
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
productRefGroup = 19C28FACFE9D520D11CA2CBB /* Products */;
projectDirPath = "";
projectRoot = "";
@ -3999,7 +4002,7 @@
633FEEE01D3CD55A0014B822 /* numpad_8_over~ipad@2x.png in Resources */,
C6710FA42722B20000ED888F /* voip_single_contact_avatar.png in Resources */,
633FEDDC1D3CD5590014B822 /* call_start_body_disabled~ipad.png in Resources */,
63E802DB1C625AEF000D5509 /* BuildFile in Resources */,
63E802DB1C625AEF000D5509 /* (null) in Resources */,
633FEE2E1D3CD5590014B822 /* color_F.png in Resources */,
C6710FA72722B20000ED888F /* voip_call_more.png in Resources */,
633FEDC51D3CD5590014B822 /* call_hangup_disabled@2x.png in Resources */,
@ -4917,6 +4920,7 @@
D3F83F8E15822ABE00336684 /* PhoneMainView.m in Sources */,
C6A1BB3E26E882D000540D50 /* UIChatReplyBubbleView.m in Sources */,
6377AC801BDE4069007F7625 /* UIBackToCallButton.m in Sources */,
C662D0A927EA2C5F00C02D4A /* ConferenceWaitingRoomViewModel.swift in Sources */,
C6D09F43274288D4003C2173 /* PayloadType.swift in Sources */,
6308F9C51BF0DD6600D1234B /* XMLRPCHelper.m in Sources */,
C6EA2F5F2754CFB0008E60F8 /* TimestampUtils.swift in Sources */,