Pārlūkot izejas kodu

[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 gadus atpakaļ
vecāks
revīzija
7fa941cb8c
1 mainītis faili ar 40 papildinājumiem un 1 dzēšanām
  1. 40
    1
      react/features/mobile/callkit/middleware.js

+ 40
- 1
react/features/mobile/callkit/middleware.js Parādīt failu

14
     CONFERENCE_LEFT,
14
     CONFERENCE_LEFT,
15
     CONFERENCE_WILL_JOIN,
15
     CONFERENCE_WILL_JOIN,
16
     CONFERENCE_JOINED,
16
     CONFERENCE_JOINED,
17
+    SET_AUDIO_ONLY,
17
     getCurrentConference
18
     getCurrentConference
18
 } from '../../base/conference';
19
 } from '../../base/conference';
19
 import { getInviteURL } from '../../base/connection';
20
 import { getInviteURL } from '../../base/connection';
66
     case CONFERENCE_WILL_JOIN:
67
     case CONFERENCE_WILL_JOIN:
67
         return _conferenceWillJoin(store, next, action);
68
         return _conferenceWillJoin(store, next, action);
68
 
69
 
70
+    case SET_AUDIO_ONLY:
71
+        return _setAudioOnly(store, next, action);
72
+
69
     case TRACK_ADDED:
73
     case TRACK_ADDED:
70
     case TRACK_REMOVED:
74
     case TRACK_REMOVED:
71
     case TRACK_UPDATED:
75
     case TRACK_UPDATED:
247
                     state['features/base/tracks'],
251
                     state['features/base/tracks'],
248
                     MEDIA_TYPE.AUDIO);
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
             CallKit.setMuted(conference.callUUID, muted);
256
             CallKit.setMuted(conference.callUUID, muted);
252
         });
257
         });
253
 
258
 
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
  * Notifies the feature callkit that the action
344
  * Notifies the feature callkit that the action
306
  * {@link _SET_CALLKIT_SUBSCRIPTIONS} is being dispatched within a specific
345
  * {@link _SET_CALLKIT_SUBSCRIPTIONS} is being dispatched within a specific

Notiek ielāde…
Atcelt
Saglabāt