Browse Source

解决成员离开时视频模式UI没有变成音频模式UI的问题

heavyrian2012 1 week ago
parent
commit
65b271cd4e
1 changed files with 26 additions and 20 deletions
  1. 26 20
      wfuikit/WFChatUIKit/Voip/Conference/WFCUConferenceViewController.m

+ 26 - 20
wfuikit/WFChatUIKit/Voip/Conference/WFCUConferenceViewController.m

@@ -1918,35 +1918,41 @@
 
 - (void)didParticipantLeft:(NSString *)userId screenSharing:(BOOL)screenSharing withReason:(WFAVCallEndReason)reason {
     [[NSNotificationCenter defaultCenter] postNotificationName:@"kConferenceMemberChanged" object:nil];
-
-    BOOL focusLeft = [self.focusUserProfile.userId isEqualToString:userId] && self.focusUserProfile.screeSharing == screenSharing;
-    int index = -1;
-    for (int i = 0; i < self.participants.count; i++) {
-        WFAVParticipantProfile *profile = self.participants[i];
-        if([profile.userId isEqualToString:userId] && profile.screeSharing == screenSharing) {
-            [self.participants removeObjectAtIndex:i];
-            index = i;
-            break;
-        }
-    }
     
-    if([self isAudioOnly]) {
+    if([self updateAudioOnly]) {
+        [self rearrangeParticipants];
         [self reloadParticipantCollectionView];
     } else {
-        if(self.participants.count < 3) {
-            [self resetFocus];
+        BOOL focusLeft = [self.focusUserProfile.userId isEqualToString:userId] && self.focusUserProfile.screeSharing == screenSharing;
+        int index = -1;
+        for (int i = 0; i < self.participants.count; i++) {
+            WFAVParticipantProfile *profile = self.participants[i];
+            if([profile.userId isEqualToString:userId] && profile.screeSharing == screenSharing) {
+                [self.participants removeObjectAtIndex:i];
+                index = i;
+                break;
+            }
+        }
+        
+        if([self isAudioOnly]) {
             [self reloadParticipantCollectionView];
         } else {
-            [self resetFocus];
-            [self.participantCollectionView deleteItemsAtIndexPaths:@[[NSIndexPath indexPathForRow:index+1 inSection:0]]];
-            if(focusLeft) {
-                [self.participantCollectionView reloadItemsAtIndexPaths:@[[NSIndexPath indexPathForRow:0 inSection:0]]];
+            if(self.participants.count < 3) {
+                [self resetFocus];
+                [self reloadParticipantCollectionView];
+            } else {
+                [self resetFocus];
+                [self.participantCollectionView deleteItemsAtIndexPaths:@[[NSIndexPath indexPathForRow:index+1 inSection:0]]];
+                if(focusLeft) {
+                    [self.participantCollectionView reloadItemsAtIndexPaths:@[[NSIndexPath indexPathForRow:0 inSection:0]]];
+                }
             }
         }
+        
+        [self updateVideoStreams];
+        [self updateManagerButtonNumber];
     }
     
-    [self updateVideoStreams];
-    [self updateManagerButtonNumber];
     
     WFCCUserInfo *userInfo = [[WFCCIMService sharedWFCIMService] getUserInfo:userId inGroup:self.currentSession.conversation.type == Group_Type ? self.currentSession.conversation.target : nil refresh:NO];