|
@@ -21,7 +21,6 @@ import Foundation
|
21
|
21
|
internal final class JMCallKitEmitter: NSObject, CXProviderDelegate {
|
22
|
22
|
|
23
|
23
|
private var listeners = Set<JMCallKitEventListenerWrapper>()
|
24
|
|
- private var pendingMuteActions = Set<UUID>()
|
25
|
24
|
|
26
|
25
|
internal override init() {}
|
27
|
26
|
|
|
@@ -57,17 +56,10 @@ internal final class JMCallKitEmitter: NSObject, CXProviderDelegate {
|
57
|
56
|
}
|
58
|
57
|
}
|
59
|
58
|
|
60
|
|
- // MARK: - Add mute action
|
61
|
|
-
|
62
|
|
- func addMuteAction(_ actionUUID: UUID) {
|
63
|
|
- pendingMuteActions.insert(actionUUID)
|
64
|
|
- }
|
65
|
|
-
|
66
|
59
|
// MARK: - CXProviderDelegate
|
67
|
60
|
|
68
|
61
|
func providerDidReset(_ provider: CXProvider) {
|
69
|
62
|
listeners.forEach { $0.listener?.providerDidReset?() }
|
70
|
|
- pendingMuteActions.removeAll()
|
71
|
63
|
}
|
72
|
64
|
|
73
|
65
|
func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {
|
|
@@ -87,17 +79,8 @@ internal final class JMCallKitEmitter: NSObject, CXProviderDelegate {
|
87
|
79
|
}
|
88
|
80
|
|
89
|
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
|
86
|
action.fulfill()
|