소스 검색

[iOS] Fix setting call type in CallKit

Your truly introduced this regression in
8c7a3f16b1, alas.

The audio only mode is used to set the CallKit call type. This affects the
behavior on the recent calls entries (calls are marked either as audio or video
calls).

Sync both at the start and for transitions. The previous code was working by
chance (in a way): when the CallKit UI is presented the local video is muted,
which triggers a SET_VIDEO_MUTED action, at which point the audio-only mode was
checked for. Now we are more explicit and act on SET_AUDIO_MUTED.
master
Saúl Ibarra Corretgé 7 년 전
부모
커밋
7fa941cb8c
1개의 변경된 파일40개의 추가작업 그리고 1개의 파일을 삭제
  1. 40
    1
      react/features/mobile/callkit/middleware.js

+ 40
- 1
react/features/mobile/callkit/middleware.js 파일 보기

@@ -14,6 +14,7 @@ import {
14 14
     CONFERENCE_LEFT,
15 15
     CONFERENCE_WILL_JOIN,
16 16
     CONFERENCE_JOINED,
17
+    SET_AUDIO_ONLY,
17 18
     getCurrentConference
18 19
 } from '../../base/conference';
19 20
 import { getInviteURL } from '../../base/connection';
@@ -66,6 +67,9 @@ CallKit && MiddlewareRegistry.register(store => next => action => {
66 67
     case CONFERENCE_WILL_JOIN:
67 68
         return _conferenceWillJoin(store, next, action);
68 69
 
70
+    case SET_AUDIO_ONLY:
71
+        return _setAudioOnly(store, next, action);
72
+
69 73
     case TRACK_ADDED:
70 74
     case TRACK_REMOVED:
71 75
     case TRACK_UPDATED:
@@ -247,7 +251,8 @@ function _conferenceWillJoin({ getState }, next, action) {
247 251
                     state['features/base/tracks'],
248 252
                     MEDIA_TYPE.AUDIO);
249 253
 
250
-            CallKit.updateCall(conference.callUUID, { displayName });
254
+            // eslint-disable-next-line object-property-newline
255
+            CallKit.updateCall(conference.callUUID, { displayName, hasVideo });
251 256
             CallKit.setMuted(conference.callUUID, muted);
252 257
         });
253 258
 
@@ -301,6 +306,40 @@ function _onPerformSetMutedCallAction({ callUUID, muted: newValue }) {
301 306
     }
302 307
 }
303 308
 
309
+/**
310
+ * Update CallKit with the audio only state of the conference. When a conference
311
+ * is in audio only mode we will tell CallKit the call has no video. This
312
+ * affects how the call is saved in the recent calls list.
313
+ *
314
+ * XXX: Note that here we are taking the `audioOnly` value straight from the
315
+ * action, instead of examining the state. This is intentional, as setting the
316
+ * audio only involves multiple actions which will be reflected in the state
317
+ * later, but we are just interested in knowing if the mode is going to be
318
+ * set or not.
319
+ *
320
+ * @param {Store} store - The redux store in which the specified {@code action}
321
+ * is being dispatched.
322
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
323
+ * specified {@code action} in the specified {@code store}.
324
+ * @param {Action} action - The redux action which is being dispatched in the
325
+ * specified {@code store}.
326
+ * @private
327
+ * @returns {*} The value returned by {@code next(action)}.
328
+ */
329
+function _setAudioOnly({ getState }, next, action) {
330
+    const result = next(action);
331
+    const state = getState();
332
+    const conference = getCurrentConference(state);
333
+
334
+    if (conference && conference.callUUID) {
335
+        CallKit.updateCall(
336
+            conference.callUUID,
337
+            { hasVideo: !action.audioOnly });
338
+    }
339
+
340
+    return result;
341
+}
342
+
304 343
 /**
305 344
  * Notifies the feature callkit that the action
306 345
  * {@link _SET_CALLKIT_SUBSCRIPTIONS} is being dispatched within a specific

Loading…
취소
저장