Fix multiple instance of call view

Added further debug details
This commit is contained in:
Christophe Deschamps 2022-05-13 11:20:58 +02:00
parent 0ee549f5e2
commit 176cfd8b4b
7 changed files with 11 additions and 25 deletions

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>

View file

@ -321,7 +321,7 @@
return NO;
}
VIEW(ActiveCallOrConferenceView); // to get created and all observers added
[PhoneMainView.instance.mainViewController getCachedController:ActiveCallOrConferenceView.compositeViewDescription.name]; // This will create the single instance of the ActiveCallOrConferenceView including listeneres
return YES;
}

View file

@ -85,7 +85,6 @@
- (UIInterfaceOrientation)currentOrientation;
- (void)clearCache:(NSArray *)exclude;
- (IBAction)onRightSwipe:(id)sender;
- (void) removeCallViewFromCache;
@end

View file

@ -305,13 +305,6 @@
return nil;
}
-(void) removeCallViewFromCache {
for (NSString *key in [viewControllerCache allKeys]) {
if ([key isEqualToString:ActiveCallOrConferenceView.compositeViewDescription.name]) {
[viewControllerCache removeObjectForKey:key];
}
}
}
- (void)clearCache:(NSArray *)exclude {
for (NSString *key in [viewControllerCache allKeys]) {

View file

@ -28,7 +28,6 @@ class ConferenceParticipantDeviceData {
let videoEnabled = MutableLiveData<Bool>()
let activeSpeaker = MutableLiveData<Bool>()
let isInConference = MutableLiveData<Bool>()
private var videoView: UIView? = nil
var core : Core { get { Core.get() } }
@ -39,17 +38,16 @@ class ConferenceParticipantDeviceData {
self.participantDevice = participantDevice
participantDeviceDelegate = ParticipantDeviceDelegateStub(
onIsSpeakingChanged: { (participantDevice, isSpeaking) in
Log.i("[Conference Participant Device] Participant \(participantDevice ) isspeaking = \(isSpeaking)")
Log.i("[Conference Participant Device] Participant \(participantDevice.address?.asStringUriOnly()) isspeaking = \(isSpeaking)")
self.activeSpeaker.value = isSpeaking
}, onConferenceJoined: { (participantDevice) in
Log.i("[Conference Participant Device] Participant \(participantDevice) has joined the conference")
Log.i("[Conference Participant Device] Participant \(participantDevice.address?.asStringUriOnly()) has joined the conference")
self.isInConference.value = true
self.setVideoView(view: self.videoView)
}, onConferenceLeft: { (participantDevice) in
Log.i("[Conference Participant Device] Participant \(participantDevice) has left the conference")
Log.i("[Conference Participant Device] Participant \(participantDevice.address?.asStringUriOnly()) has left the conference")
self.isInConference.value = false
}, onStreamCapabilityChanged: { (participantDevice, direction, streamType) in
Log.i("[Conference Participant Device] Participant \(participantDevice) video stream direction changed: \(direction)")
Log.i("[Conference Participant Device] Participant \(participantDevice.address?.asStringUriOnly()) video stream direction changed: \(direction)")
self.videoEnabled.value = direction == MediaDirection.SendOnly || direction == MediaDirection.SendRecv
if (streamType == StreamType.Video) {
Log.i("[Conference Participant Device] Participant [\(participantDevice.address?.asStringUriOnly())] video capability changed to \(direction)")
@ -58,9 +56,6 @@ class ConferenceParticipantDeviceData {
if (streamType == StreamType.Video) {
Log.i("[Conference Participant Device] Participant [\(participantDevice.address?.asStringUriOnly())] video availability changed to \(available)")
self.videoEnabled.value = available
if (available) {
self.setVideoView(view: self.videoView)
}
}
}
@ -96,15 +91,14 @@ class ConferenceParticipantDeviceData {
return isMe && Core.get().showSwitchCameraButton()
}
func setVideoView(view:UIView?) {
self.videoView = view
func setVideoView(view:UIView) {
Log.i("[Conference Participant Device] Setting textureView \(view) for participant \(participantDevice.address?.asStringUriOnly())")
view?.contentMode = .scaleAspectFill
view.contentMode = .scaleAspectFill
if (isMe) {
core.usePreviewWindow(yesno: false)
core.nativePreviewWindow = view
} else {
participantDevice.nativeVideoWindowId = view != nil ? UnsafeMutableRawPointer(Unmanaged.passUnretained(view!).toOpaque()) : nil
participantDevice.nativeVideoWindowId = UnsafeMutableRawPointer(Unmanaged.passRetained(view).toOpaque())
}
}
}

View file

@ -310,7 +310,6 @@ import linphonesw
func updateNavigation() {
if (Core.get().callsNb == 0) {
PhoneMainView.instance().popView(self.compositeViewDescription())
PhoneMainView.instance().mainViewController.removeCallFromCache()
} else {
if let data = CallsViewModel.shared.currentCallData.value {
if (data?.isOutgoing.value == true || data?.isIncoming.value == true) {

View file

@ -74,6 +74,7 @@ class VoipConferenceGridView: UIView, UICollectionViewDataSource, UICollectionVi
let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
layout.minimumInteritemSpacing = 0
layout.minimumLineSpacing = 0
layout.estimatedItemSize = .zero
grid = UICollectionView(frame:.zero, collectionViewLayout: layout)
super.init(frame: .zero)