Browse Source

ios: remove no longer needed code

Ever since we switched to handling track events instead of mute actions this has
been dead code. It was also added in the wrong place, since it's responsibility
of the JS code to solve the ping-pong problem.
master
Saúl Ibarra Corretgé 6 years ago
parent
commit
603d161788

+ 2
- 19
ios/sdk/src/callkit/JMCallKitEmitter.swift View File

21
 internal final class JMCallKitEmitter: NSObject, CXProviderDelegate {
21
 internal final class JMCallKitEmitter: NSObject, CXProviderDelegate {
22
 
22
 
23
     private var listeners = Set<JMCallKitEventListenerWrapper>()
23
     private var listeners = Set<JMCallKitEventListenerWrapper>()
24
-    private var pendingMuteActions = Set<UUID>()
25
 
24
 
26
     internal override init() {}
25
     internal override init() {}
27
 
26
 
57
         }
56
         }
58
     }
57
     }
59
 
58
 
60
-    // MARK: - Add mute action
61
-
62
-    func addMuteAction(_ actionUUID: UUID) {
63
-        pendingMuteActions.insert(actionUUID)
64
-    }
65
-
66
     // MARK: - CXProviderDelegate
59
     // MARK: - CXProviderDelegate
67
 
60
 
68
     func providerDidReset(_ provider: CXProvider) {
61
     func providerDidReset(_ provider: CXProvider) {
69
         listeners.forEach { $0.listener?.providerDidReset?() }
62
         listeners.forEach { $0.listener?.providerDidReset?() }
70
-        pendingMuteActions.removeAll()
71
     }
63
     }
72
 
64
 
73
     func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {
65
     func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {
87
     }
79
     }
88
 
80
 
89
     func provider(_ provider: CXProvider, perform action: CXSetMutedCallAction) {
81
     func provider(_ provider: CXProvider, perform action: CXSetMutedCallAction) {
90
-        let uuid = pendingMuteActions.remove(action.uuid)
91
-
92
-        // XXX avoid mute actions ping-pong: if the mute action was caused by
93
-        // the JS side (we requested a transaction) don't call the delegate
94
-        // method. If it was called by the provder itself (when the user presses
95
-        // the mute button in the CallKit view) then call the delegate method.
96
-        if (uuid == nil) {
97
-            listeners.forEach {
98
-                $0.listener?.performSetMutedCall?(UUID: action.callUUID,
99
-                                                isMuted: action.isMuted)
100
-            }
82
+        listeners.forEach {
83
+            $0.listener?.performSetMutedCall?(UUID: action.callUUID, isMuted: action.isMuted)
101
         }
84
         }
102
 
85
 
103
         action.fulfill()
86
         action.fulfill()

+ 0
- 9
ios/sdk/src/callkit/JMCallKitProxy.swift View File

156
             completion: @escaping (Error?) -> Swift.Void) {
156
             completion: @escaping (Error?) -> Swift.Void) {
157
         guard enabled else { return }
157
         guard enabled else { return }
158
 
158
 
159
-        // XXX keep track of muted actions to avoid "ping-pong"ing. See
160
-        // JMCallKitEmitter for details on the CXSetMutedCallAction handling.
161
-        for action in transaction.actions {
162
-            if (action as? CXSetMutedCallAction) != nil {
163
-                emitter.addMuteAction(action.uuid)
164
-            }
165
-        }
166
-
167
         callController.request(transaction, completion: completion)
159
         callController.request(transaction, completion: completion)
168
     }
160
     }
169
 
161
 
191
         return update
183
         return update
192
     }
184
     }
193
 }
185
 }
194
-

Loading…
Cancel
Save